]> source.dussan.org Git - archiva.git/commitdiff
add a new module with mock for test
authorOlivier Lamy <olamy@apache.org>
Thu, 1 Oct 2015 04:51:45 +0000 (14:51 +1000)
committerOlivier Lamy <olamy@apache.org>
Thu, 1 Oct 2015 04:51:45 +0000 (14:51 +1000)
archiva-modules/archiva-base/archiva-mock/pom.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-mock/src/main/java/org/apache/archiva/mock/MockRepositorySessionFactory.java [new file with mode: 0644]
archiva-modules/archiva-base/archiva-mock/src/main/resources/META-INF/spring-context.xml [new file with mode: 0644]
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MockRepositorySessionFactory.java [deleted file]
archiva-modules/archiva-base/pom.xml
pom.xml

diff --git a/archiva-modules/archiva-base/archiva-mock/pom.xml b/archiva-modules/archiva-base/archiva-mock/pom.xml
new file mode 100644 (file)
index 0000000..bbe2e8c
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.apache.archiva</groupId>
+    <artifactId>archiva-base</artifactId>
+    <version>2.2.1-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>archiva-mock</artifactId>
+  <packaging>jar</packaging>
+  <name>Archiva Base :: Mocks</name>
+  <dependencies>
+
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>metadata-repository-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+    </dependency>
+  </dependencies>
+
+</project>
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
new file mode 100644 (file)
index 0000000..303d2e0
--- /dev/null
@@ -0,0 +1,61 @@
+package org.apache.archiva.mock;
+
+/*
+ * 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.apache.archiva.metadata.repository.AbstractMetadataRepository;
+import org.apache.archiva.metadata.repository.MetadataRepository;
+import org.apache.archiva.metadata.repository.RepositorySession;
+import org.apache.archiva.metadata.repository.RepositorySessionFactory;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author Olivier Lamy
+ */
+@Service( "repositorySessionFactory#mock" )
+public class MockRepositorySessionFactory
+    implements RepositorySessionFactory
+{
+    @Override
+    public RepositorySession createSession()
+    {
+        return new RepositorySession( null, null )
+        {
+            @Override
+            public void close()
+            {
+                return;
+            }
+
+            @Override
+            public void save()
+            {
+                // no op
+            }
+
+            @Override
+            public MetadataRepository getRepository()
+            {
+                return new AbstractMetadataRepository()
+                {
+                };
+            }
+        };
+    }
+}
diff --git a/archiva-modules/archiva-base/archiva-mock/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-base/archiva-mock/src/main/resources/META-INF/spring-context.xml
new file mode 100644 (file)
index 0000000..2c9156d
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+
+<!--
+  ~ 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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+           http://www.springframework.org/schema/context 
+           http://www.springframework.org/schema/context/spring-context-3.0.xsd" default-lazy-init="true">
+
+
+  <context:annotation-config />
+  <context:component-scan base-package="org.apache.archiva.mock"/>
+
+</beans>
\ No newline at end of file
index 9927f885c00e343f929e17f212a7b8a18b1b3cff..f91ed77891e1d4a9d6fa35d5202faa14769692c2 100644 (file)
       <scope>test</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-mock</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
   <build>
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
deleted file mode 100644 (file)
index d26a704..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.apache.archiva.admin.mock;
-/*
- * 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.apache.archiva.metadata.repository.AbstractMetadataRepository;
-import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.archiva.metadata.repository.RepositorySession;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
-import org.springframework.stereotype.Service;
-
-/**
- * @author Olivier Lamy
- */
-@Service( "repositorySessionFactory#mock" )
-public class MockRepositorySessionFactory
-    implements RepositorySessionFactory
-{
-    @Override
-    public RepositorySession createSession()
-    {
-        return new RepositorySession( null, null )
-        {
-            @Override
-            public void close()
-            {
-                return;
-            }
-
-            @Override
-            public void save()
-            {
-                // no op
-            }
-
-            @Override
-            public MetadataRepository getRepository()
-            {
-                return new AbstractMetadataRepository() {};
-            }
-        };
-    }
-}
index cf2c25fa1b7337a7f88a669f6b525e9176626f59..3a5da0d66cb7213be876fbe5c9840cade33346d8 100644 (file)
@@ -32,6 +32,7 @@
   <modules>
     <module>archiva-test-utils</module>
     <module>archiva-common</module>
+    <module>archiva-mock</module>
     <module>archiva-filelock</module>
     <module>archiva-model</module>
     <module>archiva-configuration</module>
diff --git a/pom.xml b/pom.xml
index 3d58f71a150427f61c91352caee71c58b83f7737..692b5fdc9157b8432b5018830a269c1b63b0dad1 100644 (file)
--- a/pom.xml
+++ b/pom.xml
         <artifactId>archiva-common</artifactId>
         <version>${project.version}</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.archiva</groupId>
+        <artifactId>archiva-mock</artifactId>
+        <version>${project.version}</version>
+      </dependency>
       <dependency>
         <groupId>org.apache.archiva</groupId>
         <artifactId>archiva-filelock</artifactId>