[webbeans-commits] Webbeans SVN: r949 - ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Wed Jan 14 02:07:22 EST 2009
Author: shane.bryzak at jboss.com
Date: 2009-01-14 02:07:21 -0500 (Wed, 14 Jan 2009)
New Revision: 949
Removed:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DefaultDeploymentTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java
Log:
ported tests to TCK
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DefaultDeploymentTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DefaultDeploymentTypeTest.java 2009-01-14 07:04:34 UTC (rev 948)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DefaultDeploymentTypeTest.java 2009-01-14 07:07:21 UTC (rev 949)
@@ -1,26 +0,0 @@
-package org.jboss.webbeans.test;
-
-import javax.webbeans.Production;
-import javax.webbeans.Standard;
-
-import org.testng.annotations.Test;
-
-
-public class DefaultDeploymentTypeTest extends AbstractTest
-{
-
- @Override
- protected void addStandardDeploymentTypesForTests()
- {
- // No-op
- }
-
- @Test @SpecAssertion(section={"2.5.6", "2.5.7"})
- public void testDefaultEnabledDeploymentTypes()
- {
- assert manager.getEnabledDeploymentTypes().size() == 2;
- assert manager.getEnabledDeploymentTypes().get(0).equals(Standard.class);
- assert manager.getEnabledDeploymentTypes().get(1).equals(Production.class);
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java 2009-01-14 07:04:34 UTC (rev 948)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java 2009-01-14 07:07:21 UTC (rev 949)
@@ -1,147 +0,0 @@
-package org.jboss.webbeans.test;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-
-import javax.webbeans.DefinitionException;
-import javax.webbeans.DeploymentException;
-import javax.webbeans.Production;
-import javax.webbeans.Standard;
-import javax.webbeans.UnsatisfiedDependencyException;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.bean.ProducerMethodBean;
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
-import org.jboss.webbeans.test.annotations.HornedAnimalDeploymentType;
-import org.jboss.webbeans.test.beans.BlackWidow;
-import org.jboss.webbeans.test.beans.RedSnapper;
-import org.jboss.webbeans.test.beans.Reindeer;
-import org.jboss.webbeans.test.beans.Rhinoceros;
-import org.jboss.webbeans.test.beans.SpiderProducer;
-import org.jboss.webbeans.test.beans.broken.BeanWithTooManyDeploymentTypes;
-import org.jboss.webbeans.test.beans.broken.Gazelle;
-import org.testng.annotations.Test;
-
- at SpecVersion("20081206")
-public class DeploymentTypeTest extends AbstractTest
-{
-
- @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.5.1")
- public void testNonBuiltInComponentUsesStandard()
- {
- SimpleBean.of(Gazelle.class, manager);
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.5.2")
- public void testDeploymentTypeHasCorrectTarget()
- {
- assert false;
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.5.2")
- public void testDeploymentTypeHasCorrectRetention()
- {
- assert false;
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.5.2")
- public void testDeploymentTypeDeclaresScopeTypeAnnotation()
- {
- assert false;
- }
-
- @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.5.3")
- public void testTooManyDeploymentTypes()
- {
- SimpleBean.of(BeanWithTooManyDeploymentTypes.class, manager);
- }
-
- @Test @SpecAssertion(section="2.5.3")
- public void testDeploymentTypeInhertitedFromDeclaringBean() throws Exception
- {
- SimpleBean<SpiderProducer> bean = SimpleBean.of(SpiderProducer.class, manager);
- manager.addBean(bean);
- Method method = SpiderProducer.class.getMethod("produceBlackWidow");
- ProducerMethodBean<BlackWidow> blackWidowSpiderModel = ProducerMethodBean.of(method, bean, manager);
- assert blackWidowSpiderModel.getDeploymentType().equals(AnotherDeploymentType.class);
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.4")
- public void testXmlDeploymentTypeOverridesJava()
- {
- //Map<Class<? extends Annotation>, Annotation> xmlDefinedDeploymentTypeAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //xmlDefinedDeploymentTypeAnnotations.put(AnotherDeploymentType.class, new AnotherDeploymentTypeAnnotationLiteral());
- //AnnotatedClass<BeanWithTooManyDeploymentTypes> xmlDefinedDeploymentTypeAnnotatedItem = new SimpleAnnotatedClass<BeanWithTooManyDeploymentTypes>(BeanWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
-
- //SimpleBean<BeanWithTooManyDeploymentTypes> model = createSimpleBean(BeanWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotatedItem, manager);
- //assert model.getDeploymentType().equals(AnotherDeploymentType.class);
- assert false;
- }
-
-
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.4")
- public void testXmlRespectsJavaDeploymentType()
- {
- //AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
- //SimpleBean<Tuna> tuna = createSimpleBean(Tuna.class, annotatedItem, manager);
- //assert tuna.getDeploymentType().equals(AnotherDeploymentType.class);
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.5.5")
- public void testXmlDefaultDeploymentType()
- {
- //AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
- //SimpleBean<Antelope> antelope = createSimpleBean(Antelope.class, antelopeAnnotatedItem, manager);
- // assert antelope.getDeploymentType().equals(Production.class);
- assert false;
- }
-
- @Test @SpecAssertion(section="2.5.5")
- public void testHighestPrecedenceDeploymentTypeFromStereotype()
- {
- Bean<?> bean = SimpleBean.of(Rhinoceros.class, manager);
- assert bean.getDeploymentType().equals(HornedAnimalDeploymentType.class);
- }
-
- @Test(groups="beanLifecycle", expectedExceptions=UnsatisfiedDependencyException.class) @SpecAssertion(section="2.5.6")
- public void testBeanWithDisabledDeploymentTypeNotInstantiated()
- {
- manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class, AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
-
- Bean<RedSnapper> bean = SimpleBean.of(RedSnapper.class, manager);
- manager.addBean(bean);
- manager.getInstanceByType(RedSnapper.class);
- }
-
- @Test @SpecAssertion(section={"2.5.6", "2.5.7"})
- public void testCustomDeploymentTypes()
- {
- manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class, AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
- assert manager.getEnabledDeploymentTypes().size() == 3;
- assert manager.getEnabledDeploymentTypes().get(0).equals(Standard.class);
- assert manager.getEnabledDeploymentTypes().get(1).equals(AnotherDeploymentType.class);
- assert manager.getEnabledDeploymentTypes().get(2).equals(HornedAnimalDeploymentType.class);
- }
-
- @Test(expectedExceptions=DeploymentException.class) @SpecAssertion(section="2.5.6")
- public void testStandardMustBeDeclared()
- {
- manager.setEnabledDeploymentTypes(Arrays.asList(AnotherDeploymentType.class, HornedAnimalDeploymentType.class));
- }
-
- @Test(groups={"stub", "webbeansxml"}, expectedExceptions=DeploymentException.class) @SpecAssertion(section="2.5.6")
- public void testMultipleDeployElementsCannotBeDefined()
- {
-
- }
-
- @Test @SpecAssertion(section={"2.5.5", "2.7.2"})
- public void testWebBeanDeploymentTypeOverridesStereotype()
- {
- Bean<Reindeer> bean = SimpleBean.of(Reindeer.class, manager);
- assert bean.getDeploymentType().equals(Production.class);
- }
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java 2009-01-14 07:04:34 UTC (rev 948)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java 2009-01-14 07:07:21 UTC (rev 949)
@@ -1,136 +0,0 @@
-package org.jboss.webbeans.test;
-
-import javax.webbeans.DefinitionException;
-
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.test.beans.Haddock;
-import org.jboss.webbeans.test.beans.Minnow;
-import org.jboss.webbeans.test.beans.Moose;
-import org.jboss.webbeans.test.beans.RedSnapper;
-import org.jboss.webbeans.test.beans.SeaBass;
-import org.testng.annotations.Test;
-
- at SpecVersion("20081206")
-public class NameTest extends AbstractTest
-{
-
- @Test(groups="stub", expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.6")
- public void testInvalidElIdentifierUsedAsWebBeanName()
- {
- assert false;
- }
-
- @Test @SpecAssertion(section="2.6.1")
- public void testNonDefaultNamed()
- {
- SimpleBean<Moose> moose = SimpleBean.of(Moose.class, manager);
- assert moose.getName().equals("aMoose");
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.2")
- public void testNonDefaultXmlNamed()
- {
- /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Named.class, new NamedAnnotationLiteral(){
-
- public String value()
- {
- return "aTrout";
- }
-
- });
- AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);*/
- //SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
-
- //assert trout.getName().equals("aTrout");
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.2")
- public void testXmlNamedOverridesJavaNamed()
- {
- /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Named.class, new NamedAnnotationLiteral(){
-
- public String value()
- {
- return "aTrout";
- }
-
- });
- AnnotatedClass<Cod> annotatedItem = new SimpleAnnotatedClass<Cod>(Cod.class, annotations);*/
- //SimpleBean<Cod> cod = createSimpleBean(Cod.class, annotatedItem, manager);
-
- //assert cod.getName().equals("aTrout");
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section={"2.6.2", "2.6.3"})
- public void testJavaNamedUsedWhenNoXmlSpecified()
- {
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //AnnotatedClass<Cod> annotatedItem = new SimpleAnnotatedClass<Cod>(Cod.class, annotations);
- //SimpleBean<Cod> cod = createSimpleBean(Cod.class, annotatedItem, manager);
-
- //assert cod.getName().equals("whitefish");
- assert false;
- }
-
- @Test @SpecAssertion(section={"2.6.3", "3.2.7"})
- public void testDefaultNamed()
- {
- SimpleBean<Haddock> haddock = SimpleBean.of(Haddock.class, manager);
- assert haddock.getName() != null;
- assert haddock.getName().equals("haddock");
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.6.3")
- public void testDefaultXmlNamed()
- {
- /*Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- annotations.put(Named.class, new NamedAnnotationLiteral() {
-
- public String value()
- {
- return "";
- }
-
- });
- AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);*/
- //SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
-
- //assert trout.getName() != null;
- //assert trout.getName().equals("seaBass");
- assert false;
- }
-
- @Test @SpecAssertion(section={"2.6.3", "2.7"})
- public void testSterotypeDefaultsName()
- {
- SimpleBean<RedSnapper> model = SimpleBean.of(RedSnapper.class, manager);
- assert model.getMergedStereotypes().isBeanNameDefaulted();
- assert model.getName().equals("redSnapper");
- }
-
- @Test @SpecAssertion(section="2.6.4")
- public void testNotNamedInJava()
- {
- SimpleBean<SeaBass> model = SimpleBean.of(SeaBass.class, manager);
- assert model.getName() == null;
- }
-
- @Test @SpecAssertion(section="2.6.4")
- public void testNotNamedInXml()
- {
- SimpleBean<SeaBass> model = SimpleBean.of(SeaBass.class, manager);
- assert model.getName() == null;
- }
-
- @Test @SpecAssertion(section="2.6.4")
- public void testNotNamedInStereotype()
- {
- SimpleBean<Minnow> model = SimpleBean.of(Minnow.class, manager);
- assert model.getName() == null;
- }
-
-}
Deleted: 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 2009-01-14 07:04:34 UTC (rev 948)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java 2009-01-14 07:07:21 UTC (rev 949)
@@ -1,149 +0,0 @@
-package org.jboss.webbeans.test;
-
-import javax.webbeans.ApplicationScoped;
-import javax.webbeans.DefinitionException;
-import javax.webbeans.Dependent;
-import javax.webbeans.RequestScoped;
-import javax.webbeans.manager.Bean;
-
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.test.annotations.AnotherScopeType;
-import org.jboss.webbeans.test.beans.BeanWithTooManyScopeTypes;
-import org.jboss.webbeans.test.beans.Grayling;
-import org.jboss.webbeans.test.beans.Minnow;
-import org.jboss.webbeans.test.beans.Mullet;
-import org.jboss.webbeans.test.beans.Order;
-import org.jboss.webbeans.test.beans.Pollock;
-import org.jboss.webbeans.test.beans.RedSnapper;
-import org.jboss.webbeans.test.beans.SeaBass;
-import org.jboss.webbeans.test.beans.broken.Scallop;
-import org.testng.annotations.Test;
-
- at SpecVersion("20081206")
-public class ScopeTypeTest extends AbstractTest
-{
-
- @Test @SpecAssertion(section="2.4")
- public void testScopeTypesAreExtensible()
- {
- Bean<Mullet> mullet = SimpleBean.of(Mullet.class, manager);
- assert mullet.getScopeType().equals(AnotherScopeType.class);
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.4.2")
- public void testScopeTypeHasCorrectTarget()
- {
- assert false;
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.4.2")
- public void testScopeTypeHasCorrectRetention()
- {
- assert false;
- }
-
- @Test(groups={"stub", "annotationDefinition"}) @SpecAssertion(section="2.4.2")
- public void testScopeTypeDeclaresScopeTypeAnnotation()
- {
- assert false;
- }
-
- @Test @SpecAssertion(section="2.4.3")
- public void testScopeDeclaredInJava()
- {
- SimpleBean<SeaBass> trout = SimpleBean.of(SeaBass.class, manager);
- assert trout.getScopeType().equals(RequestScoped.class);
- }
-
- @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.4.3")
- public void testTooManyScopesSpecifiedInJava()
- {
- SimpleBean.of(BeanWithTooManyScopeTypes.class, manager);
- }
-
- @Test(expectedExceptions=DefinitionException.class, groups={"stub", "webbeansxml"})
- public void testTooManyScopesSpecifiedInXml()
- {
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
- //annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
- //AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, annotations);
- //createSimpleBean(null, antelopeAnnotatedItem, manager);
- }
-
- @Test(groups={"stub", "webbeansxml"}) @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 RequestScopedAnnotationLiteral());
- //AnnotatedClass<Order> annotatedItem = new SimpleAnnotatedClass<Order>(Order.class, annotations);
-
- //SimpleBean<Order> order = createSimpleBean(Order.class, annotatedItem, manager);
- //assert order.getScopeType().equals(RequestScoped.class);
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @SpecAssertion(section="2.4.4")
- public void testScopeMissingInXml()
- {
- //Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- //AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
-
- //SimpleBean<SeaBass> trout =createSimpleBean(SeaBass.class, annotatedItem, manager);
- //assert trout.getScopeType().equals(RequestScoped.class);
- assert false;
- }
-
- @Test(groups={"stub", "webbeansxml"}) @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 ConversationScopedAnnotationLiteral());
- //AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
- //SimpleBean<SeaBass> trout = createSimpleBean(SeaBass.class, annotatedItem, manager);
- //assert trout.getScopeType().equals(ConversationScoped.class);
- assert false;
- }
-
- @Test @SpecAssertion(section="2.4.5")
- public void testDefaultScope()
- {
- SimpleBean<Order> order = SimpleBean.of(Order.class, manager);
- assert order.getScopeType().equals(Dependent.class);
- }
-
- @Test @SpecAssertion(section={"2.4.5", "2.7.2"})
- public void testScopeSpecifiedAndStereotyped()
- {
- Bean<Minnow> minnow = SimpleBean.of(Minnow.class, manager);
- assert minnow.getScopeType().equals(RequestScoped.class);
- }
-
- @Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.4.5")
- public void testMutipleIncompatibleScopeStereotypes()
- {
- SimpleBean.of(Scallop.class, manager);
- }
-
- @Test @SpecAssertion(section="2.4.5")
- public void testMutipleIncompatibleScopeStereotypesWithScopeSpecified()
- {
- Bean<Pollock> pollock = SimpleBean.of(Pollock.class, manager);
- assert pollock.getScopeType().equals(Dependent.class);
- }
-
- @Test @SpecAssertion(section="2.4.5")
- public void testMutipleCompatibleScopeStereotypes()
- {
- Bean<Grayling> grayling = SimpleBean.of(Grayling.class, manager);
- assert grayling.getScopeType().equals(ApplicationScoped.class);
- }
-
- @Test @SpecAssertion(section="2.7.2")
- public void testWebBeanScopeTypeOverridesStereotype()
- {
- Bean<RedSnapper> bean = SimpleBean.of(RedSnapper.class, manager);
- assert bean.getScopeType().equals(RequestScoped.class);
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java 2009-01-14 07:04:34 UTC (rev 948)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java 2009-01-14 07:07:21 UTC (rev 949)
@@ -1,19 +0,0 @@
-package org.jboss.webbeans.test;
-
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.test.beans.Haddock;
-import org.testng.annotations.Test;
-
-public class TypeTest extends AbstractTest
-{
-
- @Test @SpecAssertion(section="2.6.3")
- public void testDefaultNamed()
- {
- SimpleBean<Haddock> haddock = SimpleBean.of(Haddock.class, manager);
- assert haddock.getName() != null;
- assert haddock.getName().equals("haddock");
- }
-
-}
-
More information about the weld-commits
mailing list