summaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2015-10-01 15:50:35 +1000
committerOlivier Lamy <olamy@apache.org>2015-10-01 15:50:35 +1000
commitbe4c847d961cc65fdf95a85bbd8049bb879a44f2 (patch)
tree06d29d32a4ffbd4c0b1868587f011c21caaeb470 /archiva-modules
parent87ff9f5d3dc1ca0b921764a9412dcbdc8776f466 (diff)
downloadarchiva-be4c847d961cc65fdf95a85bbd8049bb879a44f2.tar.gz
archiva-be4c847d961cc65fdf95a85bbd8049bb879a44f2.zip
more usage of MockRepositorySessionFactory
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml9
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java46
-rw-r--r--archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorAbstractTest.java14
3 files changed, 13 insertions, 56 deletions
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml
index e305eb0b5..c501e3e46 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml
@@ -110,7 +110,12 @@
<artifactId>archiva-test-utils</artifactId>
<version>${project.version}</version>
<scope>test</scope>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-mock</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
@@ -176,7 +181,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
- <archiva.repositorySessionFactory.id>test</archiva.repositorySessionFactory.id>
+ <archiva.repositorySessionFactory.id>mock</archiva.repositorySessionFactory.id>
</systemPropertyVariables>
</configuration>
</plugin>
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
deleted file mode 100644
index def73a181..000000000
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.apache.archiva.metadata.repository;
-
-import org.springframework.stereotype.Service;
-
-/*
-* 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.
-*/
-@Service("repositorySessionFactory#test")
-public class TestRepositorySessionFactory
- implements RepositorySessionFactory
-{
- private MetadataRepository repository;
-
- private MetadataResolver resolver;
-
- @Override
- public RepositorySession createSession()
- {
- return new RepositorySession( repository, resolver );
- }
-
- public void setRepository( MetadataRepository repository )
- {
- this.repository = repository;
- }
-
- public void setResolver( MetadataResolver resolver )
- {
- this.resolver = resolver;
- }
-}
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorAbstractTest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorAbstractTest.java
index 554287c83..1698f078a 100644
--- a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorAbstractTest.java
+++ b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorAbstractTest.java
@@ -23,13 +23,15 @@ import junit.framework.TestCase;
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.TestRepositorySessionFactory;
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
+import org.apache.archiva.mock.MockRepositorySessionFactory;
import org.apache.archiva.redback.components.taskqueue.execution.TaskExecutor;
+import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.codehaus.plexus.util.FileUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
+import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import javax.inject.Inject;
@@ -37,19 +39,15 @@ import javax.inject.Named;
import java.io.File;
import java.util.Calendar;
import java.util.List;
-import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import static org.mockito.Mockito.mock;
-import org.springframework.test.annotation.DirtiesContext;
/**
* ArchivaRepositoryScanningTaskExecutorPhase1Test
- *
- *
*/
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
-@DirtiesContext( classMode= DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD )
+@DirtiesContext( classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD )
public abstract class ArchivaRepositoryScanningTaskExecutorAbstractTest
extends TestCase
{
@@ -70,8 +68,8 @@ public abstract class ArchivaRepositoryScanningTaskExecutorAbstractTest
protected TestConsumer testConsumer;
@Inject
- @Named( value = "repositorySessionFactory#test" )
- private TestRepositorySessionFactory factory;
+ @Named( value = "repositorySessionFactory#mock" )
+ private MockRepositorySessionFactory factory;
protected File repoDir;