portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jf...@apache.org
Subject cvs commit: jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry TestRegistry.java
Date Mon, 08 Mar 2004 16:45:55 GMT
jford       2004/03/08 08:45:55

  Modified:    components/registry/src/test/org/apache/jetspeed/components/portletregistry
                        TestRegistry.java
  Log:
  Added dublin core tests back in.  Added new test for testing field removal
  
  Revision  Changes    Path
  1.8       +78 -37    jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/TestRegistry.java
  
  Index: TestRegistry.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/registry/src/test/org/apache/jetspeed/components/portletregistry/TestRegistry.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TestRegistry.java	8 Mar 2004 00:50:03 -0000	1.7
  +++ TestRegistry.java	8 Mar 2004 16:45:55 -0000	1.8
  @@ -170,25 +170,26 @@
               pac.setName(APP_1_NAME);
               pac.setDescription("This is a Registry Test Portlet.");
               pac.setVersion("1.0");
  -//            GenericMetadata md = pac.getMetadata();
  -//            DublinCore dc = new DublinCoreImpl(md);
  -//            dc.addTitle(JetspeedLocale.getDefaultLocale(), "Test title 1");
  -//            dc.addTitle(JetspeedLocale.getDefaultLocale(), "Test title 2");
  -//            dc.addTitle(JetspeedLocale.getDefaultLocale(), "Test title 3");
  -//            dc.addContributor(JetspeedLocale.getDefaultLocale(), "Contrib 1");
  -//            dc.addCoverage(JetspeedLocale.getDefaultLocale(), "Coverage 1");
  -//            dc.addCoverage(JetspeedLocale.getDefaultLocale(), "Coverage 2");
  -//            dc.addCreator(JetspeedLocale.getDefaultLocale(), "Creator 1");
  -//            dc.addDescription(JetspeedLocale.getDefaultLocale(), "Description 1");
  -//            dc.addFormat(JetspeedLocale.getDefaultLocale(), "Format 1");
  -//            dc.addIdentifier(JetspeedLocale.getDefaultLocale(), "Identifier 1");
  -//            dc.addLanguage(JetspeedLocale.getDefaultLocale(), "Language 1");
  -//            dc.addPublisher(JetspeedLocale.getDefaultLocale(), "Publisher 1");
  -//            dc.addRelation(JetspeedLocale.getDefaultLocale(), "Relation 1");
  -//            dc.addRight(JetspeedLocale.getDefaultLocale(), "Right 1");
  -//            dc.addSource(JetspeedLocale.getDefaultLocale(), "Source 1");
  -//            dc.addSubject(JetspeedLocale.getDefaultLocale(), "Subject 1");
  -//            dc.addType(JetspeedLocale.getDefaultLocale(), "Type 1");
  +            GenericMetadata md = pac.getMetadata();
  +            DublinCore dc = new DublinCoreImpl(md);
  +            dc.addTitle(JetspeedLocale.getDefaultLocale(), "Test title 1");
  +            dc.addTitle(JetspeedLocale.getDefaultLocale(), "Test title 2");
  +            dc.addTitle(JetspeedLocale.getDefaultLocale(), "Test title 3");
  +            dc.addContributor(JetspeedLocale.getDefaultLocale(), "Contrib 1");
  +            dc.addCoverage(JetspeedLocale.getDefaultLocale(), "Coverage 1");
  +            dc.addCoverage(JetspeedLocale.getDefaultLocale(), "Coverage 2");
  +            dc.addCreator(JetspeedLocale.getDefaultLocale(), "Creator 1");
  +            dc.addDescription(JetspeedLocale.getDefaultLocale(), "Description 1");
  +            dc.addFormat(JetspeedLocale.getDefaultLocale(), "Format 1");
  +            dc.addIdentifier(JetspeedLocale.getDefaultLocale(), "Identifier 1");
  +            dc.addLanguage(JetspeedLocale.getDefaultLocale(), "Language 1");
  +            dc.addPublisher(JetspeedLocale.getDefaultLocale(), "Publisher 1");
  +            dc.addRelation(JetspeedLocale.getDefaultLocale(), "Relation 1");
  +            dc.addRight(JetspeedLocale.getDefaultLocale(), "Right 1");
  +            dc.addSource(JetspeedLocale.getDefaultLocale(), "Source 1");
  +            dc.addSubject(JetspeedLocale.getDefaultLocale(), "Subject 1");
  +            dc.addType(JetspeedLocale.getDefaultLocale(), "Type 1");
  +            
               wac.setContextRoot("/root");
               wac.addDescription(JetspeedLocale.getDefaultLocale(), "This is an english desrcitpion");
               wac.addDisplayName(JetspeedLocale.getDefaultLocale(), "This is an english display
name");
  @@ -255,23 +256,63 @@
   
       public void testDublinCore() throws Throwable
       {
  -        MutablePortletApplication appExists = registry.getPortletApplication(APP_1_NAME);
  -        assertNotNull(appExists);
  -        DublinCore dc = new DublinCoreImpl(appExists.getMetadata());
  -        assertEquals(dc.getTitles().size(), 3);
  -        assertEquals(dc.getContributors().size(), 1);
  -        assertEquals(dc.getCoverages().size(), 2);
  -        assertEquals(dc.getCreators().size(), 1);
  -        assertEquals(dc.getDescriptions().size(), 1);
  -        assertEquals(dc.getFormats().size(), 1);
  -        assertEquals(dc.getIdentifiers().size(), 1);
  -        assertEquals(dc.getLanguages().size(), 1);
  -        assertEquals(dc.getPublishers().size(), 1);
  -        assertEquals(dc.getRelations().size(), 1);
  -        assertEquals(dc.getRights().size(), 1);
  -        assertEquals(dc.getSources().size(), 1);
  -        assertEquals(dc.getSubjects().size(), 1);
  -        assertEquals(dc.getTypes().size(), 1);
  +        try
  +        {
  +            store.getTransaction().begin();
  +	        MutablePortletApplication appExists = registry.getPortletApplication(APP_1_NAME);
  +	        assertNotNull(appExists);
  +	        
  +	        DublinCore dc = new DublinCoreImpl(appExists.getMetadata());
  +	        assertEquals(dc.getTitles().size(), 3);
  +	        assertEquals(dc.getContributors().size(), 1);
  +	        assertEquals(dc.getCoverages().size(), 2);
  +	        assertEquals(dc.getCreators().size(), 1);
  +	        assertEquals(dc.getDescriptions().size(), 1);
  +	        assertEquals(dc.getFormats().size(), 1);
  +	        assertEquals(dc.getIdentifiers().size(), 1);
  +	        assertEquals(dc.getLanguages().size(), 1);
  +	        assertEquals(dc.getPublishers().size(), 1);
  +	        assertEquals(dc.getRelations().size(), 1);
  +	        assertEquals(dc.getRights().size(), 1);
  +	        assertEquals(dc.getSources().size(), 1);
  +	        assertEquals(dc.getSubjects().size(), 1);
  +	        assertEquals(dc.getTypes().size(), 1);
  +	        	        
  +	        store.getTransaction().commit();
  +        }
  +        catch (Exception e)
  +        {
  +            store.getTransaction().rollback();
  +            throw e;
  +        }
  +    }
  +    
  +    public void testDublinCoreRemove() throws Throwable
  +    {
  +        try
  +        {
  +            store.getTransaction().begin();
  +            MutablePortletApplication appExists = registry.getPortletApplication(APP_1_NAME);
  +            assertNotNull(appExists);
  +            
  +            DublinCore dc = new DublinCoreImpl(appExists.getMetadata());
  +            dc.setCoverages(null);
  +            
  +            assertNull(dc.getCoverages());
  +            
  +            dc.addCoverage(JetspeedLocale.getDefaultLocale(), "Coverage 3");
  +            dc.addCoverage(JetspeedLocale.getDefaultLocale(), "Coverage 4");
  +            dc.addCoverage(JetspeedLocale.getDefaultLocale(), "Coverage 5");
  +            
  +            assertEquals(dc.getCoverages().size(), 3);
  +            
  +            store.getTransaction().commit();
  +        }
  +        catch (Exception e)
  +        {
  +            store.getTransaction().rollback();
  +            throw e;
  +        }
       }
   
       public void testAddingPortlet() throws Throwable
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message