[webbeans-commits] Webbeans SVN: r1050 - in ri/trunk/webbeans-ri: src/test/java/org/jboss/webbeans and 4 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sat Jan 17 15:20:09 EST 2009


Author: pete.muir at jboss.org
Date: 2009-01-17 15:20:08 -0500 (Sat, 17 Jan 2009)
New Revision: 1050

Added:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Game.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Generator.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Mock.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/MockSentenceTranslator.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Random.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceParser.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceTranslator.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Tests.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/TextTranslator.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Translator.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockApplicationContext.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockDependentContext.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockRequestContext.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockSessionContext.java
Removed:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/annotations/
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/beans/
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Game.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Generator.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Mock.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/MockSentenceTranslator.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Random.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceParser.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceTranslator.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Tests.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/TextTranslator.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Translator.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockApplicationContext.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockDependentContext.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockInitialContext.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockRequestContext.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockSessionContext.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/newbean/
Modified:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java
   ri/trunk/webbeans-ri/unit-tests.xml
Log:
a  bit more cleanup and move stuff a bit

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples (from rev 1047, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples)

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Game.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Game.java	2009-01-17 19:58:42 UTC (rev 1047)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Game.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,20 +0,0 @@
-package org.jboss.webbeans.examples;
-
-import javax.webbeans.Initializer;
-
-public class Game
-{
-   private final int number;
-   
-   @Initializer
-   Game(@Random int number)
-   {
-      this.number = number;
-   }
-
-   public int getNumber()
-   {
-      return number;
-   }
-   
-}

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Game.java (from rev 1049, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Game.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Game.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Game.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.test.examples;
+
+import javax.webbeans.Initializer;
+
+public class Game
+{
+   private final int number;
+   
+   @Initializer
+   Game(@Random int number)
+   {
+      this.number = number;
+   }
+
+   public int getNumber()
+   {
+      return number;
+   }
+   
+}

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Generator.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Generator.java	2009-01-17 19:58:42 UTC (rev 1047)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Generator.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,20 +0,0 @@
-package org.jboss.webbeans.examples;
-
-import javax.webbeans.ApplicationScoped;
-import javax.webbeans.Produces;
-
- at ApplicationScoped
-public class Generator {
-   
-   private java.util.Random random = new java.util.Random( System.currentTimeMillis() ); 
-   
-   java.util.Random getRandom()
-   {
-      return random;
-   }
-   
-   @Produces @Random int next() { 
-      return getRandom().nextInt(100); 
-   }
-
-} 

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Generator.java (from rev 1049, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Generator.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Generator.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Generator.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.test.examples;
+
+import javax.webbeans.ApplicationScoped;
+import javax.webbeans.Produces;
+
+ at ApplicationScoped
+public class Generator {
+   
+   private java.util.Random random = new java.util.Random( System.currentTimeMillis() ); 
+   
+   java.util.Random getRandom()
+   {
+      return random;
+   }
+   
+   @Produces @Random int next() { 
+      return getRandom().nextInt(100); 
+   }
+
+} 

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Mock.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Mock.java	2009-01-17 19:58:42 UTC (rev 1047)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Mock.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,20 +0,0 @@
-package org.jboss.webbeans.examples;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.webbeans.DeploymentType;
-
- at Target( { TYPE, METHOD })
- at Retention(RUNTIME)
- at Documented
- at DeploymentType
-public @interface Mock
-{
-
-}

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Mock.java (from rev 1049, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Mock.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Mock.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Mock.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.test.examples;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.DeploymentType;
+
+ at Target( { TYPE, METHOD })
+ at Retention(RUNTIME)
+ at Documented
+ at DeploymentType
+public @interface Mock
+{
+
+}

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/MockSentenceTranslator.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/MockSentenceTranslator.java	2009-01-17 19:58:42 UTC (rev 1047)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/MockSentenceTranslator.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,8 +0,0 @@
-package org.jboss.webbeans.examples;
-
- at Mock
-public class MockSentenceTranslator implements Translator { 
-   public String translate(String sentence) { 
-      return "Lorem ipsum dolor sit amet"; 
-   }
-} 

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/MockSentenceTranslator.java (from rev 1049, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/MockSentenceTranslator.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/MockSentenceTranslator.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/MockSentenceTranslator.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,8 @@
+package org.jboss.webbeans.test.examples;
+
+ at Mock
+public class MockSentenceTranslator implements Translator { 
+   public String translate(String sentence) { 
+      return "Lorem ipsum dolor sit amet"; 
+   }
+} 

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Random.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Random.java	2009-01-17 19:58:42 UTC (rev 1047)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Random.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,22 +0,0 @@
-package org.jboss.webbeans.examples;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.webbeans.BindingType;
-
- at Target( { TYPE, METHOD, PARAMETER, FIELD })
- at Retention(RUNTIME)
- at Documented
- at BindingType
-public @interface Random
-{
-
-}

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Random.java (from rev 1049, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Random.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Random.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Random.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,22 @@
+package org.jboss.webbeans.test.examples;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.webbeans.BindingType;
+
+ at Target( { TYPE, METHOD, PARAMETER, FIELD })
+ at Retention(RUNTIME)
+ at Documented
+ at BindingType
+public @interface Random
+{
+
+}

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceParser.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/SentenceParser.java	2009-01-17 19:58:42 UTC (rev 1047)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceParser.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,10 +0,0 @@
-package org.jboss.webbeans.examples;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class SentenceParser { 
-   public List<String> parse(String text) {
-      return Arrays.asList( text.split("[.?]") );
-   } 
-} 

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceParser.java (from rev 1049, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/SentenceParser.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceParser.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceParser.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.test.examples;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class SentenceParser { 
+   public List<String> parse(String text) {
+      return Arrays.asList( text.split("[.?]") );
+   } 
+} 

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceTranslator.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/SentenceTranslator.java	2009-01-17 19:58:42 UTC (rev 1047)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceTranslator.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,10 +0,0 @@
-package org.jboss.webbeans.examples;
-
-import javax.ejb.Stateless;
-
- at Stateless
-public class SentenceTranslator implements Translator { 
-public String translate(String sentence) { 
-   throw new UnsupportedOperationException();
-} 
-}
\ No newline at end of file

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceTranslator.java (from rev 1049, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/SentenceTranslator.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceTranslator.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/SentenceTranslator.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,10 @@
+package org.jboss.webbeans.test.examples;
+
+import javax.ejb.Stateless;
+
+ at Stateless
+public class SentenceTranslator implements Translator { 
+public String translate(String sentence) { 
+   throw new UnsupportedOperationException();
+} 
+}
\ No newline at end of file

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Tests.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Tests.java	2009-01-17 19:58:42 UTC (rev 1047)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Tests.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,107 +0,0 @@
-package org.jboss.webbeans.examples;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-
-import javax.webbeans.Production;
-import javax.webbeans.Standard;
-
-import org.jboss.webbeans.bean.ProducerMethodBean;
-import org.jboss.webbeans.bean.SimpleBean;
-import org.jboss.webbeans.context.DependentContext;
-import org.jboss.webbeans.test.AbstractTest;
-import org.testng.annotations.Test;
-
-public class Tests extends AbstractTest
-{
-   @Test
-   public void testGameGenerator() throws Exception {
-     setupGameGenerator();
-     
-     try
-     {
-        DependentContext.INSTANCE.setActive(true);
-        Game game1 = manager.getInstanceByType(Game.class);
-        Game game2 = manager.getInstanceByType(Game.class);
-        assert game1!=game2;
-        assert game1.getNumber()!=game2.getNumber();
-        Generator gen1 = manager.getInstanceByType(Generator.class);
-        Generator gen2 = manager.getInstanceByType(Generator.class);
-        assert gen1.getRandom()!=null;
-        assert gen1.getRandom()==gen2.getRandom();
-     }
-     finally
-     {
-        DependentContext.INSTANCE.setActive(false);
-     }
-   }
-
-   private void setupGameGenerator() throws NoSuchMethodException
-   {
-      SimpleBean<Game> gameBean = SimpleBean.of(Game.class, manager);
-      SimpleBean<Generator> generatorBean = SimpleBean.of(Generator.class, manager);
-      Method method = Generator.class.getDeclaredMethod("next");
-      method.setAccessible(true);
-      ProducerMethodBean<Integer> nextBean = ProducerMethodBean.of(method, generatorBean, manager);
-        
-      manager.addBean(gameBean);
-      manager.addBean(generatorBean);
-      manager.addBean(nextBean);
-   }
-   
-   @Test
-   public void testMockSentenceTranslator() throws Exception {
-      setupTextTranslator();
-      
-      manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class, Production.class, Mock.class));
-      
-      try
-      {
-         DependentContext.INSTANCE.setActive(true);
-         TextTranslator tt2 = manager.getInstanceByType(TextTranslator.class);
-         assert "Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.".equals( tt2.translate("Hello world. How's tricks?") );
-      }
-      finally
-      {
-         DependentContext.INSTANCE.setActive(false);
-      }      
-   }
-
-   @Test
-   public void testSentenceTranslator() throws Exception {
-      setupTextTranslator();
-      
-      try
-      {
-         DependentContext.INSTANCE.setActive(true);
-         TextTranslator tt1 = manager.getInstanceByType(TextTranslator.class);
-         try 
-         {
-            tt1.translate("hello world");
-            assert false;
-         }
-         catch (UnsupportedOperationException uoe)
-         {
-            //expected
-         }
-      }
-      finally
-      {
-         DependentContext.INSTANCE.setActive(false);
-      }
-   }
-   
-   private void setupTextTranslator()
-   {
-      SimpleBean<SentenceParser> spBean = SimpleBean.of(SentenceParser.class, manager);
-      SimpleBean<SentenceTranslator> stBean = SimpleBean.of(SentenceTranslator.class, manager);
-      SimpleBean<MockSentenceTranslator> mstBean = SimpleBean.of(MockSentenceTranslator.class, manager);
-      SimpleBean<TextTranslator> ttBean = SimpleBean.of(TextTranslator.class, manager);
-      
-      manager.addBean(spBean);
-      manager.addBean(stBean);
-      manager.addBean(mstBean);
-      manager.addBean(ttBean);
-   }
-   
-}

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Tests.java (from rev 1049, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Tests.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Tests.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Tests.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,107 @@
+package org.jboss.webbeans.test.examples;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+
+import javax.webbeans.Production;
+import javax.webbeans.Standard;
+
+import org.jboss.webbeans.bean.ProducerMethodBean;
+import org.jboss.webbeans.bean.SimpleBean;
+import org.jboss.webbeans.context.DependentContext;
+import org.jboss.webbeans.test.unit.AbstractTest;
+import org.testng.annotations.Test;
+
+public class Tests extends AbstractTest
+{
+   @Test
+   public void testGameGenerator() throws Exception {
+     setupGameGenerator();
+     
+     try
+     {
+        DependentContext.INSTANCE.setActive(true);
+        Game game1 = manager.getInstanceByType(Game.class);
+        Game game2 = manager.getInstanceByType(Game.class);
+        assert game1!=game2;
+        assert game1.getNumber()!=game2.getNumber();
+        Generator gen1 = manager.getInstanceByType(Generator.class);
+        Generator gen2 = manager.getInstanceByType(Generator.class);
+        assert gen1.getRandom()!=null;
+        assert gen1.getRandom()==gen2.getRandom();
+     }
+     finally
+     {
+        DependentContext.INSTANCE.setActive(false);
+     }
+   }
+
+   private void setupGameGenerator() throws NoSuchMethodException
+   {
+      SimpleBean<Game> gameBean = SimpleBean.of(Game.class, manager);
+      SimpleBean<Generator> generatorBean = SimpleBean.of(Generator.class, manager);
+      Method method = Generator.class.getDeclaredMethod("next");
+      method.setAccessible(true);
+      ProducerMethodBean<Integer> nextBean = ProducerMethodBean.of(method, generatorBean, manager);
+        
+      manager.addBean(gameBean);
+      manager.addBean(generatorBean);
+      manager.addBean(nextBean);
+   }
+   
+   @Test
+   public void testMockSentenceTranslator() throws Exception {
+      setupTextTranslator();
+      
+      manager.setEnabledDeploymentTypes(Arrays.asList(Standard.class, Production.class, Mock.class));
+      
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         TextTranslator tt2 = manager.getInstanceByType(TextTranslator.class);
+         assert "Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.".equals( tt2.translate("Hello world. How's tricks?") );
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }      
+   }
+
+   @Test
+   public void testSentenceTranslator() throws Exception {
+      setupTextTranslator();
+      
+      try
+      {
+         DependentContext.INSTANCE.setActive(true);
+         TextTranslator tt1 = manager.getInstanceByType(TextTranslator.class);
+         try 
+         {
+            tt1.translate("hello world");
+            assert false;
+         }
+         catch (UnsupportedOperationException uoe)
+         {
+            //expected
+         }
+      }
+      finally
+      {
+         DependentContext.INSTANCE.setActive(false);
+      }
+   }
+   
+   private void setupTextTranslator()
+   {
+      SimpleBean<SentenceParser> spBean = SimpleBean.of(SentenceParser.class, manager);
+      SimpleBean<SentenceTranslator> stBean = SimpleBean.of(SentenceTranslator.class, manager);
+      SimpleBean<MockSentenceTranslator> mstBean = SimpleBean.of(MockSentenceTranslator.class, manager);
+      SimpleBean<TextTranslator> ttBean = SimpleBean.of(TextTranslator.class, manager);
+      
+      manager.addBean(spBean);
+      manager.addBean(stBean);
+      manager.addBean(mstBean);
+      manager.addBean(ttBean);
+   }
+   
+}

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/TextTranslator.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/TextTranslator.java	2009-01-17 19:58:42 UTC (rev 1047)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/TextTranslator.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,23 +0,0 @@
-package org.jboss.webbeans.examples;
-
-import javax.webbeans.Initializer;
-
-public class TextTranslator { 
-   private SentenceParser sentenceParser; 
-   private Translator sentenceTranslator; 
-   
-   @Initializer
-   TextTranslator(SentenceParser sentenceParser, Translator sentenceTranslator) { 
-      this.sentenceParser = sentenceParser; 
-      this.sentenceTranslator = sentenceTranslator; 
-   }
-   
-   public String translate(String text) { 
-      StringBuilder sb = new StringBuilder(); 
-      for (String sentence: sentenceParser.parse(text)) { 
-         sb.append(sentenceTranslator.translate(sentence)).append(". "); 
-      } 
-      return sb.toString().trim(); 
-   }
-   
-}
\ No newline at end of file

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/TextTranslator.java (from rev 1049, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/TextTranslator.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/TextTranslator.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/TextTranslator.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,23 @@
+package org.jboss.webbeans.test.examples;
+
+import javax.webbeans.Initializer;
+
+public class TextTranslator { 
+   private SentenceParser sentenceParser; 
+   private Translator sentenceTranslator; 
+   
+   @Initializer
+   TextTranslator(SentenceParser sentenceParser, Translator sentenceTranslator) { 
+      this.sentenceParser = sentenceParser; 
+      this.sentenceTranslator = sentenceTranslator; 
+   }
+   
+   public String translate(String text) { 
+      StringBuilder sb = new StringBuilder(); 
+      for (String sentence: sentenceParser.parse(text)) { 
+         sb.append(sentenceTranslator.translate(sentence)).append(". "); 
+      } 
+      return sb.toString().trim(); 
+   }
+   
+}
\ No newline at end of file

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Translator.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Translator.java	2009-01-17 19:58:42 UTC (rev 1047)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Translator.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,8 +0,0 @@
-package org.jboss.webbeans.examples;
-
-import javax.ejb.Local;
-
- at Local 
-public interface Translator { 
-   public String translate(String sentence); 
-}

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Translator.java (from rev 1049, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/examples/Translator.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Translator.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/examples/Translator.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,8 @@
+package org.jboss.webbeans.test.examples;
+
+import javax.ejb.Local;
+
+ at Local 
+public interface Translator { 
+   public String translate(String sentence); 
+}

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockApplicationContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockApplicationContext.java	2009-01-17 20:11:52 UTC (rev 1049)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockApplicationContext.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,16 +0,0 @@
-package org.jboss.webbeans.test.mock;
-
-import org.jboss.webbeans.context.ApplicationContext;
-import org.jboss.webbeans.context.beanmap.SimpleBeanMap;
-
-public class MockApplicationContext extends ApplicationContext
-{
-   
-   public MockApplicationContext()
-   {
-      super();
-      ApplicationContext.INSTANCE = this;
-      setBeanMap(new SimpleBeanMap());
-   }
-   
-}

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java	2009-01-17 20:11:52 UTC (rev 1049)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockBootstrap.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -22,6 +22,10 @@
 import org.jboss.webbeans.resource.AbstractNaming;
 import org.jboss.webbeans.resources.spi.Naming;
 import org.jboss.webbeans.resources.spi.ResourceLoader;
+import org.jboss.webbeans.test.mock.context.MockApplicationContext;
+import org.jboss.webbeans.test.mock.context.MockDependentContext;
+import org.jboss.webbeans.test.mock.context.MockRequestContext;
+import org.jboss.webbeans.test.mock.context.MockSessionContext;
 
 public class MockBootstrap extends WebBeansBootstrap
 { 

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockDependentContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockDependentContext.java	2009-01-17 20:11:52 UTC (rev 1049)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockDependentContext.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,14 +0,0 @@
-package org.jboss.webbeans.test.mock;
-
-import org.jboss.webbeans.context.DependentContext;
-
-public class MockDependentContext extends DependentContext
-{
-   
-   public MockDependentContext()
-   {
-      super();
-      DependentContext.INSTANCE = this;
-   }
-   
-}

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockInitialContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockInitialContext.java	2009-01-17 20:11:52 UTC (rev 1049)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockInitialContext.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,17 +0,0 @@
-package org.jboss.webbeans.test.mock;
-
-import java.util.Hashtable;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-public class MockInitialContext extends InitialContext
-{
-
-   public MockInitialContext(Hashtable<?, ?> arg0) throws NamingException
-   {
-      super(arg0);
-      // TODO Auto-generated constructor stub
-   }
-   
-}

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockRequestContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockRequestContext.java	2009-01-17 20:11:52 UTC (rev 1049)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockRequestContext.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,14 +0,0 @@
-package org.jboss.webbeans.test.mock;
-
-import org.jboss.webbeans.context.RequestContext;
-
-public class MockRequestContext extends RequestContext
-{
-   
-   public MockRequestContext()
-   {
-      super();
-      RequestContext.INSTANCE = this;
-   }
-   
-}

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockSessionContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockSessionContext.java	2009-01-17 20:11:52 UTC (rev 1049)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockSessionContext.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -1,16 +0,0 @@
-package org.jboss.webbeans.test.mock;
-
-import org.jboss.webbeans.context.SessionContext;
-import org.jboss.webbeans.context.beanmap.SimpleBeanMap;
-
-public class MockSessionContext extends SessionContext
-{
-   
-   public MockSessionContext()
-   {
-      super();
-      SessionContext.INSTANCE = this;
-      setBeanMap(new SimpleBeanMap());
-   }
-   
-}

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockApplicationContext.java (from rev 1047, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockApplicationContext.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockApplicationContext.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockApplicationContext.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,16 @@
+package org.jboss.webbeans.test.mock.context;
+
+import org.jboss.webbeans.context.ApplicationContext;
+import org.jboss.webbeans.context.beanmap.SimpleBeanMap;
+
+public class MockApplicationContext extends ApplicationContext
+{
+   
+   public MockApplicationContext()
+   {
+      super();
+      ApplicationContext.INSTANCE = this;
+      setBeanMap(new SimpleBeanMap());
+   }
+   
+}


Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockApplicationContext.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockDependentContext.java (from rev 1047, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockDependentContext.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockDependentContext.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockDependentContext.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.mock.context;
+
+import org.jboss.webbeans.context.DependentContext;
+
+public class MockDependentContext extends DependentContext
+{
+   
+   public MockDependentContext()
+   {
+      super();
+      DependentContext.INSTANCE = this;
+   }
+   
+}


Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockDependentContext.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockRequestContext.java (from rev 1047, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockRequestContext.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockRequestContext.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockRequestContext.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,14 @@
+package org.jboss.webbeans.test.mock.context;
+
+import org.jboss.webbeans.context.RequestContext;
+
+public class MockRequestContext extends RequestContext
+{
+   
+   public MockRequestContext()
+   {
+      super();
+      RequestContext.INSTANCE = this;
+   }
+   
+}


Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockRequestContext.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockSessionContext.java (from rev 1047, ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockSessionContext.java)
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockSessionContext.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockSessionContext.java	2009-01-17 20:20:08 UTC (rev 1050)
@@ -0,0 +1,16 @@
+package org.jboss.webbeans.test.mock.context;
+
+import org.jboss.webbeans.context.SessionContext;
+import org.jboss.webbeans.context.beanmap.SimpleBeanMap;
+
+public class MockSessionContext extends SessionContext
+{
+   
+   public MockSessionContext()
+   {
+      super();
+      SessionContext.INSTANCE = this;
+      setBeanMap(new SimpleBeanMap());
+   }
+   
+}


Property changes on: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/context/MockSessionContext.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/webbeans-ri/unit-tests.xml
===================================================================
--- ri/trunk/webbeans-ri/unit-tests.xml	2009-01-17 20:11:52 UTC (rev 1049)
+++ ri/trunk/webbeans-ri/unit-tests.xml	2009-01-17 20:20:08 UTC (rev 1050)
@@ -33,8 +33,7 @@
          </run>
       </groups>
       <packages>
-         <package name="org.jboss.webbeans.test" />
-         <package name="org.jboss.webbeans.examples" />
+         <package name="org.jboss.webbeans.test.examples" />
          <package name="org.jboss.webbeans.test.unit.bootstrap" />
          <package name="org.jboss.webbeans.test.unit.context" />
          <package name="org.jboss.webbeans.test.unit.definition" />




More information about the weld-commits mailing list