incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1234453 [19/33] - in /incubator/isis/trunk/framework/core: commons/src/main/java/org/apache/isis/core/commons/authentication/ commons/src/main/java/org/apache/isis/core/commons/components/ commons/src/main/java/org/apache/isis/core/commons...
Date Sun, 22 Jan 2012 06:59:23 GMT
Modified: incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/actcoll/typeof/TypeOfAnnotationFacetFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/actcoll/typeof/TypeOfAnnotationFacetFactoryTest.java?rev=1234453&r1=1234452&r2=1234453&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/actcoll/typeof/TypeOfAnnotationFacetFactoryTest.java
(original)
+++ incubator/isis/trunk/framework/core/progmodel/src/test/java/org/apache/isis/core/progmodel/facets/actcoll/typeof/TypeOfAnnotationFacetFactoryTest.java
Sun Jan 22 06:58:43 2012
@@ -17,9 +17,8 @@
  *  under the License.
  */
 
+package org.apache.isis.core.progmodel.facets.actcoll.typeof;
 
-package org.apache.isis.core.progmodel.facets.actcoll.typeof;
-
 import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.List;
@@ -35,257 +34,265 @@ import org.apache.isis.core.metamodel.sp
 import org.apache.isis.core.progmodel.facets.AbstractFacetFactoryTest;
 import org.apache.isis.core.progmodel.facets.collections.typeof.TypeOfAnnotationForCollectionsFacetFactory;
 import org.apache.isis.core.progmodel.facets.collections.typeof.TypeOfFacetAnnotationForCollection;
-
-
-public class TypeOfAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
-
-    private TypeOfAnnotationForCollectionsFacetFactory facetFactory;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        facetFactory = new TypeOfAnnotationForCollectionsFacetFactory();
-        facetFactory.setCollectionTypeRegistry(new CollectionTypeRegistryDefault());
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        facetFactory = null;
-        super.tearDown();
-    }
-
-
-    public void testTypeOfFacetInferredForActionWithJavaUtilCollectionReturnType() {
-        class Order {}
-        class Customer {
-            @SuppressWarnings("unused")
-            @TypeOf(Order.class)
-            public Collection someAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover,
facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetAnnotationForCollection);
-        final TypeOfFacetAnnotationForCollection typeOfFacetAnnotationForCollection = (TypeOfFacetAnnotationForCollection)
facet;
-        assertEquals(Order.class, typeOfFacetAnnotationForCollection.value());
-
-        assertNoMethodsRemoved();
-    }
-
-    public void testTypeOfFacetInferredForCollectionWithJavaUtilCollectionReturnType() {
-        class Order {}
-        class Customer {
-            @SuppressWarnings("unused")
-            @TypeOf(Order.class)
-            public Collection getOrders() {
-                return null;
-            }
-        }
-        final Method accessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, accessorMethod, methodRemover,
facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetAnnotationForCollection);
-        final TypeOfFacetAnnotationForCollection typeOfFacetAnnotationForCollection = (TypeOfFacetAnnotationForCollection)
facet;
-        assertEquals(Order.class, typeOfFacetAnnotationForCollection.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, 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, 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 {
-            @SuppressWarnings("unused")
-            @TypeOf(Order.class)
-            public List someAction() {
-                return null;
-            }
-        }
-        final Method actionMethod = findMethod(Customer.class, "someAction");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover,
facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetAnnotationForCollection);
-        final TypeOfFacetAnnotationForCollection typeOfFacetAnnotationForCollection = (TypeOfFacetAnnotationForCollection)
facet;
-        assertEquals(Order.class, typeOfFacetAnnotationForCollection.value());
-
-        assertNoMethodsRemoved();
-    }
-
-    public void testTypeOfFacetInferredForCollectionWithJavaUtilListReturnType() {
-        class Order {}
-        class Customer {
-            @SuppressWarnings("unused")
-            @TypeOf(Order.class)
-            public List getOrders() {
-                return null;
-            }
-        }
-        final Method accessorMethod = findMethod(Customer.class, "getOrders");
-
-        facetFactory.process(new ProcessMethodContext(Customer.class, accessorMethod, methodRemover,
facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetAnnotationForCollection);
-        final TypeOfFacetAnnotationForCollection typeOfFacetAnnotationForCollection = (TypeOfFacetAnnotationForCollection)
facet;
-        assertEquals(Order.class, typeOfFacetAnnotationForCollection.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, actionMethod, methodRemover,
facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetAnnotationForCollection);
-        final TypeOfFacetAnnotationForCollection typeOfFacetAnnotationForCollection = (TypeOfFacetAnnotationForCollection)
facet;
-        assertEquals(Order.class, typeOfFacetAnnotationForCollection.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, accessorMethod, methodRemover,
facetedMethod));
-
-        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
-        assertNotNull(facet);
-        assertTrue(facet instanceof TypeOfFacetAnnotationForCollection);
-        final TypeOfFacetAnnotationForCollection typeOfFacetAnnotationForCollection = (TypeOfFacetAnnotationForCollection)
facet;
-        assertEquals(Order.class, typeOfFacetAnnotationForCollection.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, 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, 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, actionMethod, methodRemover,
facetedMethod));
-
-        assertNull(facetedMethod.getFacet(TypeOfFacet.class));
-
-        assertNoMethodsRemoved();
-    }
-
-}
-
+
+public class TypeOfAnnotationFacetFactoryTest extends AbstractFacetFactoryTest {
+
+    private TypeOfAnnotationForCollectionsFacetFactory facetFactory;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        facetFactory = new TypeOfAnnotationForCollectionsFacetFactory();
+        facetFactory.setCollectionTypeRegistry(new CollectionTypeRegistryDefault());
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        facetFactory = null;
+        super.tearDown();
+    }
+
+    public void testTypeOfFacetInferredForActionWithJavaUtilCollectionReturnType() {
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            @TypeOf(Order.class)
+            public Collection someAction() {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover,
facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetAnnotationForCollection);
+        final TypeOfFacetAnnotationForCollection typeOfFacetAnnotationForCollection = (TypeOfFacetAnnotationForCollection)
facet;
+        assertEquals(Order.class, typeOfFacetAnnotationForCollection.value());
+
+        assertNoMethodsRemoved();
+    }
+
+    public void testTypeOfFacetInferredForCollectionWithJavaUtilCollectionReturnType() {
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            @TypeOf(Order.class)
+            public Collection getOrders() {
+                return null;
+            }
+        }
+        final Method accessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, accessorMethod, methodRemover,
facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetAnnotationForCollection);
+        final TypeOfFacetAnnotationForCollection typeOfFacetAnnotationForCollection = (TypeOfFacetAnnotationForCollection)
facet;
+        assertEquals(Order.class, typeOfFacetAnnotationForCollection.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, 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, 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 {
+            @SuppressWarnings("unused")
+            @TypeOf(Order.class)
+            public List someAction() {
+                return null;
+            }
+        }
+        final Method actionMethod = findMethod(Customer.class, "someAction");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, actionMethod, methodRemover,
facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetAnnotationForCollection);
+        final TypeOfFacetAnnotationForCollection typeOfFacetAnnotationForCollection = (TypeOfFacetAnnotationForCollection)
facet;
+        assertEquals(Order.class, typeOfFacetAnnotationForCollection.value());
+
+        assertNoMethodsRemoved();
+    }
+
+    public void testTypeOfFacetInferredForCollectionWithJavaUtilListReturnType() {
+        class Order {
+        }
+        class Customer {
+            @SuppressWarnings("unused")
+            @TypeOf(Order.class)
+            public List getOrders() {
+                return null;
+            }
+        }
+        final Method accessorMethod = findMethod(Customer.class, "getOrders");
+
+        facetFactory.process(new ProcessMethodContext(Customer.class, accessorMethod, methodRemover,
facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetAnnotationForCollection);
+        final TypeOfFacetAnnotationForCollection typeOfFacetAnnotationForCollection = (TypeOfFacetAnnotationForCollection)
facet;
+        assertEquals(Order.class, typeOfFacetAnnotationForCollection.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, actionMethod, methodRemover,
facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetAnnotationForCollection);
+        final TypeOfFacetAnnotationForCollection typeOfFacetAnnotationForCollection = (TypeOfFacetAnnotationForCollection)
facet;
+        assertEquals(Order.class, typeOfFacetAnnotationForCollection.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, accessorMethod, methodRemover,
facetedMethod));
+
+        final Facet facet = facetedMethod.getFacet(TypeOfFacet.class);
+        assertNotNull(facet);
+        assertTrue(facet instanceof TypeOfFacetAnnotationForCollection);
+        final TypeOfFacetAnnotationForCollection typeOfFacetAnnotationForCollection = (TypeOfFacetAnnotationForCollection)
facet;
+        assertEquals(Order.class, typeOfFacetAnnotationForCollection.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, 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, 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, actionMethod, methodRemover,
facetedMethod));
+
+        assertNull(facetedMethod.getFacet(TypeOfFacet.class));
+
+        assertNoMethodsRemoved();
+    }
+
+}



Mime
View raw message