archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [06/10] archiva git commit: more usage of MockRepositorySessionFactory
Date Thu, 01 Oct 2015 07:42:22 GMT
 more usage of MockRepositorySessionFactory


Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/be4c847d
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/be4c847d
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/be4c847d

Branch: refs/heads/master
Commit: be4c847d961cc65fdf95a85bbd8049bb879a44f2
Parents: 87ff9f5
Author: Olivier Lamy <olamy@apache.org>
Authored: Thu Oct 1 15:50:35 2015 +1000
Committer: Olivier Lamy <olamy@apache.org>
Committed: Thu Oct 1 15:50:35 2015 +1000

----------------------------------------------------------------------
 .../archiva-scheduler-repository/pom.xml        |  9 +++-
 .../TestRepositorySessionFactory.java           | 46 --------------------
 ...ositoryScanningTaskExecutorAbstractTest.java | 14 +++---
 3 files changed, 13 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva/blob/be4c847d/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml b/archiva-modules/archiva-scheduler/archiva-scheduler-repository/pom.xml
index e305eb0..c501e3e 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>

http://git-wip-us.apache.org/repos/asf/archiva/blob/be4c847d/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/metadata/repository/TestRepositorySessionFactory.java
----------------------------------------------------------------------
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 def73a1..0000000
--- 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;
-    }
-}

http://git-wip-us.apache.org/repos/asf/archiva/blob/be4c847d/archiva-modules/archiva-scheduler/archiva-scheduler-repository/src/test/java/org/apache/archiva/scheduler/repository/ArchivaRepositoryScanningTaskExecutorAbstractTest.java
----------------------------------------------------------------------
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 554287c..1698f07 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;
 


Mime
View raw message