[MRM-37 and MRM-527]

- added code for cleaning up the database of artifacts that are no longer existing in the repository 
(DatabaseCleanupRemoveArtifactConsumer and DatabaseCleanupRemoveProjectConsumer)
- created tests for database cleanup of removed artifacts
- updated some of the test cases (in archiva-database and archiva-scheduled modules) to reflect the changes in thedb cleanup consumers 


git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@584735 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maria Odea B. Ching 2007-10-15 11:16:38 +00:00
parent 829e85759e
commit 88e4896ee9
14 changed files with 655 additions and 29 deletions

View File

@ -23,13 +23,23 @@ import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer;
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.database.ArtifactDAO;
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
import org.apache.maven.archiva.repository.RepositoryContentFactory;
import org.apache.maven.archiva.repository.RepositoryException;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.layout.LayoutException;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
import java.util.List;
import java.io.File;
/**
* DatabaseCleanupRemoveArtifactConsumer
* Consumer for cleaning up the database of artifacts that are no longer existing in the repository.
*
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
* <a href="mailto:oching@apache.org">Maria Odea Ching</a>
* @version $Id$
*
* @plexus.component role="org.apache.maven.archiva.consumers.DatabaseCleanupConsumer"
@ -50,6 +60,21 @@ public class DatabaseCleanupRemoveArtifactConsumer
*/
private String description;
/**
* @plexus.requirement role-hint="jdo"
*/
private ArtifactDAO artifactDAO;
/**
* @plexus.requirement
*/
private BidirectionalRepositoryLayoutFactory layoutFactory;
/**
* @plexus.requirement
*/
private RepositoryContentFactory repositoryFactory;
public void beginScan()
{
// TODO Auto-generated method stub
@ -59,20 +84,37 @@ public class DatabaseCleanupRemoveArtifactConsumer
public void completeScan()
{
// TODO Auto-generated method stub
}
public List<String> getIncludedTypes()
{
// TODO Auto-generated method stub
return null;
}
public void processArchivaArtifact( ArchivaArtifact artifact )
throws ConsumerException
{
// TODO Auto-generated method stub
try
{
ManagedRepositoryContent repositoryContent =
repositoryFactory.getManagedRepositoryContent( artifact.getModel().getRepositoryId() );
File file = new File( repositoryContent.getRepoRoot(), toPath( artifact ) );
if( !file.exists() )
{
artifactDAO.deleteArtifact( artifact );
}
}
catch ( RepositoryException re )
{
throw new ConsumerException( "Can't run database cleanup remove artifact consumer: " +
re.getMessage() );
}
catch ( ArchivaDatabaseException e )
{
throw new ConsumerException( e.getMessage() );
}
}
public String getDescription()
@ -90,4 +132,34 @@ public class DatabaseCleanupRemoveArtifactConsumer
return false;
}
public void setArtifactDAO( ArtifactDAO artifactDAO)
{
this.artifactDAO = artifactDAO;
}
public void setBidirectionalRepositoryLayoutFactory( BidirectionalRepositoryLayoutFactory layoutFactory )
{
this.layoutFactory = layoutFactory;
}
public void setRepositoryFactory( RepositoryContentFactory repositoryFactory )
{
this.repositoryFactory = repositoryFactory;
}
private String toPath( ArchivaArtifact artifact )
{
try
{
BidirectionalRepositoryLayout layout = layoutFactory.getLayout( artifact );
return layout.toPath( artifact );
}
catch ( LayoutException e )
{
getLogger().warn( "Unable to calculate path for artifact: " + artifact );
return null;
}
}
}

View File

@ -19,17 +19,31 @@ package org.apache.maven.archiva.consumers.database;
* under the License.
*/
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer;
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArchivaProjectModel;
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
import org.apache.maven.archiva.repository.RepositoryContentFactory;
import org.apache.maven.archiva.repository.RepositoryException;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
import org.apache.maven.archiva.repository.layout.LayoutException;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
import org.apache.maven.archiva.database.ProjectModelDAO;
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import java.util.List;
import java.util.ArrayList;
import java.io.File;
/**
* DatabaseCleanupRemoveProjectConsumer
* Consumer for removing or deleting from the database the project models fo artifacts that have been
* deleted/removed from the repository.
*
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
* <a href="mailto:oching@apache.org">Maria Odea Ching</a>
* @version $Id$
*
* @plexus.component role="org.apache.maven.archiva.consumers.DatabaseCleanupConsumer"
@ -50,28 +64,71 @@ public class DatabaseCleanupRemoveProjectConsumer
*/
private String description;
/**
* @plexus.requirement role-hint="jdo"
*/
private ProjectModelDAO projectModelDAO;
/**
* @plexus.requirement
*/
private BidirectionalRepositoryLayoutFactory layoutFactory;
/**
* @plexus.requirement
*/
private RepositoryContentFactory repositoryFactory;
public void beginScan()
{
// TODO Auto-generated method stub
}
public void completeScan()
{
// TODO Auto-generated method stub
}
public List<String> getIncludedTypes()
{
// TODO Auto-generated method stub
return null;
}
public void processArchivaArtifact( ArchivaArtifact artifact )
throws ConsumerException
{
// TODO Auto-generated method stub
if ( !StringUtils.equals( "pom", artifact.getType() ) )
{
// Not a pom. Skip it.
return;
}
try
{
ManagedRepositoryContent repositoryContent =
repositoryFactory.getManagedRepositoryContent( artifact.getModel().getRepositoryId() );
File file = new File( repositoryContent.getRepoRoot(), toPath( artifact ) );
if( !file.exists() )
{
ArchivaProjectModel projectModel = projectModelDAO.getProjectModel(
artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() );
projectModelDAO.deleteProjectModel( projectModel );
}
}
catch ( RepositoryException re )
{
re.printStackTrace();
throw new ConsumerException( "Can't run database cleanup remove artifact consumer: " +
re.getMessage() );
}
catch ( ArchivaDatabaseException e )
{
e.printStackTrace();
throw new ConsumerException( e.getMessage() );
}
}
@ -90,4 +147,34 @@ public class DatabaseCleanupRemoveProjectConsumer
return false;
}
private String toPath( ArchivaArtifact artifact )
{
try
{
BidirectionalRepositoryLayout layout = layoutFactory.getLayout( artifact );
return layout.toPath( artifact );
}
catch ( LayoutException e )
{
getLogger().warn( "Unable to calculate path for artifact: " + artifact );
return null;
}
}
public void setProjectModelDAO( ProjectModelDAO projectModelDAO )
{
this.projectModelDAO = projectModelDAO;
}
public void setBidirectionalRepositoryLayoutFactory( BidirectionalRepositoryLayoutFactory layoutFactory )
{
this.layoutFactory = layoutFactory;
}
public void setRepositoryFactory( RepositoryContentFactory repositoryFactory )
{
this.repositoryFactory = repositoryFactory;
}
}

View File

@ -0,0 +1,104 @@
package org.apache.maven.archiva.consumers.database;
/*
* 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.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.repository.RepositoryContentFactory;
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArchivaArtifactModel;
import org.apache.maven.archiva.model.ArchivaProjectModel;
import java.io.File;
/**
* @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
*/
public class AbstractDatabaseCleanupTest
extends PlexusTestCase
{
ArchivaConfiguration archivaConfig;
BidirectionalRepositoryLayoutFactory layoutFactory;
RepositoryContentFactory repositoryFactory;
public static final String TEST_GROUP_ID = "org.apache.maven.archiva";
public static final String TEST_ARTIFACT_ID = "cleanup-artifact-test";
public static final String TEST_VERSION = "1.0";
public static final String TEST_REPO_ID = "test-repo";
public void setUp()
throws Exception
{
super.setUp();
// archiva configuration (need to update the repository url)
File userFile = getTestFile( "target/test/repository-manager.xml" );
userFile.delete();
assertFalse( userFile.exists() );
userFile.getParentFile().mkdirs();
FileUtils.copyFileToDirectory( getTestFile( "src/test/conf/repository-manager.xml" ),
userFile.getParentFile() );
archivaConfig = (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "database-cleanup" );
Configuration configuration = archivaConfig.getConfiguration();
ManagedRepositoryConfiguration repo = configuration.findManagedRepositoryById( TEST_REPO_ID );
repo.setLocation( new File( getBasedir(), "src/test/resources/test-repo" ).toString() );
archivaConfig.save( configuration );
// set bidirectional repository layout factory
layoutFactory = (BidirectionalRepositoryLayoutFactory) lookup( BidirectionalRepositoryLayoutFactory.class );
repositoryFactory = (RepositoryContentFactory) lookup( RepositoryContentFactory.class );
}
protected ArchivaArtifact createArtifact( String groupId, String artifactId, String version, String type )
{
ArchivaArtifactModel model = new ArchivaArtifactModel();
model.setGroupId( groupId );
model.setArtifactId( artifactId );
model.setVersion( version );
model.setType( type );
model.setRepositoryId( TEST_REPO_ID );
return new ArchivaArtifact( model );
}
protected ArchivaProjectModel createProjectModel( String groupId, String artifactId, String version )
{
ArchivaProjectModel projectModel = new ArchivaProjectModel();
projectModel.setGroupId( groupId );
projectModel.setArtifactId( artifactId );
projectModel.setVersion( version );
return projectModel;
}
}

View File

@ -0,0 +1,84 @@
package org.apache.maven.archiva.consumers.database;
/*
* 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.easymock.MockControl;
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.database.ArtifactDAO;
/**
* Test for DatabaseCleanupRemoveArtifactConsumerTest
*
* @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
*/
public class DatabaseCleanupRemoveArtifactConsumerTest
extends AbstractDatabaseCleanupTest
{
private MockControl artifactDAOControl;
private ArtifactDAO artifactDAOMock;
private DatabaseCleanupRemoveArtifactConsumer dbCleanupRemoveArtifactConsumer;
public void setUp()
throws Exception
{
super.setUp();
dbCleanupRemoveArtifactConsumer = new DatabaseCleanupRemoveArtifactConsumer();
artifactDAOControl = MockControl.createControl( ArtifactDAO.class );
artifactDAOMock = (ArtifactDAO) artifactDAOControl.getMock();
dbCleanupRemoveArtifactConsumer.setArtifactDAO( artifactDAOMock );
dbCleanupRemoveArtifactConsumer.setBidirectionalRepositoryLayoutFactory( layoutFactory );
dbCleanupRemoveArtifactConsumer.setRepositoryFactory( repositoryFactory );
}
public void testIfArtifactWasNotDeleted()
throws Exception
{
ArchivaArtifact artifact = createArtifact( TEST_GROUP_ID, "do-not-cleanup-artifact-test", TEST_VERSION, "jar" );
artifactDAOControl.replay();
dbCleanupRemoveArtifactConsumer.processArchivaArtifact( artifact );
artifactDAOControl.verify();
}
public void testIfArtifactWasDeleted()
throws Exception
{
ArchivaArtifact artifact = createArtifact( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION, "jar" );
artifactDAOMock.deleteArtifact( artifact );
artifactDAOControl.replay();
dbCleanupRemoveArtifactConsumer.processArchivaArtifact( artifact );
artifactDAOControl.verify();
}
}

View File

@ -0,0 +1,110 @@
package org.apache.maven.archiva.consumers.database;
/*
* 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.easymock.MockControl;
import org.apache.maven.archiva.database.ProjectModelDAO;
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArchivaProjectModel;
/**
* Test for DatabaseCleanupRemoveProjectConsumer
*
* @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
*/
public class DatabaseCleanupRemoveProjectConsumerTest
extends AbstractDatabaseCleanupTest
{
private MockControl projectModelDAOControl;
private ProjectModelDAO projectModelDAOMock;
private DatabaseCleanupRemoveProjectConsumer dbCleanupRemoveProjectConsumer;
public void setUp()
throws Exception
{
super.setUp();
dbCleanupRemoveProjectConsumer = new DatabaseCleanupRemoveProjectConsumer();
projectModelDAOControl = MockControl.createControl( ProjectModelDAO.class );
projectModelDAOMock = (ProjectModelDAO) projectModelDAOControl.getMock();
dbCleanupRemoveProjectConsumer.setProjectModelDAO( projectModelDAOMock );
dbCleanupRemoveProjectConsumer.setBidirectionalRepositoryLayoutFactory( layoutFactory );
dbCleanupRemoveProjectConsumer.setRepositoryFactory( repositoryFactory );
}
public void testIfArtifactWasNotDeleted()
throws Exception
{
ArchivaArtifact artifact = createArtifact( TEST_GROUP_ID, "do-not-cleanup-artifact-test", TEST_VERSION, "pom" );
projectModelDAOControl.replay();
dbCleanupRemoveProjectConsumer.processArchivaArtifact( artifact );
projectModelDAOControl.verify();
}
public void testIfArtifactWasDeleted()
throws Exception
{
ArchivaArtifact artifact = createArtifact( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION, "pom" );
ArchivaProjectModel projectModel = createProjectModel( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION );
//this should return a value
projectModelDAOControl.expectAndReturn(
projectModelDAOMock.getProjectModel( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION ),
(ArchivaProjectModel) projectModel );
projectModelDAOMock.deleteProjectModel( projectModel );
projectModelDAOControl.replay();
dbCleanupRemoveProjectConsumer.processArchivaArtifact( artifact );
projectModelDAOControl.verify();
}
public void testIfArtifactWasNotAPom()
throws Exception
{
ArchivaArtifact artifact = createArtifact( TEST_GROUP_ID, "do-not-cleanup-artifact-test", TEST_VERSION, "jar" );
projectModelDAOControl.replay();
dbCleanupRemoveProjectConsumer.processArchivaArtifact( artifact );
projectModelDAOControl.verify();
}
public void tearDown()
throws Exception
{
super.tearDown();
}
}

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ 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.
-->
<component-set>
<components>
<component>
<role>org.apache.maven.archiva.consumers.DatabaseCleanupConsumer</role>
<role-hint>not-present-remove-db-artifact</role-hint>
<implementation>org.apache.maven.archiva.consumers.database.DatabaseCleanupRemoveArtifactConsumer</implementation>
<requirements>
<requirement>
<role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
<role-hint>database-cleanup</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory</role>
</requirement>
<requirement>
<role>org.apache.maven.archiva.database.ArtifactDAO</role>
<role-hint>jdo</role-hint>
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
<role-hint>database-cleanup</role-hint>
<implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation>
<requirements>
<requirement>
<role>org.codehaus.plexus.registry.Registry</role>
<role-hint>database-cleanup</role-hint>
</requirement>
</requirements>
</component>
<component>
<role>org.codehaus.plexus.registry.Registry</role>
<role-hint>database-cleanup</role-hint>
<implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation>
<configuration>
<properties>
<xml fileName="${basedir}/target/test/repository-manager.xml" config-optional="true" config-forceCreate="true"
config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/>
</properties>
</configuration>
</component>
<component>
<role>org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory</role>
<implementation>org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory</implementation>
<requirements>
<requirement>
<role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
<role-hint>database-cleanup</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout</role>
<field-name>layouts</field-name>
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout</role>
<role-hint>default</role-hint>
<implementation>org.apache.maven.archiva.repository.layout.DefaultBidirectionalRepositoryLayout</implementation>
</component>
<component>
<role>org.apache.maven.archiva.repository.RepositoryContentFactory</role>
<implementation>org.apache.maven.archiva.repository.RepositoryContentFactory</implementation>
<requirements>
<requirement>
<role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
<role-hint>database-cleanup</role-hint>
</requirement>
</requirements>
</component>
</components>
</component-set>

View File

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ 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.
-->
<component-set>
<components>
<component>
<role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
<role-hint>database-cleanup</role-hint>
<implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation>
<requirements>
<requirement>
<role>org.codehaus.plexus.registry.Registry</role>
<role-hint>database-cleanup</role-hint>
</requirement>
</requirements>
</component>
<component>
<role>org.codehaus.plexus.registry.Registry</role>
<role-hint>database-cleanup</role-hint>
<implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation>
<configuration>
<properties>
<xml fileName="${basedir}/target/test/repository-manager.xml" config-optional="true" config-forceCreate="true"
config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/>
</properties>
</configuration>
</component>
<component>
<role>org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory</role>
<implementation>org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory</implementation>
<requirements>
<requirement>
<role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
<role-hint>database-cleanup</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout</role>
<field-name>layouts</field-name>
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout</role>
<role-hint>default</role-hint>
<implementation>org.apache.maven.archiva.repository.layout.DefaultBidirectionalRepositoryLayout</implementation>
</component>
<component>
<role>org.apache.maven.archiva.repository.RepositoryContentFactory</role>
<implementation>org.apache.maven.archiva.repository.RepositoryContentFactory</implementation>
<requirements>
<requirement>
<role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
<role-hint>database-cleanup</role-hint>
</requirement>
</requirements>
</component>
</components>
</component-set>

View File

@ -0,0 +1,5 @@
<project>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>do-not-cleanup-artifact-test</artifactId>
<version>1.0</version>
</project>

View File

@ -95,7 +95,7 @@ public class DatabaseConsumers
DatabaseCleanupConsumer consumer = (DatabaseCleanupConsumer) object;
DatabaseScanningConfiguration config = archivaConfiguration.getConfiguration().getDatabaseScanning();
return config.getUnprocessedConsumers().contains( consumer.getId() );
return config.getCleanupConsumers().contains( consumer.getId() );
}
return satisfies;

View File

@ -70,12 +70,12 @@ public class TestDatabaseCleanupConsumer
public String getDescription()
{
return "Test Consumer for Database Unprocessed";
return "Test Consumer for Database Cleanup";
}
public String getId()
{
return "test-db-unprocessed";
return "test-db-cleanup";
}
public boolean isPermanent()

View File

@ -146,9 +146,6 @@
</unprocessedConsumers>
<cleanupConsumers>
<cleanupConsumer>test-db-cleanup</cleanupConsumer>
<cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
<cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
<cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
</cleanupConsumers>
</databaseScanning>

View File

@ -70,12 +70,12 @@ public class TestDatabaseCleanupConsumer
public String getDescription()
{
return "Test Consumer for Database Unprocessed";
return "Test Consumer for Database Cleanup";
}
public String getId()
{
return "test-db-unprocessed";
return "test-db-cleanup";
}
public boolean isPermanent()

View File

@ -113,9 +113,6 @@
</unprocessedConsumers>
<cleanupConsumers>
<cleanupConsumer>test-db-cleanup</cleanupConsumer>
<cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
<cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
<cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
</cleanupConsumers>
</databaseScanning>