continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ri...@apache.org
Subject svn commit: r490900 - in /maven/continuum/branches/key-based-refactor/continuum-store/src/test: java/org/apache/maven/continuum/store/jdo/ java/org/apache/maven/continuum/store/utils/ resources/
Date Fri, 29 Dec 2006 00:57:34 GMT
Author: rinku
Date: Thu Dec 28 16:57:33 2006
New Revision: 490900

URL: http://svn.apache.org/viewvc?view=rev&rev=490900
Log:
o  added some tests and data.

Added:
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestUtils.java
      - copied, changed from r490865, maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestCaseUtils.java
Removed:
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestCaseUtils.java
Modified:
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupTestCase.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/testData.sql

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupTestCase.java?view=diff&rev=490900&r1=490899&r2=490900
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupTestCase.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectGroupTestCase.java
Thu Dec 28 16:57:33 2006
@@ -2,7 +2,9 @@
 
 import org.apache.maven.continuum.key.GroupProjectKey;
 import org.apache.maven.continuum.model.project.ProjectGroup;
+import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
 import org.apache.maven.continuum.store.ProjectGroupStore;
+import org.apache.maven.continuum.store.utils.StoreTestUtils;
 
 import java.util.List;
 
@@ -38,7 +40,7 @@
         ProjectGroupStore store = (ProjectGroupStore) lookup( ProjectGroupStore.ROLE, "jdo"
);
         List list = store.getAllProjectGroups();
         assertNotNull( list );
-        assertEquals( 2, list.size() );
+        assertEquals( 3, list.size() );
     }
 
     public void testLookupProjectGroup() throws Exception
@@ -48,6 +50,50 @@
         ProjectGroup group = store.lookupProjectGroup( key );
         assertNotNull( group );
         assertEquals( 1L, group.getId() );
+        assertEquals( "Default Group", group.getDescription() );
+        assertEquals( "default", group.getGroupId() );
+        assertEquals( "Default", group.getKey() );
+        assertEquals( "Default Group", group.getName() );
+    }
+
+    public void testDeleteProjectGroup() throws Exception
+    {
+        ProjectGroupStore store = (ProjectGroupStore) lookup( ProjectGroupStore.ROLE, "jdo"
);
+        GroupProjectKey key = new GroupProjectKey( "DeleteableGroup", null );
+        ProjectGroup group = store.lookupProjectGroup( key );
+        assertNotNull( group );
+
+        store.deleteProjectGroup( group );
+
+        try
+        {
+            group = store.lookupProjectGroup( key );
+            fail( "Expected ContinuumObjectNotFoundException." );
+        }
+        catch ( ContinuumObjectNotFoundException e )
+        {
+            // expected
+        }
+
+    }
+
+    public void testSaveNewProjectGroup() throws Exception
+    {
+        ProjectGroupStore store = (ProjectGroupStore) lookup( ProjectGroupStore.ROLE, "jdo"
);
+        ProjectGroup group =
+            StoreTestUtils.createTestProjectGroup( "New Group", "A new project group", "newGroupId",
"newGroupKey" );
+
+        ProjectGroup copy = StoreTestUtils.createTestProjectGroup( group );
+        assertNotNull( copy );
+
+        group = store.saveProjectGroup( group );
+        assertNotNull( group );
+
+        copy.setId( group.getId() );
+
+        ProjectGroup retrievedGroup = store.lookupProjectGroup( new GroupProjectKey( group.getKey(),
null ) );
+        assertNotNull( retrievedGroup );
+        StoreTestUtils.assertProjectGroupEquals( copy, retrievedGroup );
     }
 
 }

Copied: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestUtils.java
(from r490865, maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestCaseUtils.java)
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestUtils.java?view=diff&rev=490900&p1=maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestCaseUtils.java&r1=490865&p2=maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestUtils.java&r2=490900
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestCaseUtils.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/utils/StoreTestUtils.java
Thu Dec 28 16:57:33 2006
@@ -46,7 +46,7 @@
  * @version $Id$
  * @since 1.1
  */
-public class StoreTestCaseUtils
+public class StoreTestUtils
 {
 
     public static void assertBuildDefinitionEquals( BuildDefinition expectedBuildDefinition,

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/testData.sql
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/testData.sql?view=diff&rev=490900&r1=490899&r2=490900
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/testData.sql
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/testData.sql
Thu Dec 28 16:57:33 2006
@@ -5,6 +5,8 @@
   values (1, 'Default Group' , 'default', 'Default' , 'Default Group');
 insert into PROJECTGROUP (ID, DESCRIPTION, GROUP_ID, GROUPKEY, NAME)
   values (2, 'Group 1' , 'org.apache.maven.continuum', 'Continuum' , 'Continuum Group');
+insert into PROJECTGROUP (ID, DESCRIPTION, GROUP_ID, GROUPKEY, NAME)
+  values (3, 'Deleteable Group' , 'org.group.deleteable', 'DeleteableGroup' , 'Deleteable
Group');  
   
       
 # Set up projects



Mime
View raw message