From a1230dc9e73484aeaf6138f2682c295c694927fc Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Tue, 5 Jun 2012 21:43:29 +0000 Subject: [PATCH] fix test mock compilation git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1346610 13f79535-47bb-0310-9956-ffa450edef68 --- .../repository/TestMetadataRepository.java | 7 ++++++ .../mock/MockRepositorySessionFactory.java | 22 ++++++++--------- .../repository/TestMetadataRepository.java | 7 ++++++ .../mock/MockRepositorySessionFactory.java | 24 +++++++++---------- .../mock/MockRepositorySessionFactory.java | 4 ++-- .../NewArtifactsRssFeedProcessorTest.java | 8 +++++++ .../memory/TestMetadataRepository.java | 18 ++++++++++---- .../repository/TestMetadataRepository.java | 7 ++++++ .../repository/TestMetadataRepository.java | 7 +++--- .../file/FileMetadataRepository.java | 5 ++-- 10 files changed, 72 insertions(+), 37 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 index c78389e89..9c2d22061 100644 --- 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 @@ -182,4 +182,11 @@ public class TestMetadataRepository { return null; } + + public void removeArtifact( String repositoryId, String namespace, String project, String version, + MetadataFacet metadataFacet ) + throws MetadataRepositoryException + { + throw new UnsupportedOperationException(); + } } 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 5a6c40042..bd000d822 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 @@ -42,30 +42,30 @@ import java.util.List; public class MockRepositorySessionFactory implements RepositorySessionFactory { - public RepositorySession createSession( ) + public RepositorySession createSession() { return new RepositorySession( null, null ) { @Override - public void close( ) + public void close() { return; } @Override - public void save( ) + public void save() { // no op } @Override - public MetadataRepository getRepository( ) + public MetadataRepository getRepository() { - return new MetadataRepository( ) + return new MetadataRepository() { public void removeArtifact( String repositoryId, String namespace, String project, - String projectVersion, String projectId, MetadataFacet metadataFacet ) + String projectVersion, MetadataFacet metadataFacet ) throws MetadataRepositoryException { @@ -100,7 +100,7 @@ public class MockRepositorySessionFactory public List getMetadataFacets( String repositoryId, String facetId ) throws MetadataRepositoryException { - return Collections.emptyList( ); + return Collections.emptyList(); } public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name ) @@ -134,7 +134,7 @@ public class MockRepositorySessionFactory return null; //To change body of implemented methods use File | Settings | File Templates. } - public Collection getRepositories( ) + public Collection getRepositories() throws MetadataRepositoryException { return null; //To change body of implemented methods use File | Settings | File Templates. @@ -224,17 +224,17 @@ public class MockRepositorySessionFactory return null; //To change body of implemented methods use File | Settings | File Templates. } - public void save( ) + public void save() { //To change body of implemented methods use File | Settings | File Templates. } - public void close( ) + public void close() { //To change body of implemented methods use File | Settings | File Templates. } - public void revert( ) + public void revert() { //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java index 1c1e97e90..7754911db 100644 --- 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 @@ -187,4 +187,11 @@ public class TestMetadataRepository { return Collections.emptyList(); } + + public void removeArtifact( String repositoryId, String namespace, String project, String version, + MetadataFacet metadataFacet ) + throws MetadataRepositoryException + { + throw new UnsupportedOperationException(); + } } 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 649343209..e411fc1c3 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 @@ -42,33 +42,33 @@ import java.util.List; public class MockRepositorySessionFactory implements RepositorySessionFactory { - public RepositorySession createSession( ) + public RepositorySession createSession() { return new RepositorySession( null, null ) { @Override - public void close( ) + public void close() { return; } @Override - public void save( ) + public void save() { // no op } @Override - public MetadataRepository getRepository( ) + public MetadataRepository getRepository() { - return new MetadataRepository( ) + return new MetadataRepository() { public void removeArtifact( String repositoryId, String namespace, String project, - String projectVersion, String projectId, MetadataFacet metadataFacet ) + String projectVersion, MetadataFacet metadataFacet ) throws MetadataRepositoryException { - //To change body of implemented methods use File | Settings | File Templates. + throw new UnsupportedOperationException(); } public void updateProject( String repositoryId, ProjectMetadata project ) @@ -100,7 +100,7 @@ public class MockRepositorySessionFactory public List getMetadataFacets( String repositoryId, String facetId ) throws MetadataRepositoryException { - return Collections.emptyList( ); + return Collections.emptyList(); } public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name ) @@ -134,7 +134,7 @@ public class MockRepositorySessionFactory return null; //To change body of implemented methods use File | Settings | File Templates. } - public Collection getRepositories( ) + public Collection getRepositories() throws MetadataRepositoryException { return null; //To change body of implemented methods use File | Settings | File Templates. @@ -224,17 +224,17 @@ public class MockRepositorySessionFactory return null; //To change body of implemented methods use File | Settings | File Templates. } - public void save( ) + public void save() { //To change body of implemented methods use File | Settings | File Templates. } - public void close( ) + public void close() { //To change body of implemented methods use File | Settings | File Templates. } - public void revert( ) + public void revert() { //To change body of implemented methods use File | Settings | File Templates. } diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java index 37290708a..de7a9de65 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/mock/MockRepositorySessionFactory.java @@ -65,10 +65,10 @@ public class MockRepositorySessionFactory { public void removeArtifact( String repositoryId, String namespace, String project, - String projectVersion, String projectId, MetadataFacet metadataFacet ) + String projectVersion, MetadataFacet metadataFacet ) throws MetadataRepositoryException { - + throw new UnsupportedOperationException(); } public void updateProject( String repositoryId, ProjectMetadata project ) diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java index 1636f27c7..4fabb5998 100644 --- a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java +++ b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java @@ -28,6 +28,7 @@ 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.rss.RssFeedGenerator; import org.junit.Before; @@ -141,6 +142,13 @@ public class NewArtifactsRssFeedProcessorTest return artifactsByDateRange; } + public void removeArtifact( String repositoryId, String namespace, String project, String version, + MetadataFacet metadataFacet ) + throws MetadataRepositoryException + { + throw new UnsupportedOperationException(); + } + public void addMetadataFacet( String arg0, MetadataFacet arg1 ) { throw new UnsupportedOperationException(); diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java index 482637f91..91d7955d3 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java @@ -25,6 +25,7 @@ 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; @@ -175,17 +176,24 @@ public class TestMetadataRepository public List getArtifactsByChecksum( String repoId, String checksum ) { - return null; //To change body of implemented methods use File | Settings | File Templates. + return null; } public void removeArtifact( String repositoryId, String namespace, String project, String version, String id ) { - //To change body of implemented methods use File | Settings | File Templates. + throw new UnsupportedOperationException(); + } + + public void removeArtifact( String repositoryId, String namespace, String project, String version, + MetadataFacet metadataFacet ) + throws MetadataRepositoryException + { + throw new UnsupportedOperationException(); } public void removeRepository( String repoId ) { - //To change body of implemented methods use File | Settings | File Templates. + throw new UnsupportedOperationException(); } public Collection getArtifacts( String repoId, String namespace, String projectId, @@ -209,12 +217,12 @@ public class TestMetadataRepository public boolean canObtainAccess( Class aClass ) { - return false; //To change body of implemented methods use File | Settings | File Templates. + return false; } public Object obtainAccess( Class aClass ) { - return null; //To change body of implemented methods use File | Settings | File Templates. + return null; } public List getArtifacts( String repositoryId ) 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 index 571b2015d..1b6b8c65b 100644 --- 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 @@ -183,4 +183,11 @@ public class TestMetadataRepository { return null; } + + public void removeArtifact( String repositoryId, String namespace, String project, String version, + MetadataFacet metadataFacet ) + 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 index 24a0a5d44..93217bcd8 100644 --- 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 @@ -199,11 +199,10 @@ public class TestMetadataRepository return null; //To change body of implemented methods use File | Settings | File Templates. } - - public void removeArtifact( String repositoryId, String namespace, String project, String projectVersion, - String projectId, MetadataFacet metadataFacet ) + public void removeArtifact( String repositoryId, String namespace, String project, String version, + MetadataFacet metadataFacet ) throws MetadataRepositoryException { - //To change body of implemented methods use File | Settings | File Templates. + throw new UnsupportedOperationException(); } } \ No newline at end of file diff --git a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java index e3de5fd40..fbf246ffd 100644 --- a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java +++ b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java @@ -38,7 +38,6 @@ import org.apache.archiva.metadata.repository.MetadataRepository; import org.apache.archiva.metadata.repository.MetadataRepositoryException; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.NotImplementedException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -648,10 +647,10 @@ public class FileMetadataRepository * @throws MetadataRepositoryException */ public void removeArtifact( String repositoryId, String namespace, String project, String projectVersion, - String projectId, MetadataFacet metadataFacet ) + MetadataFacet metadataFacet ) throws MetadataRepositoryException { - throw new NotImplementedException( "not implemented" ); + throw new UnsupportedOperationException("not implemented"); } public void removeRepository( String repoId ) -- 2.39.5