diff options
author | Olivier Lamy <olamy@apache.org> | 2015-10-01 16:21:14 +1000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2015-10-01 16:21:14 +1000 |
commit | 4ad5e63c6410661733068fd23472e76cd4bc929d (patch) | |
tree | 4bcb5aa4b3658c6dad78d9851c61acf307d11d5a | |
parent | 4ce3140da9230710007669765f9579f0bd76cd82 (diff) | |
download | archiva-4ad5e63c6410661733068fd23472e76cd4bc929d.tar.gz archiva-4ad5e63c6410661733068fd23472e76cd4bc929d.zip |
more usage of MockRepositorySessionFactory
3 files changed, 15 insertions, 42 deletions
diff --git a/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java b/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java index 319942ba4..a1a27dcb9 100644 --- a/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java +++ b/archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java @@ -21,6 +21,7 @@ package org.apache.archiva.mock; import org.apache.archiva.metadata.repository.AbstractMetadataRepository; import org.apache.archiva.metadata.repository.MetadataRepository; +import org.apache.archiva.metadata.repository.MetadataResolver; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.springframework.stereotype.Service; @@ -36,15 +37,22 @@ public class MockRepositorySessionFactory { }; + private MetadataResolver resolver; + public void setRepository( MetadataRepository repository ) { this.repository = repository; } + public void setResolver( MetadataResolver resolver ) + { + this.resolver = resolver; + } + @Override public RepositorySession createSession() { - return new RepositorySession( repository, null ) + return new RepositorySession( repository, resolver ) { @Override public void close() diff --git a/archiva-modules/archiva-web/archiva-webdav/pom.xml b/archiva-modules/archiva-web/archiva-webdav/pom.xml index 3568ca1ec..de1b5be09 100644 --- a/archiva-modules/archiva-web/archiva-webdav/pom.xml +++ b/archiva-modules/archiva-web/archiva-webdav/pom.xml @@ -233,6 +233,11 @@ </exclusions> </dependency> <dependency> + <groupId>org.apache.archiva</groupId> + <artifactId>archiva-mock</artifactId> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.apache.archiva.redback</groupId> <artifactId>redback-common-test-resources</artifactId> <scope>test</scope> @@ -308,7 +313,7 @@ <archiva.user.configFileName>${project.build.testOutputDirectory}/repository-archiva.xml</archiva.user.configFileName> <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url> <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name> - <archiva.repositorySessionFactory.id>beer</archiva.repositorySessionFactory.id> + <archiva.repositorySessionFactory.id>mock</archiva.repositorySessionFactory.id> </systemPropertyVariables> <forkMode>${webdav.forkMode}</forkMode> </configuration> diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java deleted file mode 100644 index d8df702f4..000000000 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java +++ /dev/null @@ -1,40 +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.springframework.stereotype.Service; - -@Service("repositorySessionFactory#beer") -public class TestRepositorySessionFactory - implements RepositorySessionFactory -{ - private MetadataResolver resolver; - - @Override - public RepositorySession createSession() - { - return new RepositorySession( new AbstractMetadataRepository() {}, resolver ); - } - - public void setResolver( MetadataResolver resolver ) - { - this.resolver = resolver; - } -} |