aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-03-31 01:30:34 +0000
committerOlivier Lamy <olamy@apache.org>2014-03-31 01:30:34 +0000
commite278aa78c5fd394fcaf1b79666714f2cd20a4b7e (patch)
tree6ca65ddc78e16d8fa9f75c7af2aae71243f43c0e
parentddfbb1c41e95333e7f7ddc610951afec26b2ccfe (diff)
downloadarchiva-e278aa78c5fd394fcaf1b79666714f2cd20a4b7e.tar.gz
archiva-e278aa78c5fd394fcaf1b79666714f2cd20a4b7e.zip
more unit tests fixes
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1583230 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml4
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resourcesstatic/archetype-resources/pom.xml6
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/pom.xml1
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/TestRepositorySessionFactoryBean.java42
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java15
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-rss-servlet.xml6
-rw-r--r--archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml6
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactoryBean.java2
-rw-r--r--pom.xml2
9 files changed, 78 insertions, 6 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml
index b22d435e1..149249cbc 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/pom.xml
@@ -84,8 +84,8 @@
</resources>
<testResources>
<testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
</testResource>
</testResources>
<extensions>
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resourcesstatic/archetype-resources/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resourcesstatic/archetype-resources/pom.xml
index 7cbec0b59..fcaa4b370 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resourcesstatic/archetype-resources/pom.xml
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-archetype/src/main/resourcesstatic/archetype-resources/pom.xml
@@ -71,13 +71,13 @@
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
- <version>2.5.2</version>
+ <version>3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.9</version>
+ <version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -218,7 +218,7 @@
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
- <version>2.8.1</version>
+ <version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
diff --git a/archiva-modules/archiva-web/archiva-web-common/pom.xml b/archiva-modules/archiva-web/archiva-web-common/pom.xml
index fc8b47303..fbedf6192 100644
--- a/archiva-modules/archiva-web/archiva-web-common/pom.xml
+++ b/archiva-modules/archiva-web/archiva-web-common/pom.xml
@@ -526,6 +526,7 @@
<expectedVersion>${project.version}</expectedVersion>
<archiva.logMissingI18n>true</archiva.logMissingI18n>
<java.awt.headless>true</java.awt.headless>
+ <archiva.repositorySessionFactory.id>test</archiva.repositorySessionFactory.id>
</systemPropertyVariables>
</configuration>
</plugin>
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/TestRepositorySessionFactoryBean.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/TestRepositorySessionFactoryBean.java
new file mode 100644
index 000000000..eecb8e2af
--- /dev/null
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/TestRepositorySessionFactoryBean.java
@@ -0,0 +1,42 @@
+package org.apache.archiva;
+
+import org.apache.archiva.metadata.repository.RepositorySessionFactory;
+import org.apache.archiva.metadata.repository.RepositorySessionFactoryBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Properties;
+
+/**
+ * @author Olivier Lamy
+ */
+public class TestRepositorySessionFactoryBean
+ extends RepositorySessionFactoryBean
+{
+
+ private Logger logger = LoggerFactory.getLogger( getClass() );
+
+ private String beanId;
+
+ public TestRepositorySessionFactoryBean( String beanId )
+ {
+ super( new Properties( ) );
+ this.beanId = beanId;
+ }
+
+ @Override
+ public Class<RepositorySessionFactory> getObjectType()
+ {
+ return RepositorySessionFactory.class;
+ }
+
+ @Override
+ protected RepositorySessionFactory createInstance()
+ throws Exception
+ {
+ RepositorySessionFactory repositorySessionFactory =
+ getBeanFactory().getBean( "repositorySessionFactory#" + this.beanId, RepositorySessionFactory.class );
+ logger.info( "create RepositorySessionFactory instance of {}", repositorySessionFactory.getClass().getName() );
+ return repositorySessionFactory;
+ }
+}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java
index f311d97d3..ff159f47c 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java
@@ -21,10 +21,12 @@ package org.apache.archiva.webtest.memory;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
+import org.springframework.beans.factory.config.AbstractFactoryBean;
import org.springframework.stereotype.Service;
@Service("repositorySessionFactory#test")
public class TestRepositorySessionFactory
+ extends AbstractFactoryBean<RepositorySessionFactory>
implements RepositorySessionFactory
{
private RepositorySession repositorySession;
@@ -39,4 +41,17 @@ public class TestRepositorySessionFactory
return repositorySession != null ? repositorySession : new RepositorySession( new TestMetadataRepository(),
new TestMetadataResolver() );
}
+
+ @Override
+ public Class<RepositorySessionFactory> getObjectType()
+ {
+ return RepositorySessionFactory.class;
+ }
+
+ @Override
+ protected RepositorySessionFactory createInstance()
+ throws Exception
+ {
+ return this;
+ }
}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-rss-servlet.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-rss-servlet.xml
index 594a727f2..5f9f77153 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-rss-servlet.xml
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-rss-servlet.xml
@@ -49,6 +49,12 @@
<alias name="archivaConfiguration#default" alias="archivaConfiguration"/>
+ <bean name="TestRepositorySessionFactoryBean" class="org.apache.archiva.TestRepositorySessionFactoryBean">
+ <constructor-arg>
+ <value>jcr</value>
+ </constructor-arg>
+ </bean>
+
<bean name="registry#default" class="org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry">
<property name="properties">
<value>
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml
index 975b0dcca..c9ff7946c 100644
--- a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml
+++ b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-with-jcr.xml
@@ -38,6 +38,12 @@
<alias name="repositorySessionFactory#jcr" alias="repositorySessionFactory"/>
+ <bean name="TestRepositorySessionFactoryBean" class="org.apache.archiva.TestRepositorySessionFactoryBean">
+ <constructor-arg>
+ <value>jcr</value>
+ </constructor-arg>
+ </bean>
+
<bean name="scheduler" class="org.apache.archiva.redback.components.scheduler.DefaultScheduler">
<property name="properties">
<props>
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactoryBean.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactoryBean.java
index e182104f1..5a5c4857f 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactoryBean.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/RepositorySessionFactoryBean.java
@@ -22,6 +22,7 @@ package org.apache.archiva.metadata.repository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.AbstractFactoryBean;
+import org.springframework.stereotype.Service;
import java.util.Properties;
@@ -29,6 +30,7 @@ import java.util.Properties;
* @author Olivier Lamy
* @since 2.0.2
*/
+//@Service("repositorySessionFactoryBean#default")
public class RepositorySessionFactoryBean
extends AbstractFactoryBean<RepositorySessionFactory>
{
diff --git a/pom.xml b/pom.xml
index d44691747..1634899dd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -76,7 +76,7 @@
<slf4j.version>1.7.5</slf4j.version>
<log4j.version>2.0-rc1</log4j.version>
- <spring.version>4.0.2.RELEASE</spring.version>
+ <spring.version>4.0.3.RELEASE</spring.version>
<javax.jcr.version>2.0</javax.jcr.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>