[webbeans-commits] Webbeans SVN: r221 - in ri/trunk/webbeans-ri/src: main/java/org/jboss/webbeans/contexts and 2 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Mon Nov 3 04:36:42 EST 2008
Author: nickarls
Date: 2008-11-03 04:36:41 -0500 (Mon, 03 Nov 2008)
New Revision: 221
Added:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FinalTuna.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TunedTuna.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/NormalContext.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Tuna.java
Log:
Minor: tests, cleanups
Changed normal contexts destroyed = inactive
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-11-03 07:57:36 UTC (rev 220)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-11-03 09:36:41 UTC (rev 221)
@@ -3,7 +3,6 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/NormalContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/NormalContext.java 2008-11-03 07:57:36 UTC (rev 220)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/contexts/NormalContext.java 2008-11-03 09:36:41 UTC (rev 221)
@@ -14,7 +14,7 @@
{
super(scopeType);
beans = new BeanMap();
- //TODO Are they active at creation?
+ // TODO active on create?
active = true;
}
@@ -24,30 +24,18 @@
{
throw new ContextNotActiveException();
}
-
- //TODO violation of specs. Why not just set active to false in destroy()?
- if (beans == null)
- {
- // Context has been destroyed
- return null;
- }
-
T instance = beans.get(bean);
-
if (instance != null)
{
return instance;
}
-
if (!create)
{
return null;
}
// TODO should bean creation be synchronized?
-
instance = bean.create();
-
beans.put(bean, instance);
return instance;
}
@@ -64,6 +52,7 @@
destroy(manager, bean);
}
beans = new BeanMap();
+ active = false;
}
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java 2008-11-03 07:57:36 UTC (rev 220)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClientProxyTest.java 2008-11-03 09:36:41 UTC (rev 221)
@@ -9,8 +9,10 @@
import javax.webbeans.UnproxyableDependencyException;
import javax.webbeans.manager.Bean;
+import org.jboss.webbeans.test.beans.FinalTuna;
import org.jboss.webbeans.test.beans.Fox;
import org.jboss.webbeans.test.beans.Tuna;
+import org.jboss.webbeans.test.beans.TunedTuna;
import org.jboss.webbeans.test.util.Util;
import org.testng.annotations.Test;
@@ -40,9 +42,9 @@
@SpecAssertion(section = "4.4")
public void testSimpleWebBeanClientProxyIsSerializable()
{
- Bean<Tuna> tunaBean = Util.createSimpleWebBean(Tuna.class, manager);
+ Bean<TunedTuna> tunaBean = Util.createSimpleWebBean(TunedTuna.class, manager);
manager.addBean(tunaBean);
- Tuna tuna = manager.getInstance(tunaBean);
+ TunedTuna tuna = manager.getInstance(tunaBean);
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
ObjectOutputStream out = null;
ObjectInputStream in = null;
@@ -53,7 +55,7 @@
out.flush();
byte[] data = bytes.toByteArray();
in = new ObjectInputStream(new ByteArrayInputStream(data));
- tuna = (Tuna) in.readObject();
+ tuna = (TunedTuna) in.readObject();
assert tuna.getState().equals("tuned");
}
catch (Exception e)
@@ -90,8 +92,9 @@
@SpecAssertion(section = "4.4.1")
public void testInjectionPointWithUnproxyableTypeWhichResolvesToNormalScopedWebBean()
{
- Bean<Tuna> tunaBean = Util.createSimpleWebBean(Tuna.class, manager);
+ Bean<FinalTuna> tunaBean = Util.createSimpleWebBean(FinalTuna.class, manager);
manager.addBean(tunaBean);
+ FinalTuna tuna = manager.getInstanceByType(FinalTuna.class);
assert false;
}
@@ -99,9 +102,9 @@
@SpecAssertion(section = "4.4.2")
public void testClientProxyInvocation()
{
- Bean<Tuna> tunaBean = Util.createSimpleWebBean(Tuna.class, manager);
+ Bean<TunedTuna> tunaBean = Util.createSimpleWebBean(TunedTuna.class, manager);
manager.addBean(tunaBean);
- Tuna tuna = manager.getInstance(tunaBean);
+ TunedTuna tuna = manager.getInstance(tunaBean);
assert tuna.getClass().getName().indexOf("$$_javassist_") > 0;
assert tuna.getState().equals("tuned");
}
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FinalTuna.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FinalTuna.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/FinalTuna.java 2008-11-03 09:36:41 UTC (rev 221)
@@ -0,0 +1,12 @@
+package org.jboss.webbeans.test.beans;
+
+import javax.webbeans.RequestScoped;
+
+import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
+
+ at AnotherDeploymentType
+ at RequestScoped
+public final class FinalTuna
+{
+
+}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Tuna.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Tuna.java 2008-11-03 07:57:36 UTC (rev 220)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/Tuna.java 2008-11-03 09:36:41 UTC (rev 221)
@@ -1,6 +1,5 @@
package org.jboss.webbeans.test.beans;
-import javax.webbeans.Current;
import javax.webbeans.RequestScoped;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
@@ -9,10 +8,5 @@
@RequestScoped
public class Tuna
{
- @Current Animal animal;
-
- public String getState() {
- return "tuned";
- }
}
Added: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TunedTuna.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TunedTuna.java (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/TunedTuna.java 2008-11-03 09:36:41 UTC (rev 221)
@@ -0,0 +1,15 @@
+package org.jboss.webbeans.test.beans;
+
+import javax.webbeans.RequestScoped;
+
+import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
+
+ at AnotherDeploymentType
+ at RequestScoped
+public class TunedTuna
+{
+ public String getState()
+ {
+ return "tuned";
+ }
+}
More information about the weld-commits
mailing list