You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ev...@apache.org on 2008/08/08 22:48:17 UTC
svn commit: r684085 [6/6] - in /continuum/trunk: ./
continuum-api/src/main/java/org/apache/continuum/dao/
continuum-api/src/main/java/org/apache/maven/continuum/store/
continuum-base/continuum-configuration/ continuum-commons/
continuum-commons/src/mai...
Modified: continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java?rev=684085&r1=684084&r2=684085&view=diff
==============================================================================
--- continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java (original)
+++ continuum/trunk/continuum-store/src/test/java/org/apache/maven/continuum/store/ContinuumStoreTest.java Fri Aug 8 13:48:14 2008
@@ -19,15 +19,9 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.jdo.JDODetachedFieldAccessException;
-
+import org.apache.continuum.dao.BuildDefinitionDao;
+import org.apache.continuum.dao.BuildDefinitionTemplateDao;
+import org.apache.continuum.dao.BuildResultDao;
import org.apache.continuum.model.repository.DirectoryPurgeConfiguration;
import org.apache.continuum.model.repository.LocalRepository;
import org.apache.continuum.model.repository.RepositoryPurgeConfiguration;
@@ -45,6 +39,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$
@@ -56,12 +57,13 @@
public class ContinuumStoreTest
extends AbstractContinuumStoreTestCase
{
-
private static final int INVALID_ID = 15000;
- // ----------------------------------------------------------------------
- //
- // ----------------------------------------------------------------------
+ private BuildDefinitionTemplateDao buildDefinitionTemplateDao;
+
+ protected BuildDefinitionDao buildDefinitionDao;
+
+ protected BuildResultDao buildResultDao;
// ----------------------------------------------------------------------
// TEST METHODS
@@ -73,14 +75,14 @@
String name = "testAddProjectGroup";
String description = "testAddProjectGroup description";
String groupId = "org.apache.maven.continuum.test";
- LocalRepository repository = store.getLocalRepository( testLocalRepository3.getId() );
+ LocalRepository repository = localRepositoryDao.getLocalRepository( testLocalRepository3.getId() );
ProjectGroup group = createTestProjectGroup( name, description, groupId, repository );
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 );
assertLocalRepositoryEquals( testLocalRepository3, retrievedGroup.getLocalRepository() );
}
@@ -88,7 +90,7 @@
public void testGetProjectGroup()
throws ContinuumStoreException
{
- ProjectGroup retrievedGroup = store.getProjectGroupWithProjects( defaultProjectGroup.getId() );
+ ProjectGroup retrievedGroup = projectGroupDao.getProjectGroupWithProjects( defaultProjectGroup.getId() );
assertProjectGroupEquals( defaultProjectGroup, retrievedGroup );
assertLocalRepositoryEquals( testLocalRepository1, retrievedGroup.getLocalRepository() );
@@ -117,7 +119,7 @@
{
try
{
- store.getProjectGroup( INVALID_ID );
+ projectGroupDao.getProjectGroup( INVALID_ID );
fail( "Should not find group with invalid ID" );
}
catch ( ContinuumObjectNotFoundException expected )
@@ -129,7 +131,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" );
@@ -137,9 +139,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 );
assertLocalRepositoryEquals( testLocalRepository2, retrievedGroup.getLocalRepository() );
}
@@ -154,7 +156,7 @@
try
{
- store.updateProjectGroup( newGroup );
+ projectGroupDao.updateProjectGroup( newGroup );
fail( "Should not have succeeded" );
}
catch ( ContinuumStoreException expected )
@@ -166,7 +168,7 @@
public void testGetAllProjectGroups()
{
- Collection groups = store.getAllProjectGroupsWithProjects();
+ Collection groups = projectGroupDao.getAllProjectGroupsWithProjects();
assertEquals( "check size", 2, groups.size() );
assertTrue( groups.contains( defaultProjectGroup ) );
@@ -202,7 +204,7 @@
public void testGetProject()
throws ContinuumStoreException
{
- Project retrievedProject = store.getProject( testProject1.getId() );
+ Project retrievedProject = projectDao.getProject( testProject1.getId() );
assertProjectEquals( testProject1, retrievedProject );
checkProjectDefaultFetchGroup( retrievedProject );
}
@@ -210,7 +212,7 @@
public void testGetProjectWithDetails()
throws ContinuumStoreException
{
- Project retrievedProject = store.getProjectWithAllDetails( testProject1.getId() );
+ Project retrievedProject = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertProjectEquals( testProject1, retrievedProject );
checkProjectFetchGroup( retrievedProject, false, false, true, true );
@@ -223,7 +225,7 @@
public void testGetProjectWithCheckoutResult()
throws ContinuumStoreException
{
- Project retrievedProject = store.getProjectWithCheckoutResult( testProject1.getId() );
+ Project retrievedProject = projectDao.getProjectWithCheckoutResult( testProject1.getId() );
assertProjectEquals( testProject1, retrievedProject );
assertScmResultEquals( testCheckoutResult1, retrievedProject.getCheckoutResult() );
checkProjectFetchGroup( retrievedProject, true, false, false, false );
@@ -234,7 +236,7 @@
{
try
{
- store.getProject( INVALID_ID );
+ projectDao.getProject( INVALID_ID );
fail( "Should not find project with invalid ID" );
}
catch ( ContinuumObjectNotFoundException expected )
@@ -246,7 +248,7 @@
public void testEditProject()
throws ContinuumStoreException
{
- Project newProject = store.getProject( testProject2.getId() );
+ Project newProject = projectDao.getProject( testProject2.getId() );
newProject.setName( "testEditProject2" );
newProject.setDescription( "testEditProject updated description" );
@@ -254,9 +256,9 @@
Project copy = createTestProject( newProject );
copy.setId( newProject.getId() );
- store.updateProject( newProject );
+ projectDao.updateProject( newProject );
- Project retrievedProject = store.getProject( testProject2.getId() );
+ Project retrievedProject = projectDao.getProject( testProject2.getId() );
assertProjectEquals( copy, retrievedProject );
}
@@ -271,7 +273,7 @@
try
{
- store.updateProject( newProject );
+ projectDao.updateProject( newProject );
fail( "Should not have succeeded" );
}
catch ( ContinuumStoreException expected )
@@ -283,8 +285,8 @@
public void testGetAllProjects()
{
- List projects = store.getAllProjectsByName();
- assertEquals( "check items", Arrays.asList( new Project[] { testProject1, testProject2 } ), projects );
+ List projects = projectDao.getAllProjectsByName();
+ assertEquals( "check items", Arrays.asList( new Project[]{testProject1, testProject2} ), projects );
Project project = (Project) projects.get( 1 );
assertProjectEquals( testProject2, project );
@@ -296,10 +298,10 @@
{
Schedule newSchedule = createTestSchedule( "testAddSchedule", "testAddSchedule desc", 10, "cron test", false );
Schedule copy = createTestSchedule( newSchedule );
- store.addSchedule( newSchedule );
+ scheduleDao.addSchedule( newSchedule );
copy.setId( newSchedule.getId() );
- List schedules = store.getAllSchedulesByName();
+ List schedules = scheduleDao.getAllSchedulesByName();
Schedule retrievedSchedule = (Schedule) schedules.get( schedules.size() - 1 );
assertScheduleEquals( copy, retrievedSchedule );
}
@@ -307,34 +309,34 @@
public void testEditSchedule()
throws ContinuumStoreException
{
- Schedule newSchedule = (Schedule) store.getAllSchedulesByName().get( 0 );
+ Schedule newSchedule = (Schedule) scheduleDao.getAllSchedulesByName().get( 0 );
newSchedule.setName( "name1.1" );
newSchedule.setDescription( "testEditSchedule updated description" );
Schedule copy = createTestSchedule( newSchedule );
copy.setId( newSchedule.getId() );
- store.updateSchedule( newSchedule );
+ scheduleDao.updateSchedule( newSchedule );
- Schedule retrievedSchedule = (Schedule) store.getAllSchedulesByName().get( 0 );
+ Schedule retrievedSchedule = (Schedule) scheduleDao.getAllSchedulesByName().get( 0 );
assertScheduleEquals( copy, retrievedSchedule );
}
public void testRemoveSchedule()
{
- Schedule schedule = (Schedule) store.getAllSchedulesByName().get( 2 );
+ Schedule schedule = (Schedule) scheduleDao.getAllSchedulesByName().get( 2 );
// TODO: test if it has any attachments
- store.removeSchedule( schedule );
+ scheduleDao.removeSchedule( schedule );
- List schedules = store.getAllSchedulesByName();
+ List schedules = scheduleDao.getAllSchedulesByName();
assertEquals( "check size", 2, schedules.size() );
assertFalse( "check not there", schedules.contains( schedule ) );
}
public void testGetAllSchedules()
{
- List schedules = store.getAllSchedulesByName();
+ List schedules = scheduleDao.getAllSchedulesByName();
assertEquals( "check item count", 3, schedules.size() );
@@ -350,15 +352,15 @@
public void testAddProfile()
throws Exception
{
- List installations = store.getAllInstallations();
+ List installations = installationDao.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 );
+ profileDao.addProfile( newProfile );
copy.setId( newProfile.getId() );
- List profiles = store.getAllProfilesByName();
+ List profiles = profileDao.getAllProfilesByName();
Profile retrievedProfile = (Profile) profiles.get( profiles.size() - 1 );
assertProfileEquals( copy, retrievedProfile );
assertInstallationEquals( testInstallationMaven20a3, retrievedProfile.getBuilder() );
@@ -368,15 +370,15 @@
public void testEditProfile()
throws ContinuumStoreException
{
- Profile newProfile = (Profile) store.getAllProfilesByName().get( 0 );
+ Profile newProfile = (Profile) profileDao.getAllProfilesByName().get( 0 );
newProfile.setName( "name1.1" );
newProfile.setDescription( "testEditProfile updated description" );
Profile copy = createTestProfile( newProfile );
copy.setId( newProfile.getId() );
- store.updateProfile( newProfile );
+ profileDao.updateProfile( newProfile );
- Profile retrievedProfile = (Profile) store.getAllProfilesByName().get( 0 );
+ Profile retrievedProfile = (Profile) profileDao.getAllProfilesByName().get( 0 );
assertProfileEquals( copy, retrievedProfile );
assertInstallationEquals( copy.getBuilder(), retrievedProfile.getBuilder() );
assertInstallationEquals( copy.getJdk(), retrievedProfile.getJdk() );
@@ -385,20 +387,20 @@
public void testRemoveProfile()
{
- Profile profile = (Profile) store.getAllProfilesByName().get( 2 );
+ Profile profile = (Profile) profileDao.getAllProfilesByName().get( 2 );
// TODO: test if it has any attachments
- store.removeProfile( profile );
+ profileDao.removeProfile( profile );
- List profiles = store.getAllProfilesByName();
+ List profiles = profileDao.getAllProfilesByName();
assertEquals( "check size", 2, profiles.size() );
assertFalse( "check not there", profiles.contains( profile ) );
}
public void testGetAllProfiles()
{
- List profiles = store.getAllProfilesByName();
+ List profiles = profileDao.getAllProfilesByName();
assertEquals( "check item count", 3, profiles.size() );
@@ -417,18 +419,18 @@
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
{
- List installations = store.getAllInstallations();
+ List installations = installationDao.getAllInstallations();
assertEquals( "check item count", 3, installations.size() );
@@ -446,16 +448,16 @@
{
String name = "installationTest";
Installation testOne = createTestInstallation( name, InstallationService.JDK_TYPE, "varName", "varValue" );
- testOne = store.addInstallation( testOne );
+ testOne = installationDao.addInstallation( testOne );
- Installation fromStore = store.getInstallation( testOne.getInstallationId() );
+ Installation fromStore = installationDao.getInstallation( testOne.getInstallationId() );
assertInstallationEquals( testOne, fromStore );
fromStore.setVarName( "JAVA_HOME" );
fromStore.setVarValue( "/usr/local/jdk1.5.0_08" );
- store.updateInstallation( fromStore );
+ installationDao.updateInstallation( fromStore );
- Installation updatedFromStore = store.getInstallation( testOne.getInstallationId() );
+ Installation updatedFromStore = installationDao.getInstallation( testOne.getInstallationId() );
assertInstallationEquals( fromStore, updatedFromStore );
}
@@ -465,10 +467,10 @@
{
String name = "installationTestRemove";
Installation testOne = createTestInstallation( name, InstallationService.JDK_TYPE, "varName", "varValue" );
- testOne = store.addInstallation( testOne );
+ testOne = installationDao.addInstallation( testOne );
- store.removeInstallation( testOne );
- Installation fromStore = store.getInstallation( testOne.getInstallationId() );
+ installationDao.removeInstallation( testOne );
+ Installation fromStore = installationDao.getInstallation( testOne.getInstallationId() );
assertNull( fromStore );
}
@@ -480,23 +482,23 @@
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 );
+ testOne = installationDao.addInstallation( testOne );
+ testTwo = installationDao.addInstallation( testTwo );
- firstEnvVar = store.addInstallation( firstEnvVar );
- secondEnvVar = store.addInstallation( secondEnvVar );
+ firstEnvVar = installationDao.addInstallation( firstEnvVar );
+ secondEnvVar = installationDao.addInstallation( secondEnvVar );
List<Installation> envVars = new ArrayList<Installation>( 2 );
envVars.add( firstEnvVar );
@@ -506,11 +508,11 @@
Profile secondProfile = createTestProfile( "first", "", 1, true, true, testOne, testTwo, envVars );
- firstProfile = store.addProfile( firstProfile );
- secondProfile = store.addProfile( secondProfile );
+ firstProfile = profileDao.addProfile( firstProfile );
+ secondProfile = profileDao.addProfile( secondProfile );
- Profile firstGetted = store.getProfile( firstProfile.getId() );
- Profile secondGetted = store.getProfile( secondProfile.getId() );
+ Profile firstGetted = profileDao.getProfile( firstProfile.getId() );
+ Profile secondGetted = profileDao.getProfile( secondProfile.getId() );
assertNotNull( firstGetted );
assertNotNull( firstGetted.getJdk() );
@@ -528,13 +530,13 @@
assertEquals( nameSecondInst, secondGetted.getBuilder().getName() );
assertEquals( 2, secondGetted.getEnvironmentVariables().size() );
- store.removeInstallation( testOne );
+ installationDao.removeInstallation( testOne );
- Installation fromStore = store.getInstallation( testOne.getInstallationId() );
+ Installation fromStore = installationDao.getInstallation( testOne.getInstallationId() );
assertNull( fromStore );
- firstGetted = store.getProfile( firstProfile.getId() );
- secondGetted = store.getProfile( secondProfile.getId() );
+ firstGetted = profileDao.getProfile( firstProfile.getId() );
+ secondGetted = profileDao.getProfile( secondProfile.getId() );
assertNotNull( firstGetted );
assertNull( firstGetted.getJdk() );
assertNotNull( firstGetted.getBuilder() );
@@ -544,10 +546,10 @@
assertNotNull( secondGetted.getBuilder() );
assertEquals( 2, secondGetted.getEnvironmentVariables().size() );
// removing builder
- store.removeInstallation( testTwo );
+ installationDao.removeInstallation( testTwo );
- firstGetted = store.getProfile( firstProfile.getId() );
- secondGetted = store.getProfile( secondProfile.getId() );
+ firstGetted = profileDao.getProfile( firstProfile.getId() );
+ secondGetted = profileDao.getProfile( secondProfile.getId() );
assertNotNull( firstGetted );
assertNull( firstGetted.getJdk() );
@@ -560,33 +562,32 @@
assertEquals( 2, secondGetted.getEnvironmentVariables().size() );
// removing firstEnvVar
- store.removeInstallation( firstEnvVar );
- firstGetted = store.getProfile( firstProfile.getId() );
- secondGetted = store.getProfile( secondProfile.getId() );
+ installationDao.removeInstallation( firstEnvVar );
+ firstGetted = profileDao.getProfile( firstProfile.getId() );
+ secondGetted = profileDao.getProfile( secondProfile.getId() );
assertNotNull( firstGetted );
assertNull( firstGetted.getJdk() );
assertNull( firstGetted.getBuilder() );
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() );
- secondGetted = store.getProfile( secondProfile.getId() );
+ installationDao.removeInstallation( secondEnvVar );
+ firstGetted = profileDao.getProfile( firstProfile.getId() );
+ secondGetted = profileDao.getProfile( secondProfile.getId() );
assertNotNull( firstGetted );
assertNull( firstGetted.getJdk() );
assertNull( firstGetted.getBuilder() );
assertEquals( 0, firstGetted.getEnvironmentVariables().size() );
-
assertNotNull( secondGetted );
assertNull( secondGetted.getJdk() );
assertNull( secondGetted.getBuilder() );
@@ -596,11 +597,11 @@
public void testDeleteProject()
throws ContinuumStoreException
{
- Project project = store.getProjectWithBuilds( testProject1.getId() );
+ Project project = projectDao.getProjectWithBuilds( testProject1.getId() );
- store.removeProject( project );
+ projectDao.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 ) );
@@ -610,11 +611,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 )
@@ -631,7 +632,7 @@
public void testDeleteBuildResult()
throws ContinuumStoreException
{
- Project project = store.getProjectWithBuilds( testProject1.getId() );
+ Project project = projectDao.getProjectWithBuilds( testProject1.getId() );
for ( Iterator i = project.getBuildResults().iterator(); i.hasNext(); )
{
@@ -641,13 +642,13 @@
i.remove();
}
}
- store.updateProject( project );
+ projectDao.updateProject( project );
- project = store.getProjectWithBuilds( testProject1.getId() );
+ project = projectDao.getProjectWithBuilds( testProject1.getId() );
assertEquals( "check size is now 1", 1, project.getBuildResults().size() );
assertBuildResultEquals( testBuildResult2, (BuildResult) project.getBuildResults().get( 0 ) );
- List results = store.getAllBuildsForAProjectByDate( testProject1.getId() );
+ List results = buildResultDao.getAllBuildsForAProjectByDate( testProject1.getId() );
assertEquals( "check item count", 1, results.size() );
assertBuildResultEquals( testBuildResult2, (BuildResult) results.get( 0 ) );
@@ -662,7 +663,7 @@
{
try
{
- store.getBuildResult( INVALID_ID );
+ buildResultDao.getBuildResult( INVALID_ID );
fail( "Should not find build result with invalid ID" );
}
catch ( ContinuumObjectNotFoundException expected )
@@ -673,7 +674,7 @@
public void testGetAllBuildsForAProject()
{
- List results = store.getAllBuildsForAProjectByDate( testProject1.getId() );
+ List results = buildResultDao.getAllBuildsForAProjectByDate( testProject1.getId() );
assertEquals( "check item count", 2, results.size() );
@@ -691,7 +692,7 @@
public void testGetBuildResult()
throws ContinuumStoreException
{
- BuildResult buildResult = store.getBuildResult( testBuildResult3.getId() );
+ BuildResult buildResult = buildResultDao.getBuildResult( testBuildResult3.getId() );
assertBuildResultEquals( testBuildResult3, buildResult );
assertScmResultEquals( testBuildResult3.getScmResult(), buildResult.getScmResult() );
assertProjectEquals( testProject2, buildResult.getProject() );
@@ -701,8 +702,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() );
@@ -729,7 +731,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() );
@@ -763,14 +765,14 @@
public void testAddDeveloperToProject()
throws ContinuumStoreException
{
- Project project = store.getProjectWithAllDetails( testProject1.getId() );
+ Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
ProjectDeveloper developer = createTestDeveloper( 11, "email TADTP", "name TADTP", "scmId TADTP" );
ProjectDeveloper copy = createTestDeveloper( developer );
project.addDeveloper( developer );
- store.updateProject( project );
+ projectDao.updateProject( project );
- project = store.getProjectWithAllDetails( testProject1.getId() );
+ project = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertEquals( "check # devs", 2, project.getDevelopers().size() );
assertDeveloperEquals( copy, (ProjectDeveloper) project.getDevelopers().get( 1 ) );
}
@@ -778,16 +780,16 @@
public void testEditDeveloper()
throws ContinuumStoreException
{
- Project project = store.getProjectWithAllDetails( testProject1.getId() );
+ Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
ProjectDeveloper newDeveloper = (ProjectDeveloper) project.getDevelopers().get( 0 );
newDeveloper.setName( "name1.1" );
newDeveloper.setEmail( "email1.1" );
ProjectDeveloper copy = createTestDeveloper( newDeveloper );
- store.updateProject( project );
+ projectDao.updateProject( project );
- project = store.getProjectWithAllDetails( testProject1.getId() );
+ project = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertEquals( "check # devs", 1, project.getDevelopers().size() );
assertDeveloperEquals( copy, (ProjectDeveloper) project.getDevelopers().get( 0 ) );
}
@@ -795,11 +797,11 @@
public void testDeleteDeveloper()
throws ContinuumStoreException
{
- Project project = store.getProjectWithAllDetails( testProject1.getId() );
+ Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
project.getDevelopers().remove( 0 );
- store.updateProject( project );
+ projectDao.updateProject( project );
- project = store.getProjectWithAllDetails( testProject1.getId() );
+ project = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertEquals( "check size is now 0", 0, project.getDevelopers().size() );
// !! These actually aren't happening !!
@@ -809,14 +811,14 @@
public void testAddDependencyToProject()
throws ContinuumStoreException
{
- Project project = store.getProjectWithAllDetails( testProject1.getId() );
+ Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
ProjectDependency dependency = createTestDependency( "TADTP groupId", "TADTP artifactId", "TADTP version" );
ProjectDependency copy = createTestDependency( dependency );
project.addDependency( dependency );
- store.updateProject( project );
+ projectDao.updateProject( project );
- project = store.getProjectWithAllDetails( testProject1.getId() );
+ project = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertEquals( "check # deps", 3, project.getDependencies().size() );
assertDependencyEquals( copy, (ProjectDependency) project.getDependencies().get( 2 ) );
}
@@ -824,16 +826,16 @@
public void testEditDependency()
throws ContinuumStoreException
{
- Project project = store.getProjectWithAllDetails( testProject1.getId() );
+ Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
ProjectDependency newDependency = (ProjectDependency) project.getDependencies().get( 0 );
newDependency.setGroupId( "groupId1.1" );
newDependency.setArtifactId( "artifactId1.1" );
ProjectDependency copy = createTestDependency( newDependency );
- store.updateProject( project );
+ projectDao.updateProject( project );
- project = store.getProjectWithAllDetails( testProject1.getId() );
+ project = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertEquals( "check # deps", 2, project.getDependencies().size() );
assertDependencyEquals( copy, (ProjectDependency) project.getDependencies().get( 0 ) );
}
@@ -841,12 +843,12 @@
public void testDeleteDependency()
throws ContinuumStoreException
{
- Project project = store.getProjectWithAllDetails( testProject1.getId() );
+ Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
ProjectDependency dependency = (ProjectDependency) project.getDependencies().get( 1 );
project.getDependencies().remove( 0 );
- store.updateProject( project );
+ projectDao.updateProject( project );
- project = store.getProjectWithAllDetails( testProject1.getId() );
+ project = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertEquals( "check size is now 1", 1, project.getDependencies().size() );
assertDependencyEquals( dependency, (ProjectDependency) project.getDependencies().get( 0 ) );
@@ -857,14 +859,14 @@
public void testAddNotifierToProject()
throws ContinuumStoreException
{
- Project project = store.getProjectWithAllDetails( testProject1.getId() );
+ Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
ProjectNotifier notifier = createTestNotifier( 13, true, false, true, "TADNTP type" );
ProjectNotifier copy = createTestNotifier( notifier );
project.addNotifier( notifier );
- store.updateProject( project );
+ projectDao.updateProject( project );
- project = store.getProjectWithAllDetails( testProject1.getId() );
+ project = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertEquals( "check # notifiers", 2, project.getNotifiers().size() );
assertNotifierEquals( copy, (ProjectNotifier) project.getNotifiers().get( 1 ) );
}
@@ -872,7 +874,7 @@
public void testEditNotifier()
throws ContinuumStoreException
{
- Project project = store.getProjectWithAllDetails( testProject1.getId() );
+ Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
ProjectNotifier newNotifier = (ProjectNotifier) project.getNotifiers().get( 0 );
// If we use "type1.1", jpox-rc2 store "type11", weird
@@ -880,9 +882,9 @@
newNotifier.setType( type );
ProjectNotifier copy = createTestNotifier( newNotifier );
- store.updateProject( project );
+ projectDao.updateProject( project );
- project = store.getProjectWithAllDetails( testProject1.getId() );
+ project = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertEquals( "check # notifiers", 1, project.getNotifiers().size() );
assertNotifierEquals( copy, (ProjectNotifier) project.getNotifiers().get( 0 ) );
}
@@ -890,11 +892,11 @@
public void testDeleteNotifier()
throws ContinuumStoreException
{
- Project project = store.getProjectWithAllDetails( testProject1.getId() );
+ Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
project.getNotifiers().remove( 0 );
- store.updateProject( project );
+ projectDao.updateProject( project );
- project = store.getProjectWithAllDetails( testProject1.getId() );
+ project = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertEquals( "check size is now 0", 0, project.getNotifiers().size() );
// !! These actually aren't happening !!
@@ -904,17 +906,17 @@
public void testAddBuildDefinitionToProject()
throws ContinuumStoreException
{
- Project project = store.getProjectWithAllDetails( testProject1.getId() );
+ Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
- Profile profile = store.getProfile( testProfile1.getId() );
- Schedule schedule = store.getSchedule( testSchedule1.getId() );
+ Profile profile = profileDao.getProfile( testProfile1.getId() );
+ Schedule schedule = scheduleDao.getSchedule( testSchedule1.getId() );
BuildDefinition buildDefinition = createTestBuildDefinition( "TABDTP arguments", "TABDTP buildFile",
"TABDTP goals", profile, schedule, false, false );
BuildDefinition copy = createTestBuildDefinition( buildDefinition );
project.addBuildDefinition( buildDefinition );
- store.updateProject( project );
+ projectDao.updateProject( project );
- project = store.getProjectWithAllDetails( testProject1.getId() );
+ project = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertEquals( "check # build defs", 3, project.getBuildDefinitions().size() );
BuildDefinition retrievedBuildDefinition = (BuildDefinition) project.getBuildDefinitions().get( 2 );
assertBuildDefinitionEquals( copy, retrievedBuildDefinition );
@@ -925,7 +927,7 @@
public void testEditBuildDefinition()
throws ContinuumStoreException
{
- Project project = store.getProjectWithAllDetails( testProject1.getId() );
+ Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
BuildDefinition newBuildDefinition = (BuildDefinition) project.getBuildDefinitions().get( 0 );
newBuildDefinition.setBuildFresh( true );
@@ -934,9 +936,9 @@
newBuildDefinition.setArguments( arguments );
BuildDefinition copy = createTestBuildDefinition( newBuildDefinition );
- store.storeBuildDefinition( newBuildDefinition );
+ buildDefinitionDao.storeBuildDefinition( newBuildDefinition );
- project = store.getProjectWithAllDetails( testProject1.getId() );
+ project = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertEquals( "check # build defs", 2, project.getBuildDefinitions().size() );
BuildDefinition retrievedBuildDefinition = (BuildDefinition) project.getBuildDefinitions().get( 0 );
assertBuildDefinitionEquals( copy, retrievedBuildDefinition );
@@ -947,12 +949,12 @@
public void testDeleteBuildDefinition()
throws ContinuumStoreException
{
- Project project = store.getProjectWithAllDetails( testProject1.getId() );
+ Project project = projectDao.getProjectWithAllDetails( testProject1.getId() );
BuildDefinition buildDefinition = (BuildDefinition) project.getBuildDefinitions().get( 1 );
project.getBuildDefinitions().remove( 0 );
- store.updateProject( project );
+ projectDao.updateProject( project );
- project = store.getProjectWithAllDetails( testProject1.getId() );
+ project = projectDao.getProjectWithAllDetails( testProject1.getId() );
assertEquals( "check size is now 1", 1, project.getBuildDefinitions().size() );
BuildDefinition retrievedBuildDefinition = (BuildDefinition) project.getBuildDefinitions().get( 0 );
assertBuildDefinitionEquals( buildDefinition, retrievedBuildDefinition );
@@ -967,14 +969,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 ) );
}
@@ -982,7 +985,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
@@ -990,9 +994,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 ) );
}
@@ -1000,12 +1004,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 ) );
@@ -1016,17 +1021,18 @@
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() );
+ Profile profile = profileDao.getProfile( testProfile1.getId() );
+ Schedule schedule = scheduleDao.getSchedule( testSchedule1.getId() );
BuildDefinition buildDefinition = createTestBuildDefinition( "TABDTPG arguments", "TABDTPG buildFile",
"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 );
@@ -1037,7 +1043,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
@@ -1045,9 +1052,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 );
@@ -1058,23 +1065,24 @@
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
{
- int all = store.getAllBuildDefinitions().size();
+ int all = buildDefinitionDao.getAllBuildDefinitions().size();
BuildDefinition buildDefinition = new BuildDefinition();
buildDefinition.setBuildFile( "pom.xml" );
buildDefinition.setGoals( "clean" );
@@ -1083,154 +1091,164 @@
template.setName( "test" );
template.setContinuumDefault( true );
template.setType( ContinuumBuildExecutorConstants.MAVEN_TWO_BUILD_EXECUTOR );
- template = store.addBuildDefinitionTemplate( template );
- buildDefinition = store.addBuildDefinition( buildDefinition );
+ template = buildDefinitionTemplateDao.addBuildDefinitionTemplate( template );
+ buildDefinition = buildDefinitionDao.addBuildDefinition( buildDefinition );
template.addBuildDefinition( buildDefinition );
-
- template = store.updateBuildDefinitionTemplate( template );
+
+ template = buildDefinitionTemplateDao.updateBuildDefinitionTemplate( template );
assertEquals( "test", template.getName() );
assertTrue( template.isContinuumDefault() );
assertEquals( 1, template.getBuildDefinitions().size() );
- assertEquals( all + 1, store.getAllBuildDefinitions().size() );
- assertEquals( 1, store.getAllBuildDefinitionTemplate().size() );
+ assertEquals( all + 1, buildDefinitionDao.getAllBuildDefinitions().size() );
+ assertEquals( 1, buildDefinitionTemplateDao.getAllBuildDefinitionTemplate().size() );
- template = store
+ template = buildDefinitionTemplateDao
.getContinuumBuildDefinitionTemplateWithType( ContinuumBuildExecutorConstants.MAVEN_TWO_BUILD_EXECUTOR );
assertNotNull( template );
assertEquals( 1, template.getBuildDefinitions().size() );
-
- assertEquals( 1, store.getAllBuildDefinitionTemplate().size() );
+
+ assertEquals( 1, buildDefinitionTemplateDao.getAllBuildDefinitionTemplate().size() );
}
-
+
public void testAddLocalRepository()
throws Exception
{
String name = "testAddLocalRepository";
String directory = "testAddLocalRepositoryDirectory";
String layout = "default";
-
+
LocalRepository repository = createTestLocalRepository( name, directory, layout );
-
+
LocalRepository copy = createTestLocalRepository( repository );
- store.addLocalRepository( repository );
+ localRepositoryDao.addLocalRepository( repository );
copy.setId( repository.getId() );
-
- LocalRepository retrievedRepository = store.getLocalRepository( repository.getId() );
+
+ LocalRepository retrievedRepository = localRepositoryDao.getLocalRepository( repository.getId() );
assertLocalRepositoryEquals( copy, retrievedRepository );
}
-
+
public void testRemoveLocalRepository()
throws Exception
{
- LocalRepository repository = store.getLocalRepositoryByName( testLocalRepository2.getName() );
+ LocalRepository repository = localRepositoryDao.getLocalRepositoryByName( testLocalRepository2.getName() );
- ProjectGroup projectGroup = store.getProjectGroupByGroupId( testProjectGroup2.getGroupId() );
+ ProjectGroup projectGroup = projectGroupDao.getProjectGroupByGroupId( testProjectGroup2.getGroupId() );
assertLocalRepositoryEquals( testLocalRepository2, projectGroup.getLocalRepository() );
projectGroup.setLocalRepository( null );
-
+
ProjectGroup copy = createTestProjectGroup( projectGroup );
- store.updateProjectGroup( projectGroup );
-
- projectGroup = store.getProjectGroup( testProjectGroup2.getId() );
- assertNull( "check local repository" , projectGroup.getLocalRepository() );
-
- List<RepositoryPurgeConfiguration> repoPurgeList =
- store.getRepositoryPurgeConfigurationsByLocalRepository( repository.getId() );
-
+ projectGroupDao.updateProjectGroup( projectGroup );
+
+ projectGroup = projectGroupDao.getProjectGroup( testProjectGroup2.getId() );
+ assertNull( "check local repository", projectGroup.getLocalRepository() );
+
+ List<RepositoryPurgeConfiguration> repoPurgeList =
+ repositoryPurgeConfigurationDao.getRepositoryPurgeConfigurationsByLocalRepository( repository.getId() );
+
assertEquals( "check # repo purge config", 1, repoPurgeList.size() );
- store.removeRepositoryPurgeConfiguration( repoPurgeList.get( 0 ) );
- store.removeLocalRepository( repository );
-
- List<LocalRepository> localRepositories = store.getAllLocalRepositories();
+ repositoryPurgeConfigurationDao.removeRepositoryPurgeConfiguration( repoPurgeList.get( 0 ) );
+ localRepositoryDao.removeLocalRepository( repository );
+
+ List<LocalRepository> localRepositories = localRepositoryDao.getAllLocalRepositories();
assertEquals( "check # local repositories", 2, localRepositories.size() );
assertFalse( "check not there", localRepositories.contains( repository ) );
}
-
+
public void testGetAllLocalRepositories()
throws Exception
{
- List<LocalRepository> localRepositories = store.getAllLocalRepositories();
-
+ List<LocalRepository> localRepositories = localRepositoryDao.getAllLocalRepositories();
+
assertEquals( "check # local repositories", 3, localRepositories.size() );
assertLocalRepositoryEquals( testLocalRepository1, localRepositories.get( 0 ) );
assertLocalRepositoryEquals( testLocalRepository2, localRepositories.get( 1 ) );
assertLocalRepositoryEquals( testLocalRepository3, localRepositories.get( 2 ) );
}
-
+
public void testAddRepositoryPurgeConfiguration()
throws Exception
{
- LocalRepository repository = store.getLocalRepository( testLocalRepository3.getId() );
- Schedule schedule = store.getSchedule( testSchedule1.getId() );
-
- RepositoryPurgeConfiguration repoPurge = createTestRepositoryPurgeConfiguration( true, 2, 100, false, schedule, true, repository );
-
+ LocalRepository repository = localRepositoryDao.getLocalRepository( testLocalRepository3.getId() );
+ Schedule schedule = scheduleDao.getSchedule( testSchedule1.getId() );
+
+ RepositoryPurgeConfiguration repoPurge =
+ createTestRepositoryPurgeConfiguration( true, 2, 100, false, schedule, true, repository );
+
RepositoryPurgeConfiguration copy = createTestRepositoryPurgeConfiguration( repoPurge );
- store.addRepositoryPurgeConfiguration( repoPurge );
+ repositoryPurgeConfigurationDao.addRepositoryPurgeConfiguration( repoPurge );
copy.setId( repoPurge.getId() );
-
- RepositoryPurgeConfiguration retrieved = store.getRepositoryPurgeConfiguration( repoPurge.getId() );
+
+ RepositoryPurgeConfiguration retrieved =
+ repositoryPurgeConfigurationDao.getRepositoryPurgeConfiguration( repoPurge.getId() );
assertRepositoryPurgeConfigurationEquals( copy, retrieved );
assertLocalRepositoryEquals( testLocalRepository3, retrieved.getRepository() );
assertScheduleEquals( testSchedule1, retrieved.getSchedule() );
}
-
+
public void testRemoveRepositoryPurgeConfiguration()
throws Exception
{
- RepositoryPurgeConfiguration repoPurge = store.getRepositoryPurgeConfiguration( testRepoPurgeConfiguration2.getId() );
- store.removeRepositoryPurgeConfiguration( repoPurge );
-
- List<RepositoryPurgeConfiguration> repoPurgeList = store.getAllRepositoryPurgeConfigurations();
+ RepositoryPurgeConfiguration repoPurge =
+ repositoryPurgeConfigurationDao.getRepositoryPurgeConfiguration( testRepoPurgeConfiguration2.getId() );
+ repositoryPurgeConfigurationDao.removeRepositoryPurgeConfiguration( repoPurge );
+
+ List<RepositoryPurgeConfiguration> repoPurgeList =
+ repositoryPurgeConfigurationDao.getAllRepositoryPurgeConfigurations();
assertEquals( "check # repo purge configurations", 2, repoPurgeList.size() );
assertFalse( "check not there", repoPurgeList.contains( repoPurge ) );
}
-
+
public void testAddDirectoryPurgeConfiguration()
throws Exception
{
String location = "release-directory";
String directoryType = "release";
-
- Schedule schedule = store.getSchedule( testSchedule1.getId() );
- DirectoryPurgeConfiguration dirPurge = createTestDirectoryPurgeConfiguration( location, directoryType, false, 2, 100, schedule, true );
-
+
+ Schedule schedule = scheduleDao.getSchedule( testSchedule1.getId() );
+ DirectoryPurgeConfiguration dirPurge =
+ createTestDirectoryPurgeConfiguration( location, directoryType, false, 2, 100, schedule, true );
+
DirectoryPurgeConfiguration copy = createTestDirectoryPurgeConfiguration( dirPurge );
- store.addDirectoryPurgeConfiguration( dirPurge );
+ directoryPurgeConfigurationDao.addDirectoryPurgeConfiguration( dirPurge );
copy.setId( dirPurge.getId() );
-
- DirectoryPurgeConfiguration retrieved = store.getDirectoryPurgeConfiguration( dirPurge.getId() );
+
+ DirectoryPurgeConfiguration retrieved =
+ directoryPurgeConfigurationDao.getDirectoryPurgeConfiguration( dirPurge.getId() );
assertDirectoryPurgeConfigurationEquals( copy, retrieved );
assertScheduleEquals( testSchedule1, retrieved.getSchedule() );
}
-
+
public void testRemoveDirectoryPurgeConfiguration()
throws Exception
{
- DirectoryPurgeConfiguration dirPurge = store.getDirectoryPurgeConfiguration( testDirectoryPurgeConfig.getId() );
- store.removeDirectoryPurgeConfiguration( dirPurge );
-
- List<DirectoryPurgeConfiguration> dirPurgeList = store.getAllDirectoryPurgeConfigurations();
+ DirectoryPurgeConfiguration dirPurge =
+ directoryPurgeConfigurationDao.getDirectoryPurgeConfiguration( testDirectoryPurgeConfig.getId() );
+ directoryPurgeConfigurationDao.removeDirectoryPurgeConfiguration( dirPurge );
+
+ List<DirectoryPurgeConfiguration> dirPurgeList =
+ directoryPurgeConfigurationDao.getAllDirectoryPurgeConfigurations();
assertEquals( "check # dir purge configurations", 0, dirPurgeList.size() );
}
-
+
public void testGetPurgeConfigurationsBySchedule()
throws Exception
{
- List<RepositoryPurgeConfiguration> repoPurgeList = store.getRepositoryPurgeConfigurationsBySchedule( testSchedule2.getId() );
- List<DirectoryPurgeConfiguration> dirPurgeList = store.getDirectoryPurgeConfigurationsBySchedule( testSchedule2.getId() );
-
+ List<RepositoryPurgeConfiguration> repoPurgeList =
+ repositoryPurgeConfigurationDao.getRepositoryPurgeConfigurationsBySchedule( testSchedule2.getId() );
+ List<DirectoryPurgeConfiguration> dirPurgeList =
+ directoryPurgeConfigurationDao.getDirectoryPurgeConfigurationsBySchedule( testSchedule2.getId() );
+
assertEquals( "check # repo purge configurations", 2, repoPurgeList.size() );
assertEquals( "check # dir purge configurations", 1, dirPurgeList.size() );
-
+
assertRepositoryPurgeConfigurationEquals( testRepoPurgeConfiguration1, repoPurgeList.get( 0 ) );
assertRepositoryPurgeConfigurationEquals( testRepoPurgeConfiguration3, repoPurgeList.get( 1 ) );
assertDirectoryPurgeConfigurationEquals( testDirectoryPurgeConfig, dirPurgeList.get( 0 ) );
}
-
+
// ----------------------------------------------------------------------
// HELPER METHODS
// ----------------------------------------------------------------------
@@ -1240,7 +1258,7 @@
{
try
{
- store.getProject( project.getId() );
+ projectDao.getProject( project.getId() );
fail( "Project should no longer exist" );
}
catch ( ContinuumObjectNotFoundException expected )
@@ -1286,11 +1304,18 @@
checkProjectFetchGroup( project, false, false, false, false );
}
+ @Override
protected void setUp()
throws Exception
{
super.setUp();
+ buildDefinitionDao = (BuildDefinitionDao) lookup( BuildDefinitionDao.class.getName() );
+
+ buildDefinitionTemplateDao = (BuildDefinitionTemplateDao) lookup( BuildDefinitionTemplateDao.class.getName() );
+
+ buildResultDao = (BuildResultDao) lookup( BuildResultDao.class.getName() );
+
createBuildDatabase();
}
Modified: continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java?rev=684085&r1=684084&r2=684085&view=diff
==============================================================================
--- continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java (original)
+++ continuum/trunk/continuum-test/src/main/java/org/apache/maven/continuum/AbstractContinuumTest.java Fri Aug 8 13:48:14 2008
@@ -19,6 +19,10 @@
* under the License.
*/
+import org.apache.continuum.dao.DaoUtils;
+import org.apache.continuum.dao.ProjectDao;
+import org.apache.continuum.dao.ProjectGroupDao;
+import org.apache.continuum.dao.ScheduleDao;
import org.apache.maven.continuum.configuration.ConfigurationService;
import org.apache.maven.continuum.execution.ContinuumBuildExecutor;
import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
@@ -29,7 +33,6 @@
import org.apache.maven.continuum.model.project.ProjectNotifier;
import org.apache.maven.continuum.model.scm.ScmResult;
import org.apache.maven.continuum.store.ContinuumObjectNotFoundException;
-import org.apache.maven.continuum.store.ContinuumStore;
import org.apache.maven.continuum.store.ContinuumStoreException;
import org.codehaus.plexus.jdo.JdoFactory;
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
@@ -51,7 +54,13 @@
public abstract class AbstractContinuumTest
extends PlexusInSpringTestCase
{
- private ContinuumStore store;
+ private DaoUtils daoUtils;
+
+ private ProjectDao projectDao;
+
+ private ProjectGroupDao projectGroupDao;
+
+ private ScheduleDao scheduleDao;
// ----------------------------------------------------------------------
//
@@ -63,17 +72,23 @@
{
super.setUp();
- getStore();
+ init();
+
+ getProjectDao();
+
+ getProjectGroupDao();
+
+ getScheduleDao();
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() );
@@ -83,7 +98,7 @@
protected void tearDown()
throws Exception
{
- store.eraseDatabase();
+ daoUtils.eraseDatabase();
super.tearDown();
}
@@ -106,7 +121,7 @@
group.setDescription( "Contains all projects that do not have a group of their own" );
- store.addProjectGroup( group );
+ projectGroupDao.addProjectGroup( group );
}
}
@@ -123,21 +138,16 @@
protected ProjectGroup getDefaultProjectGroup()
throws ContinuumStoreException
{
- return store.getProjectGroupByGroupIdWithProjects( Continuum.DEFAULT_PROJECT_GROUP_GROUP_ID );
+ return projectGroupDao.getProjectGroupByGroupIdWithProjects( Continuum.DEFAULT_PROJECT_GROUP_GROUP_ID );
}
// ----------------------------------------------------------------------
// Store
// ----------------------------------------------------------------------
- protected ContinuumStore getStore()
+ private void init()
throws Exception
{
- if ( store != null )
- {
- return store;
- }
-
// ----------------------------------------------------------------------
// Set up the JDO factory
// ----------------------------------------------------------------------
@@ -200,9 +210,34 @@
//
// ----------------------------------------------------------------------
- store = (ContinuumStore) lookup( ContinuumStore.ROLE, "jdo" );
+ daoUtils = (DaoUtils) lookup( DaoUtils.class.getName() );
+ }
- return store;
+ protected ProjectDao getProjectDao()
+ {
+ if ( projectDao == null )
+ {
+ projectDao = (ProjectDao) lookup( ProjectDao.class.getName() );
+ }
+ return projectDao;
+ }
+
+ protected ProjectGroupDao getProjectGroupDao()
+ {
+ if ( projectGroupDao == null )
+ {
+ projectGroupDao = (ProjectGroupDao) lookup( ProjectGroupDao.class.getName() );
+ }
+ return projectGroupDao;
+ }
+
+ protected ScheduleDao getScheduleDao()
+ {
+ if ( scheduleDao == null )
+ {
+ scheduleDao = (ScheduleDao) lookup( ScheduleDao.class.getName() );
+ }
+ return scheduleDao;
}
// ----------------------------------------------------------------------
@@ -296,7 +331,7 @@
// Public utility methods
// ----------------------------------------------------------------------
- public Project addProject( ContinuumStore store, Project project )
+ public Project addProject( Project project )
throws Exception
{
ProjectGroup defaultProjectGroup = getDefaultProjectGroup();
@@ -316,32 +351,20 @@
project.setCheckoutResult( scmResult );
defaultProjectGroup.addProject( project );
- store.updateProjectGroup( defaultProjectGroup );
- project = store.getProject( project.getId() );
+ projectGroupDao.updateProjectGroup( defaultProjectGroup );
+
+ project = projectDao.getProject( project.getId() );
+
assertNotNull( "project group == null", project.getProjectGroup() );
return project;
}
- public Project addProject( ContinuumStore store, String name )
+ public Project addProject( String name )
throws Exception
{
- return addProject( store, makeStubProject( name ) );
- }
-
- public Project addProject( ContinuumStore store, String name, String nagEmailAddress, String version )
- throws Exception
- {
- return addProject( store, makeProject( name, nagEmailAddress, version ) );
- }
-
- public static void setCheckoutDone( ContinuumStore store, Project project, ScmResult scmResult )
- throws ContinuumStoreException
- {
- project.setCheckoutResult( scmResult );
-
- store.updateProject( project );
+ return addProject( makeStubProject( name ) );
}
// ----------------------------------------------------------------------
Modified: continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/application.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/application.xml?rev=684085&r1=684084&r2=684085&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/application.xml (original)
+++ continuum/trunk/continuum-webapp/src/main/resources/META-INF/plexus/application.xml Fri Aug 8 13:48:14 2008
@@ -51,8 +51,10 @@
<role>org.codehaus.plexus.velocity.VelocityComponent</role>
</requirement>
<requirement>
- <role>org.apache.maven.continuum.store.ContinuumStore</role>
- <role-hint>jdo</role-hint>
+ <role>org.apache.continuum.dao.ProjectDao</role>
+ </requirement>
+ <requirement>
+ <role>org.apache.continuum.dao.BuildResultDao</role>
</requirement>
<requirement>
<role>org.codehaus.plexus.mailsender.MailSender</role>
@@ -135,8 +137,10 @@
<role>org.apache.maven.continuum.configuration.ConfigurationService</role>
</requirement>
<requirement>
- <role>org.apache.maven.continuum.store.ContinuumStore</role>
- <role-hint>jdo</role-hint>
+ <role>org.apache.continuum.dao.ProjectDao</role>
+ </requirement>
+ <requirement>
+ <role>org.apache.continuum.dao.BuildResultDao</role>
</requirement>
</requirements>
<configuration>
@@ -169,8 +173,10 @@
<role>org.apache.maven.continuum.configuration.ConfigurationService</role>
</requirement>
<requirement>
- <role>org.apache.maven.continuum.store.ContinuumStore</role>
- <role-hint>jdo</role-hint>
+ <role>org.apache.continuum.dao.ProjectDao</role>
+ </requirement>
+ <requirement>
+ <role>org.apache.continuum.dao.BuildResultDao</role>
</requirement>
</requirements>
<configuration>
Modified: continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java?rev=684085&r1=684084&r2=684085&view=diff
==============================================================================
--- continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java (original)
+++ continuum/trunk/continuum-xmlrpc/continuum-xmlrpc-server/src/main/java/org/apache/maven/continuum/xmlrpc/server/ContinuumServiceImpl.java Fri Aug 8 13:48:14 2008
@@ -19,14 +19,9 @@
* under the License.
*/
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
import net.sf.dozer.util.mapping.DozerBeanMapperSingletonWrapper;
import net.sf.dozer.util.mapping.MapperIF;
-
+import org.apache.continuum.dao.SystemConfigurationDao;
import org.apache.maven.continuum.Continuum;
import org.apache.maven.continuum.ContinuumException;
import org.apache.maven.continuum.execution.ContinuumBuildExecutorConstants;
@@ -34,7 +29,6 @@
import org.apache.maven.continuum.project.ContinuumProjectState;
import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
import org.apache.maven.continuum.security.ContinuumRoleConstants;
-import org.apache.maven.continuum.store.ContinuumStore;
import org.apache.maven.continuum.store.ContinuumStoreException;
import org.apache.maven.continuum.xmlrpc.project.AddingResult;
import org.apache.maven.continuum.xmlrpc.project.BuildDefinition;
@@ -55,6 +49,11 @@
import org.codehaus.plexus.redback.role.RoleManagerException;
import org.codehaus.plexus.util.StringUtils;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
/**
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id$
@@ -71,9 +70,9 @@
private Continuum continuum;
/**
- * @plexus.requirement role-hint="jdo"
+ * @plexus.requirement
*/
- private ContinuumStore store;
+ private SystemConfigurationDao systemConfigurationDao;
/**
* @plexus.requirement role-hint="default"
@@ -223,7 +222,8 @@
protected String getProjectGroupName( int projectGroupId )
throws ContinuumException
{
- org.apache.maven.continuum.model.project.ProjectGroup projectGroup = continuum.getProjectGroup( projectGroupId );
+ org.apache.maven.continuum.model.project.ProjectGroup projectGroup =
+ continuum.getProjectGroup( projectGroupId );
return projectGroup == null ? null : projectGroup.getName();
}
@@ -765,7 +765,7 @@
}
// ----------------------------------------------------------------------
- // SystemConfiguration
+ // SystemConfigurationDao
// ----------------------------------------------------------------------
public SystemConfiguration getSystemConfiguration()
@@ -774,12 +774,13 @@
checkManageConfigurationAuthorization();
try
{
- org.apache.maven.continuum.model.system.SystemConfiguration sysConf = store.getSystemConfiguration();
+ org.apache.maven.continuum.model.system.SystemConfiguration sysConf =
+ systemConfigurationDao.getSystemConfiguration();
return populateSystemConfiguration( sysConf );
}
catch ( ContinuumStoreException e )
{
- throw new ContinuumException( "Can't get SystemConfiguration.", e );
+ throw new ContinuumException( "Can't get SystemConfigurationDao.", e );
}
}
@@ -805,7 +806,7 @@
// ----------------------------------------------------------------------
private List<BuildProjectTask> populateBuildProjectTaskList(
- List<org.apache.maven.continuum.buildqueue.BuildProjectTask> buildProjectTasks )
+ List<org.apache.maven.continuum.buildqueue.BuildProjectTask> buildProjectTasks )
{
List<BuildProjectTask> responses = new ArrayList<BuildProjectTask>();
for ( org.apache.maven.continuum.buildqueue.BuildProjectTask buildProjectTask : buildProjectTasks )
@@ -815,7 +816,7 @@
}
return responses;
}
-
+
private ProjectSummary populateProjectSummary( org.apache.maven.continuum.model.project.Project project )
{
return (ProjectSummary) mapper.map( project, ProjectSummary.class );
Modified: continuum/trunk/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/pom.xml?rev=684085&r1=684084&r2=684085&view=diff
==============================================================================
--- continuum/trunk/pom.xml (original)
+++ continuum/trunk/pom.xml Fri Aug 8 13:48:14 2008
@@ -180,6 +180,41 @@
</archive>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>JAVA_HOME</name>
+ <value>${java.home}</value>
+ </property>
+ <property>
+ <name>M2_HOME</name>
+ <value>${maven.home}</value>
+ </property>
+ <property>
+ <name>plexus.home</name>
+ <!-- ${project.build.directory} is not evaluated see surefire documentation -->
+ <!--value>${project.build.directory}</value-->
+ <value>./target</value>
+ </property>
+ <property>
+ <name>appserver.base</name>
+ <value>${basedir}/target/test-classes/</value>
+ </property>
+ <property>
+ <name>user.home</name>
+ <value>${basedir}/target/test-classes/</value>
+ </property>
+ <property>
+ <!-- java.io.tmpdir is a shared directory on solaris and cause permission issues -->
+ <name>java.io.tmpdir</name>
+ <value>./target</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
</plugins>
</build>
<modules>