diff options
author | Brett Porter <brett@apache.org> | 2009-12-07 22:32:10 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2009-12-07 22:32:10 +0000 |
commit | 7c7fffc71c4c2546c8e5aacb933bea9fd1c8ffa7 (patch) | |
tree | 2ea76540d2481df4db7e42d1f3f19cb076d1213b /archiva-modules/archiva-base/archiva-proxy/src | |
parent | 8afc66c9d202f12d1cfef8d80db88f3963928e3b (diff) | |
download | archiva-7c7fffc71c4c2546c8e5aacb933bea9fd1c8ffa7.tar.gz archiva-7c7fffc71c4c2546c8e5aacb933bea9fd1c8ffa7.zip |
[MRM-1293] introduce repository statistics as a new plugin that operates over the metadata repository. Currently a work in progress - repository size statistics are not stored, and only the scanner and scheduler have been hooked in (meaning reports will be out of date)
git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/MRM-1025@888164 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base/archiva-proxy/src')
12 files changed, 150 insertions, 106 deletions
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java index 1306eb76e..4b51cb0a2 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java @@ -30,7 +30,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Properties; -import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler; +import org.apache.archiva.scheduler.ArchivaTaskScheduler; import org.apache.archiva.scheduler.repository.RepositoryTask; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.io.FileUtils; @@ -134,7 +134,7 @@ public class DefaultRepositoryProxyConnectors /** * @plexus.requirement role="org.apache.archiva.scheduler.ArchivaTaskScheduler" role-hint="repository" */ - private RepositoryArchivaTaskScheduler scheduler; + private ArchivaTaskScheduler scheduler; public File fetchFromProxies( ManagedRepositoryContent repository, ArtifactReference artifact ) throws ProxyDownloadException diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java new file mode 100644 index 000000000..30ba168df --- /dev/null +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java @@ -0,0 +1,121 @@ +package org.apache.archiva.metadata.repository; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.apache.archiva.metadata.model.ArtifactMetadata; +import org.apache.archiva.metadata.model.MetadataFacet; +import org.apache.archiva.metadata.model.ProjectMetadata; +import org.apache.archiva.metadata.model.ProjectVersionMetadata; +import org.apache.archiva.metadata.model.ProjectVersionReference; + +public class TestMetadataRepository + implements MetadataRepository +{ + public ProjectMetadata getProject( String repoId, String namespace, String projectId ) + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId, + String projectVersion ) + throws MetadataResolverException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId, + String projectVersion ) + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId, + String projectVersion ) + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Collection<String> getRootNamespaces( String repoId ) + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Collection<String> getNamespaces( String repoId, String namespace ) + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Collection<String> getProjects( String repoId, String namespace ) + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public Collection<String> getProjectVersions( String repoId, String namespace, String projectId ) + throws MetadataResolverException + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void updateProject( String repoId, ProjectMetadata project ) + { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion, + ArtifactMetadata artifactMeta ) + { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void updateProjectVersion( String repoId, String namespace, String projectId, ProjectVersionMetadata versionMetadata ) + { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void updateProjectReference( String repoId, String namespace, String projectId, String projectVersion, + ProjectVersionReference reference ) + { + //To change body of implemented methods use File | Settings | File Templates. + } + + public void updateNamespace( String repoId, String namespace ) + { + //To change body of implemented methods use File | Settings | File Templates. + } + + public List<String> getMetadataFacets( String repodId, String facetId ) + { + return Collections.emptyList(); + } + + public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name ) + { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + public void addMetadataFacet( String repositoryId, String facetId, String name, MetadataFacet metadataFacet ) + { + //To change body of implemented methods use File | Settings | File Templates. + } +} diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/stubs/ArchivaDAOStub.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/stubs/ArchivaDAOStub.java deleted file mode 100644 index cd220ae55..000000000 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/maven/archiva/proxy/stubs/ArchivaDAOStub.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.apache.maven.archiva.proxy.stubs; - -/* - * 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.Serializable; -import java.util.List; - -import org.apache.maven.archiva.database.ArchivaDAO; -import org.apache.maven.archiva.database.ArtifactDAO; -import org.apache.maven.archiva.database.RepositoryContentStatisticsDAO; -import org.apache.maven.archiva.database.RepositoryProblemDAO; -import org.apache.maven.archiva.database.SimpleConstraint; - -/** - * Using a stub for faster tests! Not really used for the unit tests, just for dependency injection. - */ -public class ArchivaDAOStub - implements ArchivaDAO -{ - - public ArtifactDAO getArtifactDAO() - { - // TODO Auto-generated method stub - return null; - } - - public RepositoryContentStatisticsDAO getRepositoryContentStatisticsDAO() - { - // TODO Auto-generated method stub - return null; - } - - public RepositoryProblemDAO getRepositoryProblemDAO() - { - // TODO Auto-generated method stub - return null; - } - - public List<?> query( SimpleConstraint constraint ) - { - // TODO Auto-generated method stub - return null; - } - - public Object save( Serializable obj ) - { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml index 80bc628da..f48ef572f 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/CacheFailuresTransferTest.xml @@ -105,11 +105,10 @@ <time-to-live-seconds>1800</time-to-live-seconds> </configuration> </component> - + <component> - <role>org.apache.maven.archiva.database.ArchivaDAO</role> - <role-hint>jdo</role-hint> - <implementation>org.apache.maven.archiva.proxy.stubs.ArchivaDAOStub</implementation> + <role>org.apache.archiva.metadata.repository.MetadataRepository</role> + <implementation>org.apache.archiva.metadata.repository.TestMetadataRepository</implementation> </component> </components> </component-set> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ChecksumTransferTest.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ChecksumTransferTest.xml index d5d032574..d6e12306b 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ChecksumTransferTest.xml +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ChecksumTransferTest.xml @@ -103,11 +103,10 @@ <time-to-live-seconds>1800</time-to-live-seconds> </configuration> </component> - + <component> - <role>org.apache.maven.archiva.database.ArchivaDAO</role> - <role-hint>jdo</role-hint> - <implementation>org.apache.maven.archiva.proxy.stubs.ArchivaDAOStub</implementation> + <role>org.apache.archiva.metadata.repository.MetadataRepository</role> + <implementation>org.apache.archiva.metadata.repository.TestMetadataRepository</implementation> </component> </components> </component-set> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ErrorHandlingTest.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ErrorHandlingTest.xml index 884b9778f..fdd2414d5 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ErrorHandlingTest.xml +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ErrorHandlingTest.xml @@ -108,11 +108,10 @@ <time-to-live-seconds>1800</time-to-live-seconds> </configuration> </component> - + <component> - <role>org.apache.maven.archiva.database.ArchivaDAO</role> - <role-hint>jdo</role-hint> - <implementation>org.apache.maven.archiva.proxy.stubs.ArchivaDAOStub</implementation> + <role>org.apache.archiva.metadata.repository.MetadataRepository</role> + <implementation>org.apache.archiva.metadata.repository.TestMetadataRepository</implementation> </component> </components> </component-set> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/HttpProxyTransferTest.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/HttpProxyTransferTest.xml index 620cc84d0..6913522ed 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/HttpProxyTransferTest.xml +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/HttpProxyTransferTest.xml @@ -99,11 +99,10 @@ <time-to-live-seconds>1800</time-to-live-seconds> </configuration> </component> - + <component> - <role>org.apache.maven.archiva.database.ArchivaDAO</role> - <role-hint>jdo</role-hint> - <implementation>org.apache.maven.archiva.proxy.stubs.ArchivaDAOStub</implementation> + <role>org.apache.archiva.metadata.repository.MetadataRepository</role> + <implementation>org.apache.archiva.metadata.repository.TestMetadataRepository</implementation> </component> </components> </component-set> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.xml index d5d032574..d6e12306b 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.xml +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedDefaultTransferTest.xml @@ -103,11 +103,10 @@ <time-to-live-seconds>1800</time-to-live-seconds> </configuration> </component> - + <component> - <role>org.apache.maven.archiva.database.ArchivaDAO</role> - <role-hint>jdo</role-hint> - <implementation>org.apache.maven.archiva.proxy.stubs.ArchivaDAOStub</implementation> + <role>org.apache.archiva.metadata.repository.MetadataRepository</role> + <implementation>org.apache.archiva.metadata.repository.TestMetadataRepository</implementation> </component> </components> </component-set> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.xml index d5d032574..d6e12306b 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.xml +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/ManagedLegacyTransferTest.xml @@ -103,11 +103,10 @@ <time-to-live-seconds>1800</time-to-live-seconds> </configuration> </component> - + <component> - <role>org.apache.maven.archiva.database.ArchivaDAO</role> - <role-hint>jdo</role-hint> - <implementation>org.apache.maven.archiva.proxy.stubs.ArchivaDAOStub</implementation> + <role>org.apache.archiva.metadata.repository.MetadataRepository</role> + <implementation>org.apache.archiva.metadata.repository.TestMetadataRepository</implementation> </component> </components> </component-set> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/MetadataTransferTest.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/MetadataTransferTest.xml index 2b14dd8fb..97423198d 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/MetadataTransferTest.xml +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/MetadataTransferTest.xml @@ -122,11 +122,10 @@ <time-to-live-seconds>1800</time-to-live-seconds> </configuration> </component> - + <component> - <role>org.apache.maven.archiva.database.ArchivaDAO</role> - <role-hint>jdo</role-hint> - <implementation>org.apache.maven.archiva.proxy.stubs.ArchivaDAOStub</implementation> + <role>org.apache.archiva.metadata.repository.MetadataRepository</role> + <implementation>org.apache.archiva.metadata.repository.TestMetadataRepository</implementation> </component> </components> </component-set> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/RelocateTransferTest.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/RelocateTransferTest.xml index d5d032574..d6e12306b 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/RelocateTransferTest.xml +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/RelocateTransferTest.xml @@ -103,11 +103,10 @@ <time-to-live-seconds>1800</time-to-live-seconds> </configuration> </component> - + <component> - <role>org.apache.maven.archiva.database.ArchivaDAO</role> - <role-hint>jdo</role-hint> - <implementation>org.apache.maven.archiva.proxy.stubs.ArchivaDAOStub</implementation> + <role>org.apache.archiva.metadata.repository.MetadataRepository</role> + <implementation>org.apache.archiva.metadata.repository.TestMetadataRepository</implementation> </component> </components> </component-set> diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/SnapshotTransferTest.xml b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/SnapshotTransferTest.xml index d5d032574..d6e12306b 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/SnapshotTransferTest.xml +++ b/archiva-modules/archiva-base/archiva-proxy/src/test/resources/org/apache/maven/archiva/proxy/SnapshotTransferTest.xml @@ -103,11 +103,10 @@ <time-to-live-seconds>1800</time-to-live-seconds> </configuration> </component> - + <component> - <role>org.apache.maven.archiva.database.ArchivaDAO</role> - <role-hint>jdo</role-hint> - <implementation>org.apache.maven.archiva.proxy.stubs.ArchivaDAOStub</implementation> + <role>org.apache.archiva.metadata.repository.MetadataRepository</role> + <implementation>org.apache.archiva.metadata.repository.TestMetadataRepository</implementation> </component> </components> </component-set> |