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/07 21:38:56 UTC
svn commit: r683689 [5/7] - in
/continuum/branches/continuum-refactoring-evenisse: ./ continuum-api/
continuum-api/src/main/java/org/apache/continuum/dao/
continuum-api/src/main/java/org/apache/continuum/purge/
continuum-api/src/main/java/org/apache/co...
Copied: continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java (from r682986, continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java)
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java?p2=continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java&p1=continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java&r1=682986&r2=683689&rev=683689&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java Thu Aug 7 12:38:49 2008
@@ -19,10 +19,6 @@
* under the License.
*/
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.commons.io.FileUtils;
import org.apache.continuum.model.repository.DirectoryPurgeConfiguration;
import org.apache.continuum.model.repository.RepositoryPurgeConfiguration;
@@ -30,43 +26,47 @@
import org.apache.continuum.purge.task.PurgeTask;
import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* @author Maria Catherine Tan
*/
public abstract class AbstractPurgeExecutorTest
extends AbstractPurgeTest
{
- private static final String[] jar_extensions = new String[] { ".jar", ".jar.md5", ".jar.sha1" };
-
- private static final String[] pom_extensions = new String[] { ".pom", ".pom.md5", ".pom.sha1" };
-
- private static final String[] metadata_extensions = new String[] { ".xml", ".xml.sha1", ".xml.md5" };
-
+ private static final String[] jar_extensions = new String[]{".jar", ".jar.md5", ".jar.sha1"};
+
+ private static final String[] pom_extensions = new String[]{".pom", ".pom.md5", ".pom.sha1"};
+
+ private static final String[] metadata_extensions = new String[]{".xml", ".xml.sha1", ".xml.md5"};
+
public static final String TEST_MAVEN_METADATA = "maven-metadata-central";
-
+
private RepositoryPurgeConfiguration repoConfig;
-
+
private DirectoryPurgeConfiguration dirConfig;
-
+
protected TaskExecutor purgeExecutor;
-
+
protected PurgeTask purgeDefaultRepoTask;
-
+
protected PurgeTask purgeReleasesDirTask;
-
+
protected PurgeTask purgeBuildOutputDirTask;
protected void setUp()
throws Exception
{
super.setUp();
-
+
if ( purgeExecutor == null )
{
purgeExecutor = (TaskExecutor) lookup( TaskExecutor.class.getName(), "purge" );
}
}
-
+
protected void tearDown()
throws Exception
{
@@ -76,18 +76,18 @@
FileUtils.deleteDirectory( getReleasesDirectoryLocation() );
FileUtils.deleteDirectory( getBuildOutputDirectoryLocation() );
}
-
+
protected PurgeTask getDaysOldRepoPurgeTask()
throws Exception
{
repoConfig = new RepositoryPurgeConfiguration();
repoConfig.setRepository( defaultRepository );
repoConfig.setDaysOlder( TEST_DAYS_OLDER );
- repoConfig = getStore().addRepositoryPurgeConfiguration( repoConfig );
-
+ repoConfig = repositoryPurgeConfigurationDao.addRepositoryPurgeConfiguration( repoConfig );
+
return new PurgeTask( repoConfig.getId() );
}
-
+
protected PurgeTask getRetentionCountRepoPurgeTask()
throws Exception
{
@@ -95,11 +95,11 @@
repoConfig.setRepository( defaultRepository );
repoConfig.setDaysOlder( -1 );
repoConfig.setRetentionCount( TEST_RETENTION_COUNT );
- repoConfig = getStore().addRepositoryPurgeConfiguration( repoConfig );
-
+ repoConfig = repositoryPurgeConfigurationDao.addRepositoryPurgeConfiguration( repoConfig );
+
return new PurgeTask( repoConfig.getId() );
}
-
+
protected PurgeTask getReleasedSnapshotsRepoPurgeTask()
throws Exception
{
@@ -108,11 +108,11 @@
repoConfig.setDaysOlder( -1 );
repoConfig.setRetentionCount( TEST_RETENTION_COUNT );
repoConfig.setDeleteReleasedSnapshots( true );
- repoConfig = getStore().addRepositoryPurgeConfiguration( repoConfig );
-
+ repoConfig = repositoryPurgeConfigurationDao.addRepositoryPurgeConfiguration( repoConfig );
+
return new PurgeTask( repoConfig.getId() );
}
-
+
protected PurgeTask getDaysOldReleasesDirPurgeTask()
throws Exception
{
@@ -120,11 +120,11 @@
dirConfig.setDirectoryType( TEST_RELEASES_DIRECTORY_TYPE );
dirConfig.setLocation( getReleasesDirectoryLocation().getAbsolutePath() );
dirConfig.setDaysOlder( TEST_DAYS_OLDER );
- dirConfig = getStore().addDirectoryPurgeConfiguration( dirConfig );
-
+ dirConfig = directoryPurgeConfigurationDao.addDirectoryPurgeConfiguration( dirConfig );
+
return new PurgeTask( dirConfig.getId() );
}
-
+
protected PurgeTask getDaysOldBuildOutputDirPurgeTask()
throws Exception
{
@@ -132,11 +132,11 @@
dirConfig.setDirectoryType( TEST_BUILDOUTPUT_DIRECTORY_TYPE );
dirConfig.setLocation( getBuildOutputDirectoryLocation().getAbsolutePath() );
dirConfig.setDaysOlder( TEST_DAYS_OLDER );
- dirConfig = getStore().addDirectoryPurgeConfiguration( dirConfig );
-
+ dirConfig = directoryPurgeConfigurationDao.addDirectoryPurgeConfiguration( dirConfig );
+
return new PurgeTask( dirConfig.getId() );
}
-
+
protected PurgeTask getRetentionCountReleasesDirPurgeTask()
throws Exception
{
@@ -145,11 +145,11 @@
dirConfig.setLocation( getReleasesDirectoryLocation().getAbsolutePath() );
dirConfig.setDaysOlder( -1 );
dirConfig.setRetentionCount( TEST_RETENTION_COUNT );
- dirConfig = getStore().addDirectoryPurgeConfiguration( dirConfig );
-
+ dirConfig = directoryPurgeConfigurationDao.addDirectoryPurgeConfiguration( dirConfig );
+
return new PurgeTask( dirConfig.getId() );
}
-
+
protected PurgeTask getRetentionCountBuildOutputDirPurgeTask()
throws Exception
{
@@ -158,40 +158,40 @@
dirConfig.setLocation( getBuildOutputDirectoryLocation().getAbsolutePath() );
dirConfig.setDaysOlder( -1 );
dirConfig.setRetentionCount( TEST_RETENTION_COUNT );
- dirConfig = getStore().addDirectoryPurgeConfiguration( dirConfig );
-
+ dirConfig = directoryPurgeConfigurationDao.addDirectoryPurgeConfiguration( dirConfig );
+
return new PurgeTask( dirConfig.getId() );
}
-
+
protected PurgeTask getCleanAllDefaultRepoPurgeTask()
throws Exception
{
return new PurgeTask( defaultRepoPurge.getId() );
}
-
+
protected PurgeTask getCleanAllReleasesDirPurgeTask()
throws Exception
{
return new PurgeTask( defaultReleasesDirPurge.getId() );
}
-
+
protected PurgeTask getCleanAllBuildOutputDirPurgeTask()
throws Exception
{
return new PurgeTask( defaultBuildOutputDirPurge.getId() );
}
-
+
protected void setLastModified( String dirPath, long lastModified, boolean recurse )
{
File dir = new File( dirPath );
-
+
if ( recurse )
{
File[] contents = dir.listFiles();
for ( int i = 0; i < contents.length; i++ )
{
contents[i].setLastModified( lastModified );
-
+
if ( contents[i].list() != null && contents[i].list().length > 0 )
{
setLastModified( contents[i].getAbsolutePath(), lastModified, true );
@@ -203,14 +203,14 @@
dir.setLastModified( lastModified );
}
}
-
+
protected void assertIsEmpty( File dir )
{
File[] files = dir.listFiles();
-
+
assertEquals( "Directory should be clean: " + dir.getName(), 0, files.length );
}
-
+
protected void assertDeleted( String path )
{
assertFalse( "File should have been deleted: " + path, new File( path ).exists() );
@@ -220,135 +220,130 @@
{
assertTrue( "File should exist: " + path, new File( path ).exists() );
}
-
+
protected void assertMetadataDeleted( String projectRoot )
{
assertDeleted( projectRoot + "/" + TEST_MAVEN_METADATA + ".xml" );
assertDeleted( projectRoot + "/" + TEST_MAVEN_METADATA + ".xml.sha1" );
assertDeleted( projectRoot + "/" + TEST_MAVEN_METADATA + ".xml.md5" );
}
-
+
protected void populateDefaultRepositoryForRetentionCount()
throws Exception
{
prepareTestFolders();
-
+
List<String> versions = new ArrayList<String>();
versions.add( "1.0RC1-20070504.153317-1" );
versions.add( "1.0RC1-20070504.160758-2" );
versions.add( "1.0RC1-20070505.090015-3" );
versions.add( "1.0RC1-20070506.090132-4" );
- createDefaultRepoFiles( "/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT",
- "jruby-rake-plugin", versions );
-
+ createDefaultRepoFiles( "/org/jruby/plugins/jruby-rake-plugin/1.0RC1-SNAPSHOT", "jruby-rake-plugin", versions );
+
versions = new ArrayList<String>();
versions.add( "1.1.2-20070427.065136-1" );
versions.add( "1.1.2-20070615.105019-3" );
versions.add( "1.1.2-20070506.163513-2" );
- createDefaultRepoFiles( "/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT",
- "castor-anttasks", versions );
+ createDefaultRepoFiles( "/org/codehaus/castor/castor-anttasks/1.1.2-SNAPSHOT", "castor-anttasks", versions );
}
-
+
protected void populateDefaultRepository()
throws Exception
{
prepareTestFolders();
-
+
List<String> versions = new ArrayList<String>();
versions.add( "1.1.2-20070427.065136-1" );
versions.add( "1.1.2-20070506.163513-2" );
versions.add( "1.1.2-20070615.105019-3" );
-
- createDefaultRepoFiles( "/org/apache/maven/plugins/maven-assembly-plugin/1.1.2-SNAPSHOT",
+
+ createDefaultRepoFiles( "/org/apache/maven/plugins/maven-assembly-plugin/1.1.2-SNAPSHOT",
"maven-assembly-plugin", versions );
-
+
versions = new ArrayList<String>();
versions.add( "2.2-20061118.060401-2" );
versions.add( "2.2-20070513.034619-5" );
versions.add( "2.2-SNAPSHOT" );
-
- createDefaultRepoFiles( "/org/apache/maven/plugins/maven-install-plugin/2.2-SNAPSHOT",
- "maven-install-plugin", versions );
+
+ createDefaultRepoFiles( "/org/apache/maven/plugins/maven-install-plugin/2.2-SNAPSHOT", "maven-install-plugin",
+ versions );
}
-
+
protected void populateDefaultRepositoryForReleasedSnapshots()
throws Exception
{
populateDefaultRepository();
-
+
List<String> versions = new ArrayList<String>();
versions.add( "2.2" );
-
- createDefaultRepoFiles( "/org/apache/maven/plugins/maven-plugin-plugin/2.2",
- "maven-plugin-plugin", versions );
-
+
+ createDefaultRepoFiles( "/org/apache/maven/plugins/maven-plugin-plugin/2.2", "maven-plugin-plugin", versions );
+
versions = new ArrayList<String>();
versions.add( "2.3" );
- createDefaultRepoFiles( "/org/apache/maven/plugins/maven-plugin-plugin/2.3",
- "maven-plugin-plugin", versions );
-
+ createDefaultRepoFiles( "/org/apache/maven/plugins/maven-plugin-plugin/2.3", "maven-plugin-plugin", versions );
+
versions = new ArrayList<String>();
versions.add( "2.3-SNAPSHOT" );
- createDefaultRepoFiles( "/org/apache/maven/plugins/maven-plugin-plugin/2.3-SNAPSHOT",
- "maven-plugin-plugin", versions );
+ createDefaultRepoFiles( "/org/apache/maven/plugins/maven-plugin-plugin/2.3-SNAPSHOT", "maven-plugin-plugin",
+ versions );
}
-
+
protected void populateReleasesDirectory()
throws Exception
{
prepareTestFolders();
-
+
String repoPath = getReleasesDirectoryLocation().getAbsolutePath();
-
- String[] folders = new String[] { "1", "releases-4234729018", "", "releases-1234567809",
- "releases-1234567890" };
-
+
+ String[] folders = new String[]{"1", "releases-4234729018", "", "releases-1234567809", "releases-1234567890"};
+
for ( int i = 0; i < folders.length; i++ )
{
File dir = new File( repoPath, folders[i] );
dir.mkdir();
}
}
-
+
protected void populateBuildOutputDirectory()
throws Exception
{
prepareTestFolders();
-
+
String repoPath = getBuildOutputDirectoryLocation().getAbsolutePath();
-
+
File projectDir1 = new File( repoPath, "1" );
projectDir1.mkdir();
-
+
File projectDir2 = new File( repoPath, "2" );
projectDir2.mkdir();
-
- String[] buildOutputs1 = new String[] { "1", "3", "6" };
- String[] buildOutputs2 = new String[] { "4", "7", "9" };
-
+
+ String[] buildOutputs1 = new String[]{"1", "3", "6"};
+ String[] buildOutputs2 = new String[]{"4", "7", "9"};
+
for ( int i = 0; i < 3; i++ )
{
File outputDir1 = new File( projectDir1.getAbsolutePath(), buildOutputs1[i] );
outputDir1.mkdir();
-
+
File outputFile1 = new File( projectDir1.getAbsolutePath(), buildOutputs1[i] + ".log.txt" );
outputFile1.createNewFile();
-
+
File outputDir2 = new File( projectDir2.getAbsolutePath(), buildOutputs2[i] );
outputDir2.mkdir();
-
+
File outputFile2 = new File( projectDir2.getAbsolutePath(), buildOutputs2[i] + ".log.txt" );
outputFile2.createNewFile();
}
}
-
+
private void createDefaultRepoFiles( String versionPath, String artifactId, List<String> versions )
throws Exception
{
String repoPath = getDefaultRepositoryLocation().getAbsolutePath();
-
+
File versionDir = new File( repoPath + versionPath );
if ( !versionDir.exists() )
{
@@ -357,33 +352,28 @@
// create maven-metadata* files
for ( int i = 0; i < metadata_extensions.length; i++ )
{
- File metadata =
- new File( versionDir.getParentFile().getAbsolutePath(),
- TEST_MAVEN_METADATA + metadata_extensions[i] );
+ File metadata = new File( versionDir.getParentFile().getAbsolutePath(),
+ TEST_MAVEN_METADATA + metadata_extensions[i] );
metadata.createNewFile();
}
}
-
+
for ( String version : versions )
{
for ( int i = 0; i < jar_extensions.length; i++ )
{
- File file =
- new File( versionDir.getAbsolutePath(), artifactId + "-" +
- version + jar_extensions[i] );
+ File file = new File( versionDir.getAbsolutePath(), artifactId + "-" + version + jar_extensions[i] );
file.createNewFile();
}
-
+
for ( int i = 0; i < pom_extensions.length; i++ )
{
- File file =
- new File( versionDir.getAbsolutePath(), artifactId + "-" +
- version + pom_extensions[i] );
+ File file = new File( versionDir.getAbsolutePath(), artifactId + "-" + version + pom_extensions[i] );
file.createNewFile();
}
}
}
-
+
private void prepareTestFolders()
throws Exception
{
Copied: continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java (from r682986, continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java)
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java?p2=continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java&p1=continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java&r1=682986&r2=683689&rev=683689&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java Thu Aug 7 12:38:49 2008
@@ -1,12 +1,12 @@
package org.apache.continuum.purge.executor;
+import org.apache.commons.io.filefilter.DirectoryFileFilter;
+import org.apache.maven.archiva.consumers.core.repository.ArtifactFilenameFilter;
+
import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;
-import org.apache.commons.io.filefilter.DirectoryFileFilter;
-import org.apache.maven.archiva.consumers.core.repository.ArtifactFilenameFilter;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -36,63 +36,63 @@
throws Exception
{
super.setUp();
-
+
purgeDefaultRepoTask = getCleanAllDefaultRepoPurgeTask();
-
+
purgeReleasesDirTask = getCleanAllReleasesDirPurgeTask();
-
+
purgeBuildOutputDirTask = getCleanAllBuildOutputDirPurgeTask();
}
-
+
public void testCleanAllRepositoryPurging()
throws Exception
{
populateDefaultRepository();
-
+
purgeExecutor.executeTask( purgeDefaultRepoTask );
-
+
assertIsEmpty( getDefaultRepositoryLocation() );
}
-
+
public void testCleanAllReleasesPurging()
throws Exception
{
populateReleasesDirectory();
-
+
File workingDir = getReleasesDirectoryLocation();
-
+
FilenameFilter filter = new ArtifactFilenameFilter( "releases-" );
-
+
File[] releasesDir = workingDir.listFiles( filter );
-
+
assertExists( workingDir.getAbsolutePath() + "/1" );
-
+
assertEquals( "check # of releases directory", 3, releasesDir.length );
-
+
purgeExecutor.executeTask( purgeReleasesDirTask );
-
+
// check if no releases dir
-
+
releasesDir = workingDir.listFiles( filter );
-
+
assertEquals( "releases directory must be empty", 0, releasesDir.length );
-
+
assertExists( workingDir.getAbsolutePath() + "/1" );
}
-
+
public void testCleanAllBuildOutputPurging()
throws Exception
{
populateBuildOutputDirectory();
-
+
File buildOutputDir = getBuildOutputDirectoryLocation();
-
+
purgeExecutor.executeTask( purgeBuildOutputDirTask );
-
+
FileFilter filter = DirectoryFileFilter.DIRECTORY;
-
+
File[] projectsDir = buildOutputDir.listFiles( filter );
-
+
for ( File projectDir : projectsDir )
{
assertIsEmpty( projectDir );
Copied: continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java (from r682986, continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java)
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java?p2=continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java&p1=continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java&r1=682986&r2=683689&rev=683689&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java Thu Aug 7 12:38:49 2008
@@ -29,46 +29,46 @@
throws Exception
{
super.setUp();
-
+
purgeReleasesDirTask = getDaysOldReleasesDirPurgeTask();
-
+
purgeBuildOutputDirTask = getDaysOldBuildOutputDirPurgeTask();
}
-
+
public void testReleasesDirPurgingByLastModified()
throws Exception
{
populateReleasesDirectory();
-
+
String dirPath = getReleasesDirectoryLocation().getAbsolutePath();
-
+
setLastModified( dirPath, 1179382029, true );
setLastModified( dirPath + "/releases-1234567809", 1023453892, false );
-
+
purgeExecutor.executeTask( purgeReleasesDirTask );
-
+
assertDeleted( dirPath + "/releases-1234567809" );
-
+
assertExists( dirPath + "/1" );
assertExists( dirPath + "/releases-1234567890" );
assertExists( dirPath + "/releases-4234729018" );
}
-
+
public void testReleasesDirPurgingByOrderOfDeletion()
throws Exception
{
populateReleasesDirectory();
-
+
String dirPath = getReleasesDirectoryLocation().getAbsolutePath();
-
- setLastModified( dirPath + "/releases-4234729018", new Long("1234567809"), false );
- setLastModified( dirPath + "/releases-1234567809", new Long("4234729018"), false );
- setLastModified( dirPath + "/releases-1234567890", new Long("2234567890"), false );
-
+
+ setLastModified( dirPath + "/releases-4234729018", new Long( "1234567809" ), false );
+ setLastModified( dirPath + "/releases-1234567809", new Long( "4234729018" ), false );
+ setLastModified( dirPath + "/releases-1234567890", new Long( "2234567890" ), false );
+
purgeExecutor.executeTask( purgeReleasesDirTask );
-
+
assertDeleted( dirPath + "/releases-4234729018" );
-
+
assertExists( dirPath + "/1" );
assertExists( dirPath + "/releases-1234567890" );
assertExists( dirPath + "/releases-1234567809" );
@@ -78,68 +78,68 @@
throws Exception
{
populateBuildOutputDirectory();
-
+
String dirPath = getBuildOutputDirectoryLocation().getAbsolutePath();
-
+
setLastModified( dirPath, 1179382029, true );
setLastModified( dirPath + "/1/1", 1023453892, false );
setLastModified( dirPath + "/1/1.log.txt", 1023453892, false );
setLastModified( dirPath + "/2/4", 1023453892, false );
setLastModified( dirPath + "/2/4.log.txt", 1023453892, false );
-
+
purgeExecutor.executeTask( purgeBuildOutputDirTask );
-
+
assertDeleted( dirPath + "/1/1" );
assertDeleted( dirPath + "/1/1.log.txt" );
-
+
assertExists( dirPath + "/1/3" );
assertExists( dirPath + "/1/3.log.txt" );
assertExists( dirPath + "/1/6" );
assertExists( dirPath + "/1/6.log.txt" );
-
+
assertDeleted( dirPath + "/2/4" );
assertDeleted( dirPath + "/2/4.log.txt" );
-
+
assertExists( dirPath + "/2/7" );
assertExists( dirPath + "/2/7.log.txt" );
assertExists( dirPath + "/2/9" );
assertExists( dirPath + "/2/9.log.txt" );
}
-
+
public void testBuildOutputPurgingByOrderOfDeletion()
throws Exception
{
populateBuildOutputDirectory();
-
+
String dirPath = getBuildOutputDirectoryLocation().getAbsolutePath();
-
- setLastModified( dirPath + "/1/6", new Long("1234567809"), false );
- setLastModified( dirPath + "/1/6.log.txt", new Long("1234567809"), false );
- setLastModified( dirPath + "/1/1", new Long("4234729018"), false );
- setLastModified( dirPath + "/1/1.log.txt", new Long("4234729018"), false );
- setLastModified( dirPath + "/1/3", new Long("2234567890"), false );
- setLastModified( dirPath + "/1/3.log.txt", new Long("2234567890"), false );
-
- setLastModified( dirPath + "/2/7", new Long("1234567809"), false );
- setLastModified( dirPath + "/2/7.log.txt", new Long("1234567809"), false );
- setLastModified( dirPath + "/2/4", new Long("4234729018"), false );
- setLastModified( dirPath + "/2/4.log.txt", new Long("4234729018"), false );
- setLastModified( dirPath + "/2/9", new Long("2234567890"), false );
- setLastModified( dirPath + "/2/9.log.txt", new Long("2234567890"), false );
-
+
+ setLastModified( dirPath + "/1/6", new Long( "1234567809" ), false );
+ setLastModified( dirPath + "/1/6.log.txt", new Long( "1234567809" ), false );
+ setLastModified( dirPath + "/1/1", new Long( "4234729018" ), false );
+ setLastModified( dirPath + "/1/1.log.txt", new Long( "4234729018" ), false );
+ setLastModified( dirPath + "/1/3", new Long( "2234567890" ), false );
+ setLastModified( dirPath + "/1/3.log.txt", new Long( "2234567890" ), false );
+
+ setLastModified( dirPath + "/2/7", new Long( "1234567809" ), false );
+ setLastModified( dirPath + "/2/7.log.txt", new Long( "1234567809" ), false );
+ setLastModified( dirPath + "/2/4", new Long( "4234729018" ), false );
+ setLastModified( dirPath + "/2/4.log.txt", new Long( "4234729018" ), false );
+ setLastModified( dirPath + "/2/9", new Long( "2234567890" ), false );
+ setLastModified( dirPath + "/2/9.log.txt", new Long( "2234567890" ), false );
+
purgeExecutor.executeTask( purgeBuildOutputDirTask );
-
+
assertDeleted( dirPath + "/1/6" );
assertDeleted( dirPath + "/1/6.log.txt" );
-
+
assertExists( dirPath + "/1/3" );
assertExists( dirPath + "/1/3.log.txt" );
assertExists( dirPath + "/1/1" );
assertExists( dirPath + "/1/1.log.txt" );
-
+
assertDeleted( dirPath + "/2/7" );
assertDeleted( dirPath + "/2/7.log.txt" );
-
+
assertExists( dirPath + "/2/4" );
assertExists( dirPath + "/2/4.log.txt" );
assertExists( dirPath + "/2/9" );
Copied: continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java (from r682986, continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java)
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java?p2=continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java&p1=continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java&r1=682986&r2=683689&rev=683689&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java Thu Aug 7 12:38:49 2008
@@ -31,23 +31,23 @@
super.setUp();
populateDefaultRepository();
-
+
purgeDefaultRepoTask = getDaysOldRepoPurgeTask();
}
-
+
public void testDefaultRepoPurgingByLastModified()
throws Exception
- {
- String repoRoot = getDefaultRepositoryLocation().getAbsolutePath();
-
+ {
+ String repoRoot = getDefaultRepositoryLocation().getAbsolutePath();
+
String projectRoot = repoRoot + "/org/apache/maven/plugins/maven-install-plugin";
setLastModified( projectRoot + "/2.2-SNAPSHOT/", 1179382029, true );
-
+
purgeExecutor.executeTask( purgeDefaultRepoTask );
assertMetadataDeleted( projectRoot );
-
+
assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar" );
assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.md5" );
assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.sha1" );
@@ -70,40 +70,40 @@
assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.pom.md5" );
assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.pom.sha1" );
}
-
+
public void testDefaultRepoOrderOfDeletion()
throws Exception
{
- String repoRoot = getDefaultRepositoryLocation().getAbsolutePath();
-
- String projectRoot = repoRoot + "/org/apache/maven/plugins/maven-assembly-plugin";
-
- setLastModified( projectRoot + "/1.1.2-SNAPSHOT/", 1179382029, true );
-
- purgeExecutor.executeTask( purgeDefaultRepoTask );
-
- assertMetadataDeleted( projectRoot );
-
- assertDeleted( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.jar" );
- assertDeleted( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.jar.sha1" );
- assertDeleted( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.jar.md5" );
- assertDeleted( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.pom" );
- assertDeleted( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.pom.sha1" );
- assertDeleted( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.pom.md5" );
-
- // the following should not have been deleted
- assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.jar" );
- assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.jar.sha1" );
- assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.jar.md5" );
- assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.pom" );
- assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.pom.sha1" );
- assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.pom.md5" );
-
- assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.jar" );
- assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.jar.sha1" );
- assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.jar.md5" );
- assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.pom" );
- assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.pom.sha1" );
- assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.pom.md5" );
+ String repoRoot = getDefaultRepositoryLocation().getAbsolutePath();
+
+ String projectRoot = repoRoot + "/org/apache/maven/plugins/maven-assembly-plugin";
+
+ setLastModified( projectRoot + "/1.1.2-SNAPSHOT/", 1179382029, true );
+
+ purgeExecutor.executeTask( purgeDefaultRepoTask );
+
+ assertMetadataDeleted( projectRoot );
+
+ assertDeleted( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.jar" );
+ assertDeleted( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.jar.sha1" );
+ assertDeleted( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.jar.md5" );
+ assertDeleted( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.pom" );
+ assertDeleted( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.pom.sha1" );
+ assertDeleted( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.pom.md5" );
+
+ // the following should not have been deleted
+ assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.jar" );
+ assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.jar.sha1" );
+ assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.jar.md5" );
+ assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.pom" );
+ assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.pom.sha1" );
+ assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.pom.md5" );
+
+ assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.jar" );
+ assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.jar.sha1" );
+ assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.jar.md5" );
+ assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.pom" );
+ assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.pom.sha1" );
+ assertExists( projectRoot + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.pom.md5" );
}
}
Copied: continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java (from r682986, continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java)
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java?p2=continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java&p1=continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java&r1=682986&r2=683689&rev=683689&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java Thu Aug 7 12:38:49 2008
@@ -29,27 +29,27 @@
throws Exception
{
super.setUp();
-
+
populateDefaultRepositoryForReleasedSnapshots();
-
+
purgeDefaultRepoTask = getReleasedSnapshotsRepoPurgeTask();
}
-
+
public void testDefaultRepoReleasedSnapshotsPurging()
throws Exception
{
String repoRoot = getDefaultRepositoryLocation().getAbsolutePath();
-
+
String projectRoot1 = repoRoot + "/org/apache/maven/plugins/maven-assembly-plugin";
String projectRoot2 = repoRoot + "/org/apache/maven/plugins/maven-install-plugin";
String projectRoot3 = repoRoot + "/org/apache/maven/plugins/maven-plugin-plugin";
-
+
purgeExecutor.executeTask( purgeDefaultRepoTask );
-
+
assertMetadataDeleted( projectRoot1 );
assertMetadataDeleted( projectRoot2 );
assertMetadataDeleted( projectRoot3 );
-
+
assertDeleted( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.jar" );
assertDeleted( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.jar.sha1" );
assertDeleted( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.jar.md5" );
@@ -70,7 +70,7 @@
assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.pom" );
assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.pom.sha1" );
assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.pom.md5" );
-
+
assertDeleted( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar" );
assertDeleted( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.md5" );
assertDeleted( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.sha1" );
@@ -91,7 +91,7 @@
assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.pom" );
assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.pom.md5" );
assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.pom.sha1" );
-
+
// check if the snapshot version was removed
assertDeleted( projectRoot3 + "/2.3-SNAPSHOT" );
assertDeleted( projectRoot3 + "/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.jar" );
@@ -109,7 +109,7 @@
assertExists( projectRoot3 + "/2.2/maven-plugin-plugin-2.2.pom" );
assertExists( projectRoot3 + "/2.2/maven-plugin-plugin-2.2.pom.md5" );
assertExists( projectRoot3 + "/2.2/maven-plugin-plugin-2.2.pom.sha1" );
-
+
assertExists( projectRoot3 + "/2.3" );
assertExists( projectRoot3 + "/2.3/maven-plugin-plugin-2.3.jar" );
assertExists( projectRoot3 + "/2.3/maven-plugin-plugin-2.3.jar.md5" );
Copied: continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java (from r682986, continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java)
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java?p2=continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java&p1=continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java&r1=682986&r2=683689&rev=683689&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java Thu Aug 7 12:38:49 2008
@@ -1,12 +1,12 @@
package org.apache.continuum.purge.executor;
+import org.apache.commons.io.filefilter.DirectoryFileFilter;
+import org.apache.maven.archiva.consumers.core.repository.ArtifactFilenameFilter;
+
import java.io.File;
import java.io.FileFilter;
import java.io.FilenameFilter;
-import org.apache.commons.io.filefilter.DirectoryFileFilter;
-import org.apache.maven.archiva.consumers.core.repository.ArtifactFilenameFilter;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -36,67 +36,67 @@
throws Exception
{
super.setUp();
-
+
purgeReleasesDirTask = getRetentionCountReleasesDirPurgeTask();
-
+
purgeBuildOutputDirTask = getRetentionCountBuildOutputDirPurgeTask();
}
-
+
public void testReleasesDirPurging()
throws Exception
{
populateReleasesDirectory();
-
+
String dirPath = getReleasesDirectoryLocation().getAbsolutePath();
FilenameFilter filter = new ArtifactFilenameFilter( "releases-" );
-
+
File[] workingDir = new File( dirPath ).listFiles();
File[] releasesDir = new File( dirPath ).listFiles( filter );
-
+
assertEquals( "# of folders inside working directory", 4, workingDir.length );
assertEquals( "# of releases folders inside working directory", 3, releasesDir.length );
assertExists( dirPath + "/1" );
-
+
purgeExecutor.executeTask( purgeReleasesDirTask );
-
+
workingDir = new File( dirPath ).listFiles();
releasesDir = new File( dirPath ).listFiles( filter );
-
+
assertEquals( "# of folders inside working directory", 3, workingDir.length );
assertEquals( "# of releases folders inside working directory", 2, releasesDir.length );
assertExists( dirPath + "/1" );
}
-
+
public void testBuildOutputDirPurging()
throws Exception
{
populateBuildOutputDirectory();
-
+
String dirPath = getBuildOutputDirectoryLocation().getAbsolutePath();
-
+
File projectPath1 = new File( dirPath, "1" );
File projectPath2 = new File( dirPath, "2" );
-
+
FileFilter filter = DirectoryFileFilter.DIRECTORY;
File[] files1 = projectPath1.listFiles( filter );
File[] files2 = projectPath2.listFiles( filter );
-
+
assertEquals( "check # of build output dir", 3, files1.length );
assertEquals( "check # of build output dir", 3, files2.length );
-
+
purgeExecutor.executeTask( purgeBuildOutputDirTask );
-
+
files1 = projectPath1.listFiles( filter );
files2 = projectPath2.listFiles( filter );
-
+
assertEquals( "check # of build output dir", 2, files1.length );
assertEquals( "check # of build output dir", 2, files2.length );
-
+
for ( File file : files1 )
{
assertExists( file.getAbsolutePath() + ".log.txt" );
}
-
+
for ( File file : files2 )
{
assertExists( file.getAbsolutePath() + ".log.txt" );
Copied: continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java (from r682986, continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java)
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java?p2=continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java&p1=continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java&r1=682986&r2=683689&rev=683689&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java Thu Aug 7 12:38:49 2008
@@ -29,26 +29,26 @@
throws Exception
{
super.setUp();
-
+
purgeDefaultRepoTask = getRetentionCountRepoPurgeTask();
}
-
+
public void testRetentionCountPurging()
throws Exception
{
populateDefaultRepositoryForRetentionCount();
-
+
String repoRoot = getDefaultRepositoryLocation().getAbsolutePath();
-
+
String projectRoot1 = repoRoot + "/org/jruby/plugins/jruby-rake-plugin";
String projectRoot2 = repoRoot + "/org/codehaus/castor/castor-anttasks";
-
+
purgeExecutor.executeTask( purgeDefaultRepoTask );
-
+
// assert if metadata was removed
assertMetadataDeleted( projectRoot1 );
assertMetadataDeleted( projectRoot2 );
-
+
// assert if removed from repo
assertDeleted( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.jar" );
assertDeleted( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.jar.md5" );
@@ -102,22 +102,22 @@
assertExists( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.jar.md5" );
assertExists( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.jar.sha1" );
}
-
+
public void testOrderOfDeletion()
throws Exception
{
populateDefaultRepository();
-
+
String repoRoot = getDefaultRepositoryLocation().getAbsolutePath();
-
+
String projectRoot1 = repoRoot + "/org/apache/maven/plugins/maven-assembly-plugin";
String projectRoot2 = repoRoot + "/org/apache/maven/plugins/maven-install-plugin";
-
+
purgeExecutor.executeTask( purgeDefaultRepoTask );
-
+
assertMetadataDeleted( projectRoot1 );
assertMetadataDeleted( projectRoot2 );
-
+
assertDeleted( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.jar" );
assertDeleted( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.jar.sha1" );
assertDeleted( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.jar.md5" );
@@ -138,7 +138,7 @@
assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.pom" );
assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.pom.sha1" );
assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.pom.md5" );
-
+
assertDeleted( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar" );
assertDeleted( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.md5" );
assertDeleted( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.jar.sha1" );
Copied: continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml (from r682986, continuum/trunk/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml)
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml?p2=continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml&p1=continuum/trunk/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml&r1=682986&r2=683689&rev=683689&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml Thu Aug 7 12:38:49 2008
@@ -21,9 +21,9 @@
<configuration>
<system/>
- <jndi prefix="java:comp/env" config-optional="true"/>
+ <jndi prefix="java:comp/env" config-optional="true"/>
<xml fileName="target/conf/continuum.xml" config-optional="true"
config-forceCreate="true" config-name="org.apache.continuum"/>
<xml fileName="target/.m2/continuum.xml" config-optional="true"
- config-forceCreate="true" config-name="org.apache.continuum.user"/>
+ config-forceCreate="true" config-name="org.apache.continuum.user"/>
</configuration>
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-release/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-release/pom.xml?rev=683689&r1=683688&r2=683689&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-release/pom.xml (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-release/pom.xml Thu Aug 7 12:38:49 2008
@@ -72,8 +72,8 @@
<version>1.0-alpha-3</version>
<exclusions>
<exclusion>
- <groupId>classworlds</groupId>
- <artifactId>classworlds</artifactId>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
</exclusion>
</exclusions>
</dependency>
@@ -88,11 +88,6 @@
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
- <artifactId>maven-scm-manager-plexus</artifactId>
- <version>${maven-scm.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-bazaar</artifactId>
<version>${maven-scm.version}</version>
</dependency>
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java?rev=683689&r1=683688&r2=683689&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java Thu Aug 7 12:38:49 2008
@@ -19,6 +19,7 @@
* under the License.
*/
+import org.apache.continuum.model.repository.LocalRepository;
import org.apache.maven.continuum.model.project.Project;
import org.apache.maven.continuum.release.tasks.PerformReleaseProjectTask;
import org.apache.maven.continuum.release.tasks.PrepareReleaseProjectTask;
@@ -113,10 +114,17 @@
ContinuumReleaseManagerListener listener )
throws ContinuumReleaseException
{
+ perform( releaseId, buildDirectory, goals, useReleaseProfile, listener, null );
+ }
+
+ public void perform( String releaseId, File buildDirectory, String goals, boolean useReleaseProfile,
+ ContinuumReleaseManagerListener listener, LocalRepository repository )
+ throws ContinuumReleaseException
+ {
ReleaseDescriptor descriptor = (ReleaseDescriptor) getPreparedReleases().get( releaseId );
if ( descriptor != null )
{
- perform( releaseId, descriptor, buildDirectory, goals, useReleaseProfile, listener );
+ perform( releaseId, descriptor, buildDirectory, goals, useReleaseProfile, listener, repository );
}
}
@@ -126,11 +134,11 @@
{
ReleaseDescriptor descriptor = readReleaseDescriptor( workingDirectory );
- perform( releaseId, descriptor, buildDirectory, goals, useReleaseProfile, listener );
+ perform( releaseId, descriptor, buildDirectory, goals, useReleaseProfile, listener, null );
}
private void perform( String releaseId, ReleaseDescriptor descriptor, File buildDirectory, String goals,
- boolean useReleaseProfile, ContinuumReleaseManagerListener listener )
+ boolean useReleaseProfile, ContinuumReleaseManagerListener listener, LocalRepository repository )
throws ContinuumReleaseException
{
try
@@ -139,7 +147,8 @@
performReleaseQueue.put( new PerformReleaseProjectTask( releaseId, descriptor, buildDirectory, goals,
useReleaseProfile,
- (ReleaseManagerListener) listener ) );
+ (ReleaseManagerListener) listener,
+ repository ) );
}
catch ( TaskQueueException e )
{
@@ -206,7 +215,14 @@
descriptor.setReleaseVersions( relVersions );
descriptor.setDevelopmentVersions( devVersions );
descriptor.setPreparationGoals( releaseProperties.getProperty( "prepareGoals" ) );
-
+
+ LocalRepository repository = project.getProjectGroup().getLocalRepository();
+
+ if ( repository != null )
+ {
+ descriptor.setAdditionalArguments( "\"-Dmaven.repo.local=" + repository.getLocation() + "\"" );
+ }
+
//other properties
if ( releaseProperties.containsKey( "username" ) )
{
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java?rev=683689&r1=683688&r2=683689&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java Thu Aug 7 12:38:49 2008
@@ -19,6 +19,7 @@
* under the License.
*/
+import org.apache.continuum.model.repository.LocalRepository;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.DefaultArtifactRepository;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
@@ -65,6 +66,8 @@
private ProfileManager profileManager;
private PlexusContainer container;
+
+ private LocalRepository repository;
public void execute( ReleaseProjectTask task )
throws TaskExecutionException
@@ -77,7 +80,9 @@
descriptor.setUseReleaseProfile( performTask.isUseReleaseProfile() );
descriptor.setPerformGoals( performTask.getGoals() );
descriptor.setCheckoutDirectory( performTask.getBuildDirectory().getAbsolutePath() );
-
+
+ repository = performTask.getLocalRepository();
+
List reactorProjects = getReactorProjects( performTask );
ReleaseResult result = releaseManager.performWithResult( descriptor, settings, reactorProjects, listener );
@@ -206,8 +211,16 @@
private ArtifactRepository getLocalRepository()
{
- return new DefaultArtifactRepository( "local-repository", "file://" + settings.getLocalRepository(),
- new DefaultRepositoryLayout() );
+ if ( repository == null )
+ {
+ return new DefaultArtifactRepository( "local-repository", "file://" + settings.getLocalRepository(),
+ new DefaultRepositoryLayout() );
+ }
+ else
+ {
+ return new DefaultArtifactRepository( repository.getName(), "file://" + repository.getLocation(),
+ new DefaultRepositoryLayout() );
+ }
}
private ProfileManager getProfileManager( Settings settings )
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java?rev=683689&r1=683688&r2=683689&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java Thu Aug 7 12:38:49 2008
@@ -19,6 +19,7 @@
* under the License.
*/
+import org.apache.continuum.model.repository.LocalRepository;
import org.apache.maven.shared.release.ReleaseManagerListener;
import org.apache.maven.shared.release.config.ReleaseDescriptor;
@@ -35,16 +36,25 @@
private String goals;
private boolean useReleaseProfile = true;
+
+ private LocalRepository localRepository;
public PerformReleaseProjectTask( String releaseId, ReleaseDescriptor descriptor, File buildDirectory, String goals,
boolean useReleaseProfile, ReleaseManagerListener listener )
{
+ this( releaseId, descriptor, buildDirectory, goals, useReleaseProfile, listener, null );
+ }
+
+ public PerformReleaseProjectTask( String releaseId, ReleaseDescriptor descriptor, File buildDirectory, String goals,
+ boolean useReleaseProfile, ReleaseManagerListener listener, LocalRepository repository )
+ {
super( releaseId, descriptor, listener );
setBuildDirectory( buildDirectory );
setGoals( goals );
setUseReleaseProfile( useReleaseProfile );
+ setLocalRepository( repository );
}
-
+
public String getGoals()
{
return goals;
@@ -74,4 +84,14 @@
{
this.buildDirectory = buildDirectory;
}
+
+ public LocalRepository getLocalRepository()
+ {
+ return localRepository;
+ }
+
+ public void setLocalRepository( LocalRepository localRepository )
+ {
+ this.localRepository = localRepository;
+ }
}
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-reports/src/test/java/org/apache/maven/continuum/reports/surefire/DefaultReportTestSuiteGeneratorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-reports/src/test/java/org/apache/maven/continuum/reports/surefire/DefaultReportTestSuiteGeneratorTest.java?rev=683689&r1=683688&r2=683689&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-reports/src/test/java/org/apache/maven/continuum/reports/surefire/DefaultReportTestSuiteGeneratorTest.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-reports/src/test/java/org/apache/maven/continuum/reports/surefire/DefaultReportTestSuiteGeneratorTest.java Thu Aug 7 12:38:49 2008
@@ -21,7 +21,7 @@
import java.io.File;
import java.util.List;
-import org.codehaus.plexus.PlexusTestCase;
+import org.codehaus.plexus.spring.PlexusInSpringTestCase;
/**
* @author <a href="mailto:olamy@apache.org">olamy</a>
@@ -29,7 +29,7 @@
* @version $Id$
*/
public class DefaultReportTestSuiteGeneratorTest
- extends PlexusTestCase
+ extends PlexusInSpringTestCase
{
private File getReportsDirectory( String pathDir )
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java?rev=683689&r1=683688&r2=683689&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java Thu Aug 7 12:38:49 2008
@@ -117,4 +117,8 @@
public static final String CONTINUUM_MANAGE_QUEUES = "continuum-manage-queues";
public static final String CONTINUUM_VIEW_QUEUES = "continuum-view-queues";
+
+ public static final String CONTINUUM_MANAGE_REPOSITORIES = "continuum-manage-repositories";
+
+ public static final String CONTINUUM_MANAGE_PURGING = "continuum-manage-purging";
}
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-security/src/main/resources/META-INF/redback/redback.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-security/src/main/resources/META-INF/redback/redback.xml?rev=683689&r1=683688&r2=683689&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-security/src/main/resources/META-INF/redback/redback.xml (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-security/src/main/resources/META-INF/redback/redback.xml Thu Aug 7 12:38:49 2008
@@ -155,6 +155,16 @@
<name>continuum-manage-profiles</name>
<description>Continuum Manage Installations</description>
</operation>
+ <operation>
+ <id>continuum-manage-repositories</id>
+ <name>continuum-manage-repositories</name>
+ <description>Continuum Manage Repositories</description>
+ </operation>
+ <operation>
+ <id>continuum-manage-purging</id>
+ <name>continuum-manage-purging</name>
+ <description>Continuum Manage Purging</description>
+ </operation>
</operations>
<roles>
<role>
@@ -181,6 +191,8 @@
<childRole>continuum-manage-schedules</childRole>
<childRole>continuum-manage-build-templates</childRole>
<childRole>continuum-manage-queues</childRole>
+ <childRole>continuum-manage-repositories</childRole>
+ <childRole>continuum-manage-purging</childRole>
</childRoles>
</role>
<role>
@@ -341,6 +353,36 @@
</permission>
</permissions>
</role>
+ <role>
+ <id>continuum-manage-repositories</id>
+ <name>continuum-manage-repositories</name>
+ <assignable>true</assignable>
+ <permanent>true</permanent>
+ <permissions>
+ <permission>
+ <id>continuum-manage-repositories</id>
+ <name>Manage Continuum Local Repositories</name>
+ <permanent>true</permanent>
+ <operation>continuum-manage-repositories</operation>
+ <resource>global</resource>
+ </permission>
+ </permissions>
+ </role>
+ <role>
+ <id>continuum-manage-purging</id>
+ <name>continuum-manage-purging</name>
+ <assignable>true</assignable>
+ <permanent>true</permanent>
+ <permissions>
+ <permission>
+ <id>continuum-manage-purging</id>
+ <name>Manage Continuum Purging</name>
+ <permanent>true</permanent>
+ <operation>continuum-manage-purging</operation>
+ <resource>global</resource>
+ </permission>
+ </permissions>
+ </role>
</roles>
<templates>
<template>
@@ -366,6 +408,18 @@
<operation>user-management-role-grant</operation>
<resource>${resource}</resource>
</permission>
+ <permission>
+ <id>continuum-manage-repositories</id>
+ <name>Manage Continuum Local Repositories</name>
+ <operation>continuum-manage-repositories</operation>
+ <resource>global</resource>
+ </permission>
+ <permission>
+ <id>continuum-manage-purging</id>
+ <name>Manage Continuum Purging</name>
+ <operation>continuum-manage-purging</operation>
+ <resource>global</resource>
+ </permission>
</permissions>
<childTemplates>
<childTemplate>project-developer</childTemplate>
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-store/pom.xml
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/pom.xml?rev=683689&r1=683688&r2=683689&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/pom.xml (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/pom.xml Thu Aug 7 12:38:49 2008
@@ -17,7 +17,8 @@
specific language governing permissions and limitations
under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>continuum</artifactId>
<groupId>org.apache.continuum</groupId>
@@ -62,6 +63,11 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-slf4j-logging</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
@@ -89,4 +95,4 @@
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/BuildDefinitionDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/BuildDefinitionDaoImpl.java?rev=683689&r1=683688&r2=683689&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/BuildDefinitionDaoImpl.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/BuildDefinitionDaoImpl.java Thu Aug 7 12:38:49 2008
@@ -329,4 +329,35 @@
rollback( tx );
}
}
+
+ public List<BuildDefinition> getBuildDefinitionsBySchedule( int scheduleId )
+ {
+ PersistenceManager pm = getPersistenceManager();
+
+ Transaction tx = pm.currentTransaction();
+
+ try
+ {
+ tx.begin();
+
+ Extent extent = pm.getExtent( BuildDefinition.class, true );
+
+ Query query = pm.newQuery( extent );
+
+ query.declareParameters( "int scheduleId" );
+
+ query.setFilter( "this.schedule.id == scheduleId" );
+
+ List result = (List) query.execute( new Integer( scheduleId ) );
+
+ return result == null ? Collections.EMPTY_LIST : (List) pm.detachCopyAll( result );
+ }
+ finally
+ {
+ tx.commit();
+
+ rollback( tx );
+ }
+ }
+
}
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/DaoUtilsImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/DaoUtilsImpl.java?rev=683689&r1=683688&r2=683689&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/DaoUtilsImpl.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/DaoUtilsImpl.java Thu Aug 7 12:38:49 2008
@@ -19,6 +19,9 @@
* under the License.
*/
+import org.apache.continuum.model.repository.DirectoryPurgeConfiguration;
+import org.apache.continuum.model.repository.LocalRepository;
+import org.apache.continuum.model.repository.RepositoryPurgeConfiguration;
import org.apache.maven.continuum.model.project.BuildDefinition;
import org.apache.maven.continuum.model.project.BuildDefinitionTemplate;
import org.apache.maven.continuum.model.project.BuildResult;
@@ -75,6 +78,9 @@
PlexusJdoUtils.removeAll( getPersistenceManager(), ProjectGroup.class );
PlexusJdoUtils.removeAll( getPersistenceManager(), Project.class );
PlexusJdoUtils.removeAll( getPersistenceManager(), BuildDefinition.class );
+ PlexusJdoUtils.removeAll( getPersistenceManager(), RepositoryPurgeConfiguration.class );
+ PlexusJdoUtils.removeAll( getPersistenceManager(), LocalRepository.class );
+ PlexusJdoUtils.removeAll( getPersistenceManager(), DirectoryPurgeConfiguration.class );
PlexusJdoUtils.removeAll( getPersistenceManager(), Schedule.class );
PlexusJdoUtils.removeAll( getPersistenceManager(), Profile.class );
PlexusJdoUtils.removeAll( getPersistenceManager(), Installation.class );
Added: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/DirectoryPurgeConfigurationDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/DirectoryPurgeConfigurationDaoImpl.java?rev=683689&view=auto
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/DirectoryPurgeConfigurationDaoImpl.java (added)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/DirectoryPurgeConfigurationDaoImpl.java Thu Aug 7 12:38:49 2008
@@ -0,0 +1,163 @@
+package org.apache.continuum.dao;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.model.repository.DirectoryPurgeConfiguration;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ * @plexus.component role="org.apache.continuum.dao.DirectoryPurgeConfigurationDao"
+ */
+public class DirectoryPurgeConfigurationDaoImpl
+ extends AbstractDao
+ implements DirectoryPurgeConfigurationDao
+{
+ public List<DirectoryPurgeConfiguration> getAllDirectoryPurgeConfigurations()
+ {
+ return getAllObjectsDetached( DirectoryPurgeConfiguration.class );
+ }
+
+ public List<DirectoryPurgeConfiguration> getDirectoryPurgeConfigurationsBySchedule( int scheduleId )
+ {
+ PersistenceManager pm = getPersistenceManager();
+
+ Transaction tx = pm.currentTransaction();
+
+ try
+ {
+ tx.begin();
+
+ Extent extent = pm.getExtent( DirectoryPurgeConfiguration.class, true );
+
+ Query query = pm.newQuery( extent );
+
+ query.declareParameters( "int scheduleId" );
+
+ query.setFilter( "this.schedule.id == scheduleId" );
+
+ List result = (List) query.execute( new Integer( scheduleId ) );
+
+ return result == null ? Collections.EMPTY_LIST : (List) pm.detachCopyAll( result );
+ }
+ finally
+ {
+ tx.commit();
+
+ rollback( tx );
+ }
+ }
+
+ public List<DirectoryPurgeConfiguration> getDirectoryPurgeConfigurationsByLocation( String location )
+ {
+ PersistenceManager pm = getPersistenceManager();
+
+ Transaction tx = pm.currentTransaction();
+
+ try
+ {
+ tx.begin();
+
+ Extent extent = pm.getExtent( DirectoryPurgeConfiguration.class, true );
+
+ Query query = pm.newQuery( extent );
+
+ query.declareImports( "import java.lang.String" );
+
+ query.declareParameters( "String location" );
+
+ query.setFilter( "this.location == location" );
+
+ List result = (List) query.execute( location );
+
+ return result == null ? Collections.EMPTY_LIST : (List) pm.detachCopyAll( result );
+ }
+ finally
+ {
+ tx.commit();
+
+ rollback( tx );
+ }
+ }
+
+ public List<DirectoryPurgeConfiguration> getDirectoryPurgeConfigurationsByType( String type )
+ {
+ PersistenceManager pm = getPersistenceManager();
+
+ Transaction tx = pm.currentTransaction();
+
+ try
+ {
+ tx.begin();
+
+ Extent extent = pm.getExtent( DirectoryPurgeConfiguration.class, true );
+
+ Query query = pm.newQuery( extent );
+
+ query.declareImports( "import java.lang.String" );
+
+ query.declareParameters( "String type" );
+
+ query.setFilter( "this.directoryType == type" );
+
+ List result = (List) query.execute( type );
+
+ return result == null ? Collections.EMPTY_LIST : (List) pm.detachCopyAll( result );
+ }
+ finally
+ {
+ tx.commit();
+
+ rollback( tx );
+ }
+ }
+
+ public DirectoryPurgeConfiguration getDirectoryPurgeConfiguration( int configurationId )
+ throws ContinuumStoreException
+ {
+ return (DirectoryPurgeConfiguration) getObjectById( DirectoryPurgeConfiguration.class, configurationId );
+ }
+
+ public DirectoryPurgeConfiguration addDirectoryPurgeConfiguration( DirectoryPurgeConfiguration purgeConfiguration )
+ throws ContinuumStoreException
+ {
+ return (DirectoryPurgeConfiguration) addObject( purgeConfiguration );
+ }
+
+ public void updateDirectoryPurgeConfiguration( DirectoryPurgeConfiguration purgeConfiguration )
+ throws ContinuumStoreException
+ {
+ updateObject( purgeConfiguration );
+ }
+
+ public void removeDirectoryPurgeConfiguration( DirectoryPurgeConfiguration purgeConfiguration )
+ throws ContinuumStoreException
+ {
+ removeObject( purgeConfiguration );
+ }
+}
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/DirectoryPurgeConfigurationDaoImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/DirectoryPurgeConfigurationDaoImpl.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/LocalRepositoryDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/LocalRepositoryDaoImpl.java?rev=683689&view=auto
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/LocalRepositoryDaoImpl.java (added)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/LocalRepositoryDaoImpl.java Thu Aug 7 12:38:49 2008
@@ -0,0 +1,186 @@
+package org.apache.continuum.dao;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.continuum.model.repository.LocalRepository;
+import org.apache.maven.continuum.store.ContinuumStoreException;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ * @plexus.component role="org.apache.continuum.dao.LocalRepositoryDao"
+ */
+public class LocalRepositoryDaoImpl
+ extends AbstractDao
+ implements LocalRepositoryDao
+{
+ public LocalRepository addLocalRepository( LocalRepository repository )
+ throws ContinuumStoreException
+ {
+ return (LocalRepository) addObject( repository );
+ }
+
+ public void updateLocalRepository( LocalRepository repository )
+ throws ContinuumStoreException
+ {
+ updateObject( repository );
+ }
+
+ public void removeLocalRepository( LocalRepository repository )
+ throws ContinuumStoreException
+ {
+ removeObject( repository );
+ }
+
+ public List<LocalRepository> getAllLocalRepositories()
+ {
+ return getAllObjectsDetached( LocalRepository.class );
+ }
+
+ public List<LocalRepository> getLocalRepositoriesByLayout( String layout )
+ {
+ PersistenceManager pm = getPersistenceManager();
+
+ Transaction tx = pm.currentTransaction();
+
+ try
+ {
+ tx.begin();
+
+ Extent extent = pm.getExtent( LocalRepository.class, true );
+
+ Query query = pm.newQuery( extent );
+
+ query.declareImports( "import java.lang.String" );
+
+ query.declareParameters( "String layout" );
+
+ query.setFilter( "this.layout == layout" );
+
+ List result = (List) query.execute( layout );
+
+ return result == null ? Collections.EMPTY_LIST : (List) pm.detachCopyAll( result );
+ }
+ finally
+ {
+ tx.commit();
+
+ rollback( tx );
+ }
+ }
+
+ public LocalRepository getLocalRepository( int repositoryId )
+ throws ContinuumStoreException
+ {
+ return (LocalRepository) getObjectById( LocalRepository.class, repositoryId );
+ }
+
+ public LocalRepository getLocalRepositoryByName( String name )
+ throws ContinuumStoreException
+ {
+ PersistenceManager pm = getPersistenceManager();
+
+ Transaction tx = pm.currentTransaction();
+
+ try
+ {
+ tx.begin();
+
+ Extent extent = pm.getExtent( LocalRepository.class, true );
+
+ Query query = pm.newQuery( extent );
+
+ query.declareImports( "import java.lang.String" );
+
+ query.declareParameters( "String name" );
+
+ query.setFilter( "this.name == name" );
+
+ Collection result = (Collection) query.execute( name );
+
+ if ( result.size() == 0 )
+ {
+ tx.commit();
+
+ return null;
+ }
+
+ Object object = pm.detachCopy( result.iterator().next() );
+
+ tx.commit();
+
+ return (LocalRepository) object;
+ }
+ finally
+ {
+ rollback( tx );
+ }
+ }
+
+ public LocalRepository getLocalRepositoryByLocation( String location )
+ throws ContinuumStoreException
+ {
+ PersistenceManager pm = getPersistenceManager();
+
+ Transaction tx = pm.currentTransaction();
+
+ try
+ {
+ tx.begin();
+
+ Extent extent = pm.getExtent( LocalRepository.class, true );
+
+ Query query = pm.newQuery( extent );
+
+ query.declareImports( "import java.lang.String" );
+
+ query.declareParameters( "String location" );
+
+ query.setFilter( "this.location == location" );
+
+ Collection result = (Collection) query.execute( location );
+
+ if ( result.size() == 0 )
+ {
+ tx.commit();
+
+ return null;
+ }
+
+ Object object = pm.detachCopy( result.iterator().next() );
+
+ tx.commit();
+
+ return (LocalRepository) object;
+ }
+ finally
+ {
+ rollback( tx );
+ }
+ }
+}
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/LocalRepositoryDaoImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/LocalRepositoryDaoImpl.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ProjectGroupDaoImpl.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ProjectGroupDaoImpl.java?rev=683689&r1=683688&r2=683689&view=diff
==============================================================================
--- continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ProjectGroupDaoImpl.java (original)
+++ continuum/branches/continuum-refactoring-evenisse/continuum-store/src/main/java/org/apache/continuum/dao/ProjectGroupDaoImpl.java Thu Aug 7 12:38:49 2008
@@ -25,8 +25,13 @@
import org.apache.maven.continuum.store.ContinuumStoreException;
import org.codehaus.plexus.jdo.PlexusJdoUtils;
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
/**
@@ -162,4 +167,35 @@
{
return (ProjectGroup) getObjectById( ProjectGroup.class, projectGroupId, PROJECT_BUILD_DETAILS_FETCH_GROUP );
}
+
+ public List<ProjectGroup> getProjectGroupByRepository( int repositoryId )
+ {
+ PersistenceManager pm = getPersistenceManager();
+
+ Transaction tx = pm.currentTransaction();
+
+ try
+ {
+ tx.begin();
+
+ Extent extent = pm.getExtent( ProjectGroup.class, true );
+
+ Query query = pm.newQuery( extent );
+
+ query.declareParameters( "int repositoryId" );
+
+ query.setFilter( "this.localRepository.id == repositoryId" );
+
+ List result = (List) query.execute( new Integer( repositoryId ) );
+
+ return result == null ? Collections.EMPTY_LIST : (List) pm.detachCopyAll( result );
+ }
+ finally
+ {
+ tx.commit();
+
+ rollback( tx );
+ }
+ }
+
}