diff options
author | Carlos Sanchez <csanchez@maestrodev.com> | 2014-11-06 09:58:02 +0100 |
---|---|---|
committer | Carlos Sanchez <csanchez@maestrodev.com> | 2014-11-06 13:39:28 +0100 |
commit | 63479200cef1e242cdbdf19eb9474133959aac32 (patch) | |
tree | 5ecfb21a00562d8ad0a6086bb695dcd5e8c0ace1 /archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default | |
parent | ae9b10930639f230ebbc017d0a78d7e95b5a42ae (diff) | |
download | archiva-63479200cef1e242cdbdf19eb9474133959aac32.tar.gz archiva-63479200cef1e242cdbdf19eb9474133959aac32.zip |
Add a AbstractMetadataRepository to remove duplicated code
Diffstat (limited to 'archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default')
-rw-r--r-- | archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java | 269 |
1 files changed, 2 insertions, 267 deletions
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() {}; } }; } |