continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r681490 [2/2] - in /continuum/branches/continuum-refactoring-evenisse: continuum-api/src/main/java/org/apache/continuum/dao/ continuum-api/src/main/java/org/apache/maven/continuum/store/ continuum-core/src/main/java/org/apache/maven/continu...
Date Thu, 31 Jul 2008 21:01:15 GMT
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java?rev=681490&r1=681489&r2=681490&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/AbstractContinuumStoreTestCase.java
Thu Jul 31 14:01:14 2008
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.BuildResult;
@@ -52,6 +53,8 @@
 {
     protected ContinuumStore store;
 
+    protected ProjectGroupDao projectGroupDao;
+
     protected ProjectGroup defaultProjectGroup;
 
     protected ProjectGroup testProjectGroup2;
@@ -118,6 +121,8 @@
         super.setUp();
 
         store = createStore();
+
+        projectGroupDao = (ProjectGroupDao) lookup( ProjectGroupDao.class.getName() );
     }
 
     protected void createBuildDatabase()
@@ -394,7 +399,7 @@
 
         if ( addToStore )
         {
-            store.addProjectGroup( group );
+            projectGroupDao.addProjectGroup( group );
             defaultProjectGroup.setId( group.getId() );
             testProject1.setId( project1.getId() );
             testProject2.setId( project2.getId() );
@@ -430,7 +435,7 @@
 
         if ( addToStore )
         {
-            store.addProjectGroup( group );
+            projectGroupDao.addProjectGroup( group );
             testProjectGroup2.setId( group.getId() );
         }
         else
@@ -467,8 +472,8 @@
     protected void assertBuildDatabase()
         throws ContinuumStoreException
     {
-        assertProjectGroupEquals( defaultProjectGroup, store.getProjectGroup( defaultProjectGroup.getId()
) );
-        assertProjectGroupEquals( testProjectGroup2, store.getProjectGroup( testProjectGroup2.getId()
) );
+        assertProjectGroupEquals( defaultProjectGroup, projectGroupDao.getProjectGroup( defaultProjectGroup.getId()
) );
+        assertProjectGroupEquals( testProjectGroup2, projectGroupDao.getProjectGroup( testProjectGroup2.getId()
) );
 
         assertProjectEquals( testProject1, store.getProject( testProject1.getId() ) );
         assertProjectEquals( testProject2, store.getProject( testProject2.getId() ) );
@@ -655,7 +660,7 @@
     {
         assertEquals( 0, store.getAllInstallations().size() );
         assertEquals( 0, store.getAllProfilesByName().size() );
-        assertEquals( 0, store.getAllProjectGroups().size() );
+        assertEquals( 0, projectGroupDao.getAllProjectGroups().size() );
         assertEquals( 0, store.getAllProjectsByName().size() );
         assertNull( store.getSystemConfiguration() );
     }
@@ -1010,7 +1015,7 @@
     }
 
     protected static void assertBuildDefinitionsEqual( List<BuildDefinition> expectedBuildDefinitions,
-    												   List<BuildDefinition> actualBuildDefinitions )
+                                                       List<BuildDefinition> actualBuildDefinitions
)
     {
         for ( int i = 0; i < expectedBuildDefinitions.size(); i++ )
         {
@@ -1038,7 +1043,7 @@
     }
 
     protected static void assertDevelopersEqual( List<ProjectDeveloper> expectedDevelopers,
-    		                                     List<ProjectDeveloper> actualDevelopers
)
+                                                 List<ProjectDeveloper> actualDevelopers
)
     {
         for ( int i = 0; i < actualDevelopers.size(); i++ )
         {
@@ -1057,7 +1062,7 @@
     }
 
     protected static void assertDependenciesEqual( List<ProjectDependency> expectedDependencies,
-    		                                       List<ProjectDependency> actualDependencies
)
+                                                   List<ProjectDependency> actualDependencies
)
     {
         for ( int i = 0; i < actualDependencies.size(); i++ )
         {

Modified: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java?rev=681490&r1=681489&r2=681490&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
Thu Jul 31 14:01:14 2008
@@ -19,14 +19,6 @@
  * under the License.
  */
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.jdo.JDODetachedFieldAccessException;
-
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
 import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -41,6 +33,13 @@
 import org.apache.maven.continuum.model.system.Installation;
 import org.apache.maven.continuum.model.system.Profile;
 
+import javax.jdo.JDODetachedFieldAccessException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
 /**
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  * @version $Id$
@@ -72,17 +71,17 @@
         ProjectGroup group = createTestProjectGroup( name, description, groupId );
 
         ProjectGroup copy = createTestProjectGroup( group );
-        store.addProjectGroup( group );
+        projectGroupDao.addProjectGroup( group );
         copy.setId( group.getId() );
 
-        ProjectGroup retrievedGroup = store.getProjectGroup( group.getId() );
+        ProjectGroup retrievedGroup = projectGroupDao.getProjectGroup( group.getId() );
         assertProjectGroupEquals( copy, retrievedGroup );
     }
 
     public void testGetProjectGroup()
         throws ContinuumStoreException
     {
-        ProjectGroup retrievedGroup = store.getProjectGroupWithProjects( defaultProjectGroup.getId()
);
+        ProjectGroup retrievedGroup = projectGroupDao.getProjectGroupWithProjects( defaultProjectGroup.getId()
);
         assertProjectGroupEquals( defaultProjectGroup, retrievedGroup );
 
         List projects = retrievedGroup.getProjects();
@@ -110,7 +109,7 @@
     {
         try
         {
-            store.getProjectGroup( INVALID_ID );
+            projectGroupDao.getProjectGroup( INVALID_ID );
             fail( "Should not find group with invalid ID" );
         }
         catch ( ContinuumObjectNotFoundException expected )
@@ -122,7 +121,7 @@
     public void testEditProjectGroup()
         throws ContinuumStoreException
     {
-        ProjectGroup newGroup = store.getProjectGroup( testProjectGroup2.getId() );
+        ProjectGroup newGroup = projectGroupDao.getProjectGroup( testProjectGroup2.getId()
);
 
         newGroup.setName( "testEditProjectGroup2" );
         newGroup.setDescription( "testEditProjectGroup updated description" );
@@ -130,9 +129,9 @@
 
         ProjectGroup copy = createTestProjectGroup( newGroup );
         copy.setId( newGroup.getId() );
-        store.updateProjectGroup( newGroup );
+        projectGroupDao.updateProjectGroup( newGroup );
 
-        ProjectGroup retrievedGroup = store.getProjectGroup( testProjectGroup2.getId() );
+        ProjectGroup retrievedGroup = projectGroupDao.getProjectGroup( testProjectGroup2.getId()
);
         assertProjectGroupEquals( copy, retrievedGroup );
 
     }
@@ -147,7 +146,7 @@
 
         try
         {
-            store.updateProjectGroup( newGroup );
+            projectGroupDao.updateProjectGroup( newGroup );
             fail( "Should not have succeeded" );
         }
         catch ( ContinuumStoreException expected )
@@ -159,7 +158,7 @@
 
     public void testGetAllProjectGroups()
     {
-        Collection groups = store.getAllProjectGroupsWithProjects();
+        Collection groups = projectGroupDao.getAllProjectGroupsWithProjects();
 
         assertEquals( "check size", 2, groups.size() );
         assertTrue( groups.contains( defaultProjectGroup ) );
@@ -275,7 +274,7 @@
     public void testGetAllProjects()
     {
         List projects = store.getAllProjectsByName();
-        assertEquals( "check items", Arrays.asList( new Project[] { testProject1, testProject2
} ), projects );
+        assertEquals( "check items", Arrays.asList( new Project[]{testProject1, testProject2}
), projects );
 
         Project project = (Project) projects.get( 1 );
         assertProjectEquals( testProject2, project );
@@ -344,7 +343,7 @@
         List installations = store.getAllInstallations();
         Profile newProfile = createTestProfile( "testAddProfile", "testAddProfile desc",
5, false, false,
                                                 (Installation) installations.get( 1 ), (Installation)
installations
-                                                    .get( 2 ) );
+            .get( 2 ) );
         Profile copy = createTestProfile( newProfile );
         store.addProfile( newProfile );
         copy.setId( newProfile.getId() );
@@ -408,14 +407,14 @@
         assertInstallationEquals( testProfile3.getJdk(), profile.getJdk() );
     }
 
-/*
-    public void testGetgetProfileByName()
-        throws ContinuumStoreException
-    {
-        Profile profile = store.getProfileByName( "name1" );
-        assertNotNull( profile );
-    }
-*/
+    /*
+        public void testGetgetProfileByName()
+            throws ContinuumStoreException
+        {
+            Profile profile = store.getProfileByName( "name1" );
+            assertNotNull( profile );
+        }
+    */
     public void testGetAllInstallations()
         throws Exception
     {
@@ -471,17 +470,17 @@
         String nameFirstEnvVar = "firstEnvVar";
         String nameSecondEnvVar = "secondEnvVar";
 
-        Installation testOne = createTestInstallation( nameFirstInst, InstallationService.JDK_TYPE,
"varName",
-                                                       "varValue" );
+        Installation testOne =
+            createTestInstallation( nameFirstInst, InstallationService.JDK_TYPE, "varName",
"varValue" );
 
-        Installation testTwo = createTestInstallation( nameSecondInst, InstallationService.MAVEN2_TYPE,
"varName",
-                                                       "varValue" );
+        Installation testTwo =
+            createTestInstallation( nameSecondInst, InstallationService.MAVEN2_TYPE, "varName",
"varValue" );
 
-        Installation firstEnvVar = createTestInstallation( nameFirstEnvVar, InstallationService.MAVEN2_TYPE,
"varName",
-                                                           "varValue" );
+        Installation firstEnvVar =
+            createTestInstallation( nameFirstEnvVar, InstallationService.MAVEN2_TYPE, "varName",
"varValue" );
 
-        Installation secondEnvVar = createTestInstallation( nameSecondEnvVar, InstallationService.MAVEN2_TYPE,
-                                                            "varName", "varValue" );
+        Installation secondEnvVar =
+            createTestInstallation( nameSecondEnvVar, InstallationService.MAVEN2_TYPE, "varName",
"varValue" );
 
         testOne = store.addInstallation( testOne );
         testTwo = store.addInstallation( testTwo );
@@ -560,14 +559,14 @@
         assertEquals( 1, firstGetted.getEnvironmentVariables().size() );
         Installation env = (Installation) firstGetted.getEnvironmentVariables().get( 0 );
         assertEquals( nameSecondEnvVar, env.getName() );
-        
+
         assertNotNull( secondGetted );
         assertNull( secondGetted.getJdk() );
         assertNull( secondGetted.getBuilder() );
         assertEquals( 1, secondGetted.getEnvironmentVariables().size() );
         env = (Installation) secondGetted.getEnvironmentVariables().get( 0 );
         assertEquals( nameSecondEnvVar, env.getName() );
-        
+
         // removing secondEnvVar
         store.removeInstallation( secondEnvVar );
         firstGetted = store.getProfile( firstProfile.getId() );
@@ -577,7 +576,6 @@
         assertNull( firstGetted.getBuilder() );
         assertEquals( 0, firstGetted.getEnvironmentVariables().size() );
 
-        
         assertNotNull( secondGetted );
         assertNull( secondGetted.getJdk() );
         assertNull( secondGetted.getBuilder() );
@@ -591,7 +589,7 @@
 
         store.removeProject( project );
 
-        ProjectGroup projectGroup = store.getProjectGroupWithProjects( defaultProjectGroup.getId()
);
+        ProjectGroup projectGroup = projectGroupDao.getProjectGroupWithProjects( defaultProjectGroup.getId()
);
         assertEquals( "check size is now 1", 1, projectGroup.getProjects().size() );
         assertProjectEquals( testProject2, (Project) projectGroup.getProjects().get( 0 )
);
 
@@ -601,11 +599,11 @@
     public void testDeleteProjectGroup()
         throws ContinuumStoreException
     {
-        store.removeProjectGroup( store.getProjectGroup( defaultProjectGroup.getId() ) );
+        projectGroupDao.removeProjectGroup( projectGroupDao.getProjectGroup( defaultProjectGroup.getId()
) );
 
         try
         {
-            store.getProjectGroup( defaultProjectGroup.getId() );
+            projectGroupDao.getProjectGroup( defaultProjectGroup.getId() );
             fail( "Project group was not deleted" );
         }
         catch ( ContinuumObjectNotFoundException expected )
@@ -692,8 +690,9 @@
     public void testGetProjectGroupWithDetails()
         throws ContinuumStoreException
     {
-        ProjectGroup retrievedGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId(
defaultProjectGroup
-            .getId() );
+        ProjectGroup retrievedGroup =
+            projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup
+                .getId() );
         assertProjectGroupEquals( defaultProjectGroup, retrievedGroup );
         assertNotifiersEqual( defaultProjectGroup.getNotifiers(), retrievedGroup.getNotifiers()
);
         assertBuildDefinitionsEqual( retrievedGroup.getBuildDefinitions(), defaultProjectGroup.getBuildDefinitions()
);
@@ -720,7 +719,7 @@
 
     public void testGetAllProjectsGroupWithDetails()
     {
-        List projectGroups = store.getAllProjectGroupsWithBuildDetails();
+        List projectGroups = projectGroupDao.getAllProjectGroupsWithBuildDetails();
         ProjectGroup group1 = (ProjectGroup) projectGroups.get( 0 );
         assertProjectGroupEquals( defaultProjectGroup, group1 );
         assertNotifiersEqual( defaultProjectGroup.getNotifiers(), group1.getNotifiers() );
@@ -958,14 +957,15 @@
     public void testAddNotifierToProjectGroup()
         throws ContinuumStoreException
     {
-        ProjectGroup projectGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId(
defaultProjectGroup.getId() );
+        ProjectGroup projectGroup =
+            projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
 
         ProjectNotifier notifier = createTestNotifier( 14, true, false, true, "TADNTPG type"
);
         ProjectNotifier copy = createTestNotifier( notifier );
         projectGroup.addNotifier( notifier );
-        store.updateProjectGroup( projectGroup );
+        projectGroupDao.updateProjectGroup( projectGroup );
 
-        projectGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
+        projectGroup = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
         assertEquals( "check # notifiers", 3, projectGroup.getNotifiers().size() );
         assertNotifierEquals( copy, (ProjectNotifier) projectGroup.getNotifiers().get( 2
) );
     }
@@ -973,7 +973,8 @@
     public void testEditGroupNotifier()
         throws ContinuumStoreException
     {
-        ProjectGroup projectGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId(
defaultProjectGroup.getId() );
+        ProjectGroup projectGroup =
+            projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
 
         ProjectNotifier newNotifier = (ProjectNotifier) projectGroup.getNotifiers().get(
0 );
         // If we use "type1.1", jpox-rc2 store "type1", weird
@@ -981,9 +982,9 @@
         newNotifier.setType( type );
 
         ProjectNotifier copy = createTestNotifier( newNotifier );
-        store.updateProjectGroup( projectGroup );
+        projectGroupDao.updateProjectGroup( projectGroup );
 
-        projectGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
+        projectGroup = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
         assertEquals( "check # notifiers", 2, projectGroup.getNotifiers().size() );
         assertNotifierEquals( copy, (ProjectNotifier) projectGroup.getNotifiers().get( 0
) );
     }
@@ -991,12 +992,13 @@
     public void testDeleteGroupNotifier()
         throws ContinuumStoreException
     {
-        ProjectGroup projectGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId(
defaultProjectGroup.getId() );
+        ProjectGroup projectGroup =
+            projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
         ProjectNotifier notifier = (ProjectNotifier) projectGroup.getNotifiers().get( 1 );
         projectGroup.getNotifiers().remove( 0 );
-        store.updateProjectGroup( projectGroup );
+        projectGroupDao.updateProjectGroup( projectGroup );
 
-        projectGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
+        projectGroup = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
         assertEquals( "check size is now 1", 1, projectGroup.getNotifiers().size() );
         assertNotifierEquals( notifier, (ProjectNotifier) projectGroup.getNotifiers().get(
0 ) );
 
@@ -1007,7 +1009,8 @@
     public void testAddBuildDefinitionToProjectGroup()
         throws ContinuumStoreException
     {
-        ProjectGroup projectGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId(
defaultProjectGroup.getId() );
+        ProjectGroup projectGroup =
+            projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
 
         Profile profile = store.getProfile( testProfile1.getId() );
         Schedule schedule = store.getSchedule( testSchedule1.getId() );
@@ -1015,9 +1018,9 @@
                                                                      "TABDTPG goals", profile,
schedule, false, false );
         BuildDefinition copy = createTestBuildDefinition( buildDefinition );
         projectGroup.addBuildDefinition( buildDefinition );
-        store.updateProjectGroup( projectGroup );
+        projectGroupDao.updateProjectGroup( projectGroup );
 
-        projectGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
+        projectGroup = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
         assertEquals( "check # build defs", 2, projectGroup.getBuildDefinitions().size()
);
         BuildDefinition retrievedBuildDefinition = (BuildDefinition) projectGroup.getBuildDefinitions().get(
1 );
         assertBuildDefinitionEquals( copy, retrievedBuildDefinition );
@@ -1028,7 +1031,8 @@
     public void testEditGroupBuildDefinition()
         throws ContinuumStoreException
     {
-        ProjectGroup projectGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId(
defaultProjectGroup.getId() );
+        ProjectGroup projectGroup =
+            projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
 
         BuildDefinition newBuildDefinition = (BuildDefinition) projectGroup.getBuildDefinitions().get(
0 );
         // If we use "arguments1.1", jpox-rc2 store "arguments11", weird
@@ -1036,9 +1040,9 @@
         newBuildDefinition.setArguments( arguments );
 
         BuildDefinition copy = createTestBuildDefinition( newBuildDefinition );
-        store.updateProjectGroup( projectGroup );
+        projectGroupDao.updateProjectGroup( projectGroup );
 
-        projectGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
+        projectGroup = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
         assertEquals( "check # build defs", 1, projectGroup.getBuildDefinitions().size()
);
         BuildDefinition retrievedBuildDefinition = (BuildDefinition) projectGroup.getBuildDefinitions().get(
0 );
         assertBuildDefinitionEquals( copy, retrievedBuildDefinition );
@@ -1049,18 +1053,19 @@
     public void testDeleteGroupBuildDefinition()
         throws ContinuumStoreException
     {
-        ProjectGroup projectGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId(
defaultProjectGroup.getId() );
+        ProjectGroup projectGroup =
+            projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
         projectGroup.getBuildDefinitions().remove( 0 );
-        store.updateProjectGroup( projectGroup );
+        projectGroupDao.updateProjectGroup( projectGroup );
 
-        projectGroup = store.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
+        projectGroup = projectGroupDao.getProjectGroupWithBuildDetailsByProjectGroupId( defaultProjectGroup.getId()
);
         assertEquals( "check size is now 0", 0, projectGroup.getBuildDefinitions().size()
);
 
         // !! These actually aren't happening !!
         // TODO: test the def was physically deleted
         // TODO: test the schedule/profile was NOT physically deleted
     }
-    
+
     public void testgetTemplatesBuildDefinitions()
         throws Exception
     {
@@ -1078,7 +1083,7 @@
         buildDefinition = store.addBuildDefinition( buildDefinition );
 
         template.addBuildDefinition( buildDefinition );
-        
+
         template = store.updateBuildDefinitionTemplate( template );
 
         assertEquals( "test", template.getName() );
@@ -1092,10 +1097,10 @@
 
         assertNotNull( template );
         assertEquals( 1, template.getBuildDefinitions().size() );
-        
+
         assertEquals( 1, store.getAllBuildDefinitionTemplate().size() );
     }
-    
+
     // ----------------------------------------------------------------------
     //  HELPER METHODS
     // ----------------------------------------------------------------------

Modified: continuum/branches/continuum-refactoring-evenisse/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java?rev=681490&r1=681489&r2=681490&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
(original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
Thu Jul 31 14:01:14 2008
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.continuum.dao.ProjectGroupDao;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
 import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
@@ -53,6 +54,8 @@
 {
     private ContinuumStore store;
 
+    private ProjectGroupDao projectGroupDao;
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -65,15 +68,17 @@
 
         getStore();
 
+        getProjectGroupDao();
+
         setUpConfigurationService( (ConfigurationService) lookup( "configurationService"
) );
 
-        Collection<ProjectGroup> projectGroups = store.getAllProjectGroupsWithProjects();
+        Collection<ProjectGroup> projectGroups = projectGroupDao.getAllProjectGroupsWithProjects();
 
         if ( projectGroups.size() == 0 ) //if ContinuumInitializer is loaded by Spring at
startup, size == 1
         {
             createDefaultProjectGroup();
 
-            projectGroups = store.getAllProjectGroupsWithProjects();
+            projectGroups = projectGroupDao.getAllProjectGroupsWithProjects();
         }
 
         assertEquals( 1, projectGroups.size() );
@@ -106,7 +111,7 @@
 
             group.setDescription( "Contains all projects that do not have a group of their
own" );
 
-            store.addProjectGroup( group );
+            projectGroupDao.addProjectGroup( group );
         }
     }
 
@@ -123,7 +128,7 @@
     protected ProjectGroup getDefaultProjectGroup()
         throws ContinuumStoreException
     {
-        return store.getProjectGroupByGroupIdWithProjects( Continuum.DEFAULT_PROJECT_GROUP_GROUP_ID
);
+        return projectGroupDao.getProjectGroupByGroupIdWithProjects( Continuum.DEFAULT_PROJECT_GROUP_GROUP_ID
);
     }
 
     // ----------------------------------------------------------------------
@@ -205,6 +210,14 @@
         return store;
     }
 
+    protected ProjectGroupDao getProjectGroupDao()
+    {
+        if ( projectGroupDao == null )
+        {
+            projectGroupDao = (ProjectGroupDao) lookup( ProjectGroupDao.class.getName() );
+        }
+        return projectGroupDao;
+    }
     // ----------------------------------------------------------------------
     // Build Executor
     // ----------------------------------------------------------------------
@@ -316,9 +329,11 @@
         project.setCheckoutResult( scmResult );
 
         defaultProjectGroup.addProject( project );
-        store.updateProjectGroup( defaultProjectGroup );
+
+        projectGroupDao.updateProjectGroup( defaultProjectGroup );
 
         project = store.getProject( project.getId() );
+
         assertNotNull( "project group == null", project.getProjectGroup() );
 
         return project;



Mime
View raw message