[webbeans-commits] Webbeans SVN: r2686 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Fri May 15 10:43:28 EDT 2009
Author: dallen6
Date: 2009-05-15 10:43:28 -0400 (Fri, 15 May 2009)
New Revision: 2686
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/ExplicitContructorSimpleBean.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/InitializerSimpleBean.java
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/WrappedSimpleBean.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/Order.java
Log:
A few more bean impl tests
Copied: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/ExplicitContructorSimpleBean.java (from rev 2685, tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/WrappedSimpleBean.java)
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/ExplicitContructorSimpleBean.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/ExplicitContructorSimpleBean.java 2009-05-15 14:43:28 UTC (rev 2686)
@@ -0,0 +1,29 @@
+package org.jboss.jsr299.tck.tests.implementation.simple.newSimpleBean;
+
+import java.io.Serializable;
+
+import javax.annotation.Named;
+import javax.context.SessionScoped;
+
+ at SessionScoped
+ at Named("Fred")
+class ExplicitContructorSimpleBean implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ private static int constructorCalls = 0;
+
+ public ExplicitContructorSimpleBean() {
+ constructorCalls++;
+ }
+
+ public static int getConstructorCalls()
+ {
+ return constructorCalls;
+ }
+
+ public static void setConstructorCalls(int constructorCalls)
+ {
+ ExplicitContructorSimpleBean.constructorCalls = constructorCalls;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/ExplicitContructorSimpleBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/InitializerSimpleBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/InitializerSimpleBean.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/InitializerSimpleBean.java 2009-05-15 14:43:28 UTC (rev 2686)
@@ -0,0 +1,40 @@
+package org.jboss.jsr299.tck.tests.implementation.simple.newSimpleBean;
+
+import java.io.Serializable;
+
+import javax.annotation.Named;
+import javax.context.SessionScoped;
+import javax.inject.Current;
+import javax.inject.Initializer;
+
+ at SessionScoped
+ at Named("Charlie")
+class InitializerSimpleBean implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ private static int initializerCalls = 0;
+
+ @Current
+ protected Order order;
+
+ @Initializer
+ public void initializer()
+ {
+ initializerCalls++;
+ }
+
+ public void businessMethod()
+ {
+
+ }
+
+ public static int getInitializerCalls()
+ {
+ return initializerCalls;
+ }
+
+ public static void setInitializerCalls(int initializerCalls)
+ {
+ InitializerSimpleBean.initializerCalls = initializerCalls;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/InitializerSimpleBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java 2009-05-13 21:19:31 UTC (rev 2685)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/NewSimpleBeanTest.java 2009-05-15 14:43:28 UTC (rev 2686)
@@ -35,9 +35,9 @@
@SpecAssertion(section = "3.2.5", id = "d")
public void testNewBeanIsDependentScoped()
{
- Set<Bean<WrappedSimpleBean>> beans = getCurrentManager().resolveByType(WrappedSimpleBean.class, new NewLiteral());
+ Set<Bean<ExplicitContructorSimpleBean>> beans = getCurrentManager().resolveByType(ExplicitContructorSimpleBean.class, new NewLiteral());
assert beans.size() == 1;
- Bean<WrappedSimpleBean> newSimpleBean = beans.iterator().next();
+ Bean<ExplicitContructorSimpleBean> newSimpleBean = beans.iterator().next();
assert Dependent.class.equals(newSimpleBean.getScopeType());
}
@@ -45,9 +45,9 @@
@SpecAssertion(section = "3.2.5", id = "e")
public void testNewBeanIsOfStandardDeploymentType()
{
- Set<Bean<WrappedSimpleBean>> beans = getCurrentManager().resolveByType(WrappedSimpleBean.class, new NewLiteral());
+ Set<Bean<ExplicitContructorSimpleBean>> beans = getCurrentManager().resolveByType(ExplicitContructorSimpleBean.class, new NewLiteral());
assert beans.size() == 1;
- Bean<WrappedSimpleBean> newSimpleBean = beans.iterator().next();
+ Bean<ExplicitContructorSimpleBean> newSimpleBean = beans.iterator().next();
assert Standard.class.equals(newSimpleBean.getDeploymentType());
}
@@ -55,9 +55,9 @@
@SpecAssertion(section = "3.2.5", id = "f")
public void testNewBeanHasOnlyNewBinding()
{
- Set<Bean<WrappedSimpleBean>> beans = getCurrentManager().resolveByType(WrappedSimpleBean.class, new NewLiteral());
+ Set<Bean<ExplicitContructorSimpleBean>> beans = getCurrentManager().resolveByType(ExplicitContructorSimpleBean.class, new NewLiteral());
assert beans.size() == 1;
- Bean<WrappedSimpleBean> newSimpleBean = beans.iterator().next();
+ Bean<ExplicitContructorSimpleBean> newSimpleBean = beans.iterator().next();
assert newSimpleBean.getBindings().size() == 1;
assert newSimpleBean.getBindings().iterator().next().annotationType().equals(new NewLiteral().annotationType());
}
@@ -66,9 +66,9 @@
@SpecAssertion(section = "3.2.5", id = "g")
public void testNewBeanHasNoWebBeanName()
{
- Set<Bean<WrappedSimpleBean>> beans = getCurrentManager().resolveByType(WrappedSimpleBean.class, new NewLiteral());
+ Set<Bean<ExplicitContructorSimpleBean>> beans = getCurrentManager().resolveByType(ExplicitContructorSimpleBean.class, new NewLiteral());
assert beans.size() == 1;
- Bean<WrappedSimpleBean> newSimpleBean = beans.iterator().next();
+ Bean<ExplicitContructorSimpleBean> newSimpleBean = beans.iterator().next();
assert newSimpleBean.getName() == null;
}
@@ -141,4 +141,36 @@
assert getCurrentManager().resolveByType(Lion.class, new NewLiteral()).iterator().next().getBindings().iterator().next().annotationType().equals(New.class);
}
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.2.5", id = "ba")
+ public void testNewBeanHasSameConstructor()
+ {
+ ExplicitContructorSimpleBean.setConstructorCalls(0);
+ ExplicitContructorSimpleBean bean = getCurrentManager().getInstanceByType(ExplicitContructorSimpleBean.class);
+ ExplicitContructorSimpleBean newBean = getCurrentManager().getInstanceByType(ExplicitContructorSimpleBean.class, new NewLiteral());
+ assert bean != newBean;
+ assert ExplicitContructorSimpleBean.getConstructorCalls() == 2;
+ }
+
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.2.5", id = "bb")
+ public void testNewBeanHasSameInitializers()
+ {
+ InitializerSimpleBean.setInitializerCalls(0);
+ InitializerSimpleBean bean = getCurrentManager().getInstanceByType(InitializerSimpleBean.class);
+ bean.businessMethod(); // Cause proxy to initialize the bean
+ InitializerSimpleBean newBean = getCurrentManager().getInstanceByType(InitializerSimpleBean.class, new NewLiteral());
+ assert bean != newBean;
+ assert InitializerSimpleBean.getInitializerCalls() == 2;
+ }
+
+ @Test(groups = { "new" })
+ @SpecAssertion(section = "3.2.5", id = "bc")
+ public void testNewBeanHasSameInjectedFields()
+ {
+ Bean<InitializerSimpleBean> simpleBean = getCurrentManager().resolveByType(InitializerSimpleBean.class).iterator().next();
+ Bean<InitializerSimpleBean> newSimpleBean = getCurrentManager().resolveByType(InitializerSimpleBean.class, new NewLiteral()).iterator().next();
+ assert !newSimpleBean.getInjectionPoints().isEmpty();
+ assert simpleBean.getInjectionPoints().equals(newSimpleBean.getInjectionPoints());
+ }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/Order.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/Order.java 2009-05-13 21:19:31 UTC (rev 2685)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/Order.java 2009-05-15 14:43:28 UTC (rev 2686)
@@ -1,11 +1,14 @@
package org.jboss.jsr299.tck.tests.implementation.simple.newSimpleBean;
+import java.io.Serializable;
+
import javax.inject.Production;
@Production
-class Order
+class Order implements Serializable
{
- public static boolean constructed = true;
-
+ private static final long serialVersionUID = 1L;
+ public static boolean constructed = true;
+
}
Deleted: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/WrappedSimpleBean.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/WrappedSimpleBean.java 2009-05-13 21:19:31 UTC (rev 2685)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/newSimpleBean/WrappedSimpleBean.java 2009-05-15 14:43:28 UTC (rev 2686)
@@ -1,15 +0,0 @@
-package org.jboss.jsr299.tck.tests.implementation.simple.newSimpleBean;
-
-import java.io.Serializable;
-
-import javax.annotation.Named;
-import javax.context.SessionScoped;
-
- at SessionScoped
- at Named("Fred")
-class WrappedSimpleBean implements Serializable
-{
- public WrappedSimpleBean() {
-
- }
-}
More information about the weld-commits
mailing list