]> source.dussan.org Git - archiva.git/commitdiff
Add a AbstractMetadataRepository to remove duplicated code 9/head
authorCarlos Sanchez <csanchez@maestrodev.com>
Thu, 6 Nov 2014 08:58:02 +0000 (09:58 +0100)
committerCarlos Sanchez <csanchez@maestrodev.com>
Thu, 6 Nov 2014 12:39:28 +0000 (13:39 +0100)
14 files changed:
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java [deleted file]
archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java
archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java [deleted file]
archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java
archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java
archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java [deleted file]
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/AbstractMetadataRepository.java [new file with mode: 0644]
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java [deleted file]
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java

diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
deleted file mode 100644 (file)
index 3b2898d..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
-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 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;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-public class TestMetadataRepository
-    implements MetadataRepository
-{
-    @Override
-    public ProjectMetadata getProject( String repoId, String namespace, String projectId )
-    {
-        return null;
-    }
-
-    @Override
-    public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
-                                                     String projectVersion )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
-                                                   String projectVersion )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
-                                                                     String projectVersion )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getRootNamespaces( String repoId )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getNamespaces( String repoId, String namespace )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getProjects( String repoId, String namespace )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
-    {
-        return null;
-    }
-
-    @Override
-    public void updateProject( String repoId, ProjectMetadata project )
-    {
-    }
-
-    @Override
-    public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
-                                ArtifactMetadata artifactMeta )
-    {
-
-    }
-
-    @Override
-    public void updateProjectVersion( String repoId, String namespace, String projectId,
-                                      ProjectVersionMetadata versionMetadata )
-    {
-
-    }
-
-    @Override
-    public void updateNamespace( String repoId, String namespace )
-    {
-
-    }
-
-    @Override
-    public List<String> getMetadataFacets( String repodId, String facetId )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
-    {
-        return null;
-    }
-
-    @Override
-    public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
-    {
-
-    }
-
-    @Override
-    public void removeMetadataFacets( String repositoryId, String facetId )
-    {
-
-    }
-
-    @Override
-    public void removeMetadataFacet( String repoId, String facetId, String name )
-    {
-
-    }
-
-    @Override
-    public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getRepositories()
-    {
-        return null;
-    }
-
-    @Override
-    public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
-    {
-        return null;
-    }
-
-    @Override
-    public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
-    {
-
-    }
-
-    @Override
-    public void removeRepository( String repoId )
-    {
-
-    }
-
-    @Override
-    public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
-                                                      String projectVersion )
-    {
-        return null;
-    }
-
-    @Override
-    public void save()
-    {
-
-    }
-
-    @Override
-    public void close()
-    {
-
-    }
-
-    @Override
-    public void revert()
-    {
-
-    }
-
-    @Override
-    public boolean canObtainAccess( Class<?> aClass )
-    {
-        return false;
-    }
-
-    @Override
-    public <T>T obtainAccess( Class<T> aClass )
-    {
-        return null;
-    }
-
-    @Override
-    public List<ArtifactMetadata> getArtifacts( String repositoryId )
-    {
-        return null;
-    }
-
-    @Override
-    public void removeArtifact( String repositoryId, String namespace, String project, String version,
-                                MetadataFacet metadataFacet )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void removeNamespace( String repositoryId, String namespace )
-        throws MetadataRepositoryException
-    {
-
-    }
-
-    @Override
-    public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
-        throws MetadataRepositoryException
-    {
-
-    }
-
-    @Override
-    public void removeProject( String repositoryId, String namespace, String projectId )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean hasMetadataFacet( String repositoryId, String facetId )
-        throws MetadataRepositoryException
-    {
-        return false;
-    }
-
-}
index 11bfe4037be7426c61fecd943def1dc6dc5369a1..95abe0fa218c4c6a6bcd44d8d2a68d830ca7b313 100644 (file)
@@ -24,14 +24,14 @@ import org.springframework.stereotype.Service;
 public class TestRepositorySessionFactory
     implements RepositorySessionFactory
 {
-    private MetadataRepository repository;
+    private MetadataRepository repository = new AbstractMetadataRepository() {};
 
     private MetadataResolver resolver;
 
     @Override
     public RepositorySession createSession()
     {
-        return new RepositorySession( new TestMetadataRepository(), resolver )
+        return new RepositorySession( repository, resolver )
         {
             @Override
             public void close()
index 6b43a3a10651a4ede151e46f0b6f4fe64d0b2994..c8162967f5eabe656f0eca2fc7385ab79baf3f19 100644 (file)
@@ -18,23 +18,12 @@ package org.apache.archiva.indexer.search.mock;
  * under the License.
  */
 
-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;
+import org.apache.archiva.metadata.repository.AbstractMetadataRepository;
 import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.MetadataRepositoryException;
-import org.apache.archiva.metadata.repository.MetadataResolutionException;
 import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.metadata.repository.RepositorySessionFactory;
 import org.springframework.stereotype.Service;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
 /**
  * @author Olivier Lamy
  */
@@ -62,261 +51,7 @@ public class MockRepositorySessionFactory
             @Override
             public MetadataRepository getRepository()
             {
-                return new MetadataRepository()
-                {
-
-                    @Override
-                    public boolean hasMetadataFacet( String repositoryId, String facetId )
-                        throws MetadataRepositoryException
-                    {
-                        return false;
-                    }
-
-                    @Override
-                    public void removeArtifact( String repositoryId, String namespace, String project,
-                                                String projectVersion, MetadataFacet metadataFacet )
-                        throws MetadataRepositoryException
-                    {
-
-                    }
-
-                    @Override
-                    public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
-                        throws MetadataRepositoryException
-                    {
-                        throw new UnsupportedOperationException();
-                    }
-
-                    @Override
-                    public void updateProject( String repositoryId, ProjectMetadata project )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void updateArtifact( String repositoryId, String namespace, String projectId,
-                                                String projectVersion, ArtifactMetadata artifactMeta )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void updateProjectVersion( String repositoryId, String namespace, String projectId,
-                                                      ProjectVersionMetadata versionMetadata )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void updateNamespace( String repositoryId, String namespace )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public List<String> getMetadataFacets( String repositoryId, String facetId )
-                        throws MetadataRepositoryException
-                    {
-                        return Collections.emptyList();
-                    }
-
-                    @Override
-                    public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeMetadataFacets( String repositoryId, String facetId )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeMetadataFacet( String repositoryId, String facetId, String name )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime,
-                                                                           Date endTime )
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getRepositories()
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeArtifact( String repositoryId, String namespace, String project, String version,
-                                                String id )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeRepository( String repositoryId )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public List<ArtifactMetadata> getArtifacts( String repositoryId )
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public ProjectMetadata getProject( String repoId, String namespace, String projectId )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
-                                                                     String projectVersion )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
-                                                                   String projectVersion )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace,
-                                                                                     String projectId,
-                                                                                     String projectVersion )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getRootNamespaces( String repoId )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getNamespaces( String repoId, String namespace )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getProjects( String repoId, String namespace )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
-                                                                      String projectVersion )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void save()
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void close()
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void revert()
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public boolean canObtainAccess( Class<?> aClass )
-                    {
-                        return false;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public <T>T obtainAccess( Class<T> aClass )
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeNamespace( String repositoryId, String namespace )
-                        throws MetadataRepositoryException
-                    {
-
-                    }
-
-                    @Override
-                    public void removeProjectVersion( String repoId, String namespace, String projectId,
-                                                      String projectVersion )
-                        throws MetadataRepositoryException
-                    {
-
-                    }
-
-                    @Override
-                    public void removeProject( String repositoryId, String namespace, String projectId )
-                        throws MetadataRepositoryException
-                    {
-                        throw new UnsupportedOperationException();
-                    }
-
-                };
+                return new AbstractMetadataRepository() {};
             }
         };
     }
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
deleted file mode 100644 (file)
index 1e57522..0000000
+++ /dev/null
@@ -1,262 +0,0 @@
-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 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;
-import org.springframework.stereotype.Service;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-// TODO: remove, it does nothing
-
-@Service
-public class TestMetadataRepository
-    implements MetadataRepository
-{
-    @Override
-    public ProjectMetadata getProject( String repoId, String namespace, String projectId )
-    {
-        return null;
-    }
-
-    @Override
-    public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
-                                                     String projectVersion )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
-                                                   String projectVersion )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
-                                                                     String projectVersion )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public Collection<String> getRootNamespaces( String repoId )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public Collection<String> getNamespaces( String repoId, String namespace )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public Collection<String> getProjects( String repoId, String namespace )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void updateProject( String repoId, ProjectMetadata project )
-    {
-        // no op
-    }
-
-    @Override
-    public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
-                                ArtifactMetadata artifactMeta )
-    {
-        // no op
-    }
-
-    @Override
-    public void updateProjectVersion( String repoId, String namespace, String projectId,
-                                      ProjectVersionMetadata versionMetadata )
-    {
-        // no op
-    }
-
-    @Override
-    public void updateNamespace( String repoId, String namespace )
-    {
-        // no op
-    }
-
-    @Override
-    public List<String> getMetadataFacets( String repodId, String facetId )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
-    {
-        return null;
-    }
-
-    @Override
-    public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
-    {
-        // no op
-    }
-
-    @Override
-    public void removeMetadataFacets( String repositoryId, String facetId )
-    {
-        // no op
-    }
-
-    @Override
-    public void removeMetadataFacet( String repoId, String facetId, String name )
-    {
-        // no op
-    }
-
-    @Override
-    public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public Collection<String> getRepositories()
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
-    {
-        // no op
-    }
-
-    @Override
-    public void removeRepository( String repoId )
-    {
-        // no op
-    }
-
-    @Override
-    public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
-                                                      String projectVersion )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void save()
-    {
-        // no op
-    }
-
-    @Override
-    public void close()
-    {
-        // no op
-    }
-
-    @Override
-    public void revert()
-    {
-        // no op
-    }
-
-    @Override
-    public boolean canObtainAccess( Class<?> aClass )
-    {
-        return false;
-    }
-
-    @Override
-    public <T>T obtainAccess( Class<T> aClass )
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public List<ArtifactMetadata> getArtifacts( String repositoryId )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public void removeArtifact( String repositoryId, String namespace, String project, String version,
-                                MetadataFacet metadataFacet )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void removeNamespace( String repositoryId, String namespace )
-        throws MetadataRepositoryException
-    {
-
-    }
-
-    @Override
-    public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
-        throws MetadataRepositoryException
-    {
-
-    }
-
-    @Override
-    public void removeProject( String repositoryId, String namespace, String projectId )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean hasMetadataFacet( String repositoryId, String facetId )
-        throws MetadataRepositoryException
-    {
-        return false;
-    }
-}
index 61aeeb3844f5144f2645ece163e2414c22840f2b..5d2e8209584f12fba2f4b63cdefee17e6ad4f85a 100644 (file)
@@ -31,7 +31,7 @@ public class TestRepositorySessionFactory
     @Override
     public RepositorySession createSession()
     {
-        return new RepositorySession( new TestMetadataRepository(), resolver );
+        return new RepositorySession( new AbstractMetadataRepository() {}, resolver );
     }
 
     public void setResolver( MetadataResolver resolver )
index 69ffc47e96ad5fa412696c34865fa6f5c22f466d..d26a70443dc6f05e71fe8b304a74c4afa329e6f2 100644 (file)
@@ -18,23 +18,12 @@ package org.apache.archiva.admin.mock;
  * under the License.
  */
 
-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;
+import org.apache.archiva.metadata.repository.AbstractMetadataRepository;
 import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.MetadataRepositoryException;
-import org.apache.archiva.metadata.repository.MetadataResolutionException;
 import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.metadata.repository.RepositorySessionFactory;
 import org.springframework.stereotype.Service;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
 /**
  * @author Olivier Lamy
  */
@@ -62,261 +51,7 @@ public class MockRepositorySessionFactory
             @Override
             public MetadataRepository getRepository()
             {
-                return new MetadataRepository()
-                {
-
-                    @Override
-                    public boolean hasMetadataFacet( String repositoryId, String facetId )
-                        throws MetadataRepositoryException
-                    {
-                        return false;
-                    }
-
-                    @Override
-                    public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
-                        throws MetadataRepositoryException
-                    {
-                        throw new UnsupportedOperationException();
-                    }
-
-                    @Override
-                    public void removeArtifact( String repositoryId, String namespace, String project,
-                                                String projectVersion, MetadataFacet metadataFacet )
-                        throws MetadataRepositoryException
-                    {
-                        throw new UnsupportedOperationException();
-                    }
-
-                    @Override
-                    public void updateProject( String repositoryId, ProjectMetadata project )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void updateArtifact( String repositoryId, String namespace, String projectId,
-                                                String projectVersion, ArtifactMetadata artifactMeta )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void updateProjectVersion( String repositoryId, String namespace, String projectId,
-                                                      ProjectVersionMetadata versionMetadata )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void updateNamespace( String repositoryId, String namespace )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public List<String> getMetadataFacets( String repositoryId, String facetId )
-                        throws MetadataRepositoryException
-                    {
-                        return Collections.emptyList();
-                    }
-
-                    @Override
-                    public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeMetadataFacets( String repositoryId, String facetId )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeMetadataFacet( String repositoryId, String facetId, String name )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime,
-                                                                           Date endTime )
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getRepositories()
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeArtifact( String repositoryId, String namespace, String project, String version,
-                                                String id )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeRepository( String repositoryId )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public List<ArtifactMetadata> getArtifacts( String repositoryId )
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public ProjectMetadata getProject( String repoId, String namespace, String projectId )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
-                                                                     String projectVersion )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
-                                                                   String projectVersion )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace,
-                                                                                     String projectId,
-                                                                                     String projectVersion )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getRootNamespaces( String repoId )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getNamespaces( String repoId, String namespace )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getProjects( String repoId, String namespace )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
-                                                                      String projectVersion )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void save()
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void close()
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void revert()
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public boolean canObtainAccess( Class<?> aClass )
-                    {
-                        return false;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public <T>T obtainAccess( Class<T> aClass )
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeNamespace( String repositoryId, String namespace )
-                        throws MetadataRepositoryException
-                    {
-
-                    }
-
-                    @Override
-                    public void removeProjectVersion( String repoId, String namespace, String projectId,
-                                                      String projectVersion )
-                        throws MetadataRepositoryException
-                    {
-
-                    }
-
-                    @Override
-                    public void removeProject( String repositoryId, String namespace, String projectId )
-                        throws MetadataRepositoryException
-                    {
-                        throw new UnsupportedOperationException();
-                    }
-
-                };
+                return new AbstractMetadataRepository() {};
             }
         };
     }
index 6eedbc464b82e505cdf709bd37d8ab9695a92506..693853a53c18f046b3d906540a6ff48af223c2fe 100644 (file)
@@ -18,23 +18,12 @@ package org.apache.archiva.scheduler.indexing.mock;
  * under the License.
  */
 
-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;
+import org.apache.archiva.metadata.repository.AbstractMetadataRepository;
 import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.MetadataRepositoryException;
-import org.apache.archiva.metadata.repository.MetadataResolutionException;
 import org.apache.archiva.metadata.repository.RepositorySession;
 import org.apache.archiva.metadata.repository.RepositorySessionFactory;
 import org.springframework.stereotype.Service;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
 /**
  * @author Olivier Lamy
  */
@@ -62,261 +51,7 @@ public class MockRepositorySessionFactory
             @Override
             public MetadataRepository getRepository()
             {
-                return new MetadataRepository()
-                {
-
-                    @Override
-                    public boolean hasMetadataFacet( String repositoryId, String facetId )
-                        throws MetadataRepositoryException
-                    {
-                        return false;
-                    }
-
-                    @Override
-                    public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
-                        throws MetadataRepositoryException
-                    {
-                        throw new UnsupportedOperationException();
-                    }
-
-                    @Override
-                    public void removeArtifact( String repositoryId, String namespace, String project,
-                                                String projectVersion, MetadataFacet metadataFacet )
-                        throws MetadataRepositoryException
-                    {
-                        throw new UnsupportedOperationException();
-                    }
-
-                    @Override
-                    public void updateProject( String repositoryId, ProjectMetadata project )
-                        throws MetadataRepositoryException
-                    {
-
-                    }
-
-                    @Override
-                    public void updateArtifact( String repositoryId, String namespace, String projectId,
-                                                String projectVersion, ArtifactMetadata artifactMeta )
-                        throws MetadataRepositoryException
-                    {
-
-                    }
-
-                    @Override
-                    public void updateProjectVersion( String repositoryId, String namespace, String projectId,
-                                                      ProjectVersionMetadata versionMetadata )
-                        throws MetadataRepositoryException
-                    {
-
-                    }
-
-                    @Override
-                    public void updateNamespace( String repositoryId, String namespace )
-                        throws MetadataRepositoryException
-                    {
-
-                    }
-
-                    @Override
-                    public List<String> getMetadataFacets( String repositoryId, String facetId )
-                        throws MetadataRepositoryException
-                    {
-                        return Collections.emptyList();
-                    }
-
-                    @Override
-                    public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
-                        throws MetadataRepositoryException
-                    {
-
-                    }
-
-                    @Override
-                    public void removeMetadataFacets( String repositoryId, String facetId )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeMetadataFacet( String repositoryId, String facetId, String name )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime,
-                                                                           Date endTime )
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getRepositories()
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public List<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeArtifact( String repositoryId, String namespace, String project, String version,
-                                                String id )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeRepository( String repositoryId )
-                        throws MetadataRepositoryException
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public List<ArtifactMetadata> getArtifacts( String repositoryId )
-                        throws MetadataRepositoryException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public ProjectMetadata getProject( String repoId, String namespace, String projectId )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
-                                                                     String projectVersion )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
-                                                                   String projectVersion )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace,
-                                                                                     String projectId,
-                                                                                     String projectVersion )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getRootNamespaces( String repoId )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getNamespaces( String repoId, String namespace )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getProjects( String repoId, String namespace )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
-                                                                      String projectVersion )
-                        throws MetadataResolutionException
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void save()
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void close()
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void revert()
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public boolean canObtainAccess( Class<?> aClass )
-                    {
-                        return false;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public <T>T obtainAccess( Class<T> aClass )
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    @Override
-                    public void removeNamespace( String repositoryId, String namespace )
-                        throws MetadataRepositoryException
-                    {
-
-                    }
-
-                    @Override
-                    public void removeProjectVersion( String repoId, String namespace, String projectId,
-                                                      String projectVersion )
-                        throws MetadataRepositoryException
-                    {
-
-                    }
-
-                    @Override
-                    public void removeProject( String repositoryId, String namespace, String projectId )
-                        throws MetadataRepositoryException
-                    {
-                        throw new UnsupportedOperationException();
-                    }
-
-                };
+                return new AbstractMetadataRepository() {};
             }
         };
     }
index dee82c93e54a92f52627c44dac09c2b99a54959f..4c34c66e6e12ea353d1bffbebb6139864106ac94 100644 (file)
@@ -19,31 +19,26 @@ package org.apache.archiva.rss.processor;
  * under the License.
  */
 
-import com.sun.syndication.feed.synd.SyndEntry;
-import com.sun.syndication.feed.synd.SyndFeed;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+
 import junit.framework.TestCase;
+
 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;
-import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.MetadataRepositoryException;
-import org.apache.archiva.metadata.repository.MetadataResolutionException;
+import org.apache.archiva.metadata.repository.AbstractMetadataRepository;
 import org.apache.archiva.rss.RssFeedGenerator;
 import org.apache.archiva.test.utils.ArchivaBlockJUnit4ClassRunner;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TimeZone;
+import com.sun.syndication.feed.synd.SyndEntry;
+import com.sun.syndication.feed.synd.SyndFeed;
 
 @RunWith (ArchivaBlockJUnit4ClassRunner.class)
 public class NewArtifactsRssFeedProcessorTest
@@ -127,7 +122,7 @@ public class NewArtifactsRssFeedProcessorTest
 
     // TODO: replace with mockito
     private class MetadataRepositoryMock
-        implements MetadataRepository
+        extends AbstractMetadataRepository
     {
         private Date from, to;
 
@@ -144,191 +139,6 @@ public class NewArtifactsRssFeedProcessorTest
             return artifactsByDateRange;
         }
 
-        @Override
-        public void removeArtifact( String repositoryId, String namespace, String project, String version,
-                                    MetadataFacet metadataFacet )
-            throws MetadataRepositoryException
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void addMetadataFacet( String arg0, MetadataFacet arg1 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void removeArtifact( String arg0, String arg1, String arg2, String arg3, String arg4 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void removeRepository( String arg0 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public List<ArtifactMetadata> getArtifactsByChecksum( String arg0, String arg1 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public MetadataFacet getMetadataFacet( String arg0, String arg1, String arg2 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public List<String> getMetadataFacets( String arg0, String arg1 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Collection<String> getRepositories()
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void removeMetadataFacet( String arg0, String arg1, String arg2 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void removeMetadataFacets( String arg0, String arg1 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void updateArtifact( String arg0, String arg1, String arg2, String arg3, ArtifactMetadata arg4 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void updateNamespace( String arg0, String arg1 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void updateProject( String arg0, ProjectMetadata arg1 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void updateProjectVersion( String arg0, String arg1, String arg2, ProjectVersionMetadata arg3 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Collection<String> getArtifactVersions( String arg0, String arg1, String arg2, String arg3 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Collection<ArtifactMetadata> getArtifacts( String arg0, String arg1, String arg2, String arg3 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void save()
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void close()
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public boolean hasMetadataFacet( String repositoryId, String facetId )
-            throws MetadataRepositoryException
-        {
-            return false;
-        }
-
-        @Override
-        public void revert()
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public boolean canObtainAccess( Class<?> aClass )
-        {
-            return false;
-        }
-
-        @Override
-        public <T>T obtainAccess( Class<T> aClass )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Collection<String> getNamespaces( String arg0, String arg1 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public ProjectMetadata getProject( String arg0, String arg1, String arg2 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Collection<ProjectVersionReference> getProjectReferences( String arg0, String arg1, String arg2,
-                                                                         String arg3 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public ProjectVersionMetadata getProjectVersion( String arg0, String arg1, String arg2, String arg3 )
-            throws MetadataResolutionException
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Collection<String> getProjectVersions( String arg0, String arg1, String arg2 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Collection<String> getProjects( String arg0, String arg1 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public Collection<String> getRootNamespaces( String arg0 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void removeProject( String repositoryId, String namespace, String projectId )
-            throws MetadataRepositoryException
-        {
-            throw new UnsupportedOperationException();
-        }
 
         public void setFrom( Date from )
         {
@@ -370,26 +180,5 @@ public class NewArtifactsRssFeedProcessorTest
         {
             return artifactsByDateRange;
         }
-
-        @Override
-        public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
-            throws MetadataRepositoryException
-        {
-
-        }
-
-        @Override
-        public void removeNamespace( String repositoryId, String namespace )
-            throws MetadataRepositoryException
-        {
-
-        }
-
-        @Override
-        public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
-            throws MetadataRepositoryException
-        {
-
-        }
     }
 }
index 32c43f12d3c3d5c2d419618604110f18c90eab50..070c949f0cb39e10a5d37a4b7e33ecb768910ec7 100644 (file)
@@ -19,22 +19,17 @@ package org.apache.archiva.webtest.memory;
  * under the License.
  */
 
-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;
-import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.MetadataRepositoryException;
-
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 
+import org.apache.archiva.metadata.model.ArtifactMetadata;
+import org.apache.archiva.metadata.repository.AbstractMetadataRepository;
+
 public class TestMetadataRepository
-    implements MetadataRepository
+    extends AbstractMetadataRepository
 {
     private static final String TEST_REPO = "test-repo";
 
@@ -74,107 +69,18 @@ public class TestMetadataRepository
         versions.add( projectVersion );
     }
 
-    @Override
-    public ProjectMetadata getProject( String repoId, String namespace, String projectId )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
-                                                     String projectVersion )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
-                                                   String projectVersion )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
-                                                                     String projectVersion )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Collection<String> getRootNamespaces( String repoId )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Collection<String> getNamespaces( String repoId, String namespace )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public Collection<String> getProjects( String repoId, String namespace )
-    {
-        throw new UnsupportedOperationException();
-    }
-
     @Override
     public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
     {
         return versions;
     }
 
-    @Override
-    public void updateProject( String repoId, ProjectMetadata project )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
-                                ArtifactMetadata artifactMeta )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void updateProjectVersion( String repoId, String namespace, String projectId,
-                                      ProjectVersionMetadata versionMetadata )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void updateNamespace( String repoId, String namespace )
-    {
-        throw new UnsupportedOperationException();
-    }
-
     @Override
     public List<String> getMetadataFacets( String repodId, String facetId )
     {
         return Collections.emptyList();
     }
 
-    @Override
-    public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
- {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void removeMetadataFacets( String repositoryId, String facetId )
-    {
-        throw new UnsupportedOperationException();
-    }
-
     @Override
     public void removeMetadataFacet( String repoId, String facetId, String name )
     {
@@ -193,32 +99,6 @@ public class TestMetadataRepository
         return Collections.singletonList( TEST_REPO );
     }
 
-    @Override
-    public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
-    {
-        return null;
-    }
-
-    @Override
-    public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void removeArtifact( String repositoryId, String namespace, String project, String version,
-                                MetadataFacet metadataFacet )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void removeRepository( String repoId )
-    {
-        throw new UnsupportedOperationException();
-    }
-
     @Override
     public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
                                                       String projectVersion )
@@ -226,73 +106,10 @@ public class TestMetadataRepository
         return artifacts;
     }
 
-    @Override
-    public void save()
-    {
-    }
-
-    @Override
-    public void close()
-    {
-    }
-
-    @Override
-    public void revert()
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean canObtainAccess( Class<?> aClass )
-    {
-        return false;
-    }
-
-    @Override
-    public <T>T obtainAccess( Class<T> aClass )
-    {
-        return null;
-    }
-
     @Override
     public List<ArtifactMetadata> getArtifacts( String repositoryId )
     {
         return artifacts;
     }
 
-    @Override
-    public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void removeNamespace( String repositoryId, String namespace )
-        throws MetadataRepositoryException
-    {
-
-    }
-
-    @Override
-    public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
-        throws MetadataRepositoryException
-    {
-
-    }
-
-    @Override
-    public void removeProject( String repositoryId, String namespace, String projectId )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-
-    @Override
-    public boolean hasMetadataFacet( String repositoryId, String facetId )
-        throws MetadataRepositoryException
-    {
-        return false;
-    }
 }
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
deleted file mode 100644 (file)
index fc30e0d..0000000
+++ /dev/null
@@ -1,259 +0,0 @@
-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 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;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-// TODO: remove - it does nothing
-public class TestMetadataRepository
-    implements MetadataRepository
-{
-    @Override
-    public ProjectMetadata getProject( String repoId, String namespace, String projectId )
-    {
-        return null;
-    }
-
-    @Override
-    public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
-                                                     String projectVersion )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
-                                                   String projectVersion )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
-                                                                     String projectVersion )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getRootNamespaces( String repoId )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getNamespaces( String repoId, String namespace )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getProjects( String repoId, String namespace )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
-    {
-        return null;
-    }
-
-    @Override
-    public void updateProject( String repoId, ProjectMetadata project )
-    {
-    }
-
-    @Override
-    public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
-                                ArtifactMetadata artifactMeta )
-    {
-
-    }
-
-    @Override
-    public void updateProjectVersion( String repoId, String namespace, String projectId,
-                                      ProjectVersionMetadata versionMetadata )
-    {
-
-    }
-
-    @Override
-    public void updateNamespace( String repoId, String namespace )
-    {
-
-    }
-
-    @Override
-    public List<String> getMetadataFacets( String repodId, String facetId )
-    {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
-    {
-        return null;
-    }
-
-    @Override
-    public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
-    {
-
-    }
-
-    @Override
-    public void removeMetadataFacets( String repositoryId, String facetId )
-    {
-
-    }
-
-    @Override
-    public void removeMetadataFacet( String repoId, String facetId, String name )
-    {
-
-    }
-
-    @Override
-    public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
-    {
-        return null;
-    }
-
-    @Override
-    public Collection<String> getRepositories()
-    {
-        return null;
-    }
-
-    @Override
-    public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
-    {
-        return null;
-    }
-
-    @Override
-    public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
-    {
-
-    }
-
-    @Override
-    public void removeRepository( String repoId )
-    {
-
-    }
-
-    @Override
-    public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
-                                                      String projectVersion )
-    {
-        return null;
-    }
-
-    @Override
-    public void save()
-    {
-
-    }
-
-    @Override
-    public void close()
-    {
-
-    }
-
-    @Override
-    public void revert()
-    {
-
-    }
-
-    @Override
-    public boolean canObtainAccess( Class<?> aClass )
-    {
-        return false;
-    }
-
-    @Override
-    public <T>T obtainAccess( Class<T> aClass )
-    {
-        return null;
-    }
-
-    @Override
-    public List<ArtifactMetadata> getArtifacts( String repositoryId )
-    {
-        return null;
-    }
-
-    @Override
-    public void removeArtifact( String repositoryId, String namespace, String project, String version,
-                                MetadataFacet metadataFacet )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void removeNamespace( String repositoryId, String namespace )
-        throws MetadataRepositoryException
-    {
-
-    }
-
-    @Override
-    public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
-        throws MetadataRepositoryException
-    {
-
-    }
-
-    @Override
-    public void removeProject( String repositoryId, String namespace, String projectId )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean hasMetadataFacet( String repositoryId, String facetId )
-        throws MetadataRepositoryException
-    {
-        return false;
-    }
-
-}
index 03be76a86a3a4c4ec05990943ee98489dc93c828..d8df702f4ddec85952e9379a4df2c549bb086b4d 100644 (file)
@@ -30,7 +30,7 @@ public class TestRepositorySessionFactory
     @Override
     public RepositorySession createSession()
     {
-        return new RepositorySession( new TestMetadataRepository(), resolver );
+        return new RepositorySession( new AbstractMetadataRepository() {}, resolver );
     }
 
     public void setResolver( MetadataResolver resolver )
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/AbstractMetadataRepository.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/AbstractMetadataRepository.java
new file mode 100644 (file)
index 0000000..7372229
--- /dev/null
@@ -0,0 +1,280 @@
+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.Date;
+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 abstract class AbstractMetadataRepository
+    implements MetadataRepository
+{
+
+    @Override
+    public void updateProject( String repositoryId, ProjectMetadata project )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void updateArtifact( String repositoryId, String namespace, String projectId, String projectVersion,
+                                ArtifactMetadata artifactMeta )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void updateProjectVersion( String repositoryId, String namespace, String projectId,
+                                      ProjectVersionMetadata versionMetadata )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void updateNamespace( String repositoryId, String namespace )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public List<String> getMetadataFacets( String repositoryId, String facetId )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean hasMetadataFacet( String repositoryId, String facetId )
+        throws MetadataRepositoryException
+    {
+        return false;
+    }
+
+    @Override
+    public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
+        throws MetadataRepositoryException
+    {
+    }
+
+    @Override
+    public void removeMetadataFacets( String repositoryId, String facetId )
+        throws MetadataRepositoryException
+    {
+    }
+
+    @Override
+    public void removeMetadataFacet( String repositoryId, String facetId, String name )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public List<ArtifactMetadata> getArtifactsByDateRange( String repositoryId, Date startTime, Date endTime )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<String> getRepositories()
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<ArtifactMetadata> getArtifactsByChecksum( String repositoryId, String checksum )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void removeArtifact( String repositoryId, String namespace, String project, String version,
+                                MetadataFacet metadataFacet )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void removeRepository( String repositoryId )
+        throws MetadataRepositoryException
+    {
+    }
+
+    @Override
+    public void removeNamespace( String repositoryId, String namespace )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+
+    }
+
+    @Override
+    public List<ArtifactMetadata> getArtifacts( String repositoryId )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ProjectMetadata getProject( String repoId, String namespace, String projectId )
+        throws MetadataResolutionException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
+                                                     String projectVersion )
+        throws MetadataResolutionException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
+                                                   String projectVersion )
+        throws MetadataResolutionException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
+                                                                     String projectVersion )
+        throws MetadataResolutionException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<String> getRootNamespaces( String repoId )
+        throws MetadataResolutionException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<String> getNamespaces( String repoId, String namespace )
+        throws MetadataResolutionException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<String> getProjects( String repoId, String namespace )
+        throws MetadataResolutionException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
+        throws MetadataResolutionException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
+                                                      String projectVersion )
+        throws MetadataResolutionException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void removeProject( String repositoryId, String namespace, String projectId )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void save()
+    {
+    }
+
+    @Override
+    public void close()
+        throws MetadataRepositoryException
+    {
+    }
+
+    @Override
+    public void revert()
+    {
+    }
+
+    @Override
+    public boolean canObtainAccess( Class<?> aClass )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public <T> T obtainAccess( Class<T> aClass )
+        throws MetadataRepositoryException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+}
diff --git a/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
deleted file mode 100644 (file)
index e63cac1..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-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 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;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-@Service
-public class TestMetadataRepository
-    implements MetadataRepository
-{
-    private Map<String, MetadataFacet> facets = new HashMap<>();
-
-    @Override
-    public void updateProject( String repoId, ProjectMetadata project )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
-                                ArtifactMetadata artifactMeta )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public void updateProjectVersion( String repoId, String namespace, String projectId,
-                                      ProjectVersionMetadata versionMetadata )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public void updateNamespace( String repoId, String namespace )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public List<String> getMetadataFacets( String repoId, String facetId )
-    {
-        return new ArrayList<>( facets.keySet() );
-    }
-
-    @Override
-    public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
-    {
-        return facets.get( name );
-    }
-
-    @Override
-    public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
-    {
-        facets.put( metadataFacet.getName(), metadataFacet );
-    }
-
-    @Override
-    public void removeMetadataFacets( String repositoryId, String facetId )
-    {
-        facets.clear();
-    }
-
-    @Override
-    public void removeMetadataFacet( String repoId, String facetId, String name )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public Collection<String> getRepositories()
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public void removeRepository( String repoId )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public List<ArtifactMetadata> getArtifacts( String repositoryId )
-    {
-        return null;
-    }
-
-    @Override
-    public ProjectMetadata getProject( String repoId, String namespace, String projectId )
-        throws MetadataResolutionException
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
-                                                     String projectVersion )
-        throws MetadataResolutionException
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
-                                                   String projectVersion )
-        throws MetadataResolutionException
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
-                                                                     String projectVersion )
-        throws MetadataResolutionException
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public Collection<String> getRootNamespaces( String repoId )
-        throws MetadataResolutionException
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public Collection<String> getNamespaces( String repoId, String namespace )
-        throws MetadataResolutionException
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public Collection<String> getProjects( String repoId, String namespace )
-        throws MetadataResolutionException
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
-        throws MetadataResolutionException
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
-                                                      String projectVersion )
-        throws MetadataResolutionException
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    @Override
-    public void save()
-    {
-        //
-    }
-
-    @Override
-    public void close()
-    {
-        //
-    }
-
-    @Override
-    public void revert()
-    {
-        //
-    }
-
-    @Override
-    public boolean canObtainAccess( Class<?> aClass )
-    {
-        return false;
-    }
-
-    @Override
-    public <T>T obtainAccess( Class<T> aClass )
-    {
-        return null;
-    }
-
-    @Override
-    public void removeArtifact( String repositoryId, String namespace, String project, String version,
-                                MetadataFacet metadataFacet )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void removeNamespace( String repositoryId, String namespace )
-        throws MetadataRepositoryException
-    {
-
-    }
-
-    @Override
-    public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
-        throws MetadataRepositoryException
-    {
-
-    }
-
-    @Override
-    public void removeProject( String repositoryId, String namespace, String projectId )
-        throws MetadataRepositoryException
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public boolean hasMetadataFacet( String repositoryId, String facetId )
-        throws MetadataRepositoryException
-    {
-        return false;
-    }
-
-}
\ No newline at end of file
index f0f10ec77e771af530413afd1397754828446029..ff1562568fe49bd0e30bde2652052fc2b46c29ec 100644 (file)
@@ -24,7 +24,7 @@ import org.springframework.stereotype.Service;
 public class TestRepositorySessionFactory
     implements RepositorySessionFactory
 {
-    private MetadataRepository metadataRepository = new TestMetadataRepository();
+    private MetadataRepository metadataRepository = new AbstractMetadataRepository() {};
 
     private MetadataResolver resolver = new TestMetadataResolver();