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

Peter Muir peter at bleepbleep.org.uk
Thu Oct 11 11:07:31 EDT 2007


  User: pmuir   
  Date: 07/10/11 11:07:30

  Modified:    src/test/integration/src/org/jboss/seam/test/integration       
                        PageContextTest.java testng.xml
  Added:       src/test/integration/src/org/jboss/seam/test/integration       
                        CountryHome.java EventTest.java Country.java
                        IdentifierTest.java
  Removed:     src/test/integration/src/org/jboss/seam/test/integration       
                        MiscTests.java
  Log:
  Add identifier tests and reorganise
  
  Revision  Changes    Path
  1.2       +5 -0      jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/PageContextTest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PageContextTest.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/PageContextTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- PageContextTest.java	8 Oct 2007 18:15:48 -0000	1.1
  +++ PageContextTest.java	11 Oct 2007 15:07:30 -0000	1.2
  @@ -4,6 +4,11 @@
   import org.jboss.seam.mock.SeamTest;
   import org.testng.annotations.Test;
   
  +/**
  + * 
  + * @author Pete Muir
  + *
  + */
   public class PageContextTest extends SeamTest
   {
   
  
  
  
  1.3       +21 -5     jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/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/integration/src/org/jboss/seam/test/integration/testng.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- testng.xml	10 Oct 2007 23:08:47 -0000	1.2
  +++ testng.xml	11 Oct 2007 15:07:30 -0000	1.3
  @@ -2,11 +2,27 @@
   
   <suite name="Seam Core Tests" verbose="2" parallel="false">
   
  -   <test name="Integration">
  +   <test name="Seam Core - Integration: Contexts">
        <classes>
  -       <class name="org.jboss.seam.test.integration.EntityTest"/>
          <class name="org.jboss.seam.test.integration.PageContextTest"/>
  -       <class name="org.jboss.seam.test.integration.MiscTests"/>
  +     </classes>
  +   </test>
  +   
  +   <test name="Seam Core - Integration: Persistence">
  +     <classes>
  +       <class name="org.jboss.seam.test.integration.EntityTest"/>
  +     </classes>
  +   </test>
  +   
  +   <test name="Seam Core - Integration: Events">
  +     <classes>
  +       <class name="org.jboss.seam.test.integration.EventTest"/>
  +     </classes>
  +   </test>
  +   
  +   <test name="Seam Core - Integration: Framework">
  +     <classes>
  +       <class name="org.jboss.seam.test.integration.IdentifierTest"/>
        </classes>
      </test>
   	
  
  
  
  1.1      date: 2007/10/11 15:07:30;  author: pmuir;  state: Exp;jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/CountryHome.java
  
  Index: CountryHome.java
  ===================================================================
  package org.jboss.seam.test.integration;
  
  import org.jboss.seam.annotations.Name;
  import org.jboss.seam.framework.EntityHome;
  
  /**
   * @author Pete Muir
   *
   */
  @Name("countryHome")
  public class CountryHome extends EntityHome<Country>
  {
  
  }
  
  
  
  1.1      date: 2007/10/11 15:07:30;  author: pmuir;  state: Exp;jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/EventTest.java
  
  Index: EventTest.java
  ===================================================================
  package org.jboss.seam.test.integration;
  
  import org.jboss.seam.Component;
  import org.jboss.seam.core.Events;
  import org.jboss.seam.mock.SeamTest;
  import org.testng.annotations.Test;
  
  
  /**
   * 
   * @author Pete Muir
   *
   */
  public class EventTest extends SeamTest {
  
      @Test
      public void testEventChain() throws Exception {
  
          new FacesRequest("/index.xhtml") {
  
              @Override
              protected void invokeApplication() throws Exception {
                  BeanA beanA = (BeanA) Component.getInstance("beanA");
                  BeanB beanB = (BeanB) Component.getInstance("beanB");
  
                  assert "Foo".equals(beanA.getMyValue());
                  assert beanB.getMyValue() == null;
  
                  Events.instance().raiseEvent("BeanA.refreshMyValue");
  
                  beanA = (BeanA) Component.getInstance("beanA");
                  
                  assert "Bar".equals(beanA.getMyValue());        
              }
              
              @Override
              protected void renderResponse() throws Exception
              {
                 BeanB beanB = (BeanB) Component.getInstance("beanB");
                 assert "Bar".equals(beanB.getMyValue());
              }
          }.run();
      }
  
  }
  
  
  
  
  
  1.1      date: 2007/10/11 15:07:30;  author: pmuir;  state: Exp;jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/Country.java
  
  Index: Country.java
  ===================================================================
  package org.jboss.seam.test.integration;
  
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.Id;
  
  /**
   * @author Pete Muir
   *
   */
  @Entity
  public class Country
  {
  
      @Id @GeneratedValue
      private Integer id;
      
      private String name;
  
      /**
       * @return the id
       */
      public Integer getId()
      {
          return this.id;
      }
  
      /**
       * @param id the id to set
       */
      public void setId(Integer id)
      {
          this.id = id;
      }
  
      /**
       * @return the name
       */
      public String getName()
      {
          return this.name;
      }
  
      /**
       * @param name the name to set
       */
      public void setName(String name)
      {
          this.name = name;
      }
      
      
      
  }
  
  
  
  1.1      date: 2007/10/11 15:07:30;  author: pmuir;  state: Exp;jboss-seam/src/test/integration/src/org/jboss/seam/test/integration/IdentifierTest.java
  
  Index: IdentifierTest.java
  ===================================================================
  package org.jboss.seam.test.integration;
  
  import javax.persistence.EntityManager;
  
  import org.drools.lang.DRLParser.identifier_return;
  import org.jboss.seam.framework.EntityIdentifier;
  import org.jboss.seam.mock.SeamTest;
  import org.testng.annotations.Test;
  
  /**
   * @author Pete Muir
   *
   */
  public class IdentifierTest extends SeamTest
  {
  
      @Test
      public void testEntityIdentifier() throws Exception
      {
          new ComponentTest()
          {
  
              @Override
              protected void testComponents() throws Exception
              {
                  setValue("#{countryHome.instance.name}", "foo");
                  invokeMethod("#{countryHome.persist}");
                  Country country = (Country) getValue("#{countryHome.instance}");
                  EntityManager entityManager = (EntityManager) getValue("#{countryHome.entityManager}");
                  
                  EntityIdentifier entityIdentifier = new EntityIdentifier(country, entityManager);
                  assert "foo".equals(((Country) entityIdentifier.find(entityManager)).getName());
                  EntityIdentifier entityIdentifier2 = new EntityIdentifier(country, entityManager);
                  assert entityIdentifier.equals(entityIdentifier2);
              }
              
          }.run();
      }
      
  }
  
  
  



More information about the jboss-cvs-commits mailing list