Author: pete.muir(a)jboss.org
Date: 2008-09-26 08:44:21 -0400 (Fri, 26 Sep 2008)
New Revision: 110
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/APITypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/CommonWebBeanTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
ri/trunk/webbeans-ri/testng.xml
Log:
Restructure tests and add in placeholders
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/APITypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/APITypeTest.java
(rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/APITypeTest.java 2008-09-26
12:44:21 UTC (rev 110)
@@ -0,0 +1,13 @@
+package org.jboss.webbeans.test;
+
+import org.testng.annotations.Test;
+
+public class APITypeTest {
+
+ @Test @SpecAssertion(section="2.2")
+ public void testParameterizedApiType()
+ {
+ assert false;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/APITypeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractModelTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractModelTest.java 2008-09-26
12:44:21 UTC (rev 110)
@@ -0,0 +1,55 @@
+package org.jboss.webbeans.test;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.bindings.StandardBinding;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.model.StereotypeModel;
+import org.jboss.webbeans.test.annotations.AnimalStereotype;
+import org.jboss.webbeans.test.annotations.FishStereotype;
+import org.jboss.webbeans.test.annotations.HornedMammalStereotype;
+import org.jboss.webbeans.test.annotations.MammalStereotype;
+import org.jboss.webbeans.test.annotations.RequestScopedAnimalStereotype;
+import org.jboss.webbeans.test.annotations.RiverFishStereotype;
+import org.jboss.webbeans.test.bindings.AnotherDeploymentTypeBinding;
+import org.jboss.webbeans.test.bindings.HornedAnimalDeploymentTypeBinding;
+import org.jboss.webbeans.test.mock.MockContainerImpl;
+import org.testng.annotations.BeforeMethod;
+
+public class AbstractModelTest
+{
+
+ protected ContainerImpl container;
+
+ protected AnnotatedType<?> emptyAnnotatedItem;
+
+ @BeforeMethod
+ public void before()
+ {
+ emptyAnnotatedItem = new SimpleAnnotatedType<Object>(null, new
HashMap<Class<? extends Annotation>, Annotation>());
+
+ List<Annotation> enabledDeploymentTypes = new ArrayList<Annotation>();
+ enabledDeploymentTypes.add(new StandardBinding());
+ enabledDeploymentTypes.add(new AnotherDeploymentTypeBinding());
+ enabledDeploymentTypes.add(new HornedAnimalDeploymentTypeBinding());
+ container = new MockContainerImpl(enabledDeploymentTypes);
+
+ initStereotypes(container);
+ }
+
+ private void initStereotypes(ContainerImpl container)
+ {
+ container.getModelManager().addStereotype(new
StereotypeModel<AnimalStereotype>(new
SimpleAnnotatedType<AnimalStereotype>(AnimalStereotype.class)));
+ container.getModelManager().addStereotype(new
StereotypeModel<HornedMammalStereotype>(new
SimpleAnnotatedType<HornedMammalStereotype>(HornedMammalStereotype.class)));
+ container.getModelManager().addStereotype(new
StereotypeModel<MammalStereotype>(new
SimpleAnnotatedType<MammalStereotype>(MammalStereotype.class)));
+ container.getModelManager().addStereotype(new
StereotypeModel<FishStereotype>(new
SimpleAnnotatedType<FishStereotype>(FishStereotype.class)));
+ container.getModelManager().addStereotype(new
StereotypeModel<RiverFishStereotype>(new
SimpleAnnotatedType<RiverFishStereotype>(RiverFishStereotype.class)));
+ container.getModelManager().addStereotype(new
StereotypeModel<RequestScopedAnimalStereotype>(new
SimpleAnnotatedType<RequestScopedAnimalStereotype>(RequestScopedAnimalStereotype.class)));
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractModelTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-09-26
12:44:21 UTC (rev 110)
@@ -0,0 +1,157 @@
+package org.jboss.webbeans.test;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.webbeans.Current;
+
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.test.annotations.Asynchronous;
+import org.jboss.webbeans.test.annotations.Synchronous;
+import org.jboss.webbeans.test.bindings.AsynchronousBinding;
+import org.jboss.webbeans.test.components.Antelope;
+import org.jboss.webbeans.test.components.Cat;
+import org.jboss.webbeans.test.components.Order;
+import org.jboss.webbeans.util.Reflections;
+import org.testng.annotations.Test;
+
+public class BindingTypeTest extends AbstractModelTest
+{
+
+ @SuppressWarnings("unchecked")
+ @Test @SpecAssertion(section={"2.3.3", "2.3.1"})
+ public void testDefaultBindingTypeDeclaredInJava()
+ {
+ SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new
SimpleAnnotatedType(Order.class), emptyAnnotatedItem, container);
+ assert order.getBindingTypes().size() == 1;
+ order.getBindingTypes().iterator().next().annotationType().equals(Current.class);
+ }
+
+ @Test(groups="injection") @SpecAssertion(section="2.3.1")
+ public void testDefaultBindingTypeAssumedAtInjectionPoint()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2.3.2")
+ public void testBindingTypeHasCorrectTarget()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2.3.2")
+ public void testBindingTypeHasCorrectRetention()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2.3.2")
+ public void testBindingTypeDeclaresBindingTypeAnnotation()
+ {
+ assert false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test @SpecAssertion(section="2.3.3")
+ public void testBindingTypesDeclaredInJava()
+ {
+ SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new
SimpleAnnotatedType(Cat.class), emptyAnnotatedItem, container);
+ assert cat.getBindingTypes().size() == 1;
+ assert Reflections.annotationSetMatches(cat.getBindingTypes(), Synchronous.class);
+ }
+
+ @Test @SpecAssertion(section="2.3.3")
+ public void testMultipleBindingTypes()
+ {
+ assert false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test @SpecAssertion(section="2.3.4")
+ public void testBindingTypesDeclaredInXml()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(Asynchronous.class, new AsynchronousBinding());
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Antelope.class,
annotations);
+
+ SimpleComponentModel<Antelope> antelope = new
SimpleComponentModel<Antelope>(emptyAnnotatedItem, annotatedItem, container);
+ assert Reflections.annotationSetMatches(antelope.getBindingTypes(),
Asynchronous.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test @SpecAssertion(section="2.3.4")
+ public void testXmlBindingTypeOverridesAndIgnoresJava()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(Asynchronous.class, new AsynchronousBinding());
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Cat.class, annotations);
+
+ SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new
SimpleAnnotatedType(Cat.class), annotatedItem, container);
+ assert cat.getBindingTypes().size() == 1;
+ assert Reflections.annotationSetMatches(cat.getBindingTypes(),
Asynchronous.class);
+ }
+
+ @Test @SpecAssertion(section="2.3.4")
+ public void testNoBindingTypesDeclaredInXml()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section={"2.3.4", "2.3.1"})
+ public void testDefaultBindingTypeDeclaredInXml()
+ {
+ assert false;
+ }
+
+ @Test(groups="injection") @SpecAssertion(section="2.3.5")
+ public void testFieldsWithBindingAnnotationsAreInjected()
+ {
+ assert false;
+ }
+
+ @Test(groups="injection") @SpecAssertion(section="2.3.5")
+ public void testFieldMissingBindingTypeIsNotInjected()
+ {
+ assert false;
+ }
+
+ @Test(groups="injection") @SpecAssertion(section="2.3.5")
+ public void testFieldInjectedFromProducerMethod()
+ {
+ assert false;
+ }
+
+ @Test(groups="injection") @SpecAssertion(section="2.3.5")
+ public void testFieldWithBindingTypeInXml()
+ {
+ assert false;
+ }
+
+ @Test(groups="injection") @SpecAssertion(section="2.3.5")
+ public void testFieldWithBindingTypeInXmlIgnoresAnnotations()
+ {
+ assert false;
+ }
+
+ @Test(groups="injection") @SpecAssertion(section="2.3.6")
+ public void testMethodWithBindingAnnotationsOnParametersAreInjected()
+ {
+ assert false;
+ }
+
+ @Test(groups="injection") @SpecAssertion(section="2.3.6")
+ public void testMethodWithBindingAnnotationsOnParametersDeclaredInXml()
+ {
+ assert false;
+ }
+
+ @Test(groups="injection") @SpecAssertion(section="2.3.6")
+ public void
testMethodWithBindingAnnotationsOnParametersDeclaredInXmlIgnoresAnnotations()
+ {
+ assert false;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/CommonWebBeanTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/CommonWebBeanTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/CommonWebBeanTest.java 2008-09-26
12:44:21 UTC (rev 110)
@@ -0,0 +1,37 @@
+package org.jboss.webbeans.test;
+
+import org.testng.annotations.Test;
+
+/**
+ * This test class should be used for common assertions about Web Beans
+ *
+ * @author Pete Muir
+ *
+ */
+public class CommonWebBeanTest {
+
+ @Test @SpecAssertion(section="2")
+ public void testApiTypesNonEmpty()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2")
+ public void testBindingTypesNonEmpty()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2")
+ public void testHasScopeType()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2")
+ public void testHasDeploymentType()
+ {
+ assert false;
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/CommonWebBeanTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
(rev 0)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java 2008-09-26
12:44:21 UTC (rev 110)
@@ -0,0 +1,190 @@
+package org.jboss.webbeans.test;
+
+import java.lang.annotation.Annotation;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.webbeans.ApplicationScoped;
+import javax.webbeans.ConversationScoped;
+import javax.webbeans.Dependent;
+import javax.webbeans.RequestScoped;
+
+import org.jboss.webbeans.bindings.ConversationScopedBinding;
+import org.jboss.webbeans.bindings.RequestScopedBinding;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.model.SimpleComponentModel;
+import org.jboss.webbeans.test.annotations.AnimalStereotype;
+import org.jboss.webbeans.test.annotations.FishStereotype;
+import org.jboss.webbeans.test.annotations.RiverFishStereotype;
+import org.jboss.webbeans.test.bindings.AnimalStereotypeBinding;
+import org.jboss.webbeans.test.bindings.FishStereotypeBinding;
+import org.jboss.webbeans.test.bindings.RiverFishStereotypeBinding;
+import org.jboss.webbeans.test.components.Antelope;
+import org.jboss.webbeans.test.components.ComponentWithTooManyScopeTypes;
+import org.jboss.webbeans.test.components.Haddock;
+import org.jboss.webbeans.test.components.Order;
+import org.jboss.webbeans.test.components.SeaBass;
+import org.testng.annotations.Test;
+
+public class ScopeTypeTest extends AbstractModelTest
+{
+
+ @Test @SpecAssertion(section="2.4")
+ public void testScopeTypesAreExtensible()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2.4.2")
+ public void testScopeTypeHasCorrectTarget()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2.4.2")
+ public void testScopeTypeHasCorrectRetention()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2.4.2")
+ public void testScopeTypeDeclaresBindingTypeAnnotation()
+ {
+ assert false;
+ }
+
+ @Test @SpecAssertion(section="2.4.3")
+ public void testScopeDeclaredInJava()
+ {
+ SimpleComponentModel<SeaBass> trout = new
SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class),
emptyAnnotatedItem, container);
+ assert trout.getScopeType().annotationType().equals(RequestScoped.class);
+ }
+
+ @Test @SpecAssertion(section="2.4.3")
+ public void testTooManyScopesSpecifiedInJava()
+ {
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<ComponentWithTooManyScopeTypes>(new
SimpleAnnotatedType(ComponentWithTooManyScopeTypes.class), emptyAnnotatedItem,
container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test @SpecAssertion(section="2.4.3")
+ public void testTooManyScopesSpecifiedInXml()
+ {
+ boolean exception = false;
+ try
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(RequestScoped.class, new RequestScopedBinding());
+ annotations.put(ConversationScoped.class, new ConversationScopedBinding());
+ AnnotatedType antelopeAnnotatedItem = new SimpleAnnotatedType(Antelope.class,
annotations);
+ new SimpleComponentModel<Antelope>(emptyAnnotatedItem,
antelopeAnnotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test @SpecAssertion(section="2.4.4")
+ public void testScopeDeclaredInXml()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(RequestScoped.class, new RequestScopedBinding());
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Order.class, annotations);
+
+ SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new
SimpleAnnotatedType(Order.class), annotatedItem, container);
+ assert order.getScopeType().annotationType().equals(RequestScoped.class);
+ }
+
+ @Test @SpecAssertion(section="2.4.4")
+ public void testScopeMissingInXml()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+
+ SimpleComponentModel<SeaBass> trout = new
SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem,
container);
+ assert trout.getScopeType().annotationType().equals(RequestScoped.class);
+ }
+
+ @Test @SpecAssertion(section="2.4.4")
+ public void testScopeDeclaredInXmlOverridesJava()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(ConversationScoped.class, new ConversationScopedBinding());
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+ SimpleComponentModel<SeaBass> trout = new
SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem,
container);
+ assert trout.getScopeType().annotationType().equals(ConversationScoped.class);
+ }
+
+ @Test @SpecAssertion(section="2.4.5")
+ public void testDefaultScope()
+ {
+ SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new
SimpleAnnotatedType(Order.class), emptyAnnotatedItem, container);
+ assert order.getScopeType().annotationType().equals(Dependent.class);
+ }
+
+ @Test @SpecAssertion(section={"2.4.5", "2.7.2"})
+ public void testScopeSpecifiedAndStereotyped()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(FishStereotype.class, new FishStereotypeBinding());
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+ SimpleComponentModel<SeaBass> trout = new
SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem,
container);
+ assert trout.getScopeType().annotationType().equals(RequestScoped.class);
+ }
+
+ @Test @SpecAssertion(section="2.4.5")
+ public void testMutipleIncompatibleScopeStereotypes()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(FishStereotype.class, new FishStereotypeBinding());
+ annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Haddock.class, annotations);
+
+ boolean exception = false;
+ try
+ {
+ new SimpleComponentModel<Haddock>(new SimpleAnnotatedType(Haddock.class),
annotatedItem, container);
+ }
+ catch (Exception e)
+ {
+ exception = true;
+ }
+ assert exception;
+ }
+
+ @Test @SpecAssertion(section="2.4.5")
+ public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(FishStereotype.class, new FishStereotypeBinding());
+ annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+
+ SimpleComponentModel<SeaBass> trout = new
SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem,
container);
+ assert trout.getScopeType().annotationType().equals(RequestScoped.class);
+ }
+
+ @Test @SpecAssertion(section="2.4.5")
+ public void testMutipleCompatibleScopeStereotypes()
+ {
+ Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
+ annotations.put(FishStereotype.class, new FishStereotypeBinding());
+ annotations.put(RiverFishStereotype.class, new RiverFishStereotypeBinding());
+ AnnotatedType annotatedItem = new SimpleAnnotatedType(Haddock.class, annotations);
+
+ SimpleComponentModel<Haddock> haddock = new
SimpleComponentModel<Haddock>(new SimpleAnnotatedType(Haddock.class), annotatedItem,
container);
+ assert haddock.getScopeType().annotationType().equals(ApplicationScoped.class);
+ }
+
+}
Property changes on:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java 2008-09-25
21:01:07 UTC (rev 109)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java 2008-09-26
12:44:21 UTC (rev 110)
@@ -98,6 +98,8 @@
container.getModelManager().addStereotype(new StereotypeModel(new
SimpleAnnotatedType(RequestScopedAnimalStereotype.class)));
}
+
+
// **** TESTS FOR DEPLOYMENT TYPE **** //
@Test @SpecAssertion(section="2.5.3")
@@ -162,188 +164,12 @@
AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
SimpleComponentModel<SeaBass> trout = new
SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem,
container);
assert trout.getScopeType().annotationType().equals(RequestScoped.class);
- }
+ }
- // **** TESTS FOR BINDING TYPE **** //
-
- @SuppressWarnings("unchecked")
- @Test @SpecAssertion(section="2.3.5")
- public void testXmlBindingTypeOverridesAndIgnoresJava()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Asynchronous.class, new AsynchronousBinding());
- AnnotatedType annotatedItem = new SimpleAnnotatedType(Cat.class, annotations);
-
- SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new
SimpleAnnotatedType(Cat.class), annotatedItem, container);
- assert cat.getBindingTypes().size() == 1;
- assert Reflections.annotationSetMatches(cat.getBindingTypes(),
Asynchronous.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test @SpecAssertion(section="2.3.3")
- public void testBindingTypesDeclaredInJava()
- {
- SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new
SimpleAnnotatedType(Cat.class), emptyAnnotatedItem, container);
- assert cat.getBindingTypes().size() == 1;
- assert Reflections.annotationSetMatches(cat.getBindingTypes(), Synchronous.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test @SpecAssertion(section="2.3.3")
- public void testBindingTypesDeclaredInXml()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Asynchronous.class, new AsynchronousBinding());
- AnnotatedType annotatedItem = new SimpleAnnotatedType(Antelope.class,
annotations);
-
- SimpleComponentModel<Antelope> antelope = new
SimpleComponentModel<Antelope>(emptyAnnotatedItem, annotatedItem, container);
- assert Reflections.annotationSetMatches(antelope.getBindingTypes(),
Asynchronous.class);
- }
-
- @SuppressWarnings("unchecked")
- @Test @SpecAssertion(section={"2.3.3", "2.3.1"})
- public void testDefaultBindingTypeDeclaredInJava()
- {
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new
SimpleAnnotatedType(Order.class), emptyAnnotatedItem, container);
- assert order.getBindingTypes().size() == 1;
- order.getBindingTypes().iterator().next().annotationType().equals(Current.class);
- }
-
// **** TESTS FOR SCOPES **** //
- @Test
- public void testScopeDeclaredInJava()
- {
- SimpleComponentModel<SeaBass> trout = new
SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class),
emptyAnnotatedItem, container);
- assert trout.getScopeType().annotationType().equals(RequestScoped.class);
- }
+
- @Test
- public void testScopeDeclaredInXml()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(RequestScoped.class, new RequestScopedBinding());
- AnnotatedType annotatedItem = new SimpleAnnotatedType(Order.class, annotations);
-
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new
SimpleAnnotatedType(Order.class), annotatedItem, container);
- assert order.getScopeType().annotationType().equals(RequestScoped.class);
- }
-
- @Test @SpecAssertion(section="2.4.4")
- public void testScopeDeclaredInXmlOverridesJava()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(ConversationScoped.class, new ConversationScopedBinding());
- AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new
SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem,
container);
- assert trout.getScopeType().annotationType().equals(ConversationScoped.class);
- }
-
- @Test @SpecAssertion(section="2.4.4")
- public void testScopeMissingInXml()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
- AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
-
- SimpleComponentModel<SeaBass> trout = new
SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem,
container);
- assert trout.getScopeType().annotationType().equals(RequestScoped.class);
- }
-
- @Test @SpecAssertion(section="2.4.5")
- public void testDefaultScope()
- {
- SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new
SimpleAnnotatedType(Order.class), emptyAnnotatedItem, container);
- assert order.getScopeType().annotationType().equals(Dependent.class);
- }
-
- @Test @SpecAssertion(section="2.4.3")
- public void testTooManyScopesSpecifiedInJava()
- {
- boolean exception = false;
- try
- {
- new SimpleComponentModel<ComponentWithTooManyScopeTypes>(new
SimpleAnnotatedType(ComponentWithTooManyScopeTypes.class), emptyAnnotatedItem,
container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- @Test @SpecAssertion(section={"2.4.4", "2.4.3"})
- public void testTooManyScopesSpecifiedInXml()
- {
- boolean exception = false;
- try
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(RequestScoped.class, new RequestScopedBinding());
- annotations.put(ConversationScoped.class, new ConversationScopedBinding());
- AnnotatedType antelopeAnnotatedItem = new SimpleAnnotatedType(Antelope.class,
annotations);
- new SimpleComponentModel<Antelope>(emptyAnnotatedItem,
antelopeAnnotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- @Test @SpecAssertion(section={"2.4.5", "2.7.2"})
- public void testScopeSpecifiedAndStereotyped()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(FishStereotype.class, new FishStereotypeBinding());
- AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
- SimpleComponentModel<SeaBass> trout = new
SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem,
container);
- assert trout.getScopeType().annotationType().equals(RequestScoped.class);
- }
-
- @Test @SpecAssertion(section="2.4.5")
- public void testMutipleIncompatibleScopeStereotypes()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(FishStereotype.class, new FishStereotypeBinding());
- annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());
- AnnotatedType annotatedItem = new SimpleAnnotatedType(Haddock.class, annotations);
-
- boolean exception = false;
- try
- {
- new SimpleComponentModel<Haddock>(new SimpleAnnotatedType(Haddock.class),
annotatedItem, container);
- }
- catch (Exception e)
- {
- exception = true;
- }
- assert exception;
- }
-
- @Test @SpecAssertion(section="2.4.5")
- public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(FishStereotype.class, new FishStereotypeBinding());
- annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());
- AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
-
- SimpleComponentModel<SeaBass> trout = new
SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem,
container);
- assert trout.getScopeType().annotationType().equals(RequestScoped.class);
- }
-
- @Test @SpecAssertion(section="2.4.5")
- public void testMutipleCompatibleScopeStereotypes()
- {
- Map<Class<? extends Annotation>, Annotation> annotations = new
HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(FishStereotype.class, new FishStereotypeBinding());
- annotations.put(RiverFishStereotype.class, new RiverFishStereotypeBinding());
- AnnotatedType annotatedItem = new SimpleAnnotatedType(Haddock.class, annotations);
-
- SimpleComponentModel<Haddock> haddock = new
SimpleComponentModel<Haddock>(new SimpleAnnotatedType(Haddock.class), annotatedItem,
container);
- assert haddock.getScopeType().annotationType().equals(ApplicationScoped.class);
- }
-
// **** TESTS FOR COMPONENT NAME **** /
@Test @SpecAssertion(section="2.6.1")
Modified: ri/trunk/webbeans-ri/testng.xml
===================================================================
--- ri/trunk/webbeans-ri/testng.xml 2008-09-25 21:01:07 UTC (rev 109)
+++ ri/trunk/webbeans-ri/testng.xml 2008-09-26 12:44:21 UTC (rev 110)
@@ -2,84 +2,22 @@
<suite name="WebBeans RI" verbose="1">
- <test name="Reflection Support">
- <classes>
- <class name="org.jboss.webbeans.test.ClassAnnotatedItemTest" />
- <class name="org.jboss.webbeans.test.ConstructorModelTest" />
- </classes>
- </test>
-
- <test name="Deployment">
+ <test name="Web Beans RI">
<groups>
<run>
<exclude name="specialization" />
<exclude name="componentLifecycle" />
<exclude name="deployment" />
- </run>
- </groups>
- <classes>
- <class name="org.jboss.webbeans.test.ComponentDeploymentTest"
/>
- <class name="org.jboss.webbeans.test.DeploymentStrategyTest" />
- </classes>
- </test>
-
- <test name="Component Model">
- <groups>
- <run>
<exclude name="disposalMethod" />
<exclude name="producerExpression" />
<exclude name="remoteComponentInXml" />
- </run>
- </groups>
- <classes>
- <class name="org.jboss.webbeans.test.SimpleComponentModelTest"
/>
- <class name="org.jboss.webbeans.test.EnterpriseComponentModelTest"
/>
- <class
name="org.jboss.webbeans.test.ProducerExpressionComponentModelTest" />
- <class
name="org.jboss.webbeans.test.ProducerMethodComponentModelTest" />
- <class name="org.jboss.webbeans.test.RemoteComponentModelTest"
/>
- <class name="org.jboss.webbeans.test.StereotypeModelTest" />
- </classes>
- </test>
-
- <test name="Component Lifecycle">
- <groups>
- <run>
- <exclude name="componentLifecycle" />
- <exclude name="specialization" />
- <exclude name="disposalMethod" />
- </run>
- </groups>
- <classes>
- <class name="org.jboss.webbeans.test.SimpleComponentLifecycleTest"
/>
- <class
name="org.jboss.webbeans.test.EnterpriseComponentLifecycleTest" />
- <class
name="org.jboss.webbeans.test.ProducerMethodComponentLifecycleTest" />
- <class
name="org.jboss.webbeans.test.ProducerExpressionComponentLifecycleTest" />
- <class name="org.jboss.webbeans.test.RemoteComponentLifecycleTest"
/>
- </classes>
- </test>
-
- <test name="Container">
- <classes>
- <class name="org.jboss.webbeans.test.ContainerTest" />
- </classes>
- </test>
-
- <test name="EJB">
- <classes>
- <class name="org.jboss.webbeans.test.EjbMetaDataTest" />
- </classes>
- </test>
-
- <test name="Event Bus">
- <groups>
- <run>
<exclude name="eventbus" />
+ <exclude name="injection" />
</run>
</groups>
- <classes>
- <class name="org.jboss.webbeans.test.DeferredEventNotificationTest"
/>
- <class name="org.jboss.webbeans.test.ObserverTest" />
- </classes>
+ <packages>
+ <package name="org.jboss.webbeans.test"></package>
+ </packages>
</test>
</suite>
\ No newline at end of file