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 2013/05/20 14:46:38 UTC

[3/5] ISIS-409: junit viewer moved up to core...

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/component/viewer/junit/impl/src/test/java/org/apache/isis/viewer/junit/sample/service/OrderRepository.java
----------------------------------------------------------------------
diff --git a/component/viewer/junit/impl/src/test/java/org/apache/isis/viewer/junit/sample/service/OrderRepository.java b/component/viewer/junit/impl/src/test/java/org/apache/isis/viewer/junit/sample/service/OrderRepository.java
deleted file mode 100644
index 3249123..0000000
--- a/component/viewer/junit/impl/src/test/java/org/apache/isis/viewer/junit/sample/service/OrderRepository.java
+++ /dev/null
@@ -1,67 +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.
- */
-
-package org.apache.isis.viewer.junit.sample.service;
-
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.isis.applib.AbstractFactoryAndRepository;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.viewer.junit.sample.domain.Customer;
-import org.apache.isis.viewer.junit.sample.domain.Order;
-
-@Named("Orders")
-public class OrderRepository extends AbstractFactoryAndRepository {
-
-    // use ctrl+space to bring up the NO templates.
-
-    // also, use CoffeeBytes code folding with
-    // user-defined regions of {{ and }}
-
-    @SuppressWarnings("unused")
-    private final static Logger LOGGER = Logger.getLogger(OrderRepository.class);
-
-    // {{ findRecentOrders
-    public List<Order> findRecentOrders(final Customer customer, @Named("Number of Orders") final Integer numberOfOrders) {
-        final List<Order> orders = customer.getOrders();
-        Collections.sort(orders, new Comparator<Order>() {
-            @Override
-            public int compare(final Order o1, final Order o2) {
-                final long time1 = o1.getOrderDate().getTime();
-                final long time2 = o2.getOrderDate().getTime();
-                return (int) (time2 - time1);
-            }
-        });
-        if (orders.size() < numberOfOrders) {
-            return orders;
-        } else {
-            return orders.subList(0, numberOfOrders);
-        }
-    }
-
-    public Integer default1FindRecentOrders() {
-        return 3;
-    }
-    // }}
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/component/viewer/junit/impl/src/test/java/org/apache/isis/viewer/junit/sample/service/ProductRepository.java
----------------------------------------------------------------------
diff --git a/component/viewer/junit/impl/src/test/java/org/apache/isis/viewer/junit/sample/service/ProductRepository.java b/component/viewer/junit/impl/src/test/java/org/apache/isis/viewer/junit/sample/service/ProductRepository.java
deleted file mode 100644
index e62be41..0000000
--- a/component/viewer/junit/impl/src/test/java/org/apache/isis/viewer/junit/sample/service/ProductRepository.java
+++ /dev/null
@@ -1,103 +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.
- */
-
-package org.apache.isis.viewer.junit.sample.service;
-
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.apache.isis.applib.AbstractFactoryAndRepository;
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.filter.Filter;
-import org.apache.isis.viewer.junit.sample.domain.Customer;
-import org.apache.isis.viewer.junit.sample.domain.Product;
-
-@Named("Products")
-public class ProductRepository extends AbstractFactoryAndRepository {
-
-    // use ctrl+space to bring up the NO templates.
-
-    // also, use CoffeeBytes code folding with
-    // user-defined regions of {{ and }}
-
-    // {{ Logger
-    @SuppressWarnings("unused")
-    private final static Logger LOGGER = Logger.getLogger(ProductRepository.class);
-
-    // }}
-
-    /**
-     * Lists all products in the repository.
-     */
-    public List<Product> showAll() {
-        return allInstances(Product.class);
-    }
-
-    // {{ findByCode
-    /**
-     * Returns the Product with given code
-     */
-    public Product findByCode(@Named("Code") final String code) {
-        return firstMatch(Product.class, new Filter<Product>() {
-            @Override
-            public boolean accept(final Product product) {
-                return code.equals(product.getCode());
-            }
-        });
-    }
-
-    // }}
-
-    /**
-     * Creates a new product.
-     * 
-     * <p>
-     * For use by fixtures only.
-     * 
-     * @return
-     */
-    @Hidden
-    public Product newProduct(final String code, final String description, final int priceInPence) {
-        final Product product = newTransientInstance(Product.class);
-        product.setCode(code);
-        product.setDescription(description);
-        product.setPrice(new Double(priceInPence / 100));
-        persist(product);
-        return product;
-    }
-
-    /**
-     * Creates a new still transient product.
-     * 
-     * <p>
-     * For use by tests only. Using this rather than {@link Customer} since
-     * {@link Product} has a {@link Product#validate()} method.
-     * 
-     * @return
-     */
-    @Hidden
-    public Product newProduct() {
-        return newTransientInstance(Product.class);
-    }
-
-    
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/component/viewer/junit/tck/pom.xml
----------------------------------------------------------------------
diff --git a/component/viewer/junit/tck/pom.xml b/component/viewer/junit/tck/pom.xml
index b2dca09..0d82077 100644
--- a/component/viewer/junit/tck/pom.xml
+++ b/component/viewer/junit/tck/pom.xml
@@ -74,11 +74,15 @@
             <artifactId>isis-core-security</artifactId>
         </dependency>
 
-        <!-- isis viewers -->
+        <!-- isis testing -->
         <dependency>
-            <groupId>org.apache.isis.viewer</groupId>
-            <artifactId>isis-viewer-junit-impl</artifactId>
-            <version>${isis-viewer-junit.version}</version>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-wrapper</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-integtestsupport</artifactId>
             <scope>test</scope>
         </dependency>
         

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/component/viewer/junit/tck/src/test/java/junit/AbstractTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/junit/tck/src/test/java/junit/AbstractTest.java b/component/viewer/junit/tck/src/test/java/junit/AbstractTest.java
index bf15176..5697fd2 100644
--- a/component/viewer/junit/tck/src/test/java/junit/AbstractTest.java
+++ b/component/viewer/junit/tck/src/test/java/junit/AbstractTest.java
@@ -26,12 +26,12 @@ import org.junit.runner.RunWith;
 import org.apache.isis.applib.DomainObjectContainer;
 import org.apache.isis.applib.services.wrapper.WrapperFactory;
 import org.apache.isis.applib.services.wrapper.WrapperObject;
+import org.apache.isis.core.integtestsupport.legacy.ConfigDir;
+import org.apache.isis.core.integtestsupport.legacy.IsisTestRunner;
+import org.apache.isis.core.integtestsupport.legacy.Service;
+import org.apache.isis.core.integtestsupport.legacy.Services;
 import org.apache.isis.core.tck.dom.scalars.PrimitiveValuedEntityRepository;
 import org.apache.isis.core.wrapper.WrapperFactoryDefault;
-import org.apache.isis.viewer.junit.ConfigDir;
-import org.apache.isis.viewer.junit.IsisTestRunner;
-import org.apache.isis.viewer.junit.Service;
-import org.apache.isis.viewer.junit.Services;
 
 @RunWith(IsisTestRunner.class)
 @ConfigDir("../../viewer/dnd-tck/src/main/resources")

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/component/viewer/junit/tck/src/test/java/junit/todo/ScalarEntityRepositoryTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/junit/tck/src/test/java/junit/todo/ScalarEntityRepositoryTest.java b/component/viewer/junit/tck/src/test/java/junit/todo/ScalarEntityRepositoryTest.java
index 444c229..7d71f96 100644
--- a/component/viewer/junit/tck/src/test/java/junit/todo/ScalarEntityRepositoryTest.java
+++ b/component/viewer/junit/tck/src/test/java/junit/todo/ScalarEntityRepositoryTest.java
@@ -31,10 +31,10 @@ import junit.AbstractTest;
 import org.junit.Ignore;
 import org.junit.Test;
 
+import org.apache.isis.core.integtestsupport.legacy.Fixture;
+import org.apache.isis.core.integtestsupport.legacy.Fixtures;
 import org.apache.isis.core.tck.dom.scalars.PrimitiveValuedEntity;
 import org.apache.isis.core.tck.fixture.scalars.PrimitiveValuedEntityFixture;
-import org.apache.isis.viewer.junit.Fixture;
-import org.apache.isis.viewer.junit.Fixtures;
 
 @Fixtures({ @Fixture(PrimitiveValuedEntityFixture.class) })
 public class ScalarEntityRepositoryTest extends AbstractTest {

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/component/viewer/junit/tck/src/test/java/junit/todo/ScalarEntityTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/junit/tck/src/test/java/junit/todo/ScalarEntityTest.java b/component/viewer/junit/tck/src/test/java/junit/todo/ScalarEntityTest.java
index 889c101..57e1cea 100644
--- a/component/viewer/junit/tck/src/test/java/junit/todo/ScalarEntityTest.java
+++ b/component/viewer/junit/tck/src/test/java/junit/todo/ScalarEntityTest.java
@@ -24,10 +24,10 @@ import junit.AbstractTest;
 import org.junit.Before;
 import org.junit.Test;
 
+import org.apache.isis.core.integtestsupport.legacy.Fixture;
+import org.apache.isis.core.integtestsupport.legacy.Fixtures;
 import org.apache.isis.core.tck.dom.scalars.PrimitiveValuedEntity;
 import org.apache.isis.core.tck.fixture.scalars.PrimitiveValuedEntityFixture;
-import org.apache.isis.viewer.junit.Fixture;
-import org.apache.isis.viewer.junit.Fixtures;
 
 @Fixtures({ @Fixture(PrimitiveValuedEntityFixture.class) })
 public class ScalarEntityTest extends AbstractTest {

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/pom.xml
----------------------------------------------------------------------
diff --git a/core/integtestsupport/pom.xml b/core/integtestsupport/pom.xml
index f13d81c..967969c 100644
--- a/core/integtestsupport/pom.xml
+++ b/core/integtestsupport/pom.xml
@@ -119,6 +119,13 @@
 			<artifactId>isis-core-runtime</artifactId>
 		</dependency>
 
+        <!-- isis testing -->
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-wrapper</artifactId>
+            <scope>test</scope>
+        </dependency>
+
 
 	</dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authenticator.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authenticator.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authenticator.java
new file mode 100644
index 0000000..b788520
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authenticator.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.integtestsupport.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Authenticator {
+    Class<?> value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authorizor.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authorizor.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authorizor.java
new file mode 100644
index 0000000..be399b3
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Authorizor.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.integtestsupport.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Authorizor {
+    Class<?> value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/ConfigDir.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/ConfigDir.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/ConfigDir.java
new file mode 100644
index 0000000..eac566c
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/ConfigDir.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.integtestsupport.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * The location of the <tt>config</tt> directory, relative to the base.
+ */
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ConfigDir {
+    String value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixture.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixture.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixture.java
new file mode 100644
index 0000000..bf8a9f8
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixture.java
@@ -0,0 +1,33 @@
+/*
+ *  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.integtestsupport.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Fixture {
+    Class<?> value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixtures.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixtures.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixtures.java
new file mode 100644
index 0000000..f2e25ed
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Fixtures.java
@@ -0,0 +1,33 @@
+/*
+ *  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.integtestsupport.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Fixtures {
+    Fixture[] value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/IsisTestRunner.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/IsisTestRunner.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/IsisTestRunner.java
new file mode 100644
index 0000000..9a12e09
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/IsisTestRunner.java
@@ -0,0 +1,221 @@
+/*
+ *  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.integtestsupport.legacy;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.jmock.Mockery;
+import org.junit.internal.runners.InitializationError;
+import org.junit.internal.runners.JUnit4ClassRunner;
+import org.junit.internal.runners.MethodRoadie;
+import org.junit.internal.runners.TestClass;
+import org.junit.internal.runners.TestMethod;
+import org.junit.runner.Description;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunNotifier;
+
+import org.apache.isis.applib.fixtures.LogonFixture;
+import org.apache.isis.core.commons.authentication.AuthenticationSession;
+import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
+import org.apache.isis.core.commons.config.IsisConfigurationBuilderDefault;
+import org.apache.isis.core.integtestsupport.legacy.components.IsisSystemUsingInstallersWithinJunit;
+import org.apache.isis.core.metamodel.services.ServicesInjectorSpi;
+import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
+import org.apache.isis.core.runtime.authentication.exploration.AuthenticationRequestExploration;
+import org.apache.isis.core.runtime.fixtures.authentication.AuthenticationRequestLogonFixture;
+import org.apache.isis.core.runtime.installers.InstallerLookupDefault;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.system.SystemConstants;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+
+/**
+ * Copied from JMock, and with the same support.
+ * 
+ */
+public class IsisTestRunner extends JUnit4ClassRunner {
+
+    private final Field mockeryField;
+
+    /**
+     * Only used during object construction.
+     */
+    public IsisTestRunner(final Class<?> testClass) throws InitializationError {
+        super(testClass);
+
+        // JMock initialization, adapted to allow for no mockery field.
+        mockeryField = findFieldAndMakeAccessible(testClass, Mockery.class);
+    }
+
+    private static String getConfigDir(final Class<?> javaClass) {
+        final ConfigDir fixturesAnnotation = javaClass.getAnnotation(ConfigDir.class);
+        if (fixturesAnnotation != null) {
+            return fixturesAnnotation.value();
+        }
+        return null;
+    }
+
+    @Override
+    protected void invokeTestMethod(final Method method, final RunNotifier notifier) {
+
+        final TestClass testClass = getTestClass();
+        final String configDirIfAny = getConfigDir(testClass.getJavaClass());
+
+        final Description description = methodDescription(method);
+
+        final IsisConfigurationBuilder isisConfigurationBuilder = new IsisConfigurationBuilderDefault(configDirIfAny);
+        isisConfigurationBuilder.add(SystemConstants.NOSPLASH_KEY, "" + true); // switch
+                                                                               // off
+                                                                               // splash
+
+        final InstallerLookupDefault installerLookup = new InstallerLookupDefault();
+        isisConfigurationBuilder.injectInto(installerLookup);
+        installerLookup.init();
+
+        IsisSystemUsingInstallersWithinJunit system = null;
+        AuthenticationSession session = null;
+        try {
+            // init the system; cf similar code in Isis and
+            // IsisServletContextInitializer
+            final DeploymentType deploymentType = DeploymentType.PROTOTYPE;
+
+            // TODO: replace with regular IsisSystem and remove this subclass.
+            system = new IsisSystemUsingInstallersWithinJunit(deploymentType, installerLookup, testClass);
+
+            system.init();
+
+            // specific to this bootstrap mechanism
+            AuthenticationRequest request;
+            final LogonFixture logonFixture = system.getFixturesInstaller().getLogonFixture();
+            if (logonFixture != null) {
+                request = new AuthenticationRequestLogonFixture(logonFixture);
+            } else {
+                request = new AuthenticationRequestExploration(logonFixture);
+            }
+            session = IsisContext.getAuthenticationManager().authenticate(request);
+
+            IsisContext.openSession(session);
+            getTransactionManager().startTransaction();
+
+            final Object test = createTest();
+            getServicesInjector().injectServicesInto(test);
+
+            final TestMethod testMethod = wrapMethod(method);
+            new MethodRoadie(test, testMethod, notifier, description).run();
+
+            getTransactionManager().endTransaction();
+
+        } catch (final InvocationTargetException e) {
+            testAborted(notifier, description, e.getCause());
+            getTransactionManager().abortTransaction();
+            return;
+        } catch (final Exception e) {
+            testAborted(notifier, description, e);
+            return;
+        } finally {
+            if (system != null) {
+                if (session != null) {
+                    IsisContext.closeSession();
+                }
+                system.shutdown();
+            }
+        }
+    }
+
+    private void testAborted(final RunNotifier notifier, final Description description, final Throwable e) {
+        notifier.fireTestStarted(description);
+        notifier.fireTestFailure(new Failure(description, e));
+        notifier.fireTestFinished(description);
+    }
+
+    /**
+     * Taken from JMock's runner.
+     */
+    @Override
+    protected TestMethod wrapMethod(final Method method) {
+        return new TestMethod(method, getTestClass()) {
+            @Override
+            public void invoke(final Object testFixture) throws IllegalAccessException, InvocationTargetException {
+
+                super.invoke(testFixture);
+
+                if (mockeryField != null) {
+                    mockeryOf(testFixture).assertIsSatisfied();
+                }
+            }
+        };
+    }
+
+    /**
+     * JMock code.
+     * 
+     * @param test
+     * @return
+     */
+    protected Mockery mockeryOf(final Object test) {
+        if (mockeryField == null) {
+            return null;
+        }
+        try {
+            final Mockery mockery = (Mockery) mockeryField.get(test);
+            if (mockery == null) {
+                throw new IllegalStateException(String.format("Mockery named '%s' is null", mockeryField.getName()));
+            }
+            return mockery;
+        } catch (final IllegalAccessException e) {
+            throw new IllegalStateException(String.format("cannot get value of field %s", mockeryField.getName()), e);
+        }
+    }
+
+    /**
+     * Adapted from JMock code.
+     */
+    static Field findFieldAndMakeAccessible(final Class<?> testClass, final Class<?> clazz) throws InitializationError {
+        for (Class<?> c = testClass; c != Object.class; c = c.getSuperclass()) {
+            for (final Field field : c.getDeclaredFields()) {
+                if (clazz.isAssignableFrom(field.getType())) {
+                    field.setAccessible(true);
+                    return field;
+                }
+            }
+        }
+        return null;
+    }
+
+    // /////////////////////////////////////////////////////
+    // Dependencies (from context)
+    // /////////////////////////////////////////////////////
+
+    private static PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+    private static ServicesInjectorSpi getServicesInjector() {
+        return getPersistenceSession().getServicesInjector();
+    }
+
+    private static IsisTransactionManager getTransactionManager() {
+        return getPersistenceSession().getTransactionManager();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Persistor.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Persistor.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Persistor.java
new file mode 100644
index 0000000..32ad6e0
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Persistor.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.integtestsupport.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Persistor {
+    Class<?> value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Service.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Service.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Service.java
new file mode 100644
index 0000000..4e52531
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Service.java
@@ -0,0 +1,33 @@
+/*
+ *  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.integtestsupport.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Service {
+    Class<?> value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Services.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Services.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Services.java
new file mode 100644
index 0000000..f4290d5
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/Services.java
@@ -0,0 +1,33 @@
+/*
+ *  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.integtestsupport.legacy;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Inherited
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Services {
+    Service[] value();
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/AnnotationInstaller.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/AnnotationInstaller.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/AnnotationInstaller.java
new file mode 100644
index 0000000..9f743ac
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/AnnotationInstaller.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.integtestsupport.legacy.components;
+
+import org.apache.isis.core.integtestsupport.legacy.Authenticator;
+import org.apache.isis.core.integtestsupport.legacy.Authorizor;
+import org.apache.isis.core.integtestsupport.legacy.Persistor;
+import org.apache.isis.core.objectstore.InMemoryPersistenceMechanismInstaller;
+import org.apache.isis.core.runtime.authentication.AuthenticationManagerInstaller;
+import org.apache.isis.core.runtime.authorization.AuthorizationManagerInstaller;
+import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstaller;
+import org.apache.isis.core.security.authentication.BypassAuthenticationManagerInstaller;
+import org.apache.isis.core.security.authorization.BypassAuthorizationManagerInstaller;
+
+public class AnnotationInstaller {
+
+    /**
+     * Should be called prior to installing; typically called immediately after
+     * instantiation.
+     * 
+     * <p>
+     * Note: an alternative design would be to have a 1-arg constructor, but the
+     * convention for installers is to make them no-arg.
+     */
+    // {{ AuthenticationManagerInstaller
+    public AuthenticationManagerInstaller addAuthenticatorAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
+        final Authenticator authenticatorAnnotation = javaClass.getAnnotation(Authenticator.class);
+        if (authenticatorAnnotation != null) {
+            return addAuthenticatorRepresentedBy(authenticatorAnnotation);
+        } else {
+            return new BypassAuthenticationManagerInstaller();
+        }
+
+    }
+
+    private AuthenticationManagerInstaller addAuthenticatorRepresentedBy(final Authenticator authenticatorAnnotation) throws InstantiationException, IllegalAccessException {
+        final Class<?> fixtureClass = authenticatorAnnotation.value();
+        return (AuthenticationManagerInstaller) fixtureClass.newInstance();
+    }
+
+    // }}
+
+    // {{ AuthorizationManagerInstaller
+    public AuthorizationManagerInstaller addAuthorizerAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
+        final Authorizor authorizorAnnotation = javaClass.getAnnotation(Authorizor.class);
+        if (authorizorAnnotation != null) {
+            return addAuthorizerRepresentedBy(authorizorAnnotation);
+        } else {
+            return new BypassAuthorizationManagerInstaller();
+        }
+
+    }
+
+    private AuthorizationManagerInstaller addAuthorizerRepresentedBy(final Authorizor authorizorAnnotation) throws InstantiationException, IllegalAccessException {
+        final Class<?> fixtureClass = authorizorAnnotation.value();
+        return (AuthorizationManagerInstaller) fixtureClass.newInstance();
+    }
+
+    // }}
+
+    // {{ PersistenceMechanismInstaller
+    public PersistenceMechanismInstaller addPersistorAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
+        final Persistor annotation = javaClass.getAnnotation(Persistor.class);
+        if (annotation != null) {
+            return addPersistorRepresentedBy(annotation);
+        } else {
+            return new InMemoryPersistenceMechanismInstaller();
+        }
+
+    }
+
+    private PersistenceMechanismInstaller addPersistorRepresentedBy(final Persistor annotation) throws InstantiationException, IllegalAccessException {
+        final Class<?> fixtureClass = annotation.value();
+        return (PersistenceMechanismInstaller) fixtureClass.newInstance();
+    }
+    // }}
+
+    // new InMemoryUserProfileStoreInstaller();
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/FixtureInstallerAnnotatedClass.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/FixtureInstallerAnnotatedClass.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/FixtureInstallerAnnotatedClass.java
new file mode 100644
index 0000000..43b30ed
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/FixtureInstallerAnnotatedClass.java
@@ -0,0 +1,88 @@
+/*
+ *  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.integtestsupport.legacy.components;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.integtestsupport.legacy.Fixture;
+import org.apache.isis.core.integtestsupport.legacy.Fixtures;
+import org.apache.isis.core.runtime.fixtures.FixturesInstallerAbstract;
+import org.apache.isis.core.runtime.fixtures.FixturesInstallerDelegate;
+
+public class FixtureInstallerAnnotatedClass extends FixturesInstallerAbstract {
+
+    private final List<Object> fixtures = new ArrayList<Object>();
+
+    /**
+     * @see #addFixturesAnnotatedOn(Class)
+     */
+    public FixtureInstallerAnnotatedClass() {
+        super("annotated");
+    }
+
+    // ///////////////////////////////////////////
+    // Hook method
+    // ///////////////////////////////////////////
+
+    /**
+     * Just copies the fixtures added using
+     * {@link #addFixturesAnnotatedOn(Class)} into the delegate.
+     */
+    @Override
+    protected void addFixturesTo(final FixturesInstallerDelegate delegate) {
+        for (final Object fixture : fixtures) {
+            delegate.addFixture(fixture);
+        }
+    }
+
+    // ///////////////////////////////////////////
+    // addFixturesAnnotatedOn (not API)
+    // ///////////////////////////////////////////
+
+    /**
+     * Should be called prior to installing; typically called immediately after
+     * instantiation.
+     * 
+     * <p>
+     * Note: an alternative design would be to have a 1-arg constructor, but the
+     * convention for installers is to make them no-arg.
+     */
+    public void addFixturesAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
+        final Fixtures fixturesAnnotation = javaClass.getAnnotation(Fixtures.class);
+        if (fixturesAnnotation != null) {
+            final Fixture[] fixtureAnnotations = fixturesAnnotation.value();
+            for (final Fixture fixtureAnnotation : fixtureAnnotations) {
+                addFixtureRepresentedBy(fixtureAnnotation, fixtures);
+            }
+        }
+
+        final Fixture fixtureAnnotation = javaClass.getAnnotation(Fixture.class);
+        if (fixtureAnnotation != null) {
+            addFixtureRepresentedBy(fixtureAnnotation, fixtures);
+        }
+    }
+
+    private void addFixtureRepresentedBy(final Fixture fixtureAnnotation, final List<Object> fixtures) throws InstantiationException, IllegalAccessException {
+        final Class<?> fixtureClass = fixtureAnnotation.value();
+        fixtures.add(fixtureClass.newInstance());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/IsisSystemUsingInstallersWithinJunit.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/IsisSystemUsingInstallersWithinJunit.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/IsisSystemUsingInstallersWithinJunit.java
new file mode 100644
index 0000000..b223c22
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/IsisSystemUsingInstallersWithinJunit.java
@@ -0,0 +1,77 @@
+/*
+ *  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.integtestsupport.legacy.components;
+
+import org.junit.internal.runners.TestClass;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+import org.apache.isis.core.profilestore.InMemoryUserProfileStoreInstaller;
+import org.apache.isis.core.runtime.installerregistry.InstallerLookup;
+import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.core.runtime.systemusinginstallers.IsisSystemUsingInstallers;
+
+public class IsisSystemUsingInstallersWithinJunit extends IsisSystemUsingInstallers {
+
+    private final TestClass testClass;
+
+    public IsisSystemUsingInstallersWithinJunit(final DeploymentType deploymentType, final InstallerLookup installerLookup, final TestClass testClass) {
+        super(deploymentType, installerLookup);
+        installerLookup.getConfigurationBuilder().add("isis.deploymentType", deploymentType.nameLowerCase());
+        
+        this.testClass = testClass;
+
+        final AnnotationInstaller installer = new AnnotationInstaller();
+
+        try {
+            setAuthenticationInstaller(getInstallerLookup().injectDependenciesInto(installer.addAuthenticatorAnnotatedOn(this.testClass.getJavaClass())));
+
+            setAuthorizationInstaller(getInstallerLookup().injectDependenciesInto(installer.addAuthorizerAnnotatedOn(this.testClass.getJavaClass())));
+
+            setPersistenceMechanismInstaller(getInstallerLookup().injectDependenciesInto(installer.addPersistorAnnotatedOn(this.testClass.getJavaClass())));
+
+            setUserProfileStoreInstaller(getInstallerLookup().injectDependenciesInto(new InMemoryUserProfileStoreInstaller()));
+
+            // fixture installer
+            final FixtureInstallerAnnotatedClass fixtureInstaller = new FixtureInstallerAnnotatedClass();
+            fixtureInstaller.addFixturesAnnotatedOn(this.testClass.getJavaClass());
+            setFixtureInstaller(fixtureInstaller);
+        } catch (final InstantiationException e) {
+            throw new IsisException(e);
+        } catch (final IllegalAccessException e) {
+            throw new IsisException(e);
+        }
+
+        // services installer
+        final ServicesInstallerAnnotatedClass servicesInstaller = new ServicesInstallerAnnotatedClass();
+        try {
+            servicesInstaller.addServicesAnnotatedOn(this.testClass.getJavaClass());
+        } catch (final InstantiationException e) {
+            throw new IsisException(e);
+        } catch (final IllegalAccessException e) {
+            throw new IsisException(e);
+        }
+        setServicesInstaller(servicesInstaller);
+    }
+
+    public TestClass getTestClass() {
+        return testClass;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/ServicesInstallerAnnotatedClass.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/ServicesInstallerAnnotatedClass.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/ServicesInstallerAnnotatedClass.java
new file mode 100644
index 0000000..3aae9e5
--- /dev/null
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/legacy/components/ServicesInstallerAnnotatedClass.java
@@ -0,0 +1,68 @@
+/*
+ *  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.integtestsupport.legacy.components;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.isis.core.integtestsupport.legacy.Service;
+import org.apache.isis.core.integtestsupport.legacy.Services;
+import org.apache.isis.core.runtime.services.ServicesInstallerAbstract;
+
+public class ServicesInstallerAnnotatedClass extends ServicesInstallerAbstract {
+
+    public ServicesInstallerAnnotatedClass() {
+        super("annotated");
+    }
+
+    public void addServicesAnnotatedOn(final Class<?> javaClass) throws InstantiationException, IllegalAccessException {
+        final List<Object> services = new ArrayList<Object>();
+        addServicesAnnotatedOn(javaClass, services);
+        addServices(services);
+    }
+
+    private void addServicesAnnotatedOn(final Class<?> testClass, final List<Object> services) throws InstantiationException, IllegalAccessException {
+        final Services servicesAnnotation = testClass.getAnnotation(Services.class);
+        if (servicesAnnotation != null) {
+            final Service[] serviceAnnotations = servicesAnnotation.value();
+            for (final Service serviceAnnotation : serviceAnnotations) {
+                addServiceRepresentedBy(serviceAnnotation, services);
+            }
+        }
+
+        final Service serviceAnnotation = testClass.getAnnotation(Service.class);
+        if (serviceAnnotation != null) {
+            addServiceRepresentedBy(serviceAnnotation, services);
+        }
+    }
+
+    private void addServiceRepresentedBy(final Service serviceAnnotation, final List<Object> services) throws InstantiationException, IllegalAccessException {
+        final Class<?> serviceClass = serviceAnnotation.value();
+        // there's no need to unravel any Collections of services,
+        // because the ServiceLoader will do it for us later.
+        services.add(serviceClass.newInstance());
+    }
+
+    @Override
+    public List<Class<?>> getTypes() {
+        return listOf(List.class); // ie List<Object.class>, of services
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/AbstractTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/AbstractTest.java b/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/AbstractTest.java
new file mode 100644
index 0000000..7f23be5
--- /dev/null
+++ b/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/AbstractTest.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.integtestsupport.legacy;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+
+import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.services.wrapper.WrapperFactory;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Country;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Customer;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Product;
+import org.apache.isis.core.integtestsupport.legacy.sample.fixtures.CountriesFixture;
+import org.apache.isis.core.integtestsupport.legacy.sample.fixtures.CustomerOrdersFixture;
+import org.apache.isis.core.integtestsupport.legacy.sample.fixtures.CustomersFixture;
+import org.apache.isis.core.integtestsupport.legacy.sample.fixtures.ProductsFixture;
+import org.apache.isis.core.integtestsupport.legacy.sample.service.CountryRepository;
+import org.apache.isis.core.integtestsupport.legacy.sample.service.CustomerRepository;
+import org.apache.isis.core.integtestsupport.legacy.sample.service.OrderRepository;
+import org.apache.isis.core.integtestsupport.legacy.sample.service.ProductRepository;
+import org.apache.isis.core.wrapper.WrapperFactoryDefault;
+
+@RunWith(IsisTestRunner.class)
+@Fixtures({ @Fixture(CountriesFixture.class), @Fixture(ProductsFixture.class), @Fixture(CustomersFixture.class), @Fixture(CustomerOrdersFixture.class) })
+@Services({ @Service(CountryRepository.class), @Service(ProductRepository.class), @Service(CustomerRepository.class), @Service(OrderRepository.class), @Service(WrapperFactoryDefault.class) })
+public abstract class AbstractTest {
+
+    protected Customer custJsDO;
+    protected Customer custJsWO;
+
+    protected Product product355DO;
+    protected Product product355VO;
+
+    protected Product product850DO;
+
+    protected Country countryGbrDO;
+    protected Country countryGbrVO;
+
+    protected Country countryUsaDO;
+    protected Country countryAusDO;
+
+    private ProductRepository productRepository;
+    private CustomerRepository customerRepository;
+    private CountryRepository countryRepository;
+
+    private DomainObjectContainer domainObjectContainer;
+    private WrapperFactory wrapperFactory;
+
+    @Before
+    public void setUp() {
+
+        product355DO = productRepository.findByCode("355-40311");
+        product355VO = wrapperFactory.wrap(product355DO);
+        product850DO = productRepository.findByCode("850-18003");
+
+        countryGbrDO = countryRepository.findByCode("GBR");
+        countryGbrVO = wrapperFactory.wrap(countryGbrDO);
+
+        countryUsaDO = countryRepository.findByCode("USA");
+        countryAusDO = countryRepository.findByCode("AUS");
+
+        custJsDO = customerRepository.findByName("Pawson");
+        custJsWO = wrapperFactory.wrap(custJsDO);
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    // //////////////////////////////////////////////////////
+    // Injected.
+    // //////////////////////////////////////////////////////
+
+    protected WrapperFactory getWrapperFactory() {
+        return wrapperFactory;
+    }
+
+    public void setWrapperFactory(final WrapperFactory headlessViewer) {
+        this.wrapperFactory = headlessViewer;
+    }
+
+    protected DomainObjectContainer getDomainObjectContainer() {
+        return domainObjectContainer;
+    }
+
+    public void setDomainObjectContainer(final DomainObjectContainer domainObjectContainer) {
+        this.domainObjectContainer = domainObjectContainer;
+    }
+
+    protected ProductRepository getProductRepository() {
+        return productRepository;
+    }
+
+    public void setProductRepository(final ProductRepository productRepository) {
+        this.productRepository = productRepository;
+    }
+
+    protected CustomerRepository getCustomerRepository() {
+        return customerRepository;
+    }
+
+    public void setCustomerRepository(final CustomerRepository customerRepository) {
+        this.customerRepository = customerRepository;
+    }
+
+    protected CountryRepository getCountryRepository() {
+        return countryRepository;
+    }
+
+    public void setCountryRepository(final CountryRepository countryRepository) {
+        this.countryRepository = countryRepository;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/DefaultAndChoicesTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/DefaultAndChoicesTest.java b/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/DefaultAndChoicesTest.java
new file mode 100644
index 0000000..edcc3a3
--- /dev/null
+++ b/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/DefaultAndChoicesTest.java
@@ -0,0 +1,42 @@
+/*
+ *  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.integtestsupport.legacy;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class DefaultAndChoicesTest extends AbstractTest {
+
+    @Test
+    public void defaults() {
+        final Object[] defaultPlaceOrder = custJsWO.defaultPlaceOrder();
+        assertThat(defaultPlaceOrder.length, is(2));
+    }
+
+    @Ignore("not yet tested")
+    @Test
+    public void choicesDefaults() {
+        // not tested.
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/InteractionListenerTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/InteractionListenerTest.java b/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/InteractionListenerTest.java
new file mode 100644
index 0000000..8669781
--- /dev/null
+++ b/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/InteractionListenerTest.java
@@ -0,0 +1,54 @@
+/*
+ *  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.integtestsupport.legacy;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Test;
+
+import org.apache.isis.applib.events.InteractionEvent;
+import org.apache.isis.applib.events.PropertyAccessEvent;
+import org.apache.isis.applib.services.wrapper.listeners.InteractionAdapter;
+import org.apache.isis.applib.services.wrapper.listeners.InteractionListener;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Customer;
+
+public class InteractionListenerTest extends AbstractTest {
+
+    @Test
+    public void shouldBeAbleToAddListener() {
+        final Customer proxiedCustRP = getWrapperFactory().wrap(custJsDO);
+        final InteractionEvent[] events = { null };
+        final InteractionListener l = new InteractionAdapter() {
+            @Override
+            public void propertyAccessed(final PropertyAccessEvent ev) {
+                events[0] = ev;
+            }
+        };
+        getWrapperFactory().addInteractionListener(l);
+
+        proxiedCustRP.getFirstName();
+        assertThat(events[0], notNullValue());
+        final PropertyAccessEvent ev = (PropertyAccessEvent) events[0];
+        assertThat(ev.getMemberNaturalName(), is("First Name"));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/MemberDisabledTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/MemberDisabledTest.java b/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/MemberDisabledTest.java
new file mode 100644
index 0000000..5ce3f2d
--- /dev/null
+++ b/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/MemberDisabledTest.java
@@ -0,0 +1,131 @@
+/*
+ *  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.integtestsupport.legacy;
+
+import static org.apache.isis.core.commons.matchers.IsisMatchers.classEqualTo;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.junit.Test;
+
+import org.apache.isis.applib.services.wrapper.DisabledException;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Order;
+import org.apache.isis.core.progmodel.facets.members.disabled.annotation.DisabledFacetAnnotation;
+import org.apache.isis.core.progmodel.facets.members.disabled.method.DisableForContextFacetViaMethod;
+
+public class MemberDisabledTest extends AbstractTest {
+
+    @Test
+    public void whenValueDisabledForValueThenThrowsException() {
+        custJsDO.disableFirstName = "cannot alter";
+        try {
+            custJsWO.setFirstName("Dick");
+            fail("Should have thrown exception");
+        } catch (final DisabledException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(DisableForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("First Name"));
+            assertThat(ex.getMessage(), equalTo("cannot alter"));
+        }
+    }
+
+    @Test
+    public void whenValueDisabledForNullThenThrowsException() {
+        custJsDO.disableFirstName = "cannot alter";
+        try {
+            custJsWO.setFirstName(null);
+            fail("Should have thrown exception");
+        } catch (final DisabledException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(DisableForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("First Name"));
+            assertThat(ex.getMessage(), equalTo("cannot alter"));
+        }
+    }
+
+    @Test
+    public void whenAssociationDisabledForReferenceThenThrowsException() {
+        custJsDO.disableCountryOfBirth = "cannot alter";
+        try {
+            custJsWO.setCountryOfBirth(countryUsaDO);
+            fail("Should have thrown exception");
+        } catch (final DisabledException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(DisableForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Country Of Birth"));
+            assertThat(ex.getMessage(), equalTo("cannot alter"));
+        }
+    }
+
+    @Test
+    public void whenAssociationDisabledForNullThenThrowsException() {
+        custJsDO.disableCountryOfBirth = "cannot alter";
+        try {
+            custJsWO.setCountryOfBirth(null);
+            fail("Should have thrown exception");
+        } catch (final DisabledException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(DisableForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Country Of Birth"));
+            assertThat(ex.getMessage(), equalTo("cannot alter"));
+        }
+    }
+
+    @Test
+    public void whenCollectionDisabledThenAddToThrowsException() {
+        final List<Order> orders = custJsWO.getOrders();
+        final Order order = orders.get(0);
+        try {
+            custJsWO.addToMoreOrders(order);
+            fail("Should have thrown exception");
+        } catch (final DisabledException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(DisabledFacetAnnotation.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("More Orders"));
+            assertThat(ex.getMessage(), equalTo("Always disabled"));
+        }
+    }
+
+    @Test
+    public void whenCollectionDisabledThenRemovefromThrowsException() {
+        custJsDO.addToVisitedCountries(countryUsaDO);
+        custJsDO.disableVisitedCountries = "cannot alter";
+        try {
+            custJsWO.removeFromVisitedCountries(countryUsaDO);
+            fail("Should have thrown exception");
+        } catch (final DisabledException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(DisableForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Visited Countries"));
+            assertThat(ex.getMessage(), equalTo("cannot alter"));
+        }
+    }
+
+    @Test
+    public void whenActionDisabledThenThrowsException() {
+        custJsDO.disablePlaceOrder = "cannot invoke";
+        try {
+            custJsWO.placeOrder(product355DO, 3);
+            fail("Should have thrown exception");
+        } catch (final DisabledException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(DisableForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Place Order"));
+            assertThat(ex.getMessage(), equalTo("cannot invoke"));
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/da47b564/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/MemberHiddenTest.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/MemberHiddenTest.java b/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/MemberHiddenTest.java
new file mode 100644
index 0000000..b0589b2
--- /dev/null
+++ b/core/integtestsupport/src/test/java/org/apache/isis/core/integtestsupport/legacy/MemberHiddenTest.java
@@ -0,0 +1,357 @@
+/*
+ *  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.integtestsupport.legacy;
+
+import static org.apache.isis.core.commons.matchers.IsisMatchers.classEqualTo;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
+import org.apache.isis.applib.services.wrapper.HiddenException;
+import org.apache.isis.core.integtestsupport.legacy.sample.domain.Country;
+import org.apache.isis.core.progmodel.facets.members.hidden.annotation.HiddenFacetForMemberAnnotation;
+import org.apache.isis.core.progmodel.facets.members.hidden.forsession.HideForSessionFacetViaMethod;
+import org.apache.isis.core.progmodel.facets.members.hidden.method.HideForContextFacetViaMethod;
+
+public class MemberHiddenTest extends AbstractTest {
+
+    @Test
+    public void whenValueHiddenImperativelyForValueThenModifyThrowsException() {
+        custJsDO.hideFirstName = true;
+        try {
+            custJsWO.setFirstName("Dick");
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("First Name"));
+        }
+    }
+
+    @Test
+    public void whenValueHiddenImperativelyForNullThenModifyThrowsException() {
+        custJsDO.hideFirstName = true;
+        try {
+            custJsWO.setFirstName("Dick");
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("First Name"));
+        }
+    }
+
+    @Test
+    public void whenValueHiddenImperativelyThenReadThrowsException() {
+        custJsDO.hideFirstName = true;
+        try {
+            custJsWO.getFirstName();
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("First Name"));
+        }
+    }
+
+    @Test
+    public void whenAssociationHiddenImperativelyForValueThenModifyThrowsException() {
+        custJsDO.hideCountryOfBirth = true;
+        try {
+            custJsWO.setCountryOfBirth(countryUsaDO);
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Country Of Birth"));
+        }
+    }
+
+    @Test
+    public void whenAssociationHiddenImperativelyForNullThenModifyThrowsException() {
+        custJsDO.hideCountryOfBirth = true;
+        try {
+            custJsWO.setCountryOfBirth(null);
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Country Of Birth"));
+        }
+    }
+
+    @Test
+    public void whenAssociationHiddenImperativelyThenReadThrowsException() {
+        custJsDO.hideCountryOfBirth = true;
+        try {
+            custJsWO.getCountryOfBirth();
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Country Of Birth"));
+        }
+    }
+
+    @Test
+    public void whenIfCollectionHiddenImperativelyThenAddToThrowsException() {
+        custJsDO.hideVisitedCountries = true;
+        try {
+            custJsWO.addToVisitedCountries(countryGbrDO);
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Visited Countries"));
+        }
+    }
+
+    @Test
+    public void whenCollectionHiddenImperativelyThenRemoveFromThrowsException() {
+        custJsDO.hideVisitedCountries = true;
+        custJsDO.addToVisitedCountries(countryGbrDO);
+        try {
+            custJsWO.removeFromVisitedCountries(countryGbrDO);
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Visited Countries"));
+        }
+    }
+
+    @Test
+    public void whenCollectionHiddenImperativelyThenReadThrowsException() {
+        custJsDO.hideVisitedCountries = true;
+        custJsDO.addToVisitedCountries(countryGbrDO);
+        try {
+            custJsWO.getVisitedCountries();
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Visited Countries"));
+        }
+    }
+
+    @Test
+    public void whenActionHiddenImperativelyThenThrowsException() {
+        custJsDO.hidePlaceOrder = true;
+        try {
+            custJsWO.placeOrder(product355DO, 3);
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForContextFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Place Order"));
+        }
+    }
+
+    @Test
+    public void whenValueHiddenDeclarativelyForValueThenModifyThrowsException() {
+        try {
+            custJsWO.setAlwaysHiddenValue("Dick");
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HiddenFacetForMemberAnnotation.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Always Hidden Value"));
+        }
+    }
+
+    @Test
+    public void whenValueHiddenDeclarativelyForNullThenModifyThrowsException() {
+        try {
+            custJsWO.setAlwaysHiddenValue(null);
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HiddenFacetForMemberAnnotation.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Always Hidden Value"));
+        }
+    }
+
+    @Test
+    public void whenValueHiddenDeclarativelyThenReadThrowsException() {
+        try {
+            custJsWO.getAlwaysHiddenValue();
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HiddenFacetForMemberAnnotation.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Always Hidden Value"));
+        }
+    }
+
+    @Test
+    public void whenAssociationHiddenDeclarativelyThenModifyThrowsException() {
+        final Country[] values = new Country[] { countryUsaDO, null };
+        for (final Country value : values) {
+            try {
+                custJsWO.setAlwaysHiddenAssociation(value);
+                fail("Should have thrown exception");
+            } catch (final HiddenException ex) {
+                assertThat(ex.getAdvisorClass(), classEqualTo(HiddenFacetForMemberAnnotation.class));
+                assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Always Hidden Association"));
+            }
+        }
+    }
+
+    @Test
+    public void whenAssociationHiddenDeclarativelyThenReadThrowsException() {
+        try {
+            custJsWO.getAlwaysHiddenAssociation();
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HiddenFacetForMemberAnnotation.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Always Hidden Association"));
+        }
+    }
+
+    @Test
+    public void whenCollectionHiddenDeclarativelyThenAddToThrowsException() {
+        try {
+            custJsWO.addToAlwaysHiddenCollection(countryUsaDO);
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HiddenFacetForMemberAnnotation.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Always Hidden Collection"));
+        }
+    }
+
+    @Test
+    public void whenCollectionHiddenDeclarativelyThenRemoveFromThrowsException() {
+        custJsDO.removeFromAlwaysHiddenCollection(countryUsaDO);
+        try {
+            custJsWO.removeFromAlwaysHiddenCollection(countryUsaDO);
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HiddenFacetForMemberAnnotation.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Always Hidden Collection"));
+        }
+    }
+
+    @Test
+    public void whenCollectionHiddenDeclarativelyThenReadThrowsException() {
+        try {
+            custJsWO.getAlwaysHiddenCollection();
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HiddenFacetForMemberAnnotation.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Always Hidden Collection"));
+        }
+    }
+
+    @Test
+    public void whenActionHiddenDeclarativelyThenThrowsException() {
+        try {
+            custJsWO.alwaysHiddenAction();
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HiddenFacetForMemberAnnotation.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Always Hidden Action"));
+        }
+    }
+
+    @Test
+    public void whenValueHiddenNotAuthorizedThenModifyThrowsException() {
+        final String[] values = new String[] { "Dick", null };
+        for (final String value : values) {
+            try {
+                custJsWO.setSessionHiddenValue(value);
+                fail("Should have thrown exception");
+            } catch (final HiddenException ex) {
+                assertThat(ex.getAdvisorClass(), classEqualTo(HideForSessionFacetViaMethod.class));
+                assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Session Hidden Value"));
+            }
+        }
+    }
+
+    @Test
+    public void whenValueHiddenNotAuthorizedThenReadThrowsException() {
+        try {
+            custJsWO.getSessionHiddenValue();
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForSessionFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Session Hidden Value"));
+        }
+    }
+
+    @Test
+    public void whenAssociationHiddenNotAuthorizedThenModifyThrowsException() {
+        final Country[] values = new Country[] { countryUsaDO, null };
+        for (final Country value : values) {
+            try {
+                custJsWO.setSessionHiddenAssociation(value);
+                fail("Should have thrown exception");
+            } catch (final HiddenException ex) {
+                assertThat(ex.getAdvisorClass(), classEqualTo(HideForSessionFacetViaMethod.class));
+                assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Session Hidden Association"));
+            }
+        }
+    }
+
+    @Test
+    public void whenAssociationHiddenNotAuthorizedThenReadThrowsException() {
+        try {
+            custJsWO.getSessionHiddenAssociation();
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForSessionFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Session Hidden Association"));
+        }
+    }
+
+    @Test
+    public void whenCollectionHiddenNotAuthorizedThenAddToThrowsException() {
+        try {
+            custJsWO.addToSessionHiddenCollection(countryUsaDO);
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForSessionFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Session Hidden Collection"));
+        }
+    }
+
+    @Test
+    public void whenCollectionHiddenNotAuthorizedThenRemoveFromThrowsException() {
+        custJsDO.addToSessionHiddenCollection(countryUsaDO);
+        try {
+            custJsWO.removeFromSessionHiddenCollection(countryUsaDO);
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForSessionFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Session Hidden Collection"));
+        }
+    }
+
+    @Test
+    public void whenCollectionHiddenNotAuthorizedThenReadThrowsException() {
+        try {
+            custJsWO.getSessionHiddenCollection();
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForSessionFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Session Hidden Collection"));
+        }
+    }
+
+    @Test
+    public void whenActionHiddenNotAuthorizedThenThrowsException() {
+        try {
+            custJsWO.sessionHiddenAction();
+            fail("Should have thrown exception");
+        } catch (final HiddenException ex) {
+            assertThat(ex.getAdvisorClass(), classEqualTo(HideForSessionFacetViaMethod.class));
+            assertThat(ex.getIdentifier().getMemberNaturalName(), equalTo("Session Hidden Action"));
+        }
+    }
+
+}