Author: pete.muir(a)jboss.org
Date: 2009-10-17 14:38:58 -0400 (Sat, 17 Oct 2009)
New Revision: 4172
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Pig.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyDecorator.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
Log:
Simplyfy and fix bad tests
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java 2009-10-17
18:38:09 UTC (rev 4171)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/EJBDecoratorInvocationTest.java 2009-10-17
18:38:58 UTC (rev 4172)
@@ -22,6 +22,8 @@
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.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
import org.testng.annotations.Test;
@@ -32,27 +34,10 @@
@Artifact
@BeansXml("beans.xml")
@SpecVersion(spec="cdi", version="PFD2")
+(a)Packaging(PackagingType.EAR)
@IntegrationTest
public class EJBDecoratorInvocationTest extends AbstractJSR299Test
{
-
- @Test(groups="ri-broken")
- @SpecAssertions({
- @SpecAssertion(section="8.5", id="a"),
- @SpecAssertion(section="8.5", id="c"),
- @SpecAssertion(section="8.5", id="b"),
- @SpecAssertion(section="8.1.3", id="d"),
- @SpecAssertion(section="8.1.2", id="f"),
- @SpecAssertion(section="8.1.2", id="b")
- })
- public void testDecoratorInvocation()
- {
- TimestampLogger.reset();
- MockLogger.reset();
- getInstanceByType(PigSty.class).clean();
- assert TimestampLogger.getMessage().equals(PigSty.MESSAGE);
- assert MockLogger.getMessage().equals(TimestampLogger.PREFIX + PigSty.MESSAGE);
- }
@Test(groups="ri-broken")
@SpecAssertions({
@@ -61,36 +46,11 @@
public void testEJBDecoratorInvocation() {
// testDecoratorInvocation tests decorators of normal beans called from an EJB
// it doesn't test actual decoration of the EJB
- PigStyDecorator.decoratorCalled = false;
+ PigStyDecorator.reset();
+ PigStyImpl.reset();
getInstanceByType(PigSty.class).clean();
- assert PigStyDecorator.decoratorCalled;
+ assert PigStyDecorator.isDecoratorCalled();
+ assert PigStyImpl.isBeanCalled();
}
-
- @Test(groups="ri-broken")
- @SpecAssertions({
- @SpecAssertion(section="8.5", id="d"),
- @SpecAssertion(section="8.5", id="e"),
- @SpecAssertion(section="8.5", id="f"),
- @SpecAssertion(section="8.4", id="a"),
- @SpecAssertion(section="8.1.3", id="d"),
- @SpecAssertion(section="8.1.2", id="f"),
- @SpecAssertion(section="8.1.2", id="b")
- })
- public void testChainedDecoratorInvocation()
- {
- FooDecorator1.reset();
- FooDecorator2.reset();
- FooImpl.reset();
- getInstanceByType(PigSty.class).washDown();
- assert FooDecorator1.getMessage().equals(PigSty.MESSAGE);
- assert
FooDecorator1.getInjectionPoint().getBean().getBeanClass().equals(PigStyImpl.class);
- assert !FooDecorator1.getInjectionPoint().isDelegate();
- assert FooDecorator2.getMessage().equals(PigSty.MESSAGE + FooDecorator1.SUFFIX);
- assert
FooDecorator2.getInjectionPoint().getBean().getBeanClass().equals(FooDecorator1.class);
- assert FooDecorator2.getInjectionPoint().isDelegate();
- assert FooImpl.getMessage().equals(PigSty.MESSAGE + FooDecorator1.SUFFIX +
FooDecorator2.SUFFIX);
- assert
FooImpl.getInjectionPoint().getBean().getBeanClass().equals(FooDecorator2.class);
- assert FooImpl.getInjectionPoint().isDelegate();
- }
}
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Pig.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Pig.java
(rev 0)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Pig.java 2009-10-17
18:38:58 UTC (rev 4172)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.decorators.invocation;
+
+import java.io.Serializable;
+
+public class Pig implements Serializable
+{
+
+}
Property changes on:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/Pig.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java 2009-10-17
18:38:09 UTC (rev 4171)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigSty.java 2009-10-17
18:38:58 UTC (rev 4172)
@@ -16,17 +16,18 @@
*/
package org.jboss.jsr299.tck.tests.decorators.invocation;
+import javax.ejb.Local;
+
/**
* @author pmuir
*
*/
+@Local
public interface PigSty
{
public static final String MESSAGE = "smelly work!";
public void clean();
-
- public void washDown();
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyDecorator.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyDecorator.java 2009-10-17
18:38:09 UTC (rev 4171)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyDecorator.java 2009-10-17
18:38:58 UTC (rev 4172)
@@ -1,22 +1,32 @@
package org.jboss.jsr299.tck.tests.decorators.invocation;
+import java.io.Serializable;
+
import javax.decorator.Decorates;
import javax.decorator.Decorator;
@Decorator
-public class PigStyDecorator implements PigSty {
- public static boolean decoratorCalled = false;
-
- @Decorates PigSty pigSty;
-
- public void clean() {
- decoratorCalled = true;
- pigSty.clean();
- }
+public class PigStyDecorator implements PigSty, Serializable
+{
+ private static boolean decoratorCalled = false;
+
+ public static boolean isDecoratorCalled()
+ {
+ return decoratorCalled;
+ }
+
+ public static void reset()
+ {
+ decoratorCalled = false;
+ }
- public void washDown() {
- decoratorCalled = true;
- pigSty.washDown();
- }
+ @Decorates
+ transient PigSty pigSty;
+ public void clean()
+ {
+ decoratorCalled = true;
+ pigSty.clean();
+ }
+
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java 2009-10-17
18:38:09 UTC (rev 4171)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/PigStyImpl.java 2009-10-17
18:38:58 UTC (rev 4172)
@@ -16,27 +16,36 @@
*/
package org.jboss.jsr299.tck.tests.decorators.invocation;
+import javax.ejb.Stateful;
import javax.inject.Inject;
/**
* @author pmuir
*
*/
+@Stateful
public class PigStyImpl implements PigSty
{
- @Inject Logger logger;
+ @Inject
+ private Pig pig;
+ private static boolean BEAN_CALLED;
+
public void clean()
{
- logger.log(PigSty.MESSAGE);
+ BEAN_CALLED = true;
+ assert pig instanceof Pig;
}
- @Inject Foo foo;
+ public static boolean isBeanCalled()
+ {
+ return BEAN_CALLED;
+ }
- public void washDown()
+ public static void reset()
{
- foo.log(MESSAGE);
+ BEAN_CALLED = false;
}
}
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
===================================================================
---
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-10-17
18:38:09 UTC (rev 4171)
+++
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-10-17
18:38:58 UTC (rev 4172)
@@ -103,7 +103,6 @@
Context requestContext = getCurrentManager().getContext(RequestScoped.class);
CreationalContext<KleinStadt> creationalContext =
getCurrentManager().createCreationalContext(stadtBean);
KleinStadt kassel = stadtBean.create(creationalContext);
- assert requestContext.get(stadtBean) != null : "bean exists in request
context";
kassel.ping();
stadtBean.destroy(kassel, creationalContext);
@@ -120,7 +119,6 @@
})
public void testRemovedEjbIgnored()
{
- assert false;
KleinStadt stadtInstance = getInstanceByType(KleinStadt.class, new
AnnotationLiteral<Important>() {});
assert stadtInstance != null : "Expected instance to be created by
container";
stadtInstance.setName("Kassel-Wilhelmshoehe");