aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-base
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-11-17 10:43:06 +1100
committerOlivier Lamy <olamy@apache.org>2014-11-17 10:43:06 +1100
commitaa9bfe5eb39c08cf82d636768aaace39cbd42b7c (patch)
treed55ce2b95595984d638bf54d6464d0802c3d9e08 /archiva-modules/archiva-base
parent021bbaf5a142c5ebbc5b1f9c4d30cc1aa796506e (diff)
parent63479200cef1e242cdbdf19eb9474133959aac32 (diff)
downloadarchiva-aa9bfe5eb39c08cf82d636768aaace39cbd42b7c.tar.gz
archiva-aa9bfe5eb39c08cf82d636768aaace39cbd42b7c.zip
merge branch from Carlos. Thanks mate!!
Diffstat (limited to 'archiva-modules/archiva-base')
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java258
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java4
-rw-r--r--archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java269
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java262
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java2
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java269
6 files changed, 7 insertions, 1057 deletions
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
index 3b2898dad..000000000
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
+++ /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;
- }
-
-}
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
index 11bfe4037..95abe0fa2 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
@@ -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()
diff --git a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java
index 6b43a3a10..c8162967f 100644
--- a/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java
+++ b/archiva-modules/archiva-base/archiva-indexer/src/test/java/org/apache/archiva/indexer/search/mock/MockRepositorySessionFactory.java
@@ -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
index 1e575224d..000000000
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
+++ /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;
- }
-}
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
index 61aeeb384..5d2e82095 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
@@ -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 )
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java
index 69ffc47e9..d26a70443 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java
@@ -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() {};
}
};
}