continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ri...@apache.org
Subject svn commit: r490907 - in /maven/continuum/branches/key-based-refactor/continuum-store/src: main/java/org/apache/maven/continuum/store/jdo/ test/java/org/apache/maven/continuum/store/jdo/ test/resources/
Date Fri, 29 Dec 2006 01:34:28 GMT
Author: rinku
Date: Thu Dec 28 17:34:27 2006
New Revision: 490907

URL: http://svn.apache.org/viewvc?view=rev&rev=490907
Log: (empty)

Modified:
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/JdoProjectStore.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectStoreTestCase.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/resources/testData.sql

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/JdoProjectStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/JdoProjectStore.java?view=diff&rev=490907&r1=490906&r2=490907
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/JdoProjectStore.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/jdo/JdoProjectStore.java
Thu Dec 28 17:34:27 2006
@@ -77,7 +77,7 @@
 
             query.declareParameters( "String groupKey, String projectKey" );
 
-            query.setFilter( "this.project.groupKey = groupKey && this.project.key
== projectKey" );
+            query.setFilter( "this.project.groupkey == groupKey && this.project.key
== projectKey" );
 
             List result = (List) query.execute( key.getGroupKey(), key.getProjectKey() );
 

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectStoreTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectStoreTestCase.java?view=diff&rev=490907&r1=490906&r2=490907
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectStoreTestCase.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/jdo/JdoProjectStoreTestCase.java
Thu Dec 28 17:34:27 2006
@@ -16,7 +16,13 @@
  * limitations under the License.
  */
 
+import org.apache.maven.continuum.key.GroupProjectKey;
+import org.apache.maven.continuum.model.project.Project;
+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.ProjectStore;
+import org.apache.maven.continuum.store.utils.StoreTestUtils;
 
 import java.util.List;
 
@@ -50,10 +56,61 @@
 
     public void testGetAllProjects() throws Exception
     {
-        ProjectStore store = (ProjectStore) lookup( ProjectStore.ROLE, "jdo" );       
+        ProjectStore store = (ProjectStore) lookup( ProjectStore.ROLE, "jdo" );
         List list = store.getAllProjects();
         assertNotNull( list );
-        assertEquals( 3, list.size() );
+        assertEquals( 4, list.size() );
+    }
+
+    public void testLookupProject() throws Exception
+    {
+        ProjectStore store = (ProjectStore) lookup( ProjectStore.ROLE, "jdo" );
+        GroupProjectKey key = new GroupProjectKey( "Default", "project1" );
+
+        Project project = store.lookupProject( key );
+        assertNotNull( project );
+        ProjectGroup group = project.getProjectGroup();
+        assertNotNull( group );
+
+        // verify group properties
+        assertEquals( 1L, group.getId() );
+        assertEquals( "Default Group", group.getDescription() );
+        assertEquals( "default", group.getGroupId() );
+        assertEquals( "Default", group.getKey() );
+        assertEquals( "Default Group", group.getName() );
+
+        // verify project properties
+        assertEquals( 1L, project.getId() );
+        assertEquals( "Test Project 1", group.getDescription() );
+        assertEquals( "org.test.projects", group.getGroupId() );
+        assertEquals( "project1", group.getKey() );
+        assertEquals( "Project 1", group.getName() );
+    }
+
+    public void testDeleteProject() throws Exception
+    {
+        ProjectStore store = (ProjectStore) lookup( ProjectStore.ROLE, "jdo" );
+        GroupProjectKey key = new GroupProjectKey( "DeleteableGroup", "deleteableProject"
);
+        Project project = store.lookupProject( key );
+        assertNotNull( project );
+
+        store.deleteProject( project );
+
+        try
+        {
+            project = store.lookupProject( key );
+            fail( "Expected ContinuumObjectNotFoundException." );
+        }
+        catch ( ContinuumObjectNotFoundException e )
+        {
+            // expected
+        }
+
+    }
+
+    public void testSaveNewProjectGroup() throws Exception
+    {
+        // TODO: Implement!
     }
 
 }

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=490907&r1=490906&r2=490907
==============================================================================
--- 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 17:34:27 2006
@@ -6,22 +6,27 @@
 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');  
+  values (999, 'Deleteable Group' , 'org.group.deleteable', 'DeleteableGroup' , 'Deleteable
Group');  
   
       
 # Set up projects
 insert into PROJECT (ID, DESCRIPTION, ARTIFACT_ID, GROUP_ID, GROUP_KEY, 
     PROJECTKEY, NAME, BUILD_NUMBER, LATEST_BUILD_ID, OLD_STATE, 
     PROJECT_GROUP_ID_OID, "STATE")
-  values (1, 'Test Project 1', 'project-1',  'org.test.projects', 'project1',
+  values (1, 'Test Project 1', 'project-1',  'org.test.projects', 'Default',
     'project1', 'Project 1', 0, 0, 0, 1, 0);
 insert into PROJECT (ID, DESCRIPTION, ARTIFACT_ID, GROUP_ID, GROUP_KEY, 
     PROJECTKEY, NAME, BUILD_NUMBER, LATEST_BUILD_ID, 
     OLD_STATE, PROJECT_GROUP_ID_OID, "STATE")
-  values (2, 'Test Project 2', 'project-2',  'org.test.projects', 'project2',
-    'project2', 'Project 2', 0, 0, 0, 1, 0);
+  values (2, 'Test Project 2', 'project-2',  'org.test.projects', 'Group 1',
+    'project2', 'Project 2', 0, 0, 0, 2, 0);
 insert into PROJECT (ID, DESCRIPTION, ARTIFACT_ID, GROUP_ID, GROUP_KEY, 
     PROJECTKEY, NAME, BUILD_NUMBER, LATEST_BUILD_ID, OLD_STATE, 
     PROJECT_GROUP_ID_OID, "STATE")
-  values (3, 'Test Project 3', 'project-3', 'org.test.projects', 'project3',
+  values (3, 'Test Project 3', 'project-3', 'org.test.projects', 'Group 1',
     'project3', 'Project 3', 0, 0, 0, 2, 0);
+insert into PROJECT (ID, DESCRIPTION, ARTIFACT_ID, GROUP_ID, GROUP_KEY, 
+    PROJECTKEY, NAME, BUILD_NUMBER, LATEST_BUILD_ID, OLD_STATE, 
+    PROJECT_GROUP_ID_OID, "STATE")
+  values (999, 'Deleteable Project', 'deleteable-project', 'org.test.projects', 'DeleteableGroup',
+    'deleteableProject', 'Deleteable Project', 0, 0, 0, 999, 0);  



Mime
View raw message