continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ri...@apache.org
Subject svn commit: r490094 - in /maven/continuum/branches/key-based-refactor/continuum-store/src: main/java/org/apache/maven/continuum/store/ test/java/org/apache/maven/continuum/store/
Date Mon, 25 Dec 2006 01:07:30 GMT
Author: rinku
Date: Sun Dec 24 17:07:29 2006
New Revision: 490094

URL: http://svn.apache.org/viewvc?view=rev&rev=490094
Log:
o  implemented pending methods from the refactored store interface.
o  changed access specifiers to private for methods no longer overridden.
o  updated unit tests - all test projects now belong to a group. 
o  other group/project key related updates to unit tests.

Modified:
    maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
    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/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java?view=diff&rev=490094&r1=490093&r2=490094
==============================================================================
--- maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
(original)
+++ maven/continuum/branches/key-based-refactor/continuum-store/src/main/java/org/apache/maven/continuum/store/JdoContinuumStore.java
Sun Dec 24 17:07:29 2006
@@ -75,14 +75,14 @@
      * <p>
      * @see Modello configuration for continuum-model. 
      */
-    private static final String LOOKUP_KEY_GROUP_KEY = "groupKey";
+    private static final String LOOKUP_KEY_GROUP_KEY = "key";
 
     /**
      * Column identifier under which the {@link Project} key values are stored.
      * <p>
      * @see Modello configuration for continuum-model. 
      */
-    private static final String LOOKUP_KEY_PROJECT_KEY = "projectKey";
+    private static final String LOOKUP_KEY_PROJECT_KEY = "key";
 
     /**
      * @plexus.requirement role-hint="continuum"
@@ -620,7 +620,7 @@
             + groupProjectKey );
     }
 
-    public BuildDefinition getDefaultBuildDefinitionForProjectGroup( String groupKey )
+    private BuildDefinition getDefaultBuildDefinitionForProjectGroup( String groupKey )
         throws ContinuumStoreException, ContinuumObjectNotFoundException
     {
         GroupProjectKey key = new GroupProjectKey();
@@ -761,7 +761,7 @@
         PlexusJdoUtils.rollbackIfActive( tx );
     }
 
-    public ProjectGroup getProjectGroup( String groupKey )
+    private ProjectGroup getProjectGroup( String groupKey )
         throws ContinuumStoreException, ContinuumObjectNotFoundException
     {
         //return (ProjectGroup) getObjectById( ProjectGroup.class, groupKey );        
@@ -832,7 +832,7 @@
     }
 
     // todo get this natively supported in the store
-    public List getProjectsWithDependenciesByGroupId( String groupKey )
+    private List getProjectsWithDependenciesByGroupId( String groupKey )
     {
         List allProjects = getAllObjectsDetached( Project.class, "name ascending", PROJECT_DEPENDENCIES_FETCH_GROUP
);
 
@@ -1021,7 +1021,7 @@
     {
         // return (Project) getObjectById( Project.class, groupProjectkey, PROJECT_WITH_CHECKOUT_RESULT_FETCH_GROUP
);
         return (Project) getObjectFromQuery( Project.class, LOOKUP_KEY_PROJECT_KEY, groupProjectKey.getProjectKey(),
-                                             PROJECT_BUILD_DETAILS_FETCH_GROUP );
+                                             PROJECT_WITH_CHECKOUT_RESULT_FETCH_GROUP );
     }
 
     public BuildResult getBuildResult( int buildId )
@@ -1513,9 +1513,8 @@
      */
     public BuildDefinition getDefaultBuildDefinitionForProjectGroup( GroupProjectKey groupProjectKey
)
         throws ContinuumStoreException, ContinuumObjectNotFoundException
-    {
-        // TODO Implement!
-        return null;
+    {   
+        return getDefaultBuildDefinitionForProjectGroup( groupProjectKey.getGroupKey() );
     }
 
     /**
@@ -1526,8 +1525,7 @@
     public ProjectGroup getProjectGroup( GroupProjectKey groupProjectKey )
         throws ContinuumStoreException, ContinuumObjectNotFoundException
     {
-        // TODO Implement!
-        return null;
+        return getProjectGroup( groupProjectKey.getGroupKey() );
     }
 
     /**
@@ -1537,8 +1535,7 @@
      */
     public List getProjectsWithDependenciesByGroupId( GroupProjectKey groupProjectKey )
     {
-        // TODO Implement!
-        return null;
+        return getProjectsWithDependenciesByGroupId( groupProjectKey.getGroupKey() );
     }
 
 }

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=490094&r1=490093&r2=490094
==============================================================================
--- 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 17:07:29 2006
@@ -126,16 +126,18 @@
     {
         // Setting up test data
         defaultProjectGroup =
-            createTestProjectGroup( "Default Group", "The Default Group", "org.apache.maven.test.default"
);
+            createTestProjectGroup( "Default Group", "The Default Group", "org.apache.maven.test.default",
"DefaultGroup" );
 
-        testProjectGroup2 = createTestProjectGroup( "test group 2", "test group 2 desc",
"test group 2 groupId" );
+        testProjectGroup2 = createTestProjectGroup( "test group 2", "test group 2 desc",
"test group 2 groupId", "TestGroup2" );
 
         testProject1 = createTestProject( "artifactId1", 1, "description1", defaultProjectGroup.getGroupId(),
"name1",
-                                          "scmUrl1", 1, "url1", "version1", "workingDirectory1"
);
+                                          "scmUrl1", 1, "url1", "version1", "workingDirectory1",
defaultProjectGroup.getKey(), "TestProject1" );
+        testProject1.setProjectGroup( defaultProjectGroup );
 
         // state must be 1 unless we setup a build in the correct state
         testProject2 = createTestProject( "artifactId2", 2, "description2", defaultProjectGroup.getGroupId(),
"name2",
-                                          "scmUrl2", 1, "url2", "version2", "workingDirectory2"
);
+                                          "scmUrl2", 1, "url2", "version2", "workingDirectory2",
defaultProjectGroup.getKey(), "TestProject2" );
+        testProject2.setProjectGroup( testProjectGroup2 );
 
         testSchedule1 = createTestSchedule( "name1", "description1", 1, "cronExpression1",
true );
         testSchedule2 = createTestSchedule( "name2", "description2", 2, "cronExpression2",
true );
@@ -313,9 +315,11 @@
         ProjectDependency projectDependency2 = createTestDependency( testDependency2 );
         project1.addDependency( projectDependency2 );
         testProject1.addDependency( testDependency2 );
+        
+        project1.setProjectGroup( group );
 
-        group.addProject( project1 );
-        defaultProjectGroup.addProject( project1 );
+        group.addProject( project1 );       // ?? Are these 2 calls not the same?
+        defaultProjectGroup.addProject( project1 );     // ??
         Project project2 = createTestProject( testProject2 );
         project2.addBuildResult( buildResult3 );
         ProjectNotifier notifier2 = createTestNotifier( testNotifier2 );
@@ -791,15 +795,16 @@
 
     protected static ProjectGroup createTestProjectGroup( ProjectGroup group )
     {
-        return createTestProjectGroup( group.getName(), group.getDescription(), group.getGroupId()
);
+        return createTestProjectGroup( group.getName(), group.getDescription(), group.getGroupId(),
group.getKey() );
     }
 
-    protected static ProjectGroup createTestProjectGroup( String name, String description,
String groupId )
+    protected static ProjectGroup createTestProjectGroup( String name, String description,
String groupId, String groupKey )
     {
         ProjectGroup group = new ProjectGroup();
         group.setName( name );
         group.setDescription( description );
         group.setGroupId( groupId );
+        group.setKey( groupKey );
         return group;
     }
 
@@ -807,12 +812,12 @@
     {
         return createTestProject( project.getArtifactId(), project.getBuildNumber(), project.getDescription(),
                                   project.getGroupId(), project.getName(), project.getScmUrl(),
project.getState(),
-                                  project.getUrl(), project.getVersion(), project.getWorkingDirectory()
);
+                                  project.getUrl(), project.getVersion(), project.getWorkingDirectory(),
project.getProjectGroup().getKey(), project.getKey() );
     }
 
     private static Project createTestProject( String artifactId, int buildNumber, String
description, String groupId,
                                               String name, String scmUrl, int state, String
url, String version,
-                                              String workingDirectory )
+                                              String workingDirectory, String groupKey, String
projectKey )
     {
         Project project = new Project();
         project.setArtifactId( artifactId );
@@ -825,6 +830,9 @@
         project.setUrl( url );
         project.setVersion( version );
         project.setWorkingDirectory( workingDirectory );
+        // assumes that a project will *always* have a group.
+        project.setGroupKey( groupKey );
+        project.setKey( projectKey );
         return project;
     }
 

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=490094&r1=490093&r2=490094
==============================================================================
--- 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 17:07:29 2006
@@ -61,18 +61,22 @@
 
     public void testAddProjectGroup()
         throws ContinuumStoreException
-    {
+    {   
         String name = "testAddProjectGroup";
         String description = "testAddProjectGroup description";
         String groupId = "org.apache.maven.continuum.test";
-        ProjectGroup group = createTestProjectGroup( name, description, groupId );
-
+        String groupKey = "AddProjectGroupKey";
+        ProjectGroup group = createTestProjectGroup( name, description, groupId, groupKey);
+        
         ProjectGroup copy = createTestProjectGroup( group );
-        store.addProjectGroup( group );
+        assertNotNull( copy );
+        group = store.addProjectGroup( group );
+        assertNotNull( group );
         copy.setId( group.getId() );
 
         ProjectGroup retrievedGroup = store.getProjectGroup( new GroupProjectKey( group.getKey(),
null ) );
-        assertProjectGroupEquals( copy, retrievedGroup );
+        assertNotNull( retrievedGroup );
+        assertProjectGroupEquals( copy, retrievedGroup );        
     }
 
     public void testGetProjectGroup()
@@ -210,7 +214,7 @@
     public void testGetProjectWithCheckoutResult()
         throws ContinuumStoreException
     {
-        Project retrievedProject = store.getProjectWithCheckoutResult( new GroupProjectKey(
testProject1.getProjectGroup().getKey(), 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 );



Mime
View raw message