[jboss-cvs] jboss-seam/src/test/unit/org/jboss/seam/test/unit ...

Norman Richards norman.richards at jboss.com
Fri Oct 12 01:08:00 EDT 2007


  User: nrichards
  Date: 07/10/12 01:08:00

  Modified:    src/test/unit/org/jboss/seam/test/unit   testng.xml
  Added:       src/test/unit/org/jboss/seam/test/unit   NamespaceTest.java
  Log:
  JBSEAM-2076
  
  Revision  Changes    Path
  1.2       +1 -0      jboss-seam/src/test/unit/org/jboss/seam/test/unit/testng.xml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: testng.xml
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/test/unit/org/jboss/seam/test/unit/testng.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- testng.xml	8 Oct 2007 18:15:47 -0000	1.1
  +++ testng.xml	12 Oct 2007 05:08:00 -0000	1.2
  @@ -24,6 +24,7 @@
          <class name="org.jboss.seam.test.unit.SeamMockELResolverTest" />
          <class name="org.jboss.seam.test.unit.PageActionsTest" />
          <class name="org.jboss.seam.test.unit.HomeTest" />
  +       <class name="org.jboss.seam.test.unit.NamespaceTest" />
        </classes>
      </test>
   </suite>
  
  
  
  1.1      date: 2007/10/12 05:08:00;  author: nrichards;  state: Exp;jboss-seam/src/test/unit/org/jboss/seam/test/unit/NamespaceTest.java
  
  Index: NamespaceTest.java
  ===================================================================
  package org.jboss.seam.test.unit;
  
  import org.jboss.seam.ScopeType;
  import org.jboss.seam.annotations.Factory;
  import org.jboss.seam.annotations.Name;
  import org.jboss.seam.annotations.Out;
  import org.jboss.seam.core.Init;
  import org.jboss.seam.mock.SeamTest;
  import org.testng.annotations.Test;
  
  public class NamespaceTest 
      extends SeamTest 
  {
      @Override
      protected void startJbossEmbeddedIfNecessary() 
            throws org.jboss.deployers.spi.DeploymentException,
                   java.io.IOException 
      {
         // don't deploy   
      }
      
      
      @Test
      public void nameSpaceComponent() 
          throws Exception 
      {
          new ComponentTest() {
              @Override
              protected void testComponents() throws Exception {
                  assert getValue("#{elTest.fooFactory}") != null;
              }
          }.run();
      }
  
      @Test
      public void nameSpaceFactory() 
          throws Exception 
      {
          new ComponentTest() {
              @Override
              protected void testComponents() throws Exception {
                  assert getValue("#{elTest.ns1.factory}") != null;
              }
          }.run();
      }
      
  
      @Test
      public void namespaceOutjection() 
          throws Exception 
      {
          new ComponentTest() {
              @Override
              protected void testComponents() throws Exception {
                  FooFactory factory = (FooFactory) getValue("#{elTest.fooFactory}");
                  factory.someMethod();
                  assert getValue("#{elTest.ns2.outject}") != null;
              }
          }.run();
      }
  
      
      @Test
      public void factoryMethodExpression() 
          throws Exception 
      {
          new ComponentTest() {
              @Override
              protected void testComponents() throws Exception {
                  Init init = Init.instance();
                  init.addFactoryMethodExpression("elTest.ns3.factory", "#{elTest.fooFactory.createFoo}", ScopeType.SESSION);
                  
                  assert getValue("#{elTest.ns3.factory}") != null;
              }
          }.run();
      }
      
      @Test
      public void factoryValueExpression() 
          throws Exception 
      {
          new ComponentTest() {
              @Override
              protected void testComponents() throws Exception {
                  Init init = Init.instance();
                  init.addFactoryValueExpression("elTest.ns4.factory", "#{elTest.fooFactory.createFoo()}", ScopeType.SESSION);
                  
                  assert getValue("#{elTest.ns4.factory}") != null;
              }
          }.run();
      }
  
  
      @Name("elTest.fooFactory")
      static public class FooFactory {
          public class Foo {}
          
          @Factory("elTest.ns1.factory")
          public Foo createFoo() {
              return new Foo();
          }        
  
          @Out("elTest.ns2.outject")
          public Foo outjectFoo() {
              return new Foo();
          }
          
          public void someMethod() {
          }
      }
     
  }
  
  
  



More information about the jboss-cvs-commits mailing list