[webbeans-commits] Webbeans SVN: r1027 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests and 1 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Fri Jan 16 12:35:12 EST 2009
Author: pete.muir at jboss.org
Date: 2009-01-16 12:35:12 -0500 (Fri, 16 Jan 2009)
New Revision: 1027
Added:
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/context/
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/context/ContextTest.java
Removed:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ManagerTest.java
Log:
Move contexts to tck
Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ManagerTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ManagerTest.java 2009-01-16 17:26:15 UTC (rev 1026)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ManagerTest.java 2009-01-16 17:35:12 UTC (rev 1027)
@@ -1,55 +0,0 @@
-package org.jboss.webbeans.test;
-
-import javax.webbeans.ContextNotActiveException;
-import javax.webbeans.RequestScoped;
-import javax.webbeans.manager.Context;
-
-import org.jboss.webbeans.context.RequestContext;
-import org.testng.annotations.Test;
-
- at SpecVersion("PDR")
-public class ManagerTest extends AbstractTest
-{
-
-
- @Test(expectedExceptions={ContextNotActiveException.class}, groups={"manager"}) @SpecAssertion(section="8.6")
- public void testGetContextWithNoActiveContextsFails()
- {
- RequestContext.INSTANCE.setActive(false);
- manager.getContext(RequestScoped.class);
- }
-
- @Test(expectedExceptions={IllegalArgumentException.class}, groups={"manager"}) @SpecAssertion(section="8.6")
- public void testGetContextWithTooManyActiveContextsFails()
- {
- Context firstContext = new RequestContext() {};
- Context secondContext = new RequestContext() {};
- manager.addContext(firstContext);
- manager.addContext(secondContext);
- manager.getContext(RequestScoped.class);
- assert true;
- }
-
- @Test(expectedExceptions={ContextNotActiveException.class}, groups={"stub", "manager"}) @SpecAssertion(section="8.6")
- public void testGetContextWithNoRegisteredContextsFails()
- {
- manager.getContext(RequestScoped.class);
- assert false;
- }
-
- @Test(groups={"manager"}) @SpecAssertion(section="8.6")
- public void testGetContextReturnsActiveContext()
- {
- manager.getContext(RequestScoped.class);
- }
-
- /*
-
- @Test(groups="manager") @SpecAssertion(section="5.8")
- public void test
- {
- assert false;
- }
-
- */
-}
Added: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/context/ContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/context/ContextTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/context/ContextTest.java 2009-01-16 17:35:12 UTC (rev 1027)
@@ -0,0 +1,74 @@
+package org.jboss.webbeans.tck.tests.context;
+
+import static org.jboss.webbeans.tck.impl.WebBeansTCKImpl.configuration;
+
+import java.lang.annotation.Annotation;
+
+import javax.webbeans.ContextNotActiveException;
+import javax.webbeans.RequestScoped;
+import javax.webbeans.manager.Context;
+import javax.webbeans.manager.Contextual;
+
+import org.jboss.webbeans.tck.impl.SpecAssertion;
+import org.jboss.webbeans.tck.tests.AbstractTest;
+import org.testng.annotations.Test;
+
+public class ContextTest extends AbstractTest
+{
+
+ private @interface Dummy
+ {
+
+ }
+
+ private static class DummyContext implements Context
+ {
+
+ public <T> T get(Contextual<T> bean, boolean create)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Class<? extends Annotation> getScopeType()
+ {
+ return Dummy.class;
+ }
+
+ public boolean isActive()
+ {
+ return true;
+ }
+
+ }
+
+ @Test(expectedExceptions={ContextNotActiveException.class}, groups={"manager"}) @SpecAssertion(section="8.6")
+ public void testGetContextWithNoActiveContextsFails()
+ {
+ configuration().getContexts().setInactive(configuration().getContexts().getRequestContext());
+ manager.getContext(RequestScoped.class);
+ }
+
+ @Test(expectedExceptions={IllegalArgumentException.class}, groups={"manager"}) @SpecAssertion(section="8.6")
+ public void testGetContextWithTooManyActiveContextsFails()
+ {
+ Context firstContext = new DummyContext() {};
+ Context secondContext = new DummyContext() {};
+ manager.addContext(firstContext);
+ manager.addContext(secondContext);
+ manager.getContext(Dummy.class);
+ }
+
+ @Test(expectedExceptions={ContextNotActiveException.class}, groups={"stub", "manager"}) @SpecAssertion(section="8.6")
+ public void testGetContextWithNoRegisteredContextsFails()
+ {
+ manager.getContext(RequestScoped.class);
+ assert false;
+ }
+
+ @Test(groups={"manager"}) @SpecAssertion(section="8.6")
+ public void testGetContextReturnsActiveContext()
+ {
+ manager.getContext(RequestScoped.class);
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/tests/context/ContextTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the weld-commits
mailing list