You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2012/12/13 08:30:03 UTC

[2/58] git commit: ISIS-188: renaming packages, now builds ok (not yet tested)

ISIS-188: renaming packages, now builds ok (not yet tested)


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/978f79af
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/978f79af
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/978f79af

Branch: refs/heads/master
Commit: 978f79afa3a35318bc17eb31a50be91d1a55479e
Parents: 951a0fe
Author: Dan Haywood <da...@apache.org>
Authored: Thu Dec 13 00:25:39 2012 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Thu Dec 13 00:25:39 2012 +0000

----------------------------------------------------------------------
 core/integtestsupport/test.data                    |    2 +-
 .../runtime/persistence/PersistenceConstants.java  |    4 +-
 .../core/runtime/installer-registry.properties     |   98 +++++
 .../dflt/runtime/installer-registry.properties     |   98 -----
 .../AuthenticatorAbstractForDfltRuntimeTest.java   |  127 ++++++
 .../standard/MultiUserExplorationSessionTest.java  |  210 ++++++++++
 .../SimpleSessionEncodabilityNoRolesTest.java      |   36 ++
 .../SimpleSessionEncodabilityTestAbstract.java     |   40 ++
 .../SimpleSessionEncodabilityWithRolesTest.java    |   36 ++
 ...rdAuthenticationManager_AuthenticationTest.java |   96 +++++
 ...rdAuthenticationManager_AuthenticatorsTest.java |   80 ++++
 .../exploration/ExplorationAuthenticatorTest.java  |  130 ++++++
 .../fixture/LogonFixtureAuthenticatorTest.java     |  132 ++++++
 .../isis/core/runtime/context/IsisContextTest.java |  157 +++++++
 .../runtime/persistence/AggregatedFacetAlways.java |   32 ++
 .../adapterfactory/pojo/PojoAdapterTest.java       |  151 +++++++
 .../adapterfactory/pojo/RuntimeTestPojo.java       |   51 +++
 .../AdapterManagerDefault_aggregateAdapters.java   |  225 ++++++++++
 .../PersistenceSessionObjectStoreTest.java         |  248 +++++++++++
 .../algorithm/PersistAlgorithmContractTest.java    |  160 +++++++
 .../dflt/DefaultPersistAlgorithmContractTest.java  |   33 ++
 .../dflt/DefaultPersistAlgorithmTest.java          |  258 ++++++++++++
 .../TopDownPersistAlgorithmContractTest.java       |   55 +++
 .../TwoPassPersistAlgorithmContractTest.java       |   55 +++
 ...ectStoreTransactionManagerAbstractTestCase.java |   67 +++
 ...StoreTransactionManager_EndTransactionTest.java |  108 +++++
 ...tStoreTransactionManager_InstantiationTest.java |   33 ++
 ...oreTransactionManager_StartTransactionTest.java |   89 ++++
 .../transaction/PojoAdapterBuilder.java            |  251 +++++++++++
 .../objectstore/transaction/TransactionTest.java   |  323 +++++++++++++++
 .../isis/core/runtime/profiler/ProfilerTest.java   |  111 +++++
 .../core/runtime/profiler/ProfilerTestSystem.java  |   39 ++
 .../isis/core/runtime/system/Interface1.java       |   24 ++
 .../core/runtime/system/JavaActionTestObject.java  |   55 +++
 .../system/JavaObjectMarkedAsTransient.java        |   26 ++
 .../JavaObjectWithBasicProgramConventions.java     |  272 ++++++++++++
 .../system/JavaObjectWithOneToOneAssociations.java |   47 +++
 .../core/runtime/system/JavaReferencedObject.java  |   35 ++
 .../core/runtime/system/MethodFinderUtilsTest.java |   84 ++++
 .../core/runtime/system/ObjectActionImplTest.java  |  160 +++++++
 .../runtime/system/ObjectMemberAbstractTest.java   |  246 +++++++++++
 .../system/OneToManyAssociationImplTest.java       |  183 ++++++++
 .../isis/core/runtime/system/RuntimeTestPojo.java  |   51 +++
 .../isis/core/runtime/system/TestDomainObject.java |   24 ++
 .../isis/core/runtime/system/TestObject.java       |   23 +
 .../runtime/system/TestObjectAsAggregated.java     |   29 ++
 .../core/runtime/system/TestObjectAsService.java   |   37 ++
 .../runtime/system/TestObjectWithCollection.java   |  108 +++++
 .../system/TypeExtractorMethodReturnTest.java      |   76 ++++
 .../system/TypeExtractorMethodsParametersTest.java |   58 +++
 .../isis/core/runtime/userprofile/OptionsTest.java |  116 ++++++
 .../AuthenticatorAbstractForDfltRuntimeTest.java   |  127 ------
 .../standard/MultiUserExplorationSessionTest.java  |  210 ----------
 .../SimpleSessionEncodabilityNoRolesTest.java      |   36 --
 .../SimpleSessionEncodabilityTestAbstract.java     |   40 --
 .../SimpleSessionEncodabilityWithRolesTest.java    |   36 --
 ...rdAuthenticationManager_AuthenticationTest.java |   96 -----
 ...rdAuthenticationManager_AuthenticatorsTest.java |   80 ----
 .../exploration/ExplorationAuthenticatorTest.java  |  130 ------
 .../fixture/LogonFixtureAuthenticatorTest.java     |  132 ------
 .../dflt/runtime/context/IsisContextTest.java      |  157 -------
 .../runtime/persistence/AggregatedFacetAlways.java |   32 --
 .../adapterfactory/pojo/PojoAdapterTest.java       |  151 -------
 .../adapterfactory/pojo/RuntimeTestPojo.java       |   51 ---
 .../AdapterManagerDefault_aggregateAdapters.java   |  225 ----------
 .../PersistenceSessionObjectStoreTest.java         |  248 -----------
 .../algorithm/PersistAlgorithmContractTest.java    |  160 -------
 .../dflt/DefaultPersistAlgorithmContractTest.java  |   33 --
 .../dflt/DefaultPersistAlgorithmTest.java          |  258 ------------
 .../TopDownPersistAlgorithmContractTest.java       |   55 ---
 .../TwoPassPersistAlgorithmContractTest.java       |   55 ---
 ...ectStoreTransactionManagerAbstractTestCase.java |   67 ---
 ...StoreTransactionManager_EndTransactionTest.java |  108 -----
 ...tStoreTransactionManager_InstantiationTest.java |   33 --
 ...oreTransactionManager_StartTransactionTest.java |   89 ----
 .../transaction/PojoAdapterBuilder.java            |  251 -----------
 .../objectstore/transaction/TransactionTest.java   |  323 ---------------
 .../dflt/runtime/profiler/ProfilerTest.java        |  111 -----
 .../dflt/runtime/profiler/ProfilerTestSystem.java  |   39 --
 .../runtimes/dflt/runtime/system/Interface1.java   |   24 --
 .../dflt/runtime/system/JavaActionTestObject.java  |   55 ---
 .../system/JavaObjectMarkedAsTransient.java        |   26 --
 .../JavaObjectWithBasicProgramConventions.java     |  272 ------------
 .../system/JavaObjectWithOneToOneAssociations.java |   47 ---
 .../dflt/runtime/system/JavaReferencedObject.java  |   35 --
 .../dflt/runtime/system/MethodFinderUtilsTest.java |   84 ----
 .../dflt/runtime/system/ObjectActionImplTest.java  |  160 -------
 .../runtime/system/ObjectMemberAbstractTest.java   |  246 -----------
 .../system/OneToManyAssociationImplTest.java       |  183 --------
 .../dflt/runtime/system/RuntimeTestPojo.java       |   51 ---
 .../dflt/runtime/system/TestDomainObject.java      |   24 --
 .../runtimes/dflt/runtime/system/TestObject.java   |   23 -
 .../runtime/system/TestObjectAsAggregated.java     |   29 --
 .../dflt/runtime/system/TestObjectAsService.java   |   37 --
 .../runtime/system/TestObjectWithCollection.java   |  108 -----
 .../system/TypeExtractorMethodReturnTest.java      |   76 ----
 .../system/TypeExtractorMethodsParametersTest.java |   58 ---
 .../dflt/runtime/userprofile/OptionsTest.java      |  116 ------
 98 files changed, 5088 insertions(+), 5088 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/integtestsupport/test.data
----------------------------------------------------------------------
diff --git a/core/integtestsupport/test.data b/core/integtestsupport/test.data
index 56a616b..78b3ff7 100644
--- a/core/integtestsupport/test.data
+++ b/core/integtestsupport/test.data
@@ -1,4 +1,4 @@
-org.apache.isis.tck.dom.refs.SimpleEntity#4
+org.apache.isis.core.tck.dom.refs.SimpleEntity#4
   date: 08-Mar-2010 13:32
   name: Fred Smith
   nullable: 

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceConstants.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceConstants.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceConstants.java
index 0e5c271..3d97093 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceConstants.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/PersistenceConstants.java
@@ -32,12 +32,12 @@ public final class PersistenceConstants {
     /**
      * Default implementation to use as {@link ObjectFactory}.
      */
-    public static final String OBJECT_FACTORY_CLASS_NAME_DEFAULT = "org.apache.isis.runtimes.dflt.bytecode.dflt.objectfactory.CglibObjectFactory";
+    public static final String OBJECT_FACTORY_CLASS_NAME_DEFAULT = "org.apache.isis.core.bytecode.cglib.CglibObjectFactory";
     
     /**
      * Default implementation to use as {@link ClassSubstitutor}.
      */
-    public static final String CLASS_SUBSTITUTOR_CLASS_NAME_DEFAULT = "org.apache.isis.runtimes.dflt.bytecode.dflt.classsubstitutor.CglibClassSubstitutor";
+    public static final String CLASS_SUBSTITUTOR_CLASS_NAME_DEFAULT = "org.apache.isis.core.bytecode.cglib.CglibClassSubstitutor";
 
     /**
      * Key used to lookup implementation of {@link DomainObjectContainer} in

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties b/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties
new file mode 100644
index 0000000..3f3509e
--- /dev/null
+++ b/core/runtime/src/main/resources/org/apache/isis/core/runtime/installer-registry.properties
@@ -0,0 +1,98 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#         http://www.apache.org/licenses/LICENSE-2.0
+#         
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+############################################################
+# CORE
+############################################################
+
+org.apache.isis.core.progmodel.facetdecorators.i18n.resourcebundle.I18nDecoratorUsingResourceBundleInstaller # "resource-i18n"
+org.apache.isis.core.progmodel.facetdecorators.help.file.HelpFacetDecoratorUsingFilesInstaller               # "help-file"
+
+
+############################################################
+# SECURITY
+############################################################
+
+org.apache.isis.core.security.authentication.BypassAuthenticationManagerInstaller # "bypass"
+org.apache.isis.core.security.authorization.BypassAuthorizationManagerInstaller           # "bypass"
+
+org.apache.isis.security.file.authentication.FileAuthenticationManagerInstaller # "file"
+org.apache.isis.security.file.authorization.FileAuthorizationManagerInstaller  # "file"
+
+org.apache.isis.security.ldap.authorization.LdapAuthorizationManagerInstaller  # "ldap"
+org.apache.isis.security.ldap.authentication.LdapAuthenticationManagerInstaller # "ldap"
+
+org.apache.isis.security.sql.authorization.SqlAuthorizationManagerInstaller  # "sql"
+org.apache.isis.security.sql.authentication.SqlAuthenticationManagerInstaller # "sql"
+
+
+
+
+############################################################
+# VIEWERS
+############################################################
+
+org.apache.isis.viewer.dnd.DndViewerInstaller                                        # "dnd"
+org.apache.isis.viewer.html.HtmlViewerInstaller                                      # "html"  (runs within embedded web server)
+org.apache.isis.viewer.restfulobjects.viewer.embedded.RestfulObjectsViewerInstaller  # "restfulobjects"  (runs within embedded web server)
+
+
+############################################################
+# PROGRAMMING MODELS
+############################################################
+
+# in default runtime only for dynamic lookup of facet decorators 
+org.apache.isis.core.runtime.progmodels.JavaReflectorInstaller   # "java"
+
+
+############################################################
+# CORE AND ALTERNATIVE RUNTIME COMPONENTS
+############################################################
+
+# image loader
+org.apache.isis.core.runtime.imageloader.awt.TemplateImageLoaderAwtInstaller # "awt"
+
+# fixture loaders
+org.apache.isis.core.runtime.fixtures.FixturesInstallerFromConfiguration  "configuration"
+
+# services
+org.apache.isis.core.runtime.services.ServicesInstallerFromConfiguration   # "configuration"
+
+# objectstores
+org.apache.isis.core.objectstore.InMemoryPersistenceMechanismInstaller         # "in-memory"
+org.apache.isis.objectstore.xml.XmlPersistenceMechanismInstaller               # "xml"
+org.apache.isis.objectstore.sql.SqlPersistorInstaller                          # "sql"
+org.apache.isis.objectstore.nosql.db.mongo.MongoPersistorMechanismInstaller    # "mongo"
+org.apache.isis.objectstore.nosql.db.file.FileServerPersistorMechanismInstaller   # "fileserver"
+org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller # datanucleus
+
+# profilestores
+org.apache.isis.core.profilestore.InMemoryUserProfileStoreInstaller # "in-memory"
+org.apache.isis.profilestore.xml.XmlUserProfileStoreInstaller       # "xml"
+org.apache.isis.profilestore.sql.SqlUserProfileStoreInstaller       # "sql"
+
+# reflector decorators
+org.apache.isis.core.runtime.transaction.facetdecorator.standard.TransactionFacetDecoratorInstaller  # "transaction"
+
+# viewer (runs within embedded web server)
+org.apache.isis.viewer.html.monitoring.WebServerMonitorInstaller  # "monitor"
+
+# embedded web server
+org.apache.isis.core.webserver.embedded.jetty.JettyEmbeddedWebServerInstaller   # "jetty"
+
+
+####### END #########
+

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/main/resources/org/apache/isis/runtimes/dflt/runtime/installer-registry.properties
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/resources/org/apache/isis/runtimes/dflt/runtime/installer-registry.properties b/core/runtime/src/main/resources/org/apache/isis/runtimes/dflt/runtime/installer-registry.properties
deleted file mode 100644
index 3f3509e..0000000
--- a/core/runtime/src/main/resources/org/apache/isis/runtimes/dflt/runtime/installer-registry.properties
+++ /dev/null
@@ -1,98 +0,0 @@
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#  
-#         http://www.apache.org/licenses/LICENSE-2.0
-#         
-#  Unless required by applicable law or agreed to in writing,
-#  software distributed under the License is distributed on an
-#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-#  specific language governing permissions and limitations
-#  under the License.
-############################################################
-# CORE
-############################################################
-
-org.apache.isis.core.progmodel.facetdecorators.i18n.resourcebundle.I18nDecoratorUsingResourceBundleInstaller # "resource-i18n"
-org.apache.isis.core.progmodel.facetdecorators.help.file.HelpFacetDecoratorUsingFilesInstaller               # "help-file"
-
-
-############################################################
-# SECURITY
-############################################################
-
-org.apache.isis.core.security.authentication.BypassAuthenticationManagerInstaller # "bypass"
-org.apache.isis.core.security.authorization.BypassAuthorizationManagerInstaller           # "bypass"
-
-org.apache.isis.security.file.authentication.FileAuthenticationManagerInstaller # "file"
-org.apache.isis.security.file.authorization.FileAuthorizationManagerInstaller  # "file"
-
-org.apache.isis.security.ldap.authorization.LdapAuthorizationManagerInstaller  # "ldap"
-org.apache.isis.security.ldap.authentication.LdapAuthenticationManagerInstaller # "ldap"
-
-org.apache.isis.security.sql.authorization.SqlAuthorizationManagerInstaller  # "sql"
-org.apache.isis.security.sql.authentication.SqlAuthenticationManagerInstaller # "sql"
-
-
-
-
-############################################################
-# VIEWERS
-############################################################
-
-org.apache.isis.viewer.dnd.DndViewerInstaller                                        # "dnd"
-org.apache.isis.viewer.html.HtmlViewerInstaller                                      # "html"  (runs within embedded web server)
-org.apache.isis.viewer.restfulobjects.viewer.embedded.RestfulObjectsViewerInstaller  # "restfulobjects"  (runs within embedded web server)
-
-
-############################################################
-# PROGRAMMING MODELS
-############################################################
-
-# in default runtime only for dynamic lookup of facet decorators 
-org.apache.isis.core.runtime.progmodels.JavaReflectorInstaller   # "java"
-
-
-############################################################
-# CORE AND ALTERNATIVE RUNTIME COMPONENTS
-############################################################
-
-# image loader
-org.apache.isis.core.runtime.imageloader.awt.TemplateImageLoaderAwtInstaller # "awt"
-
-# fixture loaders
-org.apache.isis.core.runtime.fixtures.FixturesInstallerFromConfiguration  "configuration"
-
-# services
-org.apache.isis.core.runtime.services.ServicesInstallerFromConfiguration   # "configuration"
-
-# objectstores
-org.apache.isis.core.objectstore.InMemoryPersistenceMechanismInstaller         # "in-memory"
-org.apache.isis.objectstore.xml.XmlPersistenceMechanismInstaller               # "xml"
-org.apache.isis.objectstore.sql.SqlPersistorInstaller                          # "sql"
-org.apache.isis.objectstore.nosql.db.mongo.MongoPersistorMechanismInstaller    # "mongo"
-org.apache.isis.objectstore.nosql.db.file.FileServerPersistorMechanismInstaller   # "fileserver"
-org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller # datanucleus
-
-# profilestores
-org.apache.isis.core.profilestore.InMemoryUserProfileStoreInstaller # "in-memory"
-org.apache.isis.profilestore.xml.XmlUserProfileStoreInstaller       # "xml"
-org.apache.isis.profilestore.sql.SqlUserProfileStoreInstaller       # "sql"
-
-# reflector decorators
-org.apache.isis.core.runtime.transaction.facetdecorator.standard.TransactionFacetDecoratorInstaller  # "transaction"
-
-# viewer (runs within embedded web server)
-org.apache.isis.viewer.html.monitoring.WebServerMonitorInstaller  # "monitor"
-
-# embedded web server
-org.apache.isis.core.webserver.embedded.jetty.JettyEmbeddedWebServerInstaller   # "jetty"
-
-
-####### END #########
-

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/AuthenticatorAbstractForDfltRuntimeTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/AuthenticatorAbstractForDfltRuntimeTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/AuthenticatorAbstractForDfltRuntimeTest.java
new file mode 100644
index 0000000..8092610
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/AuthenticatorAbstractForDfltRuntimeTest.java
@@ -0,0 +1,127 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.authentication.standard;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
+import org.apache.isis.core.runtime.authentication.AuthenticatorAbstractForDfltRuntime;
+import org.apache.isis.core.runtime.system.DeploymentType;
+
+@RunWith(JMock.class)
+public class AuthenticatorAbstractForDfltRuntimeTest {
+
+    private final Mockery mockery = new JUnit4Mockery();
+
+    private IsisConfiguration mockConfiguration;
+    private AuthenticatorAbstractForDfltRuntime authenticator;
+
+    @Before
+    public void setUp() {
+        mockConfiguration = mockery.mock(IsisConfiguration.class);
+
+        authenticator = new AuthenticatorAbstractForDfltRuntime(mockConfiguration) {
+
+            @Override
+            public boolean isValid(final AuthenticationRequest request) {
+                return false;
+            }
+
+            @Override
+            public boolean canAuthenticate(final Class<? extends AuthenticationRequest> authenticationRequestClass) {
+                return false;
+            }
+        };
+    }
+
+    @Test
+    public void getConfiguration() throws Exception {
+        assertThat(authenticator.getConfiguration(), is(mockConfiguration));
+    }
+
+    @Test
+    public void getDeploymentTypeForExploration() throws Exception {
+        final DeploymentType deploymentType = DeploymentType.EXPLORATION;
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString("isis.deploymentType");
+                will(returnValue(deploymentType.name()));
+            }
+        });
+        assertThat(authenticator.getDeploymentType(), is(deploymentType));
+    }
+
+    @Test
+    public void getDeploymentTypeForPrototype() throws Exception {
+        final DeploymentType deploymentType = DeploymentType.PROTOTYPE;
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString("isis.deploymentType");
+                will(returnValue(deploymentType.name()));
+            }
+        });
+        assertThat(authenticator.getDeploymentType(), is(deploymentType));
+    }
+
+    @Test
+    public void getDeploymentTypeForServer() throws Exception {
+        final DeploymentType deploymentType = DeploymentType.SERVER;
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString("isis.deploymentType");
+                will(returnValue(deploymentType.name()));
+            }
+        });
+        assertThat(authenticator.getDeploymentType(), is(deploymentType));
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void expectsThereToBeADeploymentTypeInIsisConfiguration() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString("isis.deploymentType");
+                will(returnValue(null));
+            }
+        });
+        authenticator.getDeploymentType();
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void expectsThereToBeAValidDeploymentTypeInIsisConfiguration() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString("isis.deploymentType");
+                will(returnValue("GARBAGE"));
+            }
+        });
+        authenticator.getDeploymentType();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/MultiUserExplorationSessionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/MultiUserExplorationSessionTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/MultiUserExplorationSessionTest.java
new file mode 100644
index 0000000..0295456
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/MultiUserExplorationSessionTest.java
@@ -0,0 +1,210 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.authentication.standard;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.Assert;
+
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authentication.exploration.AuthenticationRequestExploration;
+import org.apache.isis.core.runtime.authentication.exploration.ExplorationAuthenticator;
+import org.apache.isis.core.runtime.authentication.exploration.ExplorationAuthenticatorConstants;
+import org.apache.isis.core.runtime.authentication.exploration.ExplorationSession;
+import org.apache.isis.core.runtime.authentication.exploration.MultiUserExplorationSession;
+import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.SystemConstants;
+
+@RunWith(JMock.class)
+public class MultiUserExplorationSessionTest {
+
+    private final Mockery mockery = new JUnit4Mockery();
+
+    private MultiUserExplorationSession session;
+    private IsisConfiguration mockConfiguration;
+    private ExplorationAuthenticator authenticator;
+
+    @Before
+    public void setUp() {
+        mockConfiguration = mockery.mock(IsisConfiguration.class);
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(SystemConstants.DEPLOYMENT_TYPE_KEY);
+                will(returnValue(DeploymentType.EXPLORATION.name()));
+            }
+        });
+    }
+
+    @Test
+    public void testNameDefaultsToFirstUser() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(ExplorationAuthenticatorConstants.USERS);
+                will(returnValue("fred, sven:admin|sales|marketing, bob:sales, dick"));
+            }
+        });
+        authenticator = new ExplorationAuthenticator(mockConfiguration);
+        final AuthenticationSession session = authenticator.authenticate(new AuthenticationRequestExploration(), "");
+
+        Assert.assertEquals("fred", session.getUserName());
+    }
+
+    @Test
+    public void testValidateCode() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(ExplorationAuthenticatorConstants.USERS);
+                will(returnValue("fred, sven:admin|sales|marketing, bob:sales, dick"));
+            }
+        });
+        authenticator = new ExplorationAuthenticator(mockConfiguration);
+        final AuthenticationSession session = authenticator.authenticate(new AuthenticationRequestExploration(), "xxx");
+
+        Assert.assertEquals("xxx", session.getValidationCode());
+    }
+
+    @Test
+    public void testNoRolesSpecifiedForFirstUser() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(ExplorationAuthenticatorConstants.USERS);
+                will(returnValue("fred, sven:admin|sales|marketing, bob:sales, dick"));
+            }
+        });
+        authenticator = new ExplorationAuthenticator(mockConfiguration);
+        final AuthenticationSession session = authenticator.authenticate(new AuthenticationRequestExploration(), "");
+
+        Assert.assertEquals(0, session.getRoles().size());
+    }
+
+    @Test
+    public void testForMultipleUser() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(ExplorationAuthenticatorConstants.USERS);
+                will(returnValue("fred, sven:admin|sales|marketing, bob:sales, dick"));
+            }
+        });
+        authenticator = new ExplorationAuthenticator(mockConfiguration);
+        final AuthenticationSession authSession = authenticator.authenticate(new AuthenticationRequestExploration(), "");
+
+        assertThat(authSession, is(instanceOf(MultiUserExplorationSession.class)));
+
+        assertThat(authSession.getUserName(), is(equalTo("fred")));
+    }
+
+    @Test
+    public void testForSingleUser() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(ExplorationAuthenticatorConstants.USERS);
+                will(returnValue("sven"));
+            }
+        });
+        authenticator = new ExplorationAuthenticator(mockConfiguration);
+        final AuthenticationSession authSession = authenticator.authenticate(new AuthenticationRequestExploration(), "");
+        assertThat(authSession, is(instanceOf(SimpleSession.class)));
+
+        assertThat(authSession.getUserName(), is(equalTo("sven")));
+    }
+
+    @Test
+    public void testNoUsersSpecified() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(ExplorationAuthenticatorConstants.USERS);
+                will(returnValue(null));
+            }
+        });
+        authenticator = new ExplorationAuthenticator(mockConfiguration);
+
+        final AuthenticationSession authSession = authenticator.authenticate(new AuthenticationRequestExploration(), "");
+        assertThat(authSession, is(instanceOf(ExplorationSession.class)));
+    }
+
+    @Test
+    public void testOtherUsers() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(ExplorationAuthenticatorConstants.USERS);
+                will(returnValue("fred, sven:admin|sales|marketing, bob:sales, dick"));
+            }
+        });
+        authenticator = new ExplorationAuthenticator(mockConfiguration);
+        this.session = (MultiUserExplorationSession) authenticator.authenticate(new AuthenticationRequestExploration(), "");
+
+        final Set<String> availableSessions = session.getUserNames();
+        Assert.assertEquals(4, availableSessions.size());
+        Assert.assertTrue(availableSessions.contains("fred"));
+        Assert.assertTrue(availableSessions.contains("sven"));
+        Assert.assertTrue(availableSessions.contains("bob"));
+        Assert.assertTrue(availableSessions.contains("dick"));
+    }
+
+    @Test
+    public void testChangeUser() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(ExplorationAuthenticatorConstants.USERS);
+                will(returnValue("fred, sven:admin|sales|marketing, bob:sales, dick"));
+            }
+        });
+        authenticator = new ExplorationAuthenticator(mockConfiguration);
+        this.session = (MultiUserExplorationSession) authenticator.authenticate(new AuthenticationRequestExploration(), "");
+
+        session.setCurrentSession("bob");
+        Assert.assertEquals("bob", session.getUserName());
+    }
+
+    @Test
+    public void testRolesExist() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(ExplorationAuthenticatorConstants.USERS);
+                will(returnValue("fred, sven:admin|sales|marketing, bob:sales, dick"));
+            }
+        });
+        authenticator = new ExplorationAuthenticator(mockConfiguration);
+        this.session = (MultiUserExplorationSession) authenticator.authenticate(new AuthenticationRequestExploration(), "");
+
+        session.setCurrentSession("sven");
+        final List<String> roles = session.getRoles();
+        Assert.assertEquals(3, roles.size());
+        Assert.assertEquals("admin", roles.get(0));
+        Assert.assertEquals("sales", roles.get(1));
+        Assert.assertEquals("marketing", roles.get(2));
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/SimpleSessionEncodabilityNoRolesTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/SimpleSessionEncodabilityNoRolesTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/SimpleSessionEncodabilityNoRolesTest.java
new file mode 100644
index 0000000..1434b02
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/SimpleSessionEncodabilityNoRolesTest.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.authentication.standard;
+
+import org.jmock.integration.junit4.JMock;
+import org.junit.runner.RunWith;
+
+import org.apache.isis.core.commons.encoding.Encodable;
+import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
+
+@RunWith(JMock.class)
+public class SimpleSessionEncodabilityNoRolesTest extends SimpleSessionEncodabilityTestAbstract {
+
+    @Override
+    protected Encodable createEncodable() {
+        return new SimpleSession("joe", new String[] {});
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/SimpleSessionEncodabilityTestAbstract.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/SimpleSessionEncodabilityTestAbstract.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/SimpleSessionEncodabilityTestAbstract.java
new file mode 100644
index 0000000..e5025f3
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/SimpleSessionEncodabilityTestAbstract.java
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.authentication.standard;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.isis.core.commons.encoding.EncodabilityContractTest;
+import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
+
+public abstract class SimpleSessionEncodabilityTestAbstract extends EncodabilityContractTest {
+
+    @Override
+    protected void assertRoundtripped(final Object decodedEncodable, final Object originalEncodable) {
+        final SimpleSession decoded = (SimpleSession) decodedEncodable;
+        final SimpleSession original = (SimpleSession) originalEncodable;
+
+        assertThat(decoded.getUserName(), is(equalTo(original.getUserName())));
+        assertThat(decoded.getRoles(), is(equalTo(original.getRoles())));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/SimpleSessionEncodabilityWithRolesTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/SimpleSessionEncodabilityWithRolesTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/SimpleSessionEncodabilityWithRolesTest.java
new file mode 100644
index 0000000..d102161
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/SimpleSessionEncodabilityWithRolesTest.java
@@ -0,0 +1,36 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.authentication.standard;
+
+import org.jmock.integration.junit4.JMock;
+import org.junit.runner.RunWith;
+
+import org.apache.isis.core.commons.encoding.Encodable;
+import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
+
+@RunWith(JMock.class)
+public class SimpleSessionEncodabilityWithRolesTest extends SimpleSessionEncodabilityTestAbstract {
+
+    @Override
+    protected Encodable createEncodable() {
+        return new SimpleSession("joe", new String[] { "role1", "role2" });
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/StandardAuthenticationManager_AuthenticationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/StandardAuthenticationManager_AuthenticationTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/StandardAuthenticationManager_AuthenticationTest.java
new file mode 100644
index 0000000..a1ee3e4
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/StandardAuthenticationManager_AuthenticationTest.java
@@ -0,0 +1,96 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.authentication.standard;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.matchers.IsisMatchers;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword;
+import org.apache.isis.core.runtime.authentication.standard.AuthenticationManagerStandard;
+import org.apache.isis.core.runtime.authentication.standard.Authenticator;
+import org.apache.isis.core.runtime.authentication.standard.RandomCodeGenerator;
+
+@RunWith(JMock.class)
+public class StandardAuthenticationManager_AuthenticationTest {
+
+    private final Mockery mockery = new JUnit4Mockery();
+
+    private AuthenticationManagerStandard authenticationManager;
+
+    private IsisConfiguration mockConfiguration;
+    private RandomCodeGenerator mockRandomCodeGenerator;
+    private Authenticator mockAuthenticator;
+    private AuthenticationSession mockAuthSession;
+
+    @Before
+    public void setUp() throws Exception {
+        mockConfiguration = mockery.mock(IsisConfiguration.class);
+        mockRandomCodeGenerator = mockery.mock(RandomCodeGenerator.class);
+        mockAuthenticator = mockery.mock(Authenticator.class);
+        mockAuthSession = mockery.mock(AuthenticationSession.class);
+
+        authenticationManager = new AuthenticationManagerStandard(mockConfiguration);
+        authenticationManager.addAuthenticator(mockAuthenticator);
+        authenticationManager.setRandomCodeGenerator(mockRandomCodeGenerator);
+
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockAuthenticator).canAuthenticate(with(IsisMatchers.anySubclassOf(AuthenticationRequest.class)));
+                will(returnValue(true));
+
+                allowing(mockAuthenticator).authenticate(with(any(AuthenticationRequest.class)), with(any(String.class)));
+                will(returnValue(mockAuthSession));
+
+                allowing(mockRandomCodeGenerator).generateRandomCode();
+                will(returnValue("123456"));
+
+                allowing(mockAuthSession).getValidationCode();
+                will(returnValue("123456"));
+
+                allowing(mockAuthSession).hasUserNameOf("foo");
+                will(returnValue(true));
+
+                allowing(mockAuthSession).getUserName();
+                will(returnValue("foo"));
+            }
+        });
+    }
+
+    @Test
+    public void newlyCreatedAuthenticationSessionShouldBeValid() throws Exception {
+        final AuthenticationRequestPassword request = new AuthenticationRequestPassword("foo", "bar");
+        final AuthenticationSession session = authenticationManager.authenticate(request);
+
+        assertThat(authenticationManager.isSessionValid(session), is(true));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/StandardAuthenticationManager_AuthenticatorsTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/StandardAuthenticationManager_AuthenticatorsTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/StandardAuthenticationManager_AuthenticatorsTest.java
new file mode 100644
index 0000000..425eda9
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/StandardAuthenticationManager_AuthenticatorsTest.java
@@ -0,0 +1,80 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.authentication.standard;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.sameInstance;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequestPassword;
+import org.apache.isis.core.runtime.authentication.standard.AuthenticationManagerStandard;
+import org.apache.isis.core.runtime.authentication.standard.Authenticator;
+import org.apache.isis.core.runtime.authentication.standard.NoAuthenticatorException;
+
+@RunWith(JMock.class)
+public class StandardAuthenticationManager_AuthenticatorsTest {
+
+    private final Mockery mockery = new JUnit4Mockery();
+
+    private IsisConfiguration mockConfiguration;
+    private AuthenticationManagerStandard authenticationManager;
+    private Authenticator mockAuthenticator;
+
+    @Before
+    public void setUp() throws Exception {
+        mockConfiguration = mockery.mock(IsisConfiguration.class);
+        mockAuthenticator = mockery.mock(Authenticator.class);
+        authenticationManager = new AuthenticationManagerStandard(mockConfiguration);
+    }
+
+    @Test
+    public void shouldInitiallyHaveNoAuthenticators() throws Exception {
+        assertThat(authenticationManager.getAuthenticators().size(), is(0));
+    }
+
+    @Test(expected = NoAuthenticatorException.class)
+    public void shouldNotBeAbleToAuthenticateWithNoAuthenticators() throws Exception {
+        authenticationManager.authenticate(new AuthenticationRequestPassword("foo", "bar"));
+    }
+
+    @Test
+    public void shouldBeAbleToAddAuthenticators() throws Exception {
+        authenticationManager.addAuthenticator(mockAuthenticator);
+        assertThat(authenticationManager.getAuthenticators().size(), is(1));
+        assertThat(authenticationManager.getAuthenticators().get(0), is(sameInstance(mockAuthenticator)));
+    }
+
+    @Test(expected = UnsupportedOperationException.class)
+    public void shouldNotBeAbleToModifyReturnedAuthenticators() throws Exception {
+        final List<Authenticator> authenticators = authenticationManager.getAuthenticators();
+        authenticators.add(mockAuthenticator);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/exploration/ExplorationAuthenticatorTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/exploration/ExplorationAuthenticatorTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/exploration/ExplorationAuthenticatorTest.java
new file mode 100644
index 0000000..48a5387
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/exploration/ExplorationAuthenticatorTest.java
@@ -0,0 +1,130 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.authentication.standard.exploration;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequestAbstract;
+import org.apache.isis.core.runtime.authentication.exploration.AuthenticationRequestExploration;
+import org.apache.isis.core.runtime.authentication.exploration.ExplorationAuthenticator;
+import org.apache.isis.core.runtime.authentication.exploration.ExplorationAuthenticatorConstants;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.SystemConstants;
+
+@RunWith(JMock.class)
+public class ExplorationAuthenticatorTest {
+
+    private final Mockery mockery = new JUnit4Mockery();
+
+    private IsisConfiguration mockConfiguration;
+    private ExplorationAuthenticator authenticator;
+
+    private AuthenticationRequestExploration explorationRequest;
+
+    private SomeOtherAuthenticationRequest someOtherRequest;
+
+    private static class SomeOtherAuthenticationRequest extends AuthenticationRequestAbstract {
+        public SomeOtherAuthenticationRequest() {
+            super("other");
+        }
+    }
+
+    @Before
+    public void setUp() {
+        mockConfiguration = mockery.mock(IsisConfiguration.class);
+
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(ExplorationAuthenticatorConstants.USERS);
+                will(returnValue(DeploymentType.EXPLORATION.name()));
+            }
+        });
+
+        explorationRequest = new AuthenticationRequestExploration();
+        someOtherRequest = new SomeOtherAuthenticationRequest();
+
+        authenticator = new ExplorationAuthenticator(mockConfiguration);
+    }
+
+    @Test
+    public void canAuthenticateExplorationRequest() throws Exception {
+        assertThat(authenticator.canAuthenticate(explorationRequest.getClass()), is(true));
+    }
+
+    @Test
+    public void canAuthenticateSomeOtherTypeOfRequest() throws Exception {
+        assertThat(authenticator.canAuthenticate(someOtherRequest.getClass()), is(false));
+    }
+
+    @Test
+    public void isValidExplorationRequestWhenRunningInExplorationMode() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(SystemConstants.DEPLOYMENT_TYPE_KEY);
+                will(returnValue(DeploymentType.EXPLORATION.name()));
+            }
+        });
+        assertThat(authenticator.isValid(explorationRequest), is(true));
+    }
+
+    @Test
+    public void isNotValidExplorationRequestWhenRunningInSomethingOtherThanExplorationMode() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(SystemConstants.DEPLOYMENT_TYPE_KEY);
+                will(returnValue(DeploymentType.PROTOTYPE.name()));
+            }
+        });
+        assertThat(authenticator.isValid(explorationRequest), is(false));
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void expectsThereToBeADeploymentTypeInIsisConfiguration() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(SystemConstants.DEPLOYMENT_TYPE_KEY);
+                will(returnValue(null));
+            }
+        });
+        authenticator.isValid(explorationRequest);
+    }
+
+    @Test
+    public void isValidSomeOtherTypeOfRequest() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString(SystemConstants.DEPLOYMENT_TYPE_KEY);
+                will(returnValue(DeploymentType.EXPLORATION.name()));
+            }
+        });
+        assertThat(authenticator.canAuthenticate(someOtherRequest.getClass()), is(false));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/fixture/LogonFixtureAuthenticatorTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/fixture/LogonFixtureAuthenticatorTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/fixture/LogonFixtureAuthenticatorTest.java
new file mode 100644
index 0000000..24ab4ab
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/authentication/standard/fixture/LogonFixtureAuthenticatorTest.java
@@ -0,0 +1,132 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.authentication.standard.fixture;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JMock;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import org.apache.isis.applib.fixtures.LogonFixture;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequestAbstract;
+import org.apache.isis.core.runtime.authentication.fixture.LogonFixtureAuthenticator;
+import org.apache.isis.core.runtime.fixtures.authentication.AuthenticationRequestLogonFixture;
+import org.apache.isis.core.runtime.system.DeploymentType;
+
+@RunWith(JMock.class)
+public class LogonFixtureAuthenticatorTest {
+
+    private final Mockery mockery = new JUnit4Mockery();
+
+    private IsisConfiguration mockConfiguration;
+    private LogonFixtureAuthenticator authenticator;
+
+    private AuthenticationRequestLogonFixture logonFixtureRequest;
+
+    private SomeOtherAuthenticationRequest someOtherRequest;
+
+    private static class SomeOtherAuthenticationRequest extends AuthenticationRequestAbstract {
+        public SomeOtherAuthenticationRequest() {
+            super("other");
+        }
+    }
+
+    @Before
+    public void setUp() {
+        mockConfiguration = mockery.mock(IsisConfiguration.class);
+
+        logonFixtureRequest = new AuthenticationRequestLogonFixture(new LogonFixture("joebloggs"));
+        someOtherRequest = new SomeOtherAuthenticationRequest();
+        authenticator = new LogonFixtureAuthenticator(mockConfiguration);
+    }
+
+    @Test
+    public void canAuthenticateExplorationRequest() throws Exception {
+        assertThat(authenticator.canAuthenticate(logonFixtureRequest.getClass()), is(true));
+    }
+
+    @Test
+    public void canAuthenticateSomeOtherTypeOfRequest() throws Exception {
+        assertThat(authenticator.canAuthenticate(someOtherRequest.getClass()), is(false));
+    }
+
+    @Test
+    public void isValidLogonFixtureRequestWhenRunningInExplorationMode() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString("isis.deploymentType");
+                will(returnValue(DeploymentType.EXPLORATION.name()));
+            }
+        });
+        assertThat(authenticator.isValid(logonFixtureRequest), is(true));
+    }
+
+    @Test
+    public void isValidLogonFixtureRequestWhenRunningInPrototypeMode() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString("isis.deploymentType");
+                will(returnValue(DeploymentType.PROTOTYPE.name()));
+            }
+        });
+        assertThat(authenticator.isValid(logonFixtureRequest), is(true));
+    }
+
+    @Test
+    public void isNotValidExplorationRequestWhenRunningInSomethingOtherThanExplorationOrPrototypeMode() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString("isis.deploymentType");
+                will(returnValue(DeploymentType.SERVER.name()));
+            }
+        });
+        assertThat(authenticator.isValid(logonFixtureRequest), is(false));
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void expectsThereToBeADeploymentTypeInIsisConfiguration() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString("isis.deploymentType");
+                will(returnValue(null));
+            }
+        });
+        authenticator.isValid(logonFixtureRequest);
+    }
+
+    @Test
+    public void isValidSomeOtherTypeOfRequest() throws Exception {
+        mockery.checking(new Expectations() {
+            {
+                allowing(mockConfiguration).getString("isis.deploymentType");
+                will(returnValue(DeploymentType.EXPLORATION.name()));
+            }
+        });
+        assertThat(authenticator.canAuthenticate(SomeOtherAuthenticationRequest.class), is(false));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java
new file mode 100644
index 0000000..e717635
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/context/IsisContextTest.java
@@ -0,0 +1,157 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.context;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.jmock.Expectations;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationDefault;
+import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.runtime.authentication.AuthenticationManager;
+import org.apache.isis.core.runtime.authentication.standard.SimpleSession;
+import org.apache.isis.core.runtime.authorization.AuthorizationManager;
+import org.apache.isis.core.runtime.imageloader.TemplateImageLoader;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.context.IsisContextStatic;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
+import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
+import org.apache.isis.core.runtime.system.session.IsisSessionFactoryDefault;
+import org.apache.isis.core.runtime.userprofile.UserProfileLoader;
+import org.apache.isis.core.unittestsupport.jmock.auto.Mock;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
+
+public class IsisContextTest {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+    
+
+    private IsisConfiguration configuration;
+    
+    @Mock
+    private PersistenceSession mockPersistenceSession;
+    
+    @Mock
+    private SpecificationLoaderSpi mockSpecificationLoader;
+
+    @Mock
+    protected TemplateImageLoader mockTemplateImageLoader;
+    @Mock
+    protected PersistenceSessionFactory mockPersistenceSessionFactory;
+    @Mock
+    private UserProfileLoader mockUserProfileLoader;
+    @Mock
+    protected AuthenticationManager mockAuthenticationManager;
+    @Mock
+    protected AuthorizationManager mockAuthorizationManager;
+
+    protected OidMarshaller oidMarshaller;
+
+    private List<Object> servicesList;
+
+
+    private AuthenticationSession authSession;
+
+
+    private IsisSessionFactory sessionFactory;
+
+    @Before
+    public void setUp() throws Exception {
+        IsisContext.testReset();
+
+        servicesList = Collections.emptyList();
+
+        configuration = new IsisConfigurationDefault();
+        
+        oidMarshaller = new OidMarshaller();
+        
+        context.checking(new Expectations() {
+            {
+                allowing(mockPersistenceSessionFactory).createPersistenceSession();
+                will(returnValue(mockPersistenceSession));
+                
+                ignoring(mockPersistenceSession);
+                ignoring(mockSpecificationLoader);
+                ignoring(mockPersistenceSessionFactory);
+                ignoring(mockUserProfileLoader);
+                ignoring(mockAuthenticationManager);
+                ignoring(mockAuthorizationManager);
+                ignoring(mockTemplateImageLoader);
+            }
+        });
+
+        sessionFactory = new IsisSessionFactoryDefault(DeploymentType.EXPLORATION, configuration, mockTemplateImageLoader, mockSpecificationLoader, mockAuthenticationManager, mockAuthorizationManager, mockUserProfileLoader, mockPersistenceSessionFactory, servicesList, oidMarshaller);
+        authSession = new SimpleSession("tester", Collections.<String>emptyList());
+        
+        IsisContext.setConfiguration(configuration);
+    }
+    
+    @After
+    public void tearDown() throws Exception {
+        if(IsisContext.inSession()) {
+            IsisContext.closeSession();
+        }
+    }
+    
+    @Test
+    public void getConfiguration() {
+        IsisContextStatic.createRelaxedInstance(sessionFactory);
+        Assert.assertEquals(configuration, IsisContext.getConfiguration());
+    }
+
+    @Test
+    public void openSession_getSpecificationLoader() {
+        IsisContextStatic.createRelaxedInstance(sessionFactory);
+        IsisContext.openSession(authSession);
+
+        Assert.assertEquals(mockSpecificationLoader, IsisContext.getSpecificationLoader());
+    }
+
+    @Test
+    public void openSession_getAuthenticationLoader() {
+        IsisContextStatic.createRelaxedInstance(sessionFactory);
+        IsisContext.openSession(authSession);
+
+        Assert.assertEquals(authSession, IsisContext.getAuthenticationSession());
+    }
+    
+    @Test
+    public void openSession_getPersistenceSession() {
+        IsisContextStatic.createRelaxedInstance(sessionFactory);
+        IsisContext.openSession(authSession);
+
+        Assert.assertSame(mockPersistenceSession, IsisContext.getPersistenceSession());
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/AggregatedFacetAlways.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/AggregatedFacetAlways.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/AggregatedFacetAlways.java
new file mode 100644
index 0000000..653f929
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/AggregatedFacetAlways.java
@@ -0,0 +1,32 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.persistence;
+
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.MarkerFacetAbstract;
+import org.apache.isis.core.metamodel.facets.object.aggregated.ParentedFacet;
+
+public class AggregatedFacetAlways extends MarkerFacetAbstract {
+
+    public AggregatedFacetAlways(final FacetHolder holder) {
+        super(ParentedFacet.class, holder);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adapterfactory/pojo/PojoAdapterTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adapterfactory/pojo/PojoAdapterTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adapterfactory/pojo/PojoAdapterTest.java
new file mode 100644
index 0000000..3789b71
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adapterfactory/pojo/PojoAdapterTest.java
@@ -0,0 +1,151 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.persistence.adapterfactory.pojo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+import java.util.Date;
+
+import org.jmock.Expectations;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.ResolveState;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
+import org.apache.isis.core.metamodel.adapter.version.Version;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.runtime.persistence.adapter.PojoAdapter;
+import org.apache.isis.core.runtime.persistence.objectstore.transaction.PojoAdapterBuilder;
+import org.apache.isis.core.unittestsupport.jmock.auto.Mock;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
+
+public class PojoAdapterTest {
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+    
+    private ObjectAdapter adapter;
+    private RuntimeTestPojo domainObject;
+
+    @Mock
+    private Version mockVersion;
+    @Mock
+    private Version mockVersion2;
+    @Mock
+    private SpecificationLoaderSpi mockSpecificationLoader;
+    @Mock
+    private AuthenticationSession mockAuthenticationSession;
+    @Mock
+    private AdapterManager mockObjectAdapterLookup;
+    @Mock
+    private Localization mockLocalization;
+    
+    @Before
+    public void setUp() throws Exception {
+        domainObject = new RuntimeTestPojo();
+        
+        adapter = new PojoAdapter(domainObject, RootOidDefault.create(ObjectSpecId.of("CUS"), "1"), mockSpecificationLoader, mockObjectAdapterLookup, mockLocalization, mockAuthenticationSession);
+        adapter.setVersion(mockVersion);
+        
+        allowUnimportantMethodCallsOn(mockVersion);
+        allowUnimportantMethodCallsOn(mockVersion2);
+    }
+
+    private void allowUnimportantMethodCallsOn(final Version version) {
+        context.checking(new Expectations() {
+            {
+                allowing(version).getSequence();
+                allowing(version).getUtcTimestamp();
+                allowing(version).sequence();
+                allowing(version).getUser();
+                
+                allowing(version).getTime();
+                will(returnValue(new Date()));
+                
+                allowing(mockAuthenticationSession).getUserName();
+                will(returnValue("fredbloggs"));
+            }
+        });
+    }
+
+    @Test
+    public void getOid_initially() {
+        assertEquals(RootOidDefault.create(ObjectSpecId.of("CUS"), "1"), adapter.getOid());
+    }
+
+    @Test
+    public void getObject_initially() {
+        assertEquals(domainObject, adapter.getObject());
+    }
+
+    @Test
+    public void getResolveState_initially() {
+        assertEquals(ResolveState.NEW, adapter.getResolveState());
+    }
+
+    @Test
+    public void changeState_newToTransient() {
+        adapter.changeState(ResolveState.TRANSIENT);
+        assertEquals(ResolveState.TRANSIENT, adapter.getResolveState());
+    }
+
+    @Test
+    public void getVersion_initially() throws Exception {
+        assertSame(mockVersion, adapter.getVersion());
+    }
+
+    @Test
+    public void checkLock_whenVersionsSame() throws Exception {
+
+        context.checking(new Expectations() {
+            {
+                one(mockVersion).different(mockVersion2);
+                will(returnValue(false));
+            }
+        });
+        
+        adapter.checkLock(mockVersion2);
+    }
+
+    @Test(expected=ConcurrencyException.class)
+    public void checkLock_whenVersionsDifferent() throws Exception {
+
+        adapter = PojoAdapterBuilder.create().with(mockSpecificationLoader).withTitleString("some pojo").with(mockVersion).with(mockAuthenticationSession).build();
+        
+        context.checking(new Expectations() {
+            {
+                one(mockVersion).different(mockVersion2);
+                will(returnValue(true));
+            }
+        });
+        
+        adapter.checkLock(mockVersion2);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adapterfactory/pojo/RuntimeTestPojo.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adapterfactory/pojo/RuntimeTestPojo.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adapterfactory/pojo/RuntimeTestPojo.java
new file mode 100644
index 0000000..00e2ca3
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adapterfactory/pojo/RuntimeTestPojo.java
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.core.runtime.persistence.adapterfactory.pojo;
+
+public class RuntimeTestPojo {
+    private static int nextId;
+    private final int id = nextId++;
+    private final String state = "pojo" + id;
+
+    @Override
+    public String toString() {
+        return "Pojo#" + id;
+    }
+
+    @Override
+    public boolean equals(final Object other) {
+        if (other == null) {
+            return false;
+        }
+        if (other == this) {
+            return true;
+        }
+        if (other.getClass() == getClass()) {
+            final RuntimeTestPojo otherTestPojo = (RuntimeTestPojo) other;
+            return otherTestPojo.state.equals(state);
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return state.hashCode();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/978f79af/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java
new file mode 100644
index 0000000..c6cbf30
--- /dev/null
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/persistence/adaptermanager/AdapterManagerDefault_aggregateAdapters.java
@@ -0,0 +1,225 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.isis.core.runtime.persistence.adaptermanager;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.jmock.Expectations;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.applib.annotation.Aggregated;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.profiles.Localization;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
+import org.apache.isis.core.metamodel.adapter.ResolveState;
+import org.apache.isis.core.metamodel.adapter.oid.AggregatedOid;
+import org.apache.isis.core.metamodel.adapter.oid.RootOidDefault;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
+import org.apache.isis.core.metamodel.runtimecontext.RuntimeContext;
+import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.spec.feature.OneToManyAssociation;
+import org.apache.isis.core.progmodel.app.IsisMetaModel;
+import org.apache.isis.core.runtime.persistence.adapter.PojoAdapterFactory;
+import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault;
+import org.apache.isis.core.runtime.persistence.adaptermanager.PojoRecreatorDefault;
+import org.apache.isis.core.runtime.system.persistence.OidGenerator;
+import org.apache.isis.core.unittestsupport.jmock.auto.Mock;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
+import org.apache.isis.progmodels.dflt.ProgrammingModelFacetsJava5;
+
+public class AdapterManagerDefault_aggregateAdapters {
+
+    public static class Customer {
+        // {{ Name (property)
+        private Name name;
+
+        @MemberOrder(sequence = "1")
+        public Name getName() {
+            return name;
+        }
+
+        public void setName(final Name name) {
+            this.name = name;
+        }
+        // }}
+    }
+    
+    @Aggregated
+    public static class Name {}
+    
+    public static class CustomerRepository {
+        public Customer x() { return null; }
+    }
+
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
+    @Mock
+    private OneToManyAssociation mockCollection;
+
+    @Mock
+    private RuntimeContext mockRuntimeContext;
+    
+    @Mock
+    private OidGenerator mockOidGenerator;
+
+    @Mock
+    protected Localization mockLocalization;
+    
+    @Mock
+    private AuthenticationSession mockAuthenticationSession;
+    
+    @Mock
+    private IsisConfiguration mockConfiguration;
+    
+    private IsisMetaModel isisMetaModel;
+    
+    private ObjectAdapterFactory adapterFactory;
+    
+    private AdapterManagerDefault adapterManager;
+    
+    private Customer rootObject;
+    private Name aggregatedObject;
+    
+    private ObjectAdapter persistentParentAdapter;
+    private ObjectAdapter aggregatedAdapter;
+
+
+    
+    
+    @Before
+    public void setUp() throws Exception {
+        Logger.getRootLogger().setLevel(Level.OFF);
+
+        context.ignoring(mockRuntimeContext);
+        context.ignoring(mockAuthenticationSession);
+        context.ignoring(mockConfiguration);
+        
+        isisMetaModel = IsisMetaModel.builder(mockRuntimeContext, new ProgrammingModelFacetsJava5()).withServices(new CustomerRepository()).build();
+        isisMetaModel.init();
+
+        adapterFactory = new PojoAdapterFactory() {
+            @Override
+            protected Localization getLocalization() {
+                return mockLocalization;
+            }
+            @Override
+            protected SpecificationLoaderSpi getSpecificationLoader() {
+                return isisMetaModel.getSpecificationLoader();
+            }
+            
+            @Override
+            protected AuthenticationSession getAuthenticationSession() {
+                return mockAuthenticationSession;
+            }
+        };
+
+        adapterManager = new AdapterManagerDefault(new PojoRecreatorDefault()) {
+            @Override
+            protected SpecificationLoaderSpi getSpecificationLoader() {
+                return isisMetaModel.getSpecificationLoader();
+            }
+            @Override
+            protected ObjectAdapterFactory getObjectAdapterFactory() {
+                return adapterFactory;
+            }
+            @Override
+            public OidGenerator getOidGenerator() {
+                return mockOidGenerator;
+            }
+            @Override
+            protected ServicesInjector getServicesInjector() {
+                return isisMetaModel.getDependencyInjector();
+            }
+        };
+
+        rootObject = new Customer();
+        aggregatedObject = new Name();
+        
+        persistentParentAdapter = adapterManager.mapRecreatedPojo(
+                RootOidDefault.create(ObjectSpecId.of("CUS"), "1"), rootObject);
+    }
+
+    private void allowing_oidGenerator_createAggregatedOid(final Object value, final AggregatedOid resultOid) {
+        context.checking(new Expectations() {
+            {
+                allowing(mockOidGenerator).createAggregateOid(with(equalTo(value)), with(any(ObjectAdapter.class)));
+                will(returnValue(resultOid));
+                ignoring(mockOidGenerator);
+            }
+        });
+    }
+
+
+    @Test
+    public void adapterFor_whenAggregated() throws Exception {
+        // given
+        allowing_oidGenerator_createAggregatedOid(
+                aggregatedObject, 
+                new AggregatedOid(ObjectSpecId.of("NME"), (TypedOid) persistentParentAdapter.getOid(), "123"));
+        
+        // when
+        aggregatedAdapter = adapterManager.adapterFor(aggregatedObject, persistentParentAdapter);
+
+        // then
+        final AggregatedOid aggregatedOid = (AggregatedOid) aggregatedAdapter.getOid();
+        assertEquals(persistentParentAdapter.getOid(), aggregatedOid.getParentOid());
+    }
+
+    @Test
+    public void testOidHasSubId() throws Exception {
+        allowing_oidGenerator_createAggregatedOid(aggregatedObject, new AggregatedOid(ObjectSpecId.of("NME"), (TypedOid) persistentParentAdapter.getOid(), "123"));
+        aggregatedAdapter = adapterManager.adapterFor(aggregatedObject, persistentParentAdapter);
+
+        final AggregatedOid aggregatedOid = (AggregatedOid) aggregatedAdapter.getOid();
+        assertEquals("123", aggregatedOid.getLocalId());
+    }
+
+    @Test
+    public void getResolveState_isInitiallyGhost() throws Exception {
+        allowing_oidGenerator_createAggregatedOid(aggregatedObject, new AggregatedOid(ObjectSpecId.of("NME"), (TypedOid) persistentParentAdapter.getOid(), "123"));
+        aggregatedAdapter = adapterManager.adapterFor(aggregatedObject, persistentParentAdapter);
+
+        assertEquals(ResolveState.GHOST, aggregatedAdapter.getResolveState());
+    }
+
+    @Test
+    public void testSameParametersRetrievesSameAdapter() throws Exception {
+        allowing_oidGenerator_createAggregatedOid(aggregatedObject, new AggregatedOid(ObjectSpecId.of("NME"), (TypedOid) persistentParentAdapter.getOid(), "123"));
+        aggregatedAdapter = adapterManager.adapterFor(aggregatedObject, persistentParentAdapter);
+
+        final ObjectAdapter valueAdapter2 = adapterManager.adapterFor(aggregatedObject, persistentParentAdapter, mockCollection);
+        assertSame(aggregatedAdapter, valueAdapter2);
+    }
+
+}