summaryrefslogtreecommitdiffstats
path: root/archiva-base/archiva-consumers/archiva-database-consumers
diff options
context:
space:
mode:
Diffstat (limited to 'archiva-base/archiva-consumers/archiva-database-consumers')
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/pom.xml62
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java266
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/BytecodeStatsToDatabaseConsumer.java93
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumer.java163
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumer.java180
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java364
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/VerifyMetadataAgainstDatabaseConsumer.java93
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/test/conf/repository-manager.xml203
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/AbstractDatabaseCleanupTest.java98
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumerTest.java79
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumerTest.java97
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumerTest.java115
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumerTest.xml56
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumerTest.xml65
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumerTest.xml87
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/org/apache/maven/archiva/do-not-cleanup-artifact-test/1.0/do-not-cleanup-artifact-test-1.0.jarbin308 -> 0 bytes
-rw-r--r--archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/org/apache/maven/archiva/do-not-cleanup-artifact-test/1.0/do-not-cleanup-artifact-test-1.0.pom5
17 files changed, 0 insertions, 2026 deletions
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/pom.xml b/archiva-base/archiva-consumers/archiva-database-consumers/pom.xml
deleted file mode 100644
index 2900a3218..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/pom.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright 2005-2006 The Apache Software Foundation.
- ~
- ~ Licensed 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.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-consumers</artifactId>
- <version>1.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>archiva-database-consumers</artifactId>
- <name>Archiva Consumers :: Database Consumers</name>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-database</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-artifact-reports</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-configuration</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-consumer-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.archiva</groupId>
- <artifactId>archiva-repository-layer</artifactId>
- </dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-digest</artifactId>
- </dependency>
- <dependency>
- <groupId>hsqldb</groupId>
- <artifactId>hsqldb</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java
deleted file mode 100644
index 5fd947e3f..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumer.java
+++ /dev/null
@@ -1,266 +0,0 @@
-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.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.ConfigurationNames;
-import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
-import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.maven.archiva.database.ArchivaDAO;
-import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.ArtifactReference;
-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.LayoutException;
-import org.codehaus.plexus.digest.Digester;
-import org.codehaus.plexus.digest.DigesterException;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
-import org.codehaus.plexus.registry.Registry;
-import org.codehaus.plexus.registry.RegistryListener;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * ArtifactUpdateDatabaseConsumer - Take an artifact off of disk and put it into the repository.
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- * @plexus.component role="org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer"
- * role-hint="update-db-artifact"
- * instantiation-strategy="per-lookup"
- */
-public class ArtifactUpdateDatabaseConsumer
- extends AbstractMonitoredConsumer
- implements KnownRepositoryContentConsumer, RegistryListener, Initializable
-{
- private static final String TYPE_NOT_ARTIFACT = "file-not-artifact";
-
- private static final String DB_ERROR = "db-error";
-
- private static final String CHECKSUM_CALCULATION = "checksum-calc";
-
- /**
- * @plexus.configuration default-value="update-db-artifact"
- */
- private String id;
-
- /**
- * @plexus.configuration default-value="Update the Artifact in the Database"
- */
- private String description;
-
- /**
- * @plexus.requirement role-hint="jdo"
- */
- private ArchivaDAO dao;
-
- /**
- * @plexus.requirement
- */
- private ArchivaConfiguration configuration;
-
- /**
- * @plexus.requirement
- */
- private FileTypes filetypes;
-
- /**
- * @plexus.requirement
- */
- private RepositoryContentFactory repositoryFactory;
-
- /**
- * @plexus.requirement role-hint="sha1"
- */
- private Digester digestSha1;
-
- /**
- * @plexus.requirement role-hint="md5";
- */
- private Digester digestMd5;
-
- private ManagedRepositoryContent repository;
-
- private File repositoryDir;
-
- private List<String> includes = new ArrayList<String>();
-
- public String getId()
- {
- return this.id;
- }
-
- public String getDescription()
- {
- return this.description;
- }
-
- public boolean isPermanent()
- {
- return true;
- }
-
- public List<String> getExcludes()
- {
- return getDefaultArtifactExclusions();
- }
-
- public List<String> getIncludes()
- {
- return this.includes;
- }
-
- public void beginScan( ManagedRepositoryConfiguration repo )
- throws ConsumerException
- {
- try
- {
- this.repository = repositoryFactory.getManagedRepositoryContent( repo.getId() );
- this.repositoryDir = new File( repository.getRepoRoot() );
- }
- catch(RepositoryException e)
- {
- throw new ConsumerException( "Unable to start ArtifactUpdateDatabaseConsumer: " + e.getMessage(), e );
- }
- }
-
- public void processFile( String path )
- throws ConsumerException
- {
- ArchivaArtifact artifact = getLiveArtifact( path );
-
- if ( artifact == null )
- {
- return;
- }
-
- try
- {
- artifact.getModel().setRepositoryId( this.repository.getId() );
-
- // Calculate the hashcodes.
- File artifactFile = new File( this.repositoryDir, path );
- try
- {
- artifact.getModel().setChecksumMD5( digestMd5.calc( artifactFile ) );
- }
- catch ( DigesterException e )
- {
- triggerConsumerWarning( CHECKSUM_CALCULATION,
- "Unable to calculate the MD5 checksum: " + e.getMessage() );
- }
-
- try
- {
- artifact.getModel().setChecksumSHA1( digestSha1.calc( artifactFile ) );
- }
- catch ( DigesterException e )
- {
- triggerConsumerWarning( CHECKSUM_CALCULATION,
- "Unable to calculate the SHA1 checksum: " + e.getMessage() );
- }
-
- artifact.getModel().setLastModified( new Date( artifactFile.lastModified() ) );
- artifact.getModel().setSize( artifactFile.length() );
- artifact.getModel().setOrigin( "FileSystem" );
- artifact.getModel().setWhenProcessed( null );
-
- dao.getArtifactDAO().saveArtifact( artifact );
- }
- catch ( ArchivaDatabaseException e )
- {
- triggerConsumerError( DB_ERROR, "Unable to save artifact to database: " + e.getMessage() );
- }
- }
-
- /**
- * Get a Live Artifact from a Path.
- * <p/>
- * Will resolve the artifact details from the path, and then return a database live version
- * of that artifact. Suitable for modification and saving (without the need to check for
- * existance in database prior to save.)
- *
- * @param path the path to work from.
- * @return the artifact that is suitable for database saving.
- */
- public ArchivaArtifact getLiveArtifact( String path )
- {
- try
- {
- ArtifactReference artifact = repository.toArtifactReference( path );
-
- ArchivaArtifact liveArtifact = dao.getArtifactDAO().createArtifact( artifact.getGroupId(),
- artifact.getArtifactId(),
- artifact.getVersion(),
- artifact.getClassifier(),
- artifact.getType() );
-
- return liveArtifact;
- }
- catch ( LayoutException e )
- {
- triggerConsumerError( TYPE_NOT_ARTIFACT,
- "Path " + path + " cannot be converted to artifact: " + e.getMessage() );
- return null;
- }
- }
-
- public void completeScan()
- {
- /* do nothing */
- }
-
- public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
- {
- if ( ConfigurationNames.isRepositoryScanning( propertyName ) )
- {
- initIncludes();
- }
- }
-
- public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue )
- {
- /* do nothing */
- }
-
- private void initIncludes()
- {
- includes.clear();
-
- includes.addAll( filetypes.getFileTypePatterns( FileTypes.ARTIFACTS ) );
- }
-
- public void initialize()
- throws InitializationException
- {
- configuration.addChangeListener( this );
-
- initIncludes();
- }
-}
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/BytecodeStatsToDatabaseConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/BytecodeStatsToDatabaseConsumer.java
deleted file mode 100644
index be46002f9..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/BytecodeStatsToDatabaseConsumer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-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.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
-import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
-import org.apache.maven.archiva.model.ArchivaArtifact;
-
-import java.util.List;
-
-/**
- * BytecodeStatsToDatabaseConsumer
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- *
- * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer"
- * role-hint="update-db-bytecode-stats"
- * instantiation-strategy="per-lookup"
- */
-public class BytecodeStatsToDatabaseConsumer
- extends AbstractMonitoredConsumer
- implements DatabaseUnprocessedArtifactConsumer
-{
- /**
- * @plexus.configuration default-value="update-db-bytecode-stats"
- */
- private String id;
-
- /**
- * @plexus.configuration default-value="Update database with java bytecode stats."
- */
- private String description;
-
- 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
-
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public String getId()
- {
- return id;
- }
-
- public boolean isPermanent()
- {
- return false;
- }
-
-}
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumer.java
deleted file mode 100644
index 5f7013b9e..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumer.java
+++ /dev/null
@@ -1,163 +0,0 @@
-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.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
-import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer;
-import org.apache.maven.archiva.database.Constraint;
-import org.apache.maven.archiva.database.RepositoryProblemDAO;
-import org.apache.maven.archiva.database.constraints.RepositoryProblemByArtifactConstraint;
-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.model.RepositoryProblem;
-import org.apache.maven.archiva.repository.ManagedRepositoryContent;
-import org.apache.maven.archiva.repository.RepositoryContentFactory;
-import org.apache.maven.archiva.repository.RepositoryException;
-
-import java.util.List;
-import java.io.File;
-
-/**
- * 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"
- * role-hint="not-present-remove-db-artifact"
- * instantiation-strategy="per-lookup"
- */
-public class DatabaseCleanupRemoveArtifactConsumer
- extends AbstractMonitoredConsumer
- implements DatabaseCleanupConsumer
-{
- /**
- * @plexus.configuration default-value="not-present-remove-db-artifact"
- */
- private String id;
-
- /**
- * @plexus.configuration default-value="Remove artifact from database if not present on filesystem."
- */
- private String description;
-
- /**
- * @plexus.requirement role-hint="jdo"
- */
- private ArtifactDAO artifactDAO;
-
- /**
- * @plexus.requirement role-hint="jdo"
- */
- private RepositoryProblemDAO repositoryProblemDAO;
-
- /**
- * @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()
- {
- return null;
- }
-
- public void processArchivaArtifact( ArchivaArtifact artifact )
- throws ConsumerException
- {
- try
- {
- ManagedRepositoryContent repositoryContent =
- repositoryFactory.getManagedRepositoryContent( artifact.getModel().getRepositoryId() );
-
- File file = new File( repositoryContent.getRepoRoot(), repositoryContent.toPath( artifact ) );
-
- if( !file.exists() )
- {
- artifactDAO.deleteArtifact( artifact );
-
- // Remove all repository problems related to this artifact
- Constraint artifactConstraint = new RepositoryProblemByArtifactConstraint( artifact );
- List<RepositoryProblem> repositoryProblems =
- repositoryProblemDAO.queryRepositoryProblems( artifactConstraint );
-
- if ( repositoryProblems != null )
- {
- for ( RepositoryProblem repositoryProblem : repositoryProblems )
- {
- repositoryProblemDAO.deleteRepositoryProblem( repositoryProblem );
- }
- }
- }
- }
- 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()
- {
- return description;
- }
-
- public String getId()
- {
- return id;
- }
-
- public boolean isPermanent()
- {
- return false;
- }
-
- public void setArtifactDAO( ArtifactDAO artifactDAO)
- {
- this.artifactDAO = artifactDAO;
- }
-
- public void setRepositoryProblemDAO( RepositoryProblemDAO repositoryProblemDAO )
- {
- this.repositoryProblemDAO = repositoryProblemDAO;
- }
-
- public void setRepositoryFactory( RepositoryContentFactory repositoryFactory )
- {
- this.repositoryFactory = repositoryFactory;
- }
-}
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumer.java
deleted file mode 100644
index dceb1a81d..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumer.java
+++ /dev/null
@@ -1,180 +0,0 @@
-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.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.database.ProjectModelDAO;
-import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.codehaus.plexus.cache.Cache;
-
-import java.util.List;
-import java.io.File;
-
-/**
- * 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"
- * role-hint="not-present-remove-db-project"
- * instantiation-strategy="per-lookup"
- */
-public class DatabaseCleanupRemoveProjectConsumer
- extends AbstractMonitoredConsumer
- implements DatabaseCleanupConsumer
-{
- /**
- * @plexus.configuration default-value="not-present-remove-db-project"
- */
- private String id;
-
- /**
- * @plexus.configuration default-value="Remove project from database if not present on filesystem."
- */
- private String description;
-
- /**
- * @plexus.requirement role-hint="jdo"
- */
- private ProjectModelDAO projectModelDAO;
-
- /**
- * @plexus.requirement
- */
- private RepositoryContentFactory repositoryFactory;
-
- /**
- * @plexus.requirement role-hint="effective-project-cache"
- */
- private Cache effectiveProjectCache;
-
- public void beginScan()
- {
- // TODO Auto-generated method stub
- }
-
- public void completeScan()
- {
- // TODO Auto-generated method stub
- }
-
- public List<String> getIncludedTypes()
- {
- return null;
- }
-
- public void processArchivaArtifact( ArchivaArtifact artifact )
- throws ConsumerException
- {
- 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(), repositoryContent.toPath( artifact ) );
-
- if ( !file.exists() )
- {
- ArchivaProjectModel projectModel =
- projectModelDAO.getProjectModel( artifact.getGroupId(), artifact.getArtifactId(),
- artifact.getVersion() );
-
- projectModelDAO.deleteProjectModel( projectModel );
-
- // Force removal of project model from effective cache
- String projectKey = toProjectKey( projectModel );
- synchronized ( effectiveProjectCache )
- {
- if ( effectiveProjectCache.hasKey( projectKey ) )
- {
- effectiveProjectCache.remove( projectKey );
- }
- }
- }
- }
- 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()
- {
- return description;
- }
-
- public String getId()
- {
- return id;
- }
-
- public boolean isPermanent()
- {
- return false;
- }
-
- public void setProjectModelDAO( ProjectModelDAO projectModelDAO )
- {
- this.projectModelDAO = projectModelDAO;
- }
-
- public void setRepositoryFactory( RepositoryContentFactory repositoryFactory )
- {
- this.repositoryFactory = repositoryFactory;
- }
-
- public void setEffectiveProjectCache( Cache effectiveProjectCache )
- {
- this.effectiveProjectCache = effectiveProjectCache;
- }
-
- private String toProjectKey( ArchivaProjectModel project )
- {
- StringBuilder key = new StringBuilder();
-
- key.append( project.getGroupId() ).append( ":" );
- key.append( project.getArtifactId() ).append( ":" );
- key.append( project.getVersion() );
-
- return key.toString();
- }
-}
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java
deleted file mode 100644
index 97b2d1f47..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java
+++ /dev/null
@@ -1,364 +0,0 @@
-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 java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
-import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
-import org.apache.maven.archiva.database.ArchivaDAO;
-import org.apache.maven.archiva.database.ArchivaDatabaseException;
-import org.apache.maven.archiva.database.ObjectNotFoundException;
-import org.apache.maven.archiva.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
-import org.apache.maven.archiva.model.Keys;
-import org.apache.maven.archiva.model.RepositoryProblem;
-import org.apache.maven.archiva.reporting.artifact.CorruptArtifactReport;
-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.content.ManagedLegacyRepositoryContent;
-import org.apache.maven.archiva.repository.project.ProjectModelException;
-import org.apache.maven.archiva.repository.project.ProjectModelFilter;
-import org.apache.maven.archiva.repository.project.ProjectModelReader;
-import org.apache.maven.archiva.repository.project.filters.EffectiveProjectModelFilter;
-import org.codehaus.plexus.cache.Cache;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * ProjectModelToDatabaseConsumer
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer"
- * role-hint="update-db-project"
- * instantiation-strategy="per-lookup"
- */
-public class ProjectModelToDatabaseConsumer
- extends AbstractMonitoredConsumer
- implements DatabaseUnprocessedArtifactConsumer
-{
- private Logger log = LoggerFactory.getLogger( ProjectModelToDatabaseConsumer.class );
-
- /**
- * @plexus.configuration default-value="update-db-project"
- */
- private String id;
-
- /**
- * @plexus.configuration default-value="Update database with project model information."
- */
- private String description;
-
- /**
- * @plexus.requirement role-hint="jdo"
- */
- private ArchivaDAO dao;
-
- /**
- * @plexus.requirement
- */
- private RepositoryContentFactory repositoryFactory;
-
- /**
- * @plexus.requirement role-hint="model400"
- */
- private ProjectModelReader project400Reader;
-
- /**
- * @plexus.requirement role-hint="model300"
- */
- private ProjectModelReader project300Reader;
-
- /**
- * @plexus.requirement role-hint="expression"
- */
- private ProjectModelFilter expressionModelFilter;
-
- /**
- * @plexus.requirement role="org.apache.maven.archiva.repository.project.ProjectModelFilter"
- * role-hint="effective"
- */
- private EffectiveProjectModelFilter effectiveModelFilter;
-
- private List<String> includes;
-
- /**
- * @plexus.requirement role-hint="effective-project-cache"
- */
- private Cache effectiveProjectCache;
-
- public ProjectModelToDatabaseConsumer()
- {
- includes = new ArrayList<String>();
- includes.add( "pom" );
- }
-
- public void beginScan()
- {
- /* nothing to do here */
- }
-
- public void completeScan()
- {
- /* nothing to do here */
- }
-
- public List<String> getIncludedTypes()
- {
- return includes;
- }
-
- public void processArchivaArtifact( ArchivaArtifact artifact )
- throws ConsumerException
- {
- if ( !StringUtils.equals( "pom", artifact.getType() ) )
- {
- // Not a pom. Skip it.
- return;
- }
-
- ArchivaProjectModel model = null;
-
- // remove old project model if it already exists in the database
- if ( ( model =
- getProjectModelFromDatabase( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() ) ) != null )
- {
- removeOldProjectModel( model );
- model = null;
- }
-
- ManagedRepositoryContent repo = getRepository( artifact );
- File artifactFile = repo.toFile( artifact );
- ProjectModelReader reader = project400Reader;
-
- if ( repo instanceof ManagedLegacyRepositoryContent )
- {
- reader = project300Reader;
- }
-
- try
- {
- model = reader.read( artifactFile );
-
- model.setOrigin( "filesystem" );
-
- // The version should be updated to the artifact/filename version if it is a unique snapshot
- if ( VersionUtil.isUniqueSnapshot( artifact.getVersion() ) )
- {
- model.setVersion( artifact.getVersion() );
- }
-
- // Filter the model
- model = expressionModelFilter.filter( model );
-
- // Resolve the project model
- model = effectiveModelFilter.filter( model );
-
- if ( isValidModel( model, repo, artifact ) )
- {
- log.debug( "Adding project model to database - " + Keys.toKey( model ) );
- dao.getProjectModelDAO().saveProjectModel( model );
- }
- else
- {
- log.warn( "Invalid or corrupt pom. Project model not added to database - " + Keys.toKey( model ) );
- }
-
- }
- catch ( ProjectModelException e )
- {
- log.warn( "Unable to read project model " + artifactFile + " : " + e.getMessage(), e );
-
- addProblem( artifact, "Unable to read project model " + artifactFile + " : " + e.getMessage() );
- }
- catch ( ArchivaDatabaseException e )
- {
- log.warn( "Unable to save project model " + artifactFile + " to the database : " + e.getMessage(), e );
- }
- catch ( Throwable t )
- {
- // Catch the other errors in the process to allow the rest of the process to complete.
- log.error( "Unable to process model " + artifactFile + " due to : " + t.getClass().getName() + " : " +
- t.getMessage(), t );
- }
- }
-
- private ArchivaProjectModel getProjectModelFromDatabase( String groupId, String artifactId, String version )
- {
- try
- {
- ArchivaProjectModel model = dao.getProjectModelDAO().getProjectModel( groupId, artifactId, version );
- return model;
- }
- catch ( ObjectNotFoundException e )
- {
- return null;
- }
- catch ( ArchivaDatabaseException e )
- {
- return null;
- }
- }
-
- private ManagedRepositoryContent getRepository( ArchivaArtifact artifact )
- throws ConsumerException
- {
- String repoId = artifact.getModel().getRepositoryId();
- try
- {
- return repositoryFactory.getManagedRepositoryContent( repoId );
- }
- catch ( RepositoryException e )
- {
- throw new ConsumerException( "Unable to process project model: " + e.getMessage(), e );
- }
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public String getId()
- {
- return id;
- }
-
- public boolean isPermanent()
- {
- // Tells the configuration that this consumer cannot be disabled.
- return true;
- }
-
- private boolean isValidModel( ArchivaProjectModel model, ManagedRepositoryContent repo, ArchivaArtifact artifact )
- throws ConsumerException
- {
- File artifactFile = repo.toFile( artifact );
-
- if ( !artifact.getArtifactId().equalsIgnoreCase( model.getArtifactId() ) )
- {
- StringBuffer emsg = new StringBuffer();
- emsg.append( "File " ).append( artifactFile.getName() );
- emsg.append( " has an invalid project model [" );
- appendModel( emsg, model );
- emsg.append( "]: The model artifactId [" ).append( model.getArtifactId() );
- emsg.append( "] does not match the artifactId portion of the filename: " ).append( artifact.getArtifactId() );
-
- log.warn( emsg.toString() );
- addProblem( artifact, emsg.toString() );
-
- return false;
- }
-
- if ( !artifact.getVersion().equalsIgnoreCase( model.getVersion() ) &&
- !VersionUtil.getBaseVersion( artifact.getVersion() ).equalsIgnoreCase( model.getVersion() ) )
- {
- StringBuffer emsg = new StringBuffer();
- emsg.append( "File " ).append( artifactFile.getName() );
- emsg.append( " has an invalid project model [" );
- appendModel( emsg, model );
- emsg.append( "]; The model version [" ).append( model.getVersion() );
- emsg.append( "] does not match the version portion of the filename: " ).append( artifact.getVersion() );
-
- log.warn( emsg.toString() );
- addProblem( artifact, emsg.toString() );
-
- return false;
- }
-
- return true;
- }
-
- private void appendModel( StringBuffer buf, ArchivaProjectModel model )
- {
- buf.append( "groupId:" ).append( model.getGroupId() );
- buf.append( "|artifactId:" ).append( model.getArtifactId() );
- buf.append( "|version:" ).append( model.getVersion() );
- buf.append( "|packaging:" ).append( model.getPackaging() );
- }
-
- private void addProblem( ArchivaArtifact artifact, String msg )
- throws ConsumerException
- {
- ManagedRepositoryContent repo = getRepository( artifact );
-
- RepositoryProblem problem = new RepositoryProblem();
- problem.setRepositoryId( artifact.getModel().getRepositoryId() );
- problem.setPath( repo.toPath( artifact ) );
- problem.setGroupId( artifact.getGroupId() );
- problem.setArtifactId( artifact.getArtifactId() );
- problem.setVersion( artifact.getVersion() );
- problem.setType( CorruptArtifactReport.PROBLEM_TYPE_CORRUPT_ARTIFACT );
- problem.setOrigin( getId() );
- problem.setMessage( msg );
-
- try
- {
- dao.getRepositoryProblemDAO().saveRepositoryProblem( problem );
- }
- catch ( ArchivaDatabaseException e )
- {
- String emsg = "Unable to save problem with artifact location to DB: " + e.getMessage();
- log.warn( emsg, e );
- throw new ConsumerException( emsg, e );
- }
- }
-
- private String toProjectKey( ArchivaProjectModel project )
- {
- StringBuilder key = new StringBuilder();
-
- key.append( project.getGroupId() ).append( ":" );
- key.append( project.getArtifactId() ).append( ":" );
- key.append( project.getVersion() );
-
- return key.toString();
- }
-
- private void removeOldProjectModel( ArchivaProjectModel model )
- {
- try
- {
- dao.getProjectModelDAO().deleteProjectModel( model );
- }
- catch ( ArchivaDatabaseException ae )
- {
- log.error( "Unable to delete existing project model." );
- }
-
- // Force removal of project model from effective cache
- String projectKey = toProjectKey( model );
- synchronized ( effectiveProjectCache )
- {
- if ( effectiveProjectCache.hasKey( projectKey ) )
- {
- effectiveProjectCache.remove( projectKey );
- }
- }
- }
-
-}
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/VerifyMetadataAgainstDatabaseConsumer.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/VerifyMetadataAgainstDatabaseConsumer.java
deleted file mode 100644
index 9b255540f..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/VerifyMetadataAgainstDatabaseConsumer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-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.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
-import org.apache.maven.archiva.consumers.ConsumerException;
-import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
-import org.apache.maven.archiva.model.ArchivaArtifact;
-
-import java.util.List;
-
-/**
- * VerifyMetadataAgainstDatabaseConsumer
- *
- * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
- * @version $Id$
- *
- * @plexus.component role="org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer"
- * role-hint="validate-repository-metadata"
- * instantiation-strategy="per-lookup"
- */
-public class VerifyMetadataAgainstDatabaseConsumer
- extends AbstractMonitoredConsumer
- implements DatabaseUnprocessedArtifactConsumer
-{
- /**
- * @plexus.configuration default-value="validate-repository-metadata"
- */
- private String id;
-
- /**
- * @plexus.configuration default-value="Verify repository metadata files against database."
- */
- private String description;
-
- 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
-
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public String getId()
- {
- return id;
- }
-
- public boolean isPermanent()
- {
- return false;
- }
-
-}
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/conf/repository-manager.xml b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/conf/repository-manager.xml
deleted file mode 100644
index 0e4a974ef..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/conf/repository-manager.xml
+++ /dev/null
@@ -1,203 +0,0 @@
-<?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.
- -->
-
-<configuration>
- <version>1</version>
- <repositories>
- <repository>
- <id>internal</id>
- <name>Archiva Managed Internal Repository</name>
- <url>file://${appserver.base}/repositories/internal</url>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <indexed>true</indexed>
- <refreshCronExpression>0 0 * * ?</refreshCronExpression>
- </repository>
- <repository>
- <id>snapshots</id>
- <name>Archiva Managed Snapshot Repository</name>
- <url>file://${appserver.base}/repositories/internal</url>
- <layout>default</layout>
- <releases>false</releases>
- <snapshots>true</snapshots>
- <indexed>true</indexed>
- <refreshCronExpression>0 0,30 * * ?</refreshCronExpression>
- </repository>
- <repository>
- <id>central</id>
- <name>Central Repository</name>
- <url>http://repo1.maven.org/maven2</url>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <indexed>false</indexed>
- </repository>
- <repository>
- <id>maven2-repository.dev.java.net</id>
- <name>Java.net Repository for Maven 2</name>
- <url>https://maven2-repository.dev.java.net/nonav/repository</url>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>false</snapshots>
- <indexed>false</indexed>
- </repository>
- <repository>
- <id>test-repo</id>
- <name>Test Repository</name>
- <url>file://${appserver.base}/repositories/test-repo</url>
- <layout>default</layout>
- <releases>true</releases>
- <snapshots>true</snapshots>
- <indexed>true</indexed>
- <refreshCronExpression>0 0 * * ?</refreshCronExpression>
- <daysOlder>0</daysOlder>
- <retentionCount>2</retentionCount>
- </repository>
- </repositories>
-
- <proxyConnectors>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>central</targetRepoId>
- <proxyId/>
- <snapshotsPolicy>disabled</snapshotsPolicy>
- <releasePolicy>never</releasePolicy>
- <failurePolicy>not-found</failurePolicy>
- </proxyConnector>
- <proxyConnector>
- <sourceRepoId>internal</sourceRepoId>
- <targetRepoId>maven2-repository.dev.java.net</targetRepoId>
- <proxyId/>
- <snapshotsPolicy>disabled</snapshotsPolicy>
- <releasePolicy>never</releasePolicy>
- <failurePolicy>not-found</failurePolicy>
- <whiteListPatterns>
- <whiteListPattern>javax/**</whiteListPattern>
- </whiteListPatterns>
- </proxyConnector>
- </proxyConnectors>
-
- <networkProxies>
- <networkProxy>
- <id>example</id>
- <protocol>http</protocol>
- <host>proxy.mycompany.com</host>
- <port>8080</port>
- <username>myself</username>
- <password>mypass</password>
- </networkProxy>
- </networkProxies>
-
- <repositoryScanning>
- <fileTypes>
- <fileType>
- <id>artifacts</id>
- <patterns>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.jar</pattern>
- <pattern>**/*.ear</pattern>
- <pattern>**/*.war</pattern>
- <pattern>**/*.car</pattern>
- <pattern>**/*.sar</pattern>
- <pattern>**/*.mar</pattern>
- <pattern>**/*.rar</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- <pattern>**/*.tar.gz</pattern>
- <pattern>**/*.tar.bz2</pattern>
- <pattern>**/*.zip</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>indexable-content</id>
- <patterns>
- <pattern>**/*.txt</pattern>
- <pattern>**/*.TXT</pattern>
- <pattern>**/*.block</pattern>
- <pattern>**/*.config</pattern>
- <pattern>**/*.pom</pattern>
- <pattern>**/*.xml</pattern>
- <pattern>**/*.xsd</pattern>
- <pattern>**/*.dtd</pattern>
- <pattern>**/*.tld</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>auto-remove</id>
- <patterns>
- <pattern>**/*.bak</pattern>
- <pattern>**/*~</pattern>
- <pattern>**/*-</pattern>
- </patterns>
- </fileType>
- <fileType>
- <id>ignored</id>
- <patterns>
- <pattern>**/.htaccess</pattern>
- <pattern>**/KEYS</pattern>
- <pattern>**/*.rb</pattern>
- <pattern>**/*.sh</pattern>
- <pattern>**/.svn/**</pattern>
- <pattern>**/.DAV/**</pattern>
- </patterns>
- </fileType>
- </fileTypes>
- <knownContentConsumers>
- <knownContentConsumer>update-db-artifact</knownContentConsumer>
- <knownContentConsumer>create-missing-checksums</knownContentConsumer>
- <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
- <knownContentConsumer>validate-checksum</knownContentConsumer>
- <knownContentConsumer>validate-signature</knownContentConsumer>
- <knownContentConsumer>index-content</knownContentConsumer>
- <knownContentConsumer>auto-remove</knownContentConsumer>
- <knownContentConsumer>auto-rename</knownContentConsumer>
- <knownContentConsumer>repository-purge</knownContentConsumer>
- </knownContentConsumers>
- <invalidContentConsumers>
- <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
- </invalidContentConsumers>
- </repositoryScanning>
-
- <databaseScanning>
- <cronExpression>0 0 * * ?</cronExpression>
- <unprocessedConsumers>
- <unprocessedConsumer>index-artifact</unprocessedConsumer>
- <unprocessedConsumer>update-db-project</unprocessedConsumer>
- <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
- <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
- <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
- <unprocessedConsumer>index-public-methods</unprocessedConsumer>
- </unprocessedConsumers>
- <cleanupConsumers>
- <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
- <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
- <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
- </cleanupConsumers>
- </databaseScanning>
-
- <webapp>
- <ui>
- <showFindArtifacts>true</showFindArtifacts>
- <appletFindEnabled>true</appletFindEnabled>
- </ui>
- </webapp>
-
-</configuration>
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/AbstractDatabaseCleanupTest.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/AbstractDatabaseCleanupTest.java
deleted file mode 100644
index 51f9412bc..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/AbstractDatabaseCleanupTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-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.apache.commons.io.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.model.ArchivaArtifact;
-import org.apache.maven.archiva.model.ArchivaArtifactModel;
-import org.apache.maven.archiva.model.ArchivaProjectModel;
-import org.apache.maven.archiva.repository.RepositoryContentFactory;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
-
-import java.io.File;
-
-/**
- * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
- */
-public abstract class AbstractDatabaseCleanupTest
- extends PlexusInSpringTestCase
-{
- ArchivaConfiguration archivaConfig;
-
- 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 );
-
- 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;
- }
-}
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumerTest.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumerTest.java
deleted file mode 100644
index 19b07ac1e..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumerTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-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.apache.maven.archiva.common.utils.BaseFile;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.FileType;
-import org.apache.maven.archiva.configuration.FileTypes;
-import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
-import org.apache.maven.archiva.repository.scanner.functors.ConsumerWantsFilePredicate;
-import org.codehaus.plexus.spring.PlexusInSpringTestCase;
-
-import java.io.File;
-
-public class ArtifactUpdateDatabaseConsumerTest
- extends PlexusInSpringTestCase
-{
- private File repoLocation;
-
- protected KnownRepositoryContentConsumer consumer;
-
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- ArchivaConfiguration archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.ROLE );
- FileType fileType =
- (FileType) archivaConfiguration.getConfiguration().getRepositoryScanning().getFileTypes().get( 0 );
- assertEquals( FileTypes.ARTIFACTS, fileType.getId() );
- fileType.addPattern( "**/*.xml" );
-
- repoLocation = getTestFile( "target/test-" + getName() + "/test-repo" );
-
- consumer =
- (KnownRepositoryContentConsumer) lookup( KnownRepositoryContentConsumer.class, "update-db-artifact" );
- }
-
- public void testConsumption()
- {
- File localFile =
- new File( repoLocation, "org/apache/maven/plugins/maven-plugin-plugin/2.4.1/maven-metadata.xml" );
-
- ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate();
- BaseFile baseFile = new BaseFile( repoLocation, localFile );
- predicate.setBasefile( baseFile );
-
- assertFalse( predicate.evaluate( consumer ) );
- }
-
- public void testConsumptionOfOtherMetadata()
- {
- File localFile =
- new File( repoLocation, "org/apache/maven/plugins/maven-plugin-plugin/2.4.1/maven-metadata-central.xml" );
-
- ConsumerWantsFilePredicate predicate = new ConsumerWantsFilePredicate();
- BaseFile baseFile = new BaseFile( repoLocation, localFile );
- predicate.setBasefile( baseFile );
-
- assertFalse( predicate.evaluate( consumer ) );
- }
-}
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumerTest.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumerTest.java
deleted file mode 100644
index 3dda2ea61..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumerTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-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;
-import org.apache.maven.archiva.database.RepositoryProblemDAO;
-
-/**
- * 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 MockControl repositoryProblemDAOControl;
-
- private RepositoryProblemDAO repositoryProblemDAOMock;
-
- private DatabaseCleanupRemoveArtifactConsumer dbCleanupRemoveArtifactConsumer;
-
- public void setUp()
- throws Exception
- {
- super.setUp();
-
- dbCleanupRemoveArtifactConsumer = new DatabaseCleanupRemoveArtifactConsumer();
-
- artifactDAOControl = MockControl.createControl( ArtifactDAO.class );
-
- artifactDAOMock = (ArtifactDAO) artifactDAOControl.getMock();
-
- repositoryProblemDAOControl = MockControl.createControl( RepositoryProblemDAO.class );
-
- repositoryProblemDAOMock = (RepositoryProblemDAO) repositoryProblemDAOControl.getMock();
-
- dbCleanupRemoveArtifactConsumer.setArtifactDAO( artifactDAOMock );
-
- dbCleanupRemoveArtifactConsumer.setRepositoryProblemDAO( repositoryProblemDAOMock );
-
- dbCleanupRemoveArtifactConsumer.setRepositoryFactory( repositoryFactory );
- }
-
- public void testIfArtifactWasNotDeleted()
- throws Exception
- {
- ArchivaArtifact artifact = createArtifact( TEST_GROUP_ID, "do-not-cleanup-artifact-test", TEST_VERSION, "jar" );
-
- artifactDAOControl.replay();
-
- repositoryProblemDAOControl.replay();
-
- dbCleanupRemoveArtifactConsumer.processArchivaArtifact( artifact );
-
- artifactDAOControl.verify();
-
- repositoryProblemDAOControl.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();
- }
-
-}
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumerTest.java b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumerTest.java
deleted file mode 100644
index 8c5846224..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumerTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-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.cache.Cache;
-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;
-
- private Cache effectiveProjectCache;
-
- public void setUp()
- throws Exception
- {
- super.setUp();
-
- dbCleanupRemoveProjectConsumer = new DatabaseCleanupRemoveProjectConsumer();
-
- projectModelDAOControl = MockControl.createControl( ProjectModelDAO.class );
-
- projectModelDAOMock = (ProjectModelDAO) projectModelDAOControl.getMock();
-
- effectiveProjectCache = (Cache) lookup( Cache.class, "effective-project-cache" );
-
- dbCleanupRemoveProjectConsumer.setProjectModelDAO( projectModelDAOMock );
-
- dbCleanupRemoveProjectConsumer.setRepositoryFactory( repositoryFactory );
-
- dbCleanupRemoveProjectConsumer.setEffectiveProjectCache( effectiveProjectCache );
- }
-
- 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();
- }
-
-}
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumerTest.xml b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumerTest.xml
deleted file mode 100644
index 801d957b8..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/ArtifactUpdateDatabaseConsumerTest.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?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>
- <!-- JdoAccess -->
- <component>
- <role>org.apache.maven.archiva.database.jdo.JdoAccess</role>
- <role-hint>archiva</role-hint>
- <implementation>org.apache.maven.archiva.database.jdo.JdoAccess</implementation>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.jdo.JdoFactory</role>
- <role-hint>archiva</role-hint>
- </requirement>
- </requirements>
- </component>
-
- <!-- JDO Factory -->
- <component>
- <role>org.codehaus.plexus.jdo.JdoFactory</role>
- <role-hint>archiva</role-hint>
- <implementation>org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory</implementation>
- <configuration>
- <persistenceManagerFactoryClass>org.jpox.PersistenceManagerFactoryImpl</persistenceManagerFactoryClass>
- <driverName>org.hsqldb.jdbcDriver</driverName>
- <userName>sa</userName>
- <password></password>
- <url>jdbc:hsqldb:mem:testdb</url>
- <otherProperties>
- <property>
- <name>javax.jdo.PersistenceManagerFactoryClass</name>
- <value>org.jpox.PersistenceManagerFactoryImpl</value>
- </property>
- </otherProperties>
- </configuration>
- </component>
- </components>
-</component-set>
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumerTest.xml b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumerTest.xml
deleted file mode 100644
index 2c0dd53e1..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveArtifactConsumerTest.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?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>
- <requirement>
- <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role>
- <field-name>prePolicies</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role>
- <field-name>postPolicies</field-name>
- </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.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>
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumerTest.xml b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumerTest.xml
deleted file mode 100644
index c34c60962..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/DatabaseCleanupRemoveProjectConsumerTest.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?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>
- <requirement>
- <role>org.apache.maven.archiva.policies.PreDownloadPolicy</role>
- <field-name>prePolicies</field-name>
- </requirement>
- <requirement>
- <role>org.apache.maven.archiva.policies.PostDownloadPolicy</role>
- <field-name>postPolicies</field-name>
- </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.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>
- <role>org.codehaus.plexus.cache.Cache</role>
- <role-hint>effective-project-cache</role-hint>
- <implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation>
- <description>Effective Project Cache</description>
- <configuration>
- <disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds>
- <disk-persistent>true</disk-persistent>
- <disk-store-path>${java.io.tmpdir}/archiva/effectiveproject</disk-store-path>
- <eternal>true</eternal>
- <max-elements-in-memory>1000</max-elements-in-memory>
- <memory-eviction-policy>LRU</memory-eviction-policy>
- <name>effective-project-cache</name>
- <overflow-to-disk>false</overflow-to-disk>
- <!-- TODO: Adjust the time to live to be more sane (ie: huge 4+ hours) -->
- <!-- 45 minutes = 2700 seconds -->
- <time-to-idle-seconds>2700</time-to-idle-seconds>
- <!-- 30 minutes = 1800 seconds -->
- <time-to-live-seconds>1800</time-to-live-seconds>
- </configuration>
- </component>
-</component-set>
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/org/apache/maven/archiva/do-not-cleanup-artifact-test/1.0/do-not-cleanup-artifact-test-1.0.jar b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/org/apache/maven/archiva/do-not-cleanup-artifact-test/1.0/do-not-cleanup-artifact-test-1.0.jar
deleted file mode 100644
index 4201a06cb..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/org/apache/maven/archiva/do-not-cleanup-artifact-test/1.0/do-not-cleanup-artifact-test-1.0.jar
+++ /dev/null
Binary files differ
diff --git a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/org/apache/maven/archiva/do-not-cleanup-artifact-test/1.0/do-not-cleanup-artifact-test-1.0.pom b/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/org/apache/maven/archiva/do-not-cleanup-artifact-test/1.0/do-not-cleanup-artifact-test-1.0.pom
deleted file mode 100644
index 94b5b2e98..000000000
--- a/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/org/apache/maven/archiva/do-not-cleanup-artifact-test/1.0/do-not-cleanup-artifact-test-1.0.pom
+++ /dev/null
@@ -1,5 +0,0 @@
-<project>
- <groupId>org.apache.maven.archiva</groupId>
- <artifactId>do-not-cleanup-artifact-test</artifactId>
- <version>1.0</version>
-</project> \ No newline at end of file