[weld-commits] Weld SVN: r4436 - in cdi-tck/trunk/impl/src/main: resources/org/jboss/jsr299/tck/tests/context and 1 other directory.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Fri Oct 30 05:24:23 EDT 2009
Author: jharting
Date: 2009-10-30 05:24:23 -0400 (Fri, 30 Oct 2009)
New Revision: 4436
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/AfterBeanDiscoveryObserver.java
Removed:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextExtensions.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextDestroysBeansTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/javax.enterprise.inject.spi.Extension
Log:
Fixed broken tests
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/AfterBeanDiscoveryObserver.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/AfterBeanDiscoveryObserver.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/AfterBeanDiscoveryObserver.java 2009-10-30 09:24:23 UTC (rev 4436)
@@ -0,0 +1,27 @@
+package org.jboss.jsr299.tck.tests.context;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+
+public class AfterBeanDiscoveryObserver implements Extension
+{
+ private static MyContextual bean = null;
+
+ public void addCustomBeanImplementation(@Observes AfterBeanDiscovery event, BeanManager manager) {
+ bean = new MyContextual(manager);
+ event.addBean(bean);
+ }
+
+ public void addNewContexts(@Observes AfterBeanDiscovery event)
+ {
+ event.addContext(new DummyContext());
+ event.addContext(new DummyContext());
+ }
+
+ public static MyContextual getBean()
+ {
+ return bean;
+ }
+}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextDestroysBeansTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextDestroysBeansTest.java 2009-10-30 03:11:01 UTC (rev 4435)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextDestroysBeansTest.java 2009-10-30 09:24:23 UTC (rev 4436)
@@ -9,6 +9,8 @@
import org.jboss.test.audit.annotations.SpecAssertions;
import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
import org.testng.annotations.Test;
/**
@@ -18,21 +20,21 @@
* @author David Allen
*/
@Artifact
+ at IntegrationTest
@SpecVersion(spec="cdi", version="20091018")
+ at Resource(source = "javax.enterprise.inject.spi.Extension", destination = "WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension")
public class ContextDestroysBeansTest extends AbstractJSR299Test
{
- @Test(groups = { "contexts", "broken" })
+ @Test(groups = { "contexts" })
@SpecAssertions( {
@SpecAssertion(section = "6.2", id = "p"),
@SpecAssertion(section = "6.3", id = "d")
})
public void testContextDestroysBeansWhenDestroyed()
{
- MyContextual bean = new MyContextual(getCurrentManager());
+ MyContextual bean = AfterBeanDiscoveryObserver.getBean();
bean.setShouldReturnNullInstances(false);
- // TODO Remove use of this deprecated API
- //getCurrentManager().addBean(bean);
Context sessionContext = getCurrentManager().getContext(SessionScoped.class);
CreationalContext<MySessionBean> creationalContext = getCurrentManager().createCreationalContext(bean);
Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextExtensions.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextExtensions.java 2009-10-30 03:11:01 UTC (rev 4435)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/ContextExtensions.java 2009-10-30 09:24:23 UTC (rev 4436)
@@ -1,14 +0,0 @@
-package org.jboss.jsr299.tck.tests.context;
-
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.Extension;
-
-public class ContextExtensions implements Extension
-{
- public void addNewContexts(@Observes AfterBeanDiscovery event)
- {
- event.addContext(new DummyContext());
- event.addContext(new DummyContext());
- }
-}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java 2009-10-30 03:11:01 UTC (rev 4435)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java 2009-10-30 09:24:23 UTC (rev 4436)
@@ -10,6 +10,8 @@
import org.jboss.test.audit.annotations.SpecAssertions;
import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
import org.testng.annotations.Test;
/**
@@ -20,6 +22,8 @@
*/
@Artifact
@SpecVersion(spec="cdi", version="20091018")
+ at IntegrationTest
+ at Resource(source = "javax.enterprise.inject.spi.Extension", destination = "WEB-INF/classes/META-INF/services/javax.enterprise.inject.spi.Extension")
public class NormalContextTest extends AbstractJSR299Test
{
@@ -43,16 +47,14 @@
assert fourth.getId() == 10;
}
- @Test(groups = { "contexts", "broken" })
+ @Test(groups = { "contexts" })
@SpecAssertions( {
@SpecAssertion(section = "6.2", id = "l")
} )
public void testGetWithCreationalContextReturnsNewInstance()
{
- MyContextual bean = new MyContextual(getCurrentManager());
+ MyContextual bean = AfterBeanDiscoveryObserver.getBean();
bean.setShouldReturnNullInstances(false);
- // TODO Remove use of this deprecated API
- //getCurrentManager().addBean(bean);
CreationalContext<MySessionBean> creationalContext = new MockCreationalContext<MySessionBean>();
MySessionBean newBean = getCurrentManager().getContext(SessionScoped.class).get(bean, creationalContext);
@@ -60,16 +62,14 @@
assert bean.isCreateCalled();
}
- @Test(groups = { "contexts" , "broken"})
+ @Test(groups = { "contexts" })
@SpecAssertion(section = "6.2", id = "nb")
public void testGetMayNotReturnNullUnlessContextualCreateReturnsNull()
{
// The case of no creational context is already tested where a null is
// returned. Here we just test that the contextual create can return null.
- MyContextual bean = new MyContextual(getCurrentManager());
+ MyContextual bean = AfterBeanDiscoveryObserver.getBean();
bean.setShouldReturnNullInstances(true);
- // TODO Remove use of this deprecated API
- //getCurrentManager().addBean(bean);
CreationalContext<MySessionBean> creationalContext = new MockCreationalContext<MySessionBean>();
assert getCurrentManager().getContext(SessionScoped.class).get(bean, creationalContext) == null;
Modified: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/javax.enterprise.inject.spi.Extension
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/javax.enterprise.inject.spi.Extension 2009-10-30 03:11:01 UTC (rev 4435)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/javax.enterprise.inject.spi.Extension 2009-10-30 09:24:23 UTC (rev 4436)
@@ -1 +1 @@
-org.jboss.jsr299.tck.tests.context.ContextExtensions
\ No newline at end of file
+org.jboss.jsr299.tck.tests.context.AfterBeanDiscoveryObserver
\ No newline at end of file
More information about the weld-commits
mailing list