isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject [50/52] [abbrv] isis git commit: ISIS-970: unit testing @Property annotation
Date Thu, 22 Jan 2015 16:54:05 GMT
ISIS-970: unit testing @Property annotation


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

Branch: refs/heads/ISIS-970
Commit: 057f1f2d6514a3d1f6a4bc6481e6ec0755cedca2
Parents: 4716513
Author: Dan Haywood <dan@haywood-associates.co.uk>
Authored: Thu Jan 22 15:16:42 2015 +0000
Committer: Dan Haywood <dan@haywood-associates.co.uk>
Committed: Thu Jan 22 16:32:47 2015 +0000

----------------------------------------------------------------------
 .../action/ActionAnnotationFacetFactory.java    |   4 +-
 .../ActionDomainEventFacetAbstract.java         |  10 +-
 .../ActionDomainEventFacetDefault.java          |   1 +
 ...onInvocationFacetForDomainEventAbstract.java |   7 +
 .../PropertyAnnotationFacetFactory.java         |  19 +-
 ...ntFacetForPropertyInteractionAnnotation.java |   4 +
 ...SpecificationFacetForPropertyAnnotation.java |   2 +
 .../regex/RegExFacetForPropertyAnnotation.java  |   6 +-
 .../MustSatisfySpecificationFacetAbstract.java  |   8 +-
 .../ActionAnnotationFacetFactoryTest.java       | 198 ++++-
 ...ectionAnnotationFacetFactoryTest_typeOf.java | 258 +++++++
 .../TypeOfAnnotationFacetFactoryTest.java       | 297 --------
 .../PropertyAnnotationFacetFactoryTest.java     | 759 +++++++++++++++++++
 ...ectAssociationAbstractTest_alwaysHidden.java | 130 ++--
 14 files changed, 1325 insertions(+), 378 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/057f1f2d/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/ActionAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/ActionAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/ActionAnnotationFacetFactory.java
index 4cd5439..eecdc03 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/ActionAnnotationFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/ActionAnnotationFacetFactory.java
@@ -106,7 +106,7 @@ public class ActionAnnotationFacetFactory extends FacetFactoryAbstract implement
         processHidden(processMethodContext);
         processRestrictTo(processMethodContext);
         processSemantics(processMethodContext);
-        processInvokeOn(processMethodContext);
+        processBulk(processMethodContext);
 
         // must come after processing semantics
         processCommand(processMethodContext);
@@ -252,7 +252,7 @@ public class ActionAnnotationFacetFactory extends FacetFactoryAbstract implement
         FacetUtil.addFacet(facet);
     }
 
-    void processInvokeOn(final ProcessMethodContext processMethodContext) {
+    void processBulk(final ProcessMethodContext processMethodContext) {
         final Method method = processMethodContext.getMethod();
         final Action action = Annotations.getAnnotation(method, Action.class);
         final FacetHolder holder = processMethodContext.getFacetHolder();

http://git-wip-us.apache.org/repos/asf/isis/blob/057f1f2d/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetAbstract.java
index 46ea774..7d5a915 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetAbstract.java
@@ -125,8 +125,16 @@ public abstract class ActionDomainEventFacetAbstract
         return null;
     }
 
-    private Class<?> eventType() {
+    protected Class eventType() {
         return value();
     }
 
+    /**
+     * For testing only.
+     */
+    public Class<? extends ActionDomainEvent<?>> getEventType() {
+        //noinspection unchecked
+        return eventType();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/057f1f2d/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetDefault.java
index f92ce63..f36ad6e 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetDefault.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionDomainEventFacetDefault.java
@@ -32,4 +32,5 @@ public class ActionDomainEventFacetDefault extends ActionDomainEventFacetAbstrac
         super(eventType, holder, servicesInjector, specificationLoader);
     }
 
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/057f1f2d/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionInvocationFacetForDomainEventAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionInvocationFacetForDomainEventAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionInvocationFacetForDomainEventAbstract.java
index 89abf44..ec534c8 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionInvocationFacetForDomainEventAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/actions/action/invocation/ActionInvocationFacetForDomainEventAbstract.java
@@ -220,6 +220,13 @@ public abstract class ActionInvocationFacetForDomainEventAbstract
         return event;
     }
 
+    /**
+     * For testing only.
+     */
+    public Class<? extends ActionDomainEvent<?>> getEventType() {
+        return eventType;
+    }
+
     protected InvocationResult internalInvoke(
             final Command command,
             final ObjectAction owningAction,

http://git-wip-us.apache.org/repos/asf/isis/blob/057f1f2d/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java
index d480257..e097db0 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/PropertyAnnotationFacetFactory.java
@@ -23,6 +23,7 @@ import java.lang.reflect.Method;
 import org.apache.isis.applib.annotation.PostsPropertyChangedEvent;
 import org.apache.isis.applib.annotation.Property;
 import org.apache.isis.applib.annotation.PropertyInteraction;
+import org.apache.isis.applib.services.eventbus.PropertyChangedEvent;
 import org.apache.isis.applib.services.eventbus.PropertyDomainEvent;
 import org.apache.isis.core.metamodel.facetapi.Facet;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
@@ -91,7 +92,7 @@ public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract impleme
     void processModify(final ProcessMethodContext processMethodContext) {
 
         final Method method = processMethodContext.getMethod();
-        FacetedMethod holder = processMethodContext.getFacetHolder();
+        final FacetedMethod holder = processMethodContext.getFacetHolder();
 
         final PropertyOrCollectionAccessorFacet getterFacet = holder.getFacet(PropertyOrCollectionAccessorFacet.class);
         if(getterFacet == null) {
@@ -101,6 +102,7 @@ public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract impleme
         //
         // Set up PropertyDomainEventFacet, which will act as the hiding/disabling/validating advisor
         //
+        final PostsPropertyChangedEvent postsPropertyChangedEvent = Annotations.getAnnotation(method, PostsPropertyChangedEvent.class);
         final Property property = Annotations.getAnnotation(method, Property.class);
         final PropertyInteraction propertyInteraction = Annotations.getAnnotation(method, PropertyInteraction.class);
         final Class<? extends PropertyDomainEvent<?, ?>> propertyDomainEventType;
@@ -120,7 +122,7 @@ public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract impleme
                     propertyDomainEventType, getterFacet, servicesInjector, getSpecificationLoader(), holder);
 
         } else
-        // else use default event type
+        // else use default event type (also for @PostsPropertyChangedEvent)
         {
             propertyDomainEventType = PropertyDomainEvent.Default.class;
             propertyDomainEventFacet = new PropertyDomainEventFacetDefault(
@@ -134,17 +136,15 @@ public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract impleme
         // emit the appropriate domain event and then delegate onto the underlying
         //
 
-
-        final PostsPropertyChangedEvent postsPropertyChangedEvent = Annotations.getAnnotation(method, PostsPropertyChangedEvent.class);
-
         final PropertySetterFacet setterFacet = holder.getFacet(PropertySetterFacet.class);
         if(setterFacet != null) {
             // the current setter facet will end up as the underlying facet
             final PropertySetterFacetForDomainEventAbstract replacementFacet;
             // deprecated
             if(postsPropertyChangedEvent != null) {
+                final Class<? extends PropertyChangedEvent<?, ?>> propertySetEventType = postsPropertyChangedEvent.value();
                 replacementFacet = new PropertySetterFacetForPostsPropertyChangedEventAnnotation(
-                        postsPropertyChangedEvent.value(), getterFacet, setterFacet, propertyDomainEventFacet, holder, servicesInjector);
+                        propertySetEventType, getterFacet, setterFacet, propertyDomainEventFacet, holder, servicesInjector);
             } else
             // deprecated (but more recently)
             if(propertyInteraction != null) {
@@ -159,7 +159,7 @@ public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract impleme
             // default
             {
                 replacementFacet = new PropertySetterFacetForDomainEventFromDefault(
-                        PropertyDomainEvent.Default.class, getterFacet, setterFacet, propertyDomainEventFacet, holder, servicesInjector);
+                        propertyDomainEventType, getterFacet, setterFacet, propertyDomainEventFacet, holder, servicesInjector);
             }
             FacetUtil.addFacet(replacementFacet);
         }
@@ -171,8 +171,9 @@ public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract impleme
 
             // deprecated
             if(postsPropertyChangedEvent != null) {
+                final Class<? extends PropertyChangedEvent<?, ?>> propertyClearEventType = postsPropertyChangedEvent.value();
                 replacementFacet = new PropertyClearFacetForPostsPropertyChangedEventAnnotation(
-                        postsPropertyChangedEvent.value(), getterFacet, clearFacet, propertyDomainEventFacet, holder, servicesInjector);
+                        propertyClearEventType, getterFacet, clearFacet, propertyDomainEventFacet, holder, servicesInjector);
             } else
             // deprecated (but more recently)
             if(propertyInteraction != null) {
@@ -186,7 +187,7 @@ public class PropertyAnnotationFacetFactory extends FacetFactoryAbstract impleme
             } else
             {
                 replacementFacet = new PropertyClearFacetForDomainEventFromDefault(
-                        PropertyDomainEvent.Default.class, getterFacet, clearFacet, propertyDomainEventFacet, holder, servicesInjector);
+                        propertyDomainEventType, getterFacet, clearFacet, propertyDomainEventFacet, holder, servicesInjector);
             }
             FacetUtil.addFacet(replacementFacet);
         }

http://git-wip-us.apache.org/repos/asf/isis/blob/057f1f2d/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyInteractionAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyInteractionAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyInteractionAnnotation.java
index 9d6ec19..c0cbbb2 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyInteractionAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/modify/PropertyDomainEventFacetForPropertyInteractionAnnotation.java
@@ -25,6 +25,10 @@ import org.apache.isis.core.metamodel.facets.propcoll.accessor.PropertyOrCollect
 import org.apache.isis.core.metamodel.runtimecontext.ServicesInjector;
 import org.apache.isis.core.metamodel.spec.SpecificationLoader;
 
+/**
+ * @deprecated
+ */
+@Deprecated
 public class PropertyDomainEventFacetForPropertyInteractionAnnotation extends PropertyDomainEventFacetAbstract {
 
     public PropertyDomainEventFacetForPropertyInteractionAnnotation(

http://git-wip-us.apache.org/repos/asf/isis/blob/057f1f2d/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/mustsatisfy/MustSatisfySpecificationFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/mustsatisfy/MustSatisfySpecificationFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/mustsatisfy/MustSatisfySpecificationFacetForPropertyAnnotation.java
index db5f5eb..f2939d0 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/mustsatisfy/MustSatisfySpecificationFacetForPropertyAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/mustsatisfy/MustSatisfySpecificationFacetForPropertyAnnotation.java
@@ -53,4 +53,6 @@ public class MustSatisfySpecificationFacetForPropertyAnnotation extends MustSati
         super(specifications, holder);
     }
 
+
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/057f1f2d/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/regex/RegExFacetForPropertyAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/regex/RegExFacetForPropertyAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/regex/RegExFacetForPropertyAnnotation.java
index 96c445d..047ed76 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/regex/RegExFacetForPropertyAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/properties/property/regex/RegExFacetForPropertyAnnotation.java
@@ -20,6 +20,7 @@
 package org.apache.isis.core.metamodel.facets.properties.property.regex;
 
 import java.util.regex.Pattern;
+import com.google.common.base.Strings;
 import org.apache.isis.applib.annotation.Property;
 import org.apache.isis.core.metamodel.facetapi.FacetHolder;
 import org.apache.isis.core.metamodel.facets.object.regex.RegExFacet;
@@ -38,13 +39,16 @@ public class RegExFacetForPropertyAnnotation extends RegExFacetAbstract {
         }
 
         final String pattern = property.regexPattern();
+        if(Strings.isNullOrEmpty(pattern)) {
+            return null;
+        }
         final int patternFlags = property.regexPatternFlags();
 
         return new RegExFacetForPropertyAnnotation(pattern, patternFlags, holder);
     }
 
     private RegExFacetForPropertyAnnotation(final String pattern, final int patternFlags, final FacetHolder holder) {
-        super(pattern, "", false, holder);
+        super(pattern, "", (patternFlags & Pattern.CASE_INSENSITIVE) == Pattern.CASE_INSENSITIVE, holder);
         this.pattern = Pattern.compile(pattern, patternFlags);
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/057f1f2d/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/propparam/mustsatisfyspec/MustSatisfySpecificationFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/propparam/mustsatisfyspec/MustSatisfySpecificationFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/propparam/mustsatisfyspec/MustSatisfySpecificationFacetAbstract.java
index 6db0d96..f80303c 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/propparam/mustsatisfyspec/MustSatisfySpecificationFacetAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/propparam/mustsatisfyspec/MustSatisfySpecificationFacetAbstract.java
@@ -38,6 +38,13 @@ public abstract class MustSatisfySpecificationFacetAbstract extends FacetAbstrac
 
     private final List<Specification> specifications;
 
+    /**
+     * For testing.
+     */
+    public List<Specification> getSpecifications() {
+        return specifications;
+    }
+
     public MustSatisfySpecificationFacetAbstract(final List<Specification> specifications, final FacetHolder holder) {
         super(type(), holder, Derivation.NOT_DERIVED);
         this.specifications = specifications;
@@ -77,5 +84,4 @@ public abstract class MustSatisfySpecificationFacetAbstract extends FacetAbstrac
         }
     }
 
-
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/057f1f2d/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/actions/action/ActionAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/actions/action/ActionAnnotationFacetFactoryTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/actions/action/ActionAnnotationFacetFactoryTest.java
index 499e9f2..e495647 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/actions/action/ActionAnnotationFacetFactoryTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/actions/action/ActionAnnotationFacetFactoryTest.java
@@ -20,6 +20,7 @@
 package org.apache.isis.core.metamodel.facets.actions.action;
 
 import java.lang.reflect.Method;
+import java.util.Collection;
 import java.util.List;
 import java.util.UUID;
 import org.jmock.Expectations;
@@ -52,6 +53,9 @@ import org.apache.isis.applib.services.publish.EventPayload;
 import org.apache.isis.core.metamodel.facetapi.Facet;
 import org.apache.isis.core.metamodel.facets.AbstractFacetFactoryJUnit4TestCase;
 import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessMethodContext;
+import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
+import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacetInferredFromArray;
+import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacetInferredFromGenerics;
 import org.apache.isis.core.metamodel.facets.actions.action.command.CommandFacetForActionAnnotation;
 import org.apache.isis.core.metamodel.facets.actions.action.command.CommandFacetForActionAnnotationAsConfigured;
 import org.apache.isis.core.metamodel.facets.actions.action.command.CommandFacetForCommandAnnotation;
@@ -69,6 +73,8 @@ import org.apache.isis.core.metamodel.facets.actions.action.invocation.ActionInv
 import org.apache.isis.core.metamodel.facets.actions.action.publishing.PublishedActionFacetForActionAnnotation;
 import org.apache.isis.core.metamodel.facets.actions.action.publishing.PublishedActionFacetForPublishedActionAnnotation;
 import org.apache.isis.core.metamodel.facets.actions.action.publishing.PublishedActionFacetFromConfiguration;
+import org.apache.isis.core.metamodel.facets.actions.action.typeof.TypeOfFacetForActionAnnotation;
+import org.apache.isis.core.metamodel.facets.actions.action.typeof.TypeOfFacetOnActionForTypeOfAnnotation;
 import org.apache.isis.core.metamodel.facets.actions.bulk.BulkFacet;
 import org.apache.isis.core.metamodel.facets.actions.command.CommandFacet;
 import org.apache.isis.core.metamodel.facets.actions.prototype.PrototypeFacet;
@@ -79,6 +85,7 @@ import org.apache.isis.core.metamodel.facets.actions.semantics.ActionSemanticsFa
 import org.apache.isis.core.metamodel.facets.all.hide.HiddenFacet;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 
+import static org.apache.isis.core.commons.matchers.IsisMatchers.classEqualTo;
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.nullValue;
@@ -97,9 +104,9 @@ public class ActionAnnotationFacetFactoryTest extends AbstractFacetFactoryJUnit4
     @Mock
     ObjectSpecification mockReturnTypeSpec;
 
-    void expectRemoveMethod(final Method actionMethod1) {
+    void expectRemoveMethod(final Method actionMethod) {
         context.checking(new Expectations() {{
-            oneOf(mockMethodRemover).removeMethod(actionMethod1);
+            oneOf(mockMethodRemover).removeMethod(actionMethod);
         }});
     }
 
@@ -179,11 +186,15 @@ public class ActionAnnotationFacetFactoryTest extends AbstractFacetFactoryJUnit4
             // then
             final Facet domainEventFacet = facetedMethod.getFacet(ActionDomainEventFacet.class);
             Assert.assertNotNull(domainEventFacet);
-            Assert.assertTrue(domainEventFacet instanceof ActionDomainEventFacetDefault); // this is discarded at runtime, see ActionInvocationFacetForPostsActionInvokedEventAnnotation#verify(...)
+            Assert.assertTrue(domainEventFacet instanceof ActionDomainEventFacetDefault);
+            final ActionDomainEventFacetDefault domainEventFacetImpl = (ActionDomainEventFacetDefault) domainEventFacet;
+            assertThat(domainEventFacetImpl.getEventType(), classEqualTo(ActionDomainEvent.Default.class)); // this is discarded at runtime, see ActionInvocationFacetForPostsActionInvokedEventAnnotation#verify(...)
 
             final Facet invocationFacet = facetedMethod.getFacet(ActionInvocationFacet.class);
             Assert.assertNotNull(invocationFacet);
             Assert.assertTrue(invocationFacet instanceof ActionInvocationFacetForPostsActionInvokedEventAnnotation);
+            final ActionInvocationFacetForPostsActionInvokedEventAnnotation invocationFacetImpl = (ActionInvocationFacetForPostsActionInvokedEventAnnotation) invocationFacet;
+            assertThat(invocationFacetImpl.getEventType(), classEqualTo(Customer.SomeActionInvoked.class));
         }
 
         @Test
@@ -218,10 +229,14 @@ public class ActionAnnotationFacetFactoryTest extends AbstractFacetFactoryJUnit4
             final Facet domainEventFacet = facetedMethod.getFacet(ActionDomainEventFacet.class);
             Assert.assertNotNull(domainEventFacet);
             Assert.assertTrue(domainEventFacet instanceof ActionDomainEventFacetForActionInteractionAnnotation);
+            final ActionDomainEventFacetForActionInteractionAnnotation domainEventFacetImpl = (ActionDomainEventFacetForActionInteractionAnnotation) domainEventFacet;
+            assertThat(domainEventFacetImpl.getEventType(), classEqualTo(Customer.SomeActionInvoked.class));
 
             final Facet invocationFacet = facetedMethod.getFacet(ActionInvocationFacet.class);
             Assert.assertNotNull(invocationFacet);
             Assert.assertTrue(invocationFacet instanceof ActionInvocationFacetForDomainEventFromActionInteractionAnnotation);
+            final ActionInvocationFacetForDomainEventFromActionInteractionAnnotation invocationFacetImpl = (ActionInvocationFacetForDomainEventFromActionInteractionAnnotation) invocationFacet;
+            assertThat(invocationFacetImpl.getEventType(), classEqualTo(Customer.SomeActionInvoked.class));
         }
 
         @Test
@@ -256,10 +271,14 @@ public class ActionAnnotationFacetFactoryTest extends AbstractFacetFactoryJUnit4
             final Facet domainEventFacet = facetedMethod.getFacet(ActionDomainEventFacet.class);
             Assert.assertNotNull(domainEventFacet);
             Assert.assertTrue(domainEventFacet instanceof ActionDomainEventFacetForActionAnnotation);
+            final ActionDomainEventFacetForActionAnnotation domainEventFacetImpl = (ActionDomainEventFacetForActionAnnotation) domainEventFacet;
+            assertThat(domainEventFacetImpl.getEventType(), classEqualTo(Customer.SomeActionInvoked.class));
 
             final Facet invocationFacet = facetedMethod.getFacet(ActionInvocationFacet.class);
             Assert.assertNotNull(invocationFacet);
             Assert.assertTrue(invocationFacet instanceof ActionInvocationFacetForDomainEventFromActionAnnotation);
+            final ActionInvocationFacetForDomainEventFromActionAnnotation invocationFacetImpl = (ActionInvocationFacetForDomainEventFromActionAnnotation) invocationFacet;
+            assertThat(invocationFacetImpl.getEventType(), classEqualTo(Customer.SomeActionInvoked.class));
         }
 
         @Test
@@ -286,10 +305,14 @@ public class ActionAnnotationFacetFactoryTest extends AbstractFacetFactoryJUnit4
             final Facet domainEventFacet = facetedMethod.getFacet(ActionDomainEventFacet.class);
             Assert.assertNotNull(domainEventFacet);
             Assert.assertTrue(domainEventFacet instanceof ActionDomainEventFacetDefault);
+            final ActionDomainEventFacetDefault domainEventFacetImpl = (ActionDomainEventFacetDefault) domainEventFacet;
+            assertThat(domainEventFacetImpl.getEventType(), classEqualTo(ActionDomainEvent.Default.class));
 
             final Facet invocationFacet = facetedMethod.getFacet(ActionInvocationFacet.class);
             Assert.assertNotNull(invocationFacet);
             Assert.assertTrue(invocationFacet instanceof ActionInvocationFacetForDomainEventFromDefault);
+            final ActionInvocationFacetForDomainEventFromDefault invocationFacetImpl = (ActionInvocationFacetForDomainEventFromDefault) invocationFacet;
+            assertThat(invocationFacetImpl.getEventType(), classEqualTo(ActionDomainEvent.Default.class));
         }
     }
 
@@ -625,7 +648,7 @@ public class ActionAnnotationFacetFactoryTest extends AbstractFacetFactoryJUnit4
 
             // when
             final ProcessMethodContext processMethodContext = new ProcessMethodContext(cls, null, null, actionMethod, mockMethodRemover, facetedMethod);
-            facetFactory.processInvokeOn(processMethodContext);
+            facetFactory.processBulk(processMethodContext);
 
             // then
             final BulkFacet facet = facetedMethod.getFacet(BulkFacet.class);
@@ -649,7 +672,7 @@ public class ActionAnnotationFacetFactoryTest extends AbstractFacetFactoryJUnit4
 
             // when
             final ProcessMethodContext processMethodContext = new ProcessMethodContext(cls, null, null, actionMethod, mockMethodRemover, facetedMethod);
-            facetFactory.processInvokeOn(processMethodContext);
+            facetFactory.processBulk(processMethodContext);
 
             // then
             final BulkFacet facet = facetedMethod.getFacet(BulkFacet.class);
@@ -672,7 +695,7 @@ public class ActionAnnotationFacetFactoryTest extends AbstractFacetFactoryJUnit4
 
             // when
             final ProcessMethodContext processMethodContext = new ProcessMethodContext(cls, null, null, actionMethod, mockMethodRemover, facetedMethod);
-            facetFactory.processInvokeOn(processMethodContext);
+            facetFactory.processBulk(processMethodContext);
 
             // then
             final BulkFacet facet = facetedMethod.getFacet(BulkFacet.class);
@@ -695,7 +718,7 @@ public class ActionAnnotationFacetFactoryTest extends AbstractFacetFactoryJUnit4
 
             // when
             final ProcessMethodContext processMethodContext = new ProcessMethodContext(cls, null, null, actionMethod, mockMethodRemover, facetedMethod);
-            facetFactory.processInvokeOn(processMethodContext);
+            facetFactory.processBulk(processMethodContext);
 
             // then
             final BulkFacet facet = facetedMethod.getFacet(BulkFacet.class);
@@ -719,7 +742,7 @@ public class ActionAnnotationFacetFactoryTest extends AbstractFacetFactoryJUnit4
 
             // when
             final ProcessMethodContext processMethodContext = new ProcessMethodContext(cls, null, null, actionMethod, mockMethodRemover, facetedMethod);
-            facetFactory.processInvokeOn(processMethodContext);
+            facetFactory.processBulk(processMethodContext);
 
             // then
             final BulkFacet facet = facetedMethod.getFacet(BulkFacet.class);
@@ -1337,6 +1360,165 @@ public class ActionAnnotationFacetFactoryTest extends AbstractFacetFactoryJUnit4
 
     }
 
+    public static class TypeOf extends ActionAnnotationFacetFactoryTest {
+
+        @Test
+        public void whenDeprecatedTypeOfAnnotationOnActionReturningCollection() {
+
+            class Order {
+            }
+            class Customer {
+                @org.apache.isis.applib.annotation.TypeOf(Order.class)
+                public Collection someAction() {
+                    return null;
+                }
+            }
+
+            // given
+            final Class<?> cls = Customer.class;
+            actionMethod = findMethod(cls, "someAction");
+
+            // when
+            final ProcessMethodContext processMethodContext = new ProcessMethodContext(cls, null, null, actionMethod, mockMethodRemover, facetedMethod);
+            facetFactory.processTypeOf(processMethodContext);
+
+            // then
+            final TypeOfFacet facet = facetedMethod.getFacet(TypeOfFacet.class);
+            Assert.assertNotNull(facet);
+            Assert.assertTrue(facet instanceof TypeOfFacetOnActionForTypeOfAnnotation);
+            assertThat(facet.value(), classEqualTo(Order.class));
+        }
+
+        @Test
+        public void whenDeprecatedTypeOfAnnotationOnActionNotReturningCollection() {
+
+            class Order {
+            }
+            class Customer {
+                @org.apache.isis.applib.annotation.TypeOf(Order.class)
+                public Customer someAction() {
+                    return null;
+                }
+            }
+
+            // given
+            final Class<?> cls = Customer.class;
+            actionMethod = findMethod(cls, "someAction");
+
+            // when
+            final ProcessMethodContext processMethodContext = new ProcessMethodContext(cls, null, null, actionMethod, mockMethodRemover, facetedMethod);
+            facetFactory.processTypeOf(processMethodContext);
+
+            // then
+            final TypeOfFacet facet = facetedMethod.getFacet(TypeOfFacet.class);
+            Assert.assertNull(facet);
+        }
+
+        @Test
+        public void whenActionAnnotationOnActionReturningCollection() {
+
+            class Order {
+            }
+            class Customer {
+                @Action(typeOf = Order.class)
+                public Collection someAction() {
+                    return null;
+                }
+            }
+
+            // given
+            final Class<?> cls = Customer.class;
+            actionMethod = findMethod(cls, "someAction");
+
+            // when
+            final ProcessMethodContext processMethodContext = new ProcessMethodContext(cls, null, null, actionMethod, mockMethodRemover, facetedMethod);
+            facetFactory.processTypeOf(processMethodContext);
+
+            // then
+            final TypeOfFacet facet = facetedMethod.getFacet(TypeOfFacet.class);
+            Assert.assertNotNull(facet);
+            Assert.assertTrue(facet instanceof TypeOfFacetForActionAnnotation);
+            assertThat(facet.value(), classEqualTo(Order.class));
+        }
+
+        @Test
+        public void whenActionAnnotationOnActionNotReturningCollection() {
+
+            class Order {
+            }
+            class Customer {
+                @Action(typeOf = Order.class)
+                public Customer someAction() {
+                    return null;
+                }
+            }
+
+            // given
+            final Class<?> cls = Customer.class;
+            actionMethod = findMethod(cls, "someAction");
+
+            // when
+            final ProcessMethodContext processMethodContext = new ProcessMethodContext(cls, null, null, actionMethod, mockMethodRemover, facetedMethod);
+            facetFactory.processTypeOf(processMethodContext);
+
+            // then
+            final TypeOfFacet facet = facetedMethod.getFacet(TypeOfFacet.class);
+            Assert.assertNull(facet);
+        }
+
+        @Test
+        public void whenInferFromType() {
+
+            class Order {
+            }
+            class Customer {
+                public Order[] someAction() {
+                    return null;
+                }
+            }
+
+            // given
+            final Class<?> cls = Customer.class;
+            actionMethod = findMethod(cls, "someAction");
+
+            // when
+            final ProcessMethodContext processMethodContext = new ProcessMethodContext(cls, null, null, actionMethod, mockMethodRemover, facetedMethod);
+            facetFactory.processTypeOf(processMethodContext);
+
+            // then
+            final TypeOfFacet facet = facetedMethod.getFacet(TypeOfFacet.class);
+            Assert.assertNotNull(facet);
+            Assert.assertTrue(facet instanceof TypeOfFacetInferredFromArray);
+            assertThat(facet.value(), classEqualTo(Order.class));
+        }
+
+        @Test
+        public void whenInferFromGenerics() {
+
+            class Order {
+            }
+            class Customer {
+                public Collection<Order> someAction() {
+                    return null;
+                }
+            }
+
+            // given
+            final Class<?> cls = Customer.class;
+            actionMethod = findMethod(cls, "someAction");
+
+            // when
+            final ProcessMethodContext processMethodContext = new ProcessMethodContext(cls, null, null, actionMethod, mockMethodRemover, facetedMethod);
+            facetFactory.processTypeOf(processMethodContext);
+
+            // then
+            final TypeOfFacet facet = facetedMethod.getFacet(TypeOfFacet.class);
+            Assert.assertNotNull(facet);
+            Assert.assertTrue(facet instanceof TypeOfFacetInferredFromGenerics);
+            assertThat(facet.value(), classEqualTo(Order.class));
+        }
+
+    }
 
     void allowingCommandConfigurationToReturn(final String value) {
         context.checking(new Expectations() {

http://git-wip-us.apache.org/repos/asf/isis/blob/057f1f2d/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/collections/collection/CollectionAnnotationFacetFactoryTest_typeOf.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/collections/collection/CollectionAnnotationFacetFactoryTest_typeOf.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/collections/collection/CollectionAnnotationFacetFactoryTest_typeOf.java
new file mode 100644
index 0000000..565ecfc
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/collections/collection/CollectionAnnotationFacetFactoryTest_typeOf.java
@@ -0,0 +1,258 @@
+/*
+ *  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.metamodel.facets.collections.collection;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import org.apache.isis.applib.annotation.TypeOf;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facets.AbstractFacetFactoryTest;
+import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessMethodContext;
+import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
+import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacetInferredFromArray;
+import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacetInferredFromGenerics;
+import org.apache.isis.core.metamodel.facets.collections.collection.typeof.TypeOfFacetOnCollectionFromTypeOfAnnotation;
+
+public class CollectionAnnotationFacetFactoryTest_typeOf extends AbstractFacetFactoryTest {
+
+    private CollectionAnnotationFacetFactory facetFactory;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        facetFactory = new CollectionAnnotationFacetFactory();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        facetFactory = null;
+        super.tearDown();
+    }
+
+    public void testTypeOfFacetInferredForActionWithJavaUtilCollectionReturnType() {
+        class Order {
+        }
+        class Customer {
+            // rawtypes are intention for this test
+            @SuppressWarnings({ "unused", "rawtypes" }) 
+            @TypeOf(Order.class)
+            public Collection someAction() {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetOnCollectionFromTypeOfAnnotation);
+        final TypeOfFacetOnCollectionFromTypeOfAnnotation typeOfFacetOnCollectionAnnotation = (TypeOfFacetOnCollectionFromTypeOfAnnotation) facet;
+        assertEquals(Order.class, typeOfFacetOnCollectionAnnotation.value());
+
+        assertNoMethodsRemoved();
+    }
+
+    public void testTypeOfFacetInferredForCollectionWithJavaUtilCollectionReturnType() {
+        class Order {
+        }
+        class Customer {
+            // rawtypes are intention for this test
+            @SuppressWarnings({ "unused", "rawtypes" })
+            @TypeOf(Order.class)
+            public Collection getOrders() {
+                return null;
+            }
+        }
+        final Method accessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, accessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetOnCollectionFromTypeOfAnnotation);
+        final TypeOfFacetOnCollectionFromTypeOfAnnotation typeOfFacetOnCollectionAnnotation = (TypeOfFacetOnCollectionFromTypeOfAnnotation) facet;
+        assertEquals(Order.class, typeOfFacetOnCollectionAnnotation.value());
+
+        assertNoMethodsRemoved();
+    }
+
+    public void testTypeOfFacetInferredForActionWithGenericCollectionReturnType() {
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Collection<Order> someAction() {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetInferredFromGenerics);
+        final TypeOfFacetInferredFromGenerics typeOfFacetInferredFromGenerics = (TypeOfFacetInferredFromGenerics) facet;
+        assertEquals(Order.class, typeOfFacetInferredFromGenerics.value());
+
+    }
+
+    public void testTypeOfFacetInferredForCollectionWithGenericCollectionReturnType() {
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Collection<Order> getOrders() {
+                return null;
+            }
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetInferredFromGenerics);
+        final TypeOfFacetInferredFromGenerics typeOfFacetInferredFromGenerics = (TypeOfFacetInferredFromGenerics) facet;
+        assertEquals(Order.class, typeOfFacetInferredFromGenerics.value());
+
+    }
+
+    public void testTypeOfFacetInferredForActionWithJavaUtilListReturnType() {
+        class Order {
+        }
+        class Customer {
+            // rawTypes is intentional here
+            @SuppressWarnings({ "unused", "rawtypes" })
+            @TypeOf(Order.class)
+            public List someAction() {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetOnCollectionFromTypeOfAnnotation);
+        final TypeOfFacetOnCollectionFromTypeOfAnnotation typeOfFacetOnCollectionAnnotation = (TypeOfFacetOnCollectionFromTypeOfAnnotation) facet;
+        assertEquals(Order.class, typeOfFacetOnCollectionAnnotation.value());
+
+        assertNoMethodsRemoved();
+    }
+
+    public void testTypeOfFacetInferredForCollectionWithJavaUtilListReturnType() {
+        class Order {
+        }
+        class Customer {
+            // rawTypes is intentional here
+            @SuppressWarnings({ "unused", "rawtypes" })
+            @TypeOf(Order.class)
+            public List getOrders() {
+                return null;
+            }
+        }
+        final Method accessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, accessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetOnCollectionFromTypeOfAnnotation);
+        final TypeOfFacetOnCollectionFromTypeOfAnnotation typeOfFacetOnCollectionAnnotation = (TypeOfFacetOnCollectionFromTypeOfAnnotation) facet;
+        assertEquals(Order.class, typeOfFacetOnCollectionAnnotation.value());
+
+        assertNoMethodsRemoved();
+    }
+
+    public void testTypeOfFacetInferredForActionWithJavaUtilSetReturnType() {
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            @TypeOf(Order.class)
+            public Set someAction() {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, actionMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetOnCollectionFromTypeOfAnnotation);
+        final TypeOfFacetOnCollectionFromTypeOfAnnotation typeOfFacetOnCollectionAnnotation = (TypeOfFacetOnCollectionFromTypeOfAnnotation) facet;
+        assertEquals(Order.class, typeOfFacetOnCollectionAnnotation.value());
+
+        assertNoMethodsRemoved();
+    }
+
+    public void testTypeOfFacetInferredForCollectionWithJavaUtilSetReturnType() {
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            @TypeOf(Order.class)
+            public Set getOrders() {
+                return null;
+            }
+        }
+        final Method accessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, accessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetOnCollectionFromTypeOfAnnotation);
+        final TypeOfFacetOnCollectionFromTypeOfAnnotation typeOfFacetOnCollectionAnnotation = (TypeOfFacetOnCollectionFromTypeOfAnnotation) facet;
+        assertEquals(Order.class, typeOfFacetOnCollectionAnnotation.value());
+
+        assertNoMethodsRemoved();
+    }
+
+
+    public void testTypeOfFacetIsInferredForCollectionFromOrderArray() {
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            public Order[] getOrders() {
+                return null;
+            }
+        }
+        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, collectionAccessorMethod, methodRemover, facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetInferredFromArray);
+        final TypeOfFacetInferredFromArray typeOfFacetInferredFromArray = (TypeOfFacetInferredFromArray) facet;
+        assertEquals(Order.class, typeOfFacetInferredFromArray.value());
+
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/057f1f2d/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/collections/collection/TypeOfAnnotationFacetFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/collections/collection/TypeOfAnnotationFacetFactoryTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/collections/collection/TypeOfAnnotationFacetFactoryTest.java
deleted file mode 100644
index 63338ea..0000000
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/collections/collection/TypeOfAnnotationFacetFactoryTest.java
+++ /dev/null
@@ -1,297 +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.core.metamodel.facets.collections.collection;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-import org.apache.isis.applib.annotation.TypeOf;
-import org.apache.isis.core.metamodel.facetapi.Facet;
-import org.apache.isis.core.metamodel.facets.AbstractFacetFactoryTest;
-import org.apache.isis.core.metamodel.facets.FacetFactory.ProcessMethodContext;
-import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacet;
-import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacetInferredFromArray;
-import org.apache.isis.core.metamodel.facets.actcoll.typeof.TypeOfFacetInferredFromGenerics;
-import org.apache.isis.core.metamodel.facets.collections.collection.typeof.TypeOfFacetOnCollectionFromTypeOfAnnotation;
-
-public class TypeOfAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
-
-    private CollectionAnnotationFacetFactory facetFactory;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        facetFactory = new CollectionAnnotationFacetFactory();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        facetFactory = null;
-        super.tearDown();
-    }
-
-    public void testTypeOfFacetInferredForActionWithJavaUtilCollectionReturnType() {
-        class Order {
-        }
-        class Customer {
-            // rawtypes are intention for this test
-            @SuppressWarnings({ "unused", "rawtypes" }) 
-            @TypeOf(Order.class)
-            public Collection someAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetOnCollectionFromTypeOfAnnotation);
-        final TypeOfFacetOnCollectionFromTypeOfAnnotation typeOfFacetOnCollectionAnnotation = (TypeOfFacetOnCollectionFromTypeOfAnnotation) facet;
-        assertEquals(Order.class, typeOfFacetOnCollectionAnnotation.value());
-
-        assertNoMethodsRemoved();
-    }
-
-    public void testTypeOfFacetInferredForCollectionWithJavaUtilCollectionReturnType() {
-        class Order {
-        }
-        class Customer {
-            // rawtypes are intention for this test
-            @SuppressWarnings({ "unused", "rawtypes" })
-            @TypeOf(Order.class)
-            public Collection getOrders() {
-                return null;
-            }
-        }
-        final Method accessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, accessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetOnCollectionFromTypeOfAnnotation);
-        final TypeOfFacetOnCollectionFromTypeOfAnnotation typeOfFacetOnCollectionAnnotation = (TypeOfFacetOnCollectionFromTypeOfAnnotation) facet;
-        assertEquals(Order.class, typeOfFacetOnCollectionAnnotation.value());
-
-        assertNoMethodsRemoved();
-    }
-
-    public void testTypeOfFacetInferredForActionWithGenericCollectionReturnType() {
-        class Order {
-        }
-        class Customer {
-            @SuppressWarnings("unused")
-            public Collection<Order> someAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetInferredFromGenerics);
-        final TypeOfFacetInferredFromGenerics typeOfFacetInferredFromGenerics = (TypeOfFacetInferredFromGenerics) facet;
-        assertEquals(Order.class, typeOfFacetInferredFromGenerics.value());
-
-    }
-
-    public void testTypeOfFacetInferredForCollectionWithGenericCollectionReturnType() {
-        class Order {
-        }
-        class Customer {
-            @SuppressWarnings("unused")
-            public Collection<Order> getOrders() {
-                return null;
-            }
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetInferredFromGenerics);
-        final TypeOfFacetInferredFromGenerics typeOfFacetInferredFromGenerics = (TypeOfFacetInferredFromGenerics) facet;
-        assertEquals(Order.class, typeOfFacetInferredFromGenerics.value());
-
-    }
-
-    public void testTypeOfFacetInferredForActionWithJavaUtilListReturnType() {
-        class Order {
-        }
-        class Customer {
-            // rawTypes is intentional here
-            @SuppressWarnings({ "unused", "rawtypes" })
-            @TypeOf(Order.class)
-            public List someAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetOnCollectionFromTypeOfAnnotation);
-        final TypeOfFacetOnCollectionFromTypeOfAnnotation typeOfFacetOnCollectionAnnotation = (TypeOfFacetOnCollectionFromTypeOfAnnotation) facet;
-        assertEquals(Order.class, typeOfFacetOnCollectionAnnotation.value());
-
-        assertNoMethodsRemoved();
-    }
-
-    public void testTypeOfFacetInferredForCollectionWithJavaUtilListReturnType() {
-        class Order {
-        }
-        class Customer {
-            // rawTypes is intentional here
-            @SuppressWarnings({ "unused", "rawtypes" })
-            @TypeOf(Order.class)
-            public List getOrders() {
-                return null;
-            }
-        }
-        final Method accessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, accessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetOnCollectionFromTypeOfAnnotation);
-        final TypeOfFacetOnCollectionFromTypeOfAnnotation typeOfFacetOnCollectionAnnotation = (TypeOfFacetOnCollectionFromTypeOfAnnotation) facet;
-        assertEquals(Order.class, typeOfFacetOnCollectionAnnotation.value());
-
-        assertNoMethodsRemoved();
-    }
-
-    public void testTypeOfFacetInferredForActionWithJavaUtilSetReturnType() {
-        class Order {
-        }
-        class Customer {
-            @SuppressWarnings("unused")
-            @TypeOf(Order.class)
-            public Set someAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetOnCollectionFromTypeOfAnnotation);
-        final TypeOfFacetOnCollectionFromTypeOfAnnotation typeOfFacetOnCollectionAnnotation = (TypeOfFacetOnCollectionFromTypeOfAnnotation) facet;
-        assertEquals(Order.class, typeOfFacetOnCollectionAnnotation.value());
-
-        assertNoMethodsRemoved();
-    }
-
-    public void testTypeOfFacetInferredForCollectionWithJavaUtilSetReturnType() {
-        class Order {
-        }
-        class Customer {
-            @SuppressWarnings("unused")
-            @TypeOf(Order.class)
-            public Set getOrders() {
-                return null;
-            }
-        }
-        final Method accessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, accessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetOnCollectionFromTypeOfAnnotation);
-        final TypeOfFacetOnCollectionFromTypeOfAnnotation typeOfFacetOnCollectionAnnotation = (TypeOfFacetOnCollectionFromTypeOfAnnotation) facet;
-        assertEquals(Order.class, typeOfFacetOnCollectionAnnotation.value());
-
-        assertNoMethodsRemoved();
-    }
-
-    public void testTypeOfFacetInferredForActionWithArrayReturnType() {
-        class Order {
-        }
-        class Customer {
-            @SuppressWarnings("unused")
-            public Order[] someAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, actionMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetInferredFromArray);
-        final TypeOfFacetInferredFromArray typeOfFacetInferredFromArray = (TypeOfFacetInferredFromArray) facet;
-        assertEquals(Order.class, typeOfFacetInferredFromArray.value());
-
-        assertNoMethodsRemoved();
-    }
-
-    public void testTypeOfFacetIsInferredForCollectionFromOrderArray() {
-        class Order {
-        }
-        class Customer {
-            @SuppressWarnings("unused")
-            public Order[] getOrders() {
-                return null;
-            }
-        }
-        final Method collectionAccessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, collectionAccessorMethod, methodRemover, facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetInferredFromArray);
-        final TypeOfFacetInferredFromArray typeOfFacetInferredFromArray = (TypeOfFacetInferredFromArray) facet;
-        assertEquals(Order.class, typeOfFacetInferredFromArray.value());
-
-    }
-
-    public void testTypeOfAnnotationIgnoredForActionIfReturnTypeIsntACollectionType() {
-        class Order {
-        }
-        class Customer {
-            @SuppressWarnings("unused")
-            @TypeOf(Order.class)
-            public Customer someAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, null, null, actionMethod, methodRemover, facetedMethod));
-
-        assertNull(facetedMethod.getFacet(TypeOfFacet.class));
-
-        assertNoMethodsRemoved();
-    }
-
-}


Mime
View raw message