continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ri...@apache.org
Subject svn commit: r490084 - in /maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store: AbstractContinuumStoreTestCase.java ContinuumStoreTest.java
Date Sun, 24 Dec 2006 23:03:18 GMT
Author: rinku
Date: Sun Dec 24 15:03:17 2006
New Revision: 490084

URL: http://svn.apache.org/viewvc?view=rev&rev=490084
Log:
o  groupKey for a Project cannot be null.

Modified:
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
    maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java?view=diff&rev=490084&r1=490083&r2=490084
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
Sun Dec 24 15:03:17 2006
@@ -435,8 +435,8 @@
         assertProjectGroupEquals( defaultProjectGroup, store.getProjectGroup( new GroupProjectKey(defaultProjectGroup.getKey(),
null) ) );
         assertProjectGroupEquals( testProjectGroup2, store.getProjectGroup( new GroupProjectKey(testProjectGroup2.getKey()
, null) ) );
 
-        assertProjectEquals( testProject1, store.getProject( new GroupProjectKey( null, testProject1.getKey()
) ) );
-        assertProjectEquals( testProject2, store.getProject( new GroupProjectKey( null, testProject2.getKey()
) ) );
+        assertProjectEquals( testProject1, store.getProject( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) ) );
+        assertProjectEquals( testProject2, store.getProject( new GroupProjectKey( testProject2.getProjectGroup().getKey(),
testProject2.getKey() ) ) );
 
         assertScheduleEquals( testSchedule1, store.getSchedule( testSchedule1.getId() ) );
         assertScheduleEquals( testSchedule2, store.getSchedule( testSchedule2.getId() ) );

Modified: maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java?view=diff&rev=490084&r1=490083&r2=490084
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
Sun Dec 24 15:03:17 2006
@@ -189,7 +189,7 @@
     public void testGetProject()
         throws ContinuumStoreException
     {
-        Project retrievedProject = store.getProject( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project retrievedProject = store.getProject( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertProjectEquals( testProject1, retrievedProject );
         checkProjectDefaultFetchGroup( retrievedProject );
     }
@@ -197,7 +197,7 @@
     public void testGetProjectWithDetails()
         throws ContinuumStoreException
     {
-        Project retrievedProject = store.getProjectWithAllDetails( new GroupProjectKey( null,
testProject1.getKey() ) );
+        Project retrievedProject = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertProjectEquals( testProject1, retrievedProject );
         checkProjectFetchGroup( retrievedProject, false, false, true, true );
 
@@ -210,7 +210,7 @@
     public void testGetProjectWithCheckoutResult()
         throws ContinuumStoreException
     {
-        Project retrievedProject = store.getProjectWithCheckoutResult( new GroupProjectKey(
null, testProject1.getKey() ) );
+        Project retrievedProject = store.getProjectWithCheckoutResult( new GroupProjectKey(
testProject1.getProjectGroup().getKey(), testProject1.getKey() ) );
         assertProjectEquals( testProject1, retrievedProject );
         assertScmResultEquals( testCheckoutResult1, retrievedProject.getCheckoutResult()
 );
         checkProjectFetchGroup( retrievedProject, true, false, false, false );
@@ -221,7 +221,7 @@
     {
         try
         {
-            store.getProject( new GroupProjectKey( null, INVALID_KEY ) );
+            store.getProject( new GroupProjectKey( INVALID_KEY, INVALID_KEY ) );
             fail( "Should not find project with invalid ID" );
         }
         catch ( ContinuumObjectNotFoundException expected )
@@ -233,7 +233,7 @@
     public void testEditProject()
         throws ContinuumStoreException
     {
-        Project newProject = store.getProject( new GroupProjectKey(null, testProject2.getKey())
);
+        Project newProject = store.getProject( new GroupProjectKey(testProject1.getProjectGroup().getKey(),
testProject2.getKey()) );
 
         newProject.setName( "testEditProject2" );
         newProject.setDescription( "testEditProject updated description" );
@@ -243,7 +243,7 @@
         copy.setId( newProject.getId() );
         store.updateProject( newProject );
 
-        Project retrievedProject = store.getProject( new GroupProjectKey(null, testProject2.getKey())
);
+        Project retrievedProject = store.getProject( new GroupProjectKey(testProject1.getProjectGroup().getKey(),
testProject2.getKey()) );
         assertProjectEquals( copy, retrievedProject );
 
     }
@@ -421,7 +421,7 @@
     public void testDeleteProject()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithBuilds( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithBuilds( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
 
         store.removeProject( project );
 
@@ -456,7 +456,7 @@
     public void testDeleteBuildResult()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithBuilds( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithBuilds( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
 
         for ( Iterator i = project.getBuildResults().iterator(); i.hasNext(); )
         {
@@ -468,11 +468,11 @@
         }
         store.updateProject( project );
 
-        project = store.getProjectWithBuilds( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithBuilds( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check size is now 1", 1, project.getBuildResults().size() );
         assertBuildResultEquals( testBuildResult2, (BuildResult) project.getBuildResults().get(
0 ) );
 
-        List results = store.getAllBuildsForAProjectByDate( new GroupProjectKey( null, testProject1.getKey()
) );
+        List results = store.getAllBuildsForAProjectByDate( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check item count", 1, results.size() );
         assertBuildResultEquals( testBuildResult2, (BuildResult) results.get( 0 ) );
 
@@ -498,7 +498,7 @@
 
     public void testGetAllBuildsForAProject()
     {
-        List results = store.getAllBuildsForAProjectByDate( new GroupProjectKey( null, testProject1.getKey()
) );
+        List results = store.getAllBuildsForAProjectByDate( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
 
         assertEquals( "check item count", 2, results.size() );
 
@@ -587,14 +587,14 @@
     public void testAddDeveloperToProject()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
 
         ProjectDeveloper developer = createTestDeveloper( 11, "email TADTP", "name TADTP",
"scmId TADTP" );
         ProjectDeveloper copy = createTestDeveloper( developer );
         project.addDeveloper( developer );
         store.updateProject( project );
 
-        project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check # devs", 2, project.getDevelopers().size() );
         assertDeveloperEquals( copy, (ProjectDeveloper) project.getDevelopers().get( 1 )
);
     }
@@ -602,7 +602,7 @@
     public void testEditDeveloper()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
 
         ProjectDeveloper newDeveloper = (ProjectDeveloper) project.getDevelopers().get( 0
);
         newDeveloper.setName( "name1.1" );
@@ -611,7 +611,7 @@
         ProjectDeveloper copy = createTestDeveloper( newDeveloper );
         store.updateProject( project );
 
-        project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check # devs", 1, project.getDevelopers().size() );
         assertDeveloperEquals( copy, (ProjectDeveloper) project.getDevelopers().get( 0 )
);
     }
@@ -619,11 +619,11 @@
     public void testDeleteDeveloper()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         project.getDevelopers().remove( 0 );
         store.updateProject( project );
 
-        project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check size is now 0", 0, project.getDevelopers().size() );
 
         // !! These actually aren't happening !!
@@ -633,14 +633,14 @@
     public void testAddDependencyToProject()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
 
         ProjectDependency dependency = createTestDependency( "TADTP groupId", "TADTP artifactId",
"TADTP version" );
         ProjectDependency copy = createTestDependency( dependency );
         project.addDependency( dependency );
         store.updateProject( project );
 
-        project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check # deps", 3, project.getDependencies().size() );
         assertDependencyEquals( copy, (ProjectDependency) project.getDependencies().get(
2 ) );
     }
@@ -648,7 +648,7 @@
     public void testEditDependency()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
 
         ProjectDependency newDependency = (ProjectDependency) project.getDependencies().get(
0 );
         newDependency.setGroupId( "groupId1.1" );
@@ -657,7 +657,7 @@
         ProjectDependency copy = createTestDependency( newDependency );
         store.updateProject( project );
 
-        project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check # deps", 2, project.getDependencies().size() );
         assertDependencyEquals( copy, (ProjectDependency) project.getDependencies().get(
0 ) );
     }
@@ -665,12 +665,12 @@
     public void testDeleteDependency()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         ProjectDependency dependency = (ProjectDependency) project.getDependencies().get(
1 );
         project.getDependencies().remove( 0 );
         store.updateProject( project );
 
-        project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check size is now 1", 1, project.getDependencies().size() );
         assertDependencyEquals( dependency, (ProjectDependency) project.getDependencies().get(
0 ) );
 
@@ -681,14 +681,14 @@
     public void testAddNotifierToProject()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
 
         ProjectNotifier notifier = createTestNotifier( 13, true, false, true, "TADNTP type"
);
         ProjectNotifier copy = createTestNotifier( notifier );
         project.addNotifier( notifier );
         store.updateProject( project );
 
-        project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check # notifiers", 2, project.getNotifiers().size() );
         assertNotifierEquals( copy, (ProjectNotifier) project.getNotifiers().get( 1 ) );
     }
@@ -696,7 +696,7 @@
     public void testEditNotifier()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
 
         ProjectNotifier newNotifier = (ProjectNotifier) project.getNotifiers().get( 0 );
         // If we use "type1.1", jpox-rc2 store "type11", weird
@@ -706,7 +706,7 @@
         ProjectNotifier copy = createTestNotifier( newNotifier );
         store.updateProject( project );
 
-        project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check # notifiers", 1, project.getNotifiers().size() );
         assertNotifierEquals( copy, (ProjectNotifier) project.getNotifiers().get( 0 ) );
     }
@@ -714,11 +714,11 @@
     public void testDeleteNotifier()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         project.getNotifiers().remove( 0 );
         store.updateProject( project );
 
-        project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check size is now 0", 0, project.getNotifiers().size() );
 
         // !! These actually aren't happening !!
@@ -728,7 +728,7 @@
     public void testAddBuildDefinitionToProject()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
 
         Profile profile = store.getProfile( testProfile1.getId() );
         Schedule schedule = store.getSchedule( testSchedule1.getId() );
@@ -738,7 +738,7 @@
         project.addBuildDefinition( buildDefinition );
         store.updateProject( project );
 
-        project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check # build defs", 3, project.getBuildDefinitions().size() );
         BuildDefinition retrievedBuildDefinition = (BuildDefinition) project.getBuildDefinitions().get(
2 );
         assertBuildDefinitionEquals( copy, retrievedBuildDefinition );
@@ -749,7 +749,7 @@
     public void testEditBuildDefinition()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
 
         BuildDefinition newBuildDefinition = (BuildDefinition) project.getBuildDefinitions().get(
0 );
         // If we use "arguments1.1", jpox-rc2 store "arguments11", weird
@@ -759,7 +759,7 @@
         BuildDefinition copy = createTestBuildDefinition( newBuildDefinition );
         store.updateProject( project );
 
-        project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check # build defs", 2, project.getBuildDefinitions().size() );
         BuildDefinition retrievedBuildDefinition = (BuildDefinition) project.getBuildDefinitions().get(
0 );
         assertBuildDefinitionEquals( copy, retrievedBuildDefinition );
@@ -770,12 +770,12 @@
     public void testDeleteBuildDefinition()
         throws ContinuumStoreException
     {
-        Project project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        Project project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         BuildDefinition buildDefinition = (BuildDefinition) project.getBuildDefinitions().get(
1 );
         project.getBuildDefinitions().remove( 0 );
         store.updateProject( project );
 
-        project = store.getProjectWithAllDetails( new GroupProjectKey( null, testProject1.getKey()
) );
+        project = store.getProjectWithAllDetails( new GroupProjectKey( testProject1.getProjectGroup().getKey(),
testProject1.getKey() ) );
         assertEquals( "check size is now 1", 1, project.getBuildDefinitions().size() );
         BuildDefinition retrievedBuildDefinition = (BuildDefinition) project.getBuildDefinitions().get(
0 );
         assertBuildDefinitionEquals( buildDefinition, retrievedBuildDefinition );
@@ -901,10 +901,8 @@
         throws ContinuumStoreException
     {
         try
-        {
-            // TODO: Review! Since the Project key is unique only within a group
-            // shouldn't we specify the Group Key as well for deletion. 
-            store.getProject( new GroupProjectKey(null, project.getKey() ) );
+        {            
+            store.getProject( new GroupProjectKey(project.getProjectGroup().getKey(), project.getKey()
) );
             fail( "Project should no longer exist" );
         }
         catch ( ContinuumObjectNotFoundException expected )



Mime
View raw message