weaver      2004/05/27 12:44:20

  Modified:    
components/registry/src/test/org/apache/jetspeed/components/portletregistry
                        TestRegistryDirect.java
                        TestRegistryDirectPart2.java
               
components/registry/src/test/org/apache/jetspeed/components/portletentity
                        TestPortletEntityAccessComponent.java
  Log:
  JS2-59 <http://nagoya.apache.org/jira/browse/JS2-59>
  
  Revision  Changes    Path
  1.8       +11 -22    
jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/TestRegistryDirect.java
  
  Index: TestRegistryDirect.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/TestRegistryDirect.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestRegistryDirect.java   7 May 2004 13:42:14 -0000       1.7
  +++ TestRegistryDirect.java   27 May 2004 19:44:20 -0000      1.8
  @@ -20,15 +20,12 @@
   import javax.portlet.PortletMode;
   
   import junit.framework.Test;
  +import junit.framework.TestSuite;
   
  -import org.apache.jetspeed.om.impl.UserAttributeImpl;
  -import org.apache.jetspeed.components.AbstractComponentAwareTestCase;
  -import org.apache.jetspeed.components.ComponentAwareTestSuite;
   import org.apache.jetspeed.components.persistence.store.Filter;
   import org.apache.jetspeed.components.persistence.store.PersistenceStore;
   import org.apache.jetspeed.components.persistence.store.impl.LockFailedException;
  -import org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent;
  -import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent;
  +import 
org.apache.jetspeed.components.persistence.store.util.PersistenceSupportedTestCase;
   import org.apache.jetspeed.om.common.DublinCore;
   import org.apache.jetspeed.om.common.GenericMetadata;
   import org.apache.jetspeed.om.common.UserAttribute;
  @@ -36,13 +33,13 @@
   import org.apache.jetspeed.om.common.portlet.ContentTypeComposite;
   import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
   import org.apache.jetspeed.om.common.preference.PreferenceComposite;
  +import org.apache.jetspeed.om.impl.UserAttributeImpl;
   import org.apache.jetspeed.om.portlet.impl.ContentTypeImpl;
   import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
   import org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl;
   import org.apache.jetspeed.om.preference.impl.DefaultPreferenceImpl;
   import org.apache.jetspeed.om.servlet.impl.WebApplicationDefinitionImpl;
   import org.apache.jetspeed.util.JetspeedLocale;
  -import org.picocontainer.MutablePicoContainer;
   
   /**
    * 
  @@ -53,10 +50,9 @@
    * @version $Id$
    *  
    */
  -public class TestRegistryDirect extends AbstractComponentAwareTestCase
  +public class TestRegistryDirect extends PersistenceSupportedTestCase
   {
   
  -    private MutablePicoContainer container;
       private static final String PORTLET_0_CLASS = "com.portlet.MyClass0";
       private static final String PORTLET_0_NAME = "Portlet 0";
       private static final String PORTLET_1_CLASS = "com.portlet.MyClass";
  @@ -71,10 +67,6 @@
       private static PortletRegistryComponent registry;
       private static PersistenceStore store;
   
  -    public void testContainer()
  -    {
  -        assertNotNull(container);
  -    }
   
       /*
        * (non-Javadoc)
  @@ -84,8 +76,8 @@
       protected void setUp() throws Exception
       {
           super.setUp();
  -        container = (MutablePicoContainer) getContainer();
  -        registry = (PortletRegistryComponent) 
container.getComponentInstance(PortletRegistryComponent.class);
  +        
  +        registry = new PortletRegistryComponentImpl(persistenceStore);
           store = registry.getPersistenceStore();
   
           testPasses++;
  @@ -98,16 +90,13 @@
        */
       protected void tearDown() throws Exception
       {
  -
           super.tearDown();
       }
   
       public static Test suite()
       {
  -        ComponentAwareTestSuite suite = new 
ComponentAwareTestSuite(TestRegistryDirect.class);
  -        suite.setScript("org/apache/jetspeed/containers/test.registry.groovy");
  -
  -        return suite;
  +        // All methods starting with "test" will be executed in the test suite.
  +        return new TestSuite(TestRegistryDirect.class);
       }
   
       /**
  @@ -115,13 +104,13 @@
        */
       public TestRegistryDirect(String testName)
       {
  -        super(testName, "./src/test/Log4j.properties");
  +        super(testName);
       }
   
       public void test001() throws Exception
       {
           // Create an Application and a Web app
  -        
assertNotNull(getContainer().getComponentInstanceOfType(PortletEntityAccessComponent.class));
  +        
           store.getTransaction().begin();
           PortletApplicationDefinitionImpl app = new 
PortletApplicationDefinitionImpl();
           app.setName("App_1");
  
  
  
  1.10      +20 -21    
jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/TestRegistryDirectPart2.java
  
  Index: TestRegistryDirectPart2.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/TestRegistryDirectPart2.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- TestRegistryDirectPart2.java      18 May 2004 21:18:46 -0000      1.9
  +++ TestRegistryDirectPart2.java      27 May 2004 19:44:20 -0000      1.10
  @@ -18,23 +18,20 @@
   import java.util.Locale;
   
   import junit.framework.Test;
  +import junit.framework.TestSuite;
   
  -import org.apache.jetspeed.components.AbstractComponentAwareTestCase;
  -import org.apache.jetspeed.components.ComponentAwareTestSuite;
   import org.apache.jetspeed.components.persistence.store.Filter;
   import org.apache.jetspeed.components.persistence.store.PersistenceStore;
   import org.apache.jetspeed.components.persistence.store.impl.LockFailedException;
  -import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent;
  +import 
org.apache.jetspeed.components.persistence.store.util.PersistenceSupportedTestCase;
   import org.apache.jetspeed.om.common.GenericMetadata;
   import org.apache.jetspeed.om.common.impl.DublinCoreImpl;
  -import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
   import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
  +import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
   import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
   import org.apache.jetspeed.om.servlet.impl.WebApplicationDefinitionImpl;
  -
   import org.apache.pluto.om.common.ObjectID;
  -
  -import org.picocontainer.MutablePicoContainer;
  +import org.apache.pluto.om.portlet.PortletApplicationDefinition;
   
   /**
    * 
  @@ -45,10 +42,9 @@
    * @version $Id$
    *  
    */
  -public class TestRegistryDirectPart2 extends AbstractComponentAwareTestCase
  +public class TestRegistryDirectPart2 extends PersistenceSupportedTestCase
   {
   
  -    private MutablePicoContainer container;
       private static final String PORTLET_0_CLASS = "com.portlet.MyClass0";
       private static final String PORTLET_0_NAME = "Portlet 0";
       private static final String PORTLET_1_CLASS = "com.portlet.MyClass";
  @@ -63,10 +59,6 @@
       private static PortletRegistryComponent registry;
       private static PersistenceStore store;
   
  -    public void testContainer()
  -    {
  -        assertNotNull(container);
  -    }
   
       /*
        * (non-Javadoc)
  @@ -76,8 +68,7 @@
       protected void setUp() throws Exception
       {
           super.setUp();
  -        container = (MutablePicoContainer) getContainer();
  -        registry = (PortletRegistryComponent) 
container.getComponentInstance(PortletRegistryComponent.class);
  +        registry = new PortletRegistryComponentImpl(persistenceStore);
           store = registry.getPersistenceStore();
   
           testPasses++;
  @@ -90,15 +81,23 @@
        */
       protected void tearDown() throws Exception
       {
  -
  +        PersistenceStore store = registry.getPersistenceStore();
  +        store.getTransaction().begin();
  +        
  +        Iterator itr = registry.getPortletApplications().iterator();
  +        while(itr.hasNext())
  +        {        
  +            registry.removeApplication((PortletApplicationDefinition)itr.next());
  +        }
  +        
  +        store.getTransaction().commit(); 
           super.tearDown();
       }
   
       public static Test suite()
       {
  -        ComponentAwareTestSuite suite = new 
ComponentAwareTestSuite(TestRegistryDirectPart2.class);
  -        suite.setScript("org/apache/jetspeed/containers/test.registry.groovy");
  -        return suite;
  +        // All methods starting with "test" will be executed in the test suite.
  +        return new TestSuite(TestRegistryDirectPart2.class);
       }
   
       /**
  @@ -106,7 +105,7 @@
        */
       public TestRegistryDirectPart2(String testName)
       {
  -        super(testName, "./src/test/Log4j.properties");
  +        super(testName);
       }
   
       public void test001() throws Exception
  
  
  
  1.5       +19 -25    
jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityAccessComponent.java
  
  Index: TestPortletEntityAccessComponent.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletentity/TestPortletEntityAccessComponent.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TestPortletEntityAccessComponent.java     24 Apr 2004 19:05:54 -0000      1.4
  +++ TestPortletEntityAccessComponent.java     27 May 2004 19:44:20 -0000      1.5
  @@ -19,11 +19,12 @@
   import java.util.Locale;
   
   import junit.framework.Test;
  +import junit.framework.TestSuite;
   
  -import org.apache.jetspeed.components.AbstractComponentAwareTestCase;
  -import org.apache.jetspeed.components.ComponentAwareTestSuite;
   import org.apache.jetspeed.components.persistence.store.PersistenceStore;
  +import 
org.apache.jetspeed.components.persistence.store.util.PersistenceSupportedTestCase;
   import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent;
  +import org.apache.jetspeed.components.portletregistry.PortletRegistryComponentImpl;
   import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
   import org.apache.jetspeed.om.portlet.impl.PortletApplicationDefinitionImpl;
   import org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl;
  @@ -32,7 +33,6 @@
   import org.apache.pluto.om.portlet.PortletApplicationDefinition;
   import org.apache.pluto.om.portlet.PortletDefinition;
   import org.apache.pluto.om.portlet.PortletDefinitionList;
  -import org.picocontainer.MutablePicoContainer;
   
   /**
    * Test Portlet Entity Accessor
  @@ -40,11 +40,11 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
    * @version $Id$
    */
  -public class TestPortletEntityAccessComponent extends 
AbstractComponentAwareTestCase 
  +public class TestPortletEntityAccessComponent extends PersistenceSupportedTestCase 
   {
  -    private static MutablePicoContainer container = null;
  -    private static PortletEntityAccessComponent entityAccess = null;
  -    private static PortletRegistryComponent registry = null;
  +    
  +    private  PortletEntityAccessComponent entityAccess = null;
  +    private  PortletRegistryComponent registry = null;
       private static final String TEST_APP = "EntityTestApp";
       private static final String TEST_PORTLET = "EntityTestPortlet";
       private static final String TEST_ENTITY = "user5/entity-9";
  @@ -57,12 +57,10 @@
       protected void setUp() throws Exception
       {        
           super.setUp();
  -        if (container == null)
  -        {
  -            container = (MutablePicoContainer) getContainer();
  -            entityAccess = (PortletEntityAccessComponent) 
container.getComponentInstance(PortletEntityAccessComponent.class);
  -            registry = (PortletRegistryComponent) 
container.getComponentInstance(PortletRegistryComponent.class);
  -        }
  +    
  +            entityAccess = new PortletEntityAccessComponentImpl(persistenceStore);
  +            registry = new PortletRegistryComponentImpl(persistenceStore);
  +        
           setupTestData();                   
       }
   
  @@ -72,19 +70,16 @@
        * @see junit.framework.TestCase#tearDown()
        */
       protected void tearDown() throws Exception
  -    {        
  +    {                
  +        teardownTestData();
           super.tearDown();
  -        teardownTestData();        
       }
   
  -    public static Test suite()
  +   public static Test suite()
       {
  -        ComponentAwareTestSuite suite = new 
ComponentAwareTestSuite(TestPortletEntityAccessComponent.class);
  -        suite.setScript("org/apache/jetspeed/containers/test-entity.groovy");
  -        
  -        return suite;
  +        // All methods starting with "test" will be executed in the test suite.
  +        return new TestSuite(TestPortletEntityAccessComponent.class);
       }
  -
       
   
       /**
  @@ -92,13 +87,12 @@
        */
       public TestPortletEntityAccessComponent(String testName)
       {
  -        super(testName, "./src/test/Log4j.properties");
  +        super(testName);
       }
           
       public void testEntities() throws Exception
       {
  -        assertNotNull(container);
  -
  +        
           PersistenceStore store = registry.getPersistenceStore();
           store.getTransaction().begin();
           
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to