You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ol...@apache.org on 2008/07/25 00:31:26 UTC
svn commit: r679588 [6/8] - in /continuum/branches/CONTINUUM-782: ./
continuum-api/ continuum-api/src/main/java/org/apache/continuum/purge/
continuum-api/src/main/java/org/apache/continuum/purge/controller/
continuum-api/src/main/java/org/apache/contin...
Added: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/DefaultPurgeConfigurationServiceTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/DefaultPurgeConfigurationServiceTest.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/DefaultPurgeConfigurationServiceTest.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/DefaultPurgeConfigurationServiceTest.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,105 @@
+package org.apache.continuum.purge;
+
+/*
+ * 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 java.util.List;
+
+import org.apache.continuum.model.repository.DirectoryPurgeConfiguration;
+import org.apache.continuum.model.repository.RepositoryPurgeConfiguration;
+import org.apache.continuum.purge.repository.content.ManagedDefaultRepositoryContent;
+import org.apache.continuum.purge.repository.content.RepositoryManagedContent;
+
+/**
+ * @author Maria Catherine Tan
+ */
+public class DefaultPurgeConfigurationServiceTest
+ extends AbstractPurgeTest
+{
+ private PurgeConfigurationService purgeConfigurationService;
+
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ purgeConfigurationService = (PurgeConfigurationService) lookup( PurgeConfigurationService.ROLE );
+ }
+
+ public void testRepositoryPurgeConfiguration()
+ throws Exception
+ {
+ RepositoryPurgeConfiguration repoConfig = new RepositoryPurgeConfiguration();
+
+ repoConfig.setRepository( defaultRepository );
+ repoConfig.setDaysOlder( TEST_DAYS_OLDER );
+ repoConfig.setRetentionCount( TEST_RETENTION_COUNT );
+
+ repoConfig = purgeConfigurationService.addRepositoryPurgeConfiguration( repoConfig );
+
+ assertNotNull( repoConfig );
+
+ RepositoryPurgeConfiguration retrieved = getStore().getRepositoryPurgeConfiguration( repoConfig.getId() );
+ assertEquals( repoConfig, retrieved );
+
+ purgeConfigurationService.removeRepositoryPurgeConfiguration( repoConfig );
+
+ List<RepositoryPurgeConfiguration> repoConfigs = purgeConfigurationService.getAllRepositoryPurgeConfigurations();
+
+ assertFalse( "check if repo purge configuration was removed", repoConfigs.contains( repoConfig ) );
+ assertNotNull( "check if repository still exists", getStore().getLocalRepository( defaultRepository.getId() ) );
+ }
+
+ public void testDirectoryPurgeConfiguration()
+ throws Exception
+ {
+ DirectoryPurgeConfiguration dirConfig = new DirectoryPurgeConfiguration();
+
+ dirConfig.setLocation( getReleasesDirectoryLocation().getAbsolutePath() );
+ dirConfig.setDirectoryType( TEST_RELEASES_DIRECTORY_TYPE );
+ dirConfig.setDaysOlder( TEST_DAYS_OLDER );
+ dirConfig.setRetentionCount( TEST_RETENTION_COUNT );
+
+ dirConfig = purgeConfigurationService.addDirectoryPurgeConfiguration( dirConfig );
+
+ assertNotNull( dirConfig );
+
+ DirectoryPurgeConfiguration retrieved = getStore().getDirectoryPurgeConfiguration( dirConfig.getId() );
+ assertEquals( dirConfig, retrieved );
+
+ dirConfig.setDirectoryType( TEST_BUILDOUTPUT_DIRECTORY_TYPE );
+ purgeConfigurationService.updateDirectoryPurgeConfiguration( dirConfig );
+ retrieved = getStore().getDirectoryPurgeConfiguration( dirConfig.getId() );
+ assertEquals( dirConfig, retrieved );
+
+ purgeConfigurationService.removeDirectoryPurgeConfiguration( dirConfig );
+
+ List<DirectoryPurgeConfiguration> dirConfigs = purgeConfigurationService.getAllDirectoryPurgeConfigurations();
+ assertFalse( "check if dir purge configuration was removed", dirConfigs.contains( dirConfig ) );
+ }
+
+ public void testRepositoryManagedContent()
+ throws Exception
+ {
+ RepositoryManagedContent repo = purgeConfigurationService.getManagedRepositoryContent( defaultRepository.getId() );
+
+ assertTrue( "check repository managed content", ( repo instanceof ManagedDefaultRepositoryContent ) );
+ assertEquals( "check repository of the managed content", defaultRepository, repo.getRepository() );
+ }
+}
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/DefaultPurgeConfigurationServiceTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/DefaultPurgeConfigurationServiceTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Revision Id
Added: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,394 @@
+package org.apache.continuum.purge.executor;
+
+/*
+ * 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 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;
+import org.apache.continuum.purge.AbstractPurgeTest;
+import org.apache.continuum.purge.task.PurgeTask;
+import org.codehaus.plexus.taskqueue.execution.TaskExecutor;
+
+/**
+ * @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" };
+
+ 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
+ {
+ super.tearDown();
+
+ FileUtils.deleteDirectory( getDefaultRepositoryLocation() );
+ 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 );
+
+ return new PurgeTask( repoConfig.getId() );
+ }
+
+ protected PurgeTask getRetentionCountRepoPurgeTask()
+ throws Exception
+ {
+ repoConfig = new RepositoryPurgeConfiguration();
+ repoConfig.setRepository( defaultRepository );
+ repoConfig.setDaysOlder( -1 );
+ repoConfig.setRetentionCount( TEST_RETENTION_COUNT );
+ repoConfig = getStore().addRepositoryPurgeConfiguration( repoConfig );
+
+ return new PurgeTask( repoConfig.getId() );
+ }
+
+ protected PurgeTask getReleasedSnapshotsRepoPurgeTask()
+ throws Exception
+ {
+ repoConfig = new RepositoryPurgeConfiguration();
+ repoConfig.setRepository( defaultRepository );
+ repoConfig.setDaysOlder( -1 );
+ repoConfig.setRetentionCount( TEST_RETENTION_COUNT );
+ repoConfig.setDeleteReleasedSnapshots( true );
+ repoConfig = getStore().addRepositoryPurgeConfiguration( repoConfig );
+
+ return new PurgeTask( repoConfig.getId() );
+ }
+
+ protected PurgeTask getDaysOldReleasesDirPurgeTask()
+ throws Exception
+ {
+ dirConfig = new DirectoryPurgeConfiguration();
+ dirConfig.setDirectoryType( TEST_RELEASES_DIRECTORY_TYPE );
+ dirConfig.setLocation( getReleasesDirectoryLocation().getAbsolutePath() );
+ dirConfig.setDaysOlder( TEST_DAYS_OLDER );
+ dirConfig = getStore().addDirectoryPurgeConfiguration( dirConfig );
+
+ return new PurgeTask( dirConfig.getId() );
+ }
+
+ protected PurgeTask getDaysOldBuildOutputDirPurgeTask()
+ throws Exception
+ {
+ dirConfig = new DirectoryPurgeConfiguration();
+ dirConfig.setDirectoryType( TEST_BUILDOUTPUT_DIRECTORY_TYPE );
+ dirConfig.setLocation( getBuildOutputDirectoryLocation().getAbsolutePath() );
+ dirConfig.setDaysOlder( TEST_DAYS_OLDER );
+ dirConfig = getStore().addDirectoryPurgeConfiguration( dirConfig );
+
+ return new PurgeTask( dirConfig.getId() );
+ }
+
+ protected PurgeTask getRetentionCountReleasesDirPurgeTask()
+ throws Exception
+ {
+ dirConfig = new DirectoryPurgeConfiguration();
+ dirConfig.setDirectoryType( TEST_RELEASES_DIRECTORY_TYPE );
+ dirConfig.setLocation( getReleasesDirectoryLocation().getAbsolutePath() );
+ dirConfig.setDaysOlder( -1 );
+ dirConfig.setRetentionCount( TEST_RETENTION_COUNT );
+ dirConfig = getStore().addDirectoryPurgeConfiguration( dirConfig );
+
+ return new PurgeTask( dirConfig.getId() );
+ }
+
+ protected PurgeTask getRetentionCountBuildOutputDirPurgeTask()
+ throws Exception
+ {
+ dirConfig = new DirectoryPurgeConfiguration();
+ dirConfig.setDirectoryType( TEST_BUILDOUTPUT_DIRECTORY_TYPE );
+ dirConfig.setLocation( getBuildOutputDirectoryLocation().getAbsolutePath() );
+ dirConfig.setDaysOlder( -1 );
+ dirConfig.setRetentionCount( TEST_RETENTION_COUNT );
+ dirConfig = getStore().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 );
+ }
+ }
+ }
+ else
+ {
+ 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() );
+ }
+
+ protected void assertExists( String path )
+ {
+ 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 );
+
+ 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 );
+ }
+
+ 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",
+ "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 );
+ }
+
+ 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 );
+
+ versions = new ArrayList<String>();
+ versions.add( "2.3" );
+ 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 );
+ }
+
+ protected void populateReleasesDirectory()
+ throws Exception
+ {
+ prepareTestFolders();
+
+ String repoPath = getReleasesDirectoryLocation().getAbsolutePath();
+
+ 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" };
+
+ 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() )
+ {
+ versionDir.mkdirs();
+
+ // 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] );
+ 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.createNewFile();
+ }
+
+ for ( int i = 0; i < pom_extensions.length; i++ )
+ {
+ File file =
+ new File( versionDir.getAbsolutePath(), artifactId + "-" +
+ version + pom_extensions[i] );
+ file.createNewFile();
+ }
+ }
+ }
+
+ private void prepareTestFolders()
+ throws Exception
+ {
+ FileUtils.cleanDirectory( getDefaultRepositoryLocation() );
+ FileUtils.cleanDirectory( getReleasesDirectoryLocation() );
+ FileUtils.cleanDirectory( getBuildOutputDirectoryLocation() );
+ }
+}
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/AbstractPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Revision Id
Added: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,101 @@
+package org.apache.continuum.purge.executor;
+
+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
+ * 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.
+ */
+
+/**
+ * @author Maria Catherine Tan
+ */
+public class CleanAllPurgeExecutorTest
+ extends AbstractPurgeExecutorTest
+{
+ protected void setUp()
+ 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 );
+ }
+ }
+}
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Revision Id
Added: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,148 @@
+package org.apache.continuum.purge.executor;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author Maria Catherine Tan
+ */
+public class DaysOldDirectoryPurgeExecutorTest
+ extends AbstractPurgeExecutorTest
+{
+ protected void setUp()
+ 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 );
+
+ purgeExecutor.executeTask( purgeReleasesDirTask );
+
+ assertDeleted( dirPath + "/releases-4234729018" );
+
+ assertExists( dirPath + "/1" );
+ assertExists( dirPath + "/releases-1234567890" );
+ assertExists( dirPath + "/releases-1234567809" );
+ }
+
+ public void testBuildOutputPurgingByLastModified()
+ 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 );
+
+ 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" );
+ assertExists( dirPath + "/2/9.log.txt" );
+ }
+}
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Revision Id
Added: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,109 @@
+package org.apache.continuum.purge.executor;
+
+/*
+ * 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.
+ */
+
+/**
+ * Tests were taken from Archiva and just added a check if the metadata was deleted.
+ */
+public class DaysOldRepositoryPurgeExecutorTest
+ extends AbstractPurgeExecutorTest
+{
+ protected void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ populateDefaultRepository();
+
+ purgeDefaultRepoTask = getDaysOldRepoPurgeTask();
+ }
+
+ public void testDefaultRepoPurgingByLastModified()
+ throws Exception
+ {
+ 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" );
+ assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom" );
+ assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.md5" );
+ assertDeleted( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.sha1" );
+
+ // shouldn't be deleted because even if older than 30 days (because retention count = 2)
+ assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar" );
+ assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar.md5" );
+ assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar.sha1" );
+ assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom" );
+ assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom.md5" );
+ assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom.sha1" );
+
+ assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar" );
+ assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar.md5" );
+ assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar.sha1" );
+ assertExists( projectRoot + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.pom" );
+ 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" );
+ }
+}
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/DaysOldRepositoryPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Revision Id
Added: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,121 @@
+package org.apache.continuum.purge.executor;
+
+/*
+ * 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.
+ */
+
+/**
+ * Tests were taken from Archiva and added a check if metadata was deleted.
+ */
+public class ReleasedSnapshotsRepositoryPurgeExecutorTest
+ extends AbstractPurgeExecutorTest
+{
+ protected void setUp()
+ 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" );
+ assertDeleted( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.pom" );
+ assertDeleted( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.pom.sha1" );
+ assertDeleted( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.pom.md5" );
+
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.jar" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.jar.sha1" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.jar.md5" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.pom" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.pom.sha1" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.pom.md5" );
+
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.jar" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.jar.sha1" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.jar.md5" );
+ 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" );
+ assertDeleted( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom" );
+ assertDeleted( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.md5" );
+ assertDeleted( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.sha1" );
+
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar.md5" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar.sha1" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom.md5" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom.sha1" );
+
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar.md5" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar.sha1" );
+ 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" );
+ assertDeleted( projectRoot3 + "/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.jar.md5" );
+ assertDeleted( projectRoot3 + "/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.jar.sha1" );
+ assertDeleted( projectRoot3 + "/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.pom" );
+ assertDeleted( projectRoot3 + "/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.pom.md5" );
+ assertDeleted( projectRoot3 + "/2.3-SNAPSHOT/maven-plugin-plugin-2.3-SNAPSHOT.pom.sha1" );
+
+ // check if the released version was not removed
+ assertExists( projectRoot3 + "/2.2" );
+ assertExists( projectRoot3 + "/2.2/maven-plugin-plugin-2.2.jar" );
+ assertExists( projectRoot3 + "/2.2/maven-plugin-plugin-2.2.jar.md5" );
+ assertExists( projectRoot3 + "/2.2/maven-plugin-plugin-2.2.jar.sha1" );
+ 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" );
+ assertExists( projectRoot3 + "/2.3/maven-plugin-plugin-2.3.jar.sha1" );
+ assertExists( projectRoot3 + "/2.3/maven-plugin-plugin-2.3.pom" );
+ assertExists( projectRoot3 + "/2.3/maven-plugin-plugin-2.3.pom.md5" );
+ assertExists( projectRoot3 + "/2.3/maven-plugin-plugin-2.3.pom.sha1" );
+ }
+}
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Revision Id
Added: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,105 @@
+package org.apache.continuum.purge.executor;
+
+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
+ * 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.
+ */
+
+/**
+ * @author Maria Catherine Tan
+ */
+public class RetentionCountDirectoryPurgeExecutorTest
+ extends AbstractPurgeExecutorTest
+{
+ protected void setUp()
+ 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" );
+ }
+ }
+}
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountDirectoryPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Revision Id
Added: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java (added)
+++ continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java Thu Jul 24 15:31:19 2008
@@ -0,0 +1,163 @@
+package org.apache.continuum.purge.executor;
+
+/*
+ * 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.
+ */
+
+/**
+ * Tests were taken from Archiva and just added a check if the metadata was deleted.
+ */
+public class RetentionCountRepositoryPurgeExecutorTest
+ extends AbstractPurgeExecutorTest
+{
+ protected void setUp()
+ 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" );
+ assertDeleted( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.jar.sha1" );
+ assertDeleted( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.pom" );
+ assertDeleted( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.pom.md5" );
+ assertDeleted( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.153317-1.pom.sha1" );
+
+ assertDeleted( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.jar" );
+ assertDeleted( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.jar.md5" );
+ assertDeleted( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.jar.sha1" );
+ assertDeleted( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.pom" );
+ assertDeleted( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.pom.md5" );
+ assertDeleted( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070504.160758-2.pom.sha1" );
+
+ // assert if not removed from repo
+ assertExists( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.jar" );
+ assertExists( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.jar.md5" );
+ assertExists( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.jar.sha1" );
+ assertExists( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.pom" );
+ assertExists( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.pom.md5" );
+ assertExists( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070505.090015-3.pom.sha1" );
+
+ assertExists( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.jar" );
+ assertExists( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.jar.md5" );
+ assertExists( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.jar.sha1" );
+ assertExists( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.pom" );
+ assertExists( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.pom.md5" );
+ assertExists( projectRoot1 + "/1.0RC1-SNAPSHOT/jruby-rake-plugin-1.0RC1-20070506.090132-4.pom.sha1" );
+
+ // assert if removed from repo
+ assertDeleted( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.jar" );
+ assertDeleted( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.jar.md5" );
+ assertDeleted( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.jar.sha1" );
+ assertDeleted( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.pom" );
+ assertDeleted( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.pom.md5" );
+ assertDeleted( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070427.065136-1.pom.sha1" );
+
+ // assert if not removed from repo
+ assertExists( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.pom" );
+ assertExists( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.pom.md5" );
+ assertExists( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.pom.sha1" );
+ assertExists( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.jar" );
+ assertExists( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.jar.md5" );
+ assertExists( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070615.105019-3.jar.sha1" );
+
+ assertExists( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.pom" );
+ assertExists( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.pom.md5" );
+ assertExists( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.pom.sha1" );
+ assertExists( projectRoot2 + "/1.1.2-SNAPSHOT/castor-anttasks-1.1.2-20070506.163513-2.jar" );
+ 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" );
+ assertDeleted( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.pom" );
+ assertDeleted( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.pom.sha1" );
+ assertDeleted( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070427.065136-1.pom.md5" );
+
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.jar" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.jar.sha1" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.jar.md5" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.pom" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.pom.sha1" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070506.163513-2.pom.md5" );
+
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.jar" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.jar.sha1" );
+ assertExists( projectRoot1 + "/1.1.2-SNAPSHOT/maven-assembly-plugin-1.1.2-20070615.105019-3.jar.md5" );
+ 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" );
+ assertDeleted( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom" );
+ assertDeleted( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.md5" );
+ assertDeleted( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-SNAPSHOT.pom.sha1" );
+
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar.md5" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.jar.sha1" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom.md5" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20070513.034619-5.pom.sha1" );
+
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar.md5" );
+ assertExists( projectRoot2 + "/2.2-SNAPSHOT/maven-install-plugin-2.2-20061118.060401-2.jar.sha1" );
+ 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" );
+ }
+}
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/java/org/apache/continuum/purge/executor/RetentionCountRepositoryPurgeExecutorTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Revision Id
Added: continuum/branches/CONTINUUM-782/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml?rev=679588&view=auto
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml (added)
+++ continuum/branches/CONTINUUM-782/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml Thu Jul 24 15:31:19 2008
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+
+<!--
+ ~ 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.
+ -->
+
+<configuration>
+ <system/>
+ <jndi prefix="java:comp/env" config-optional="true"/>
+ <xml fileName="${appserver.base}/conf/continuum.xml" config-optional="true"
+ config-forceCreate="true" config-name="org.apache.continuum"/>
+ <xml fileName="${user.home}/.m2/continuum.xml" config-optional="true"
+ config-forceCreate="true" config-name="org.apache.continuum.user"/>
+</configuration>
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: continuum/branches/CONTINUUM-782/continuum-purge/src/test/resources/META-INF/continuum/continuum-configuration.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java?rev=679588&r1=679587&r2=679588&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java (original)
+++ continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/DefaultContinuumReleaseManager.java Thu Jul 24 15:31:19 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-782/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java?rev=679588&r1=679587&r2=679588&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java (original)
+++ continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/executors/PerformReleaseTaskExecutor.java Thu Jul 24 15:31:19 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-782/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java?rev=679588&r1=679587&r2=679588&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java (original)
+++ continuum/branches/CONTINUUM-782/continuum-release/src/main/java/org/apache/maven/continuum/release/tasks/PerformReleaseProjectTask.java Thu Jul 24 15:31:19 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-782/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java?rev=679588&r1=679587&r2=679588&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java (original)
+++ continuum/branches/CONTINUUM-782/continuum-security/src/main/java/org/apache/maven/continuum/security/ContinuumRoleConstants.java Thu Jul 24 15:31:19 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-782/continuum-security/src/main/resources/META-INF/redback/redback.xml
URL: http://svn.apache.org/viewvc/continuum/branches/CONTINUUM-782/continuum-security/src/main/resources/META-INF/redback/redback.xml?rev=679588&r1=679587&r2=679588&view=diff
==============================================================================
--- continuum/branches/CONTINUUM-782/continuum-security/src/main/resources/META-INF/redback/redback.xml (original)
+++ continuum/branches/CONTINUUM-782/continuum-security/src/main/resources/META-INF/redback/redback.xml Thu Jul 24 15:31:19 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>