From d6a6f7b316f0f8ffa0a5da8b4a02d255a7360413 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 16 Dec 2011 20:31:29 +0000 Subject: [PATCH] move rss servlet to webapp common for reuse in webapp js, move some test resources too shared with webapp tru a test jar git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1215265 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva-web/archiva-webapp-common/pom.xml | 76 +++++++++++- .../archiva/web/rss/RssFeedServlet.java | 10 +- .../security/UserRepositoriesStub.java | 0 .../archiva/web/rss/RoleManagerStub.java | 8 ++ .../archiva/web/rss/RssFeedServletTest.java | 0 .../archiva/web/rss/SecuritySystemStub.java | 0 .../memory/TestMetadataRepository.java | 0 .../webtest/memory/TestMetadataResolver.java | 0 .../memory/TestRepositorySessionFactory.java | 0 .../src/test/resources/empty-archiva.xml | 111 ++++++++++++++++++ .../src/test/resources/log4j.xml | 40 +++++++ .../resources/spring-context-rss-servlet.xml | 0 .../webapp/WEB-INF/feedServletTest-web.xml | 0 .../archiva-web/archiva-webapp/pom.xml | 8 ++ 14 files changed, 247 insertions(+), 6 deletions(-) rename archiva-modules/archiva-web/{archiva-webapp => archiva-webapp-common}/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java (100%) rename archiva-modules/archiva-web/{archiva-webapp => archiva-webapp-common}/src/test/java/org/apache/archiva/security/UserRepositoriesStub.java (100%) rename archiva-modules/archiva-web/{archiva-webapp => archiva-webapp-common}/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java (92%) rename archiva-modules/archiva-web/{archiva-webapp => archiva-webapp-common}/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java (100%) rename archiva-modules/archiva-web/{archiva-webapp => archiva-webapp-common}/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java (100%) rename archiva-modules/archiva-web/{archiva-webapp => archiva-webapp-common}/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java (100%) rename archiva-modules/archiva-web/{archiva-webapp => archiva-webapp-common}/src/test/java/org/apache/archiva/webtest/memory/TestMetadataResolver.java (100%) rename archiva-modules/archiva-web/{archiva-webapp => archiva-webapp-common}/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java (100%) create mode 100644 archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/empty-archiva.xml create mode 100644 archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/log4j.xml rename archiva-modules/archiva-web/{archiva-webapp => archiva-webapp-common}/src/test/resources/spring-context-rss-servlet.xml (100%) rename archiva-modules/archiva-web/{archiva-webapp => archiva-webapp-common}/src/test/webapp/WEB-INF/feedServletTest-web.xml (100%) diff --git a/archiva-modules/archiva-web/archiva-webapp-common/pom.xml b/archiva-modules/archiva-web/archiva-webapp-common/pom.xml index 4137bd984..0ab71e5eb 100644 --- a/archiva-modules/archiva-web/archiva-webapp-common/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-common/pom.xml @@ -42,6 +42,24 @@ org.apache.archiva archiva-security-common + + org.apache.archiva + archiva-rss + + + org.apache.archiva + archiva-security + + + org.codehaus.redback + redback-common-integrations + + + stax + stax-api + + + org.apache.archiva archiva-plexus-bridge @@ -105,6 +123,21 @@ org.springframework spring-web + + httpunit + httpunit + test + + + junit + junit + test + + + org.slf4j + slf4j-log4j12 + test + @@ -124,6 +157,7 @@ javax.annotation, javax.inject, javax.servlet, + javax.servlet.http, org.apache.archiva.common;version=${project.version}, org.apache.archiva.common.plexusbridge;version=${project.version}, org.apache.archiva.configuration;version=${project.version}, @@ -144,11 +178,51 @@ org.quartz;version="[2,3)", org.slf4j;resolution:=optional, org.springframework*;version="[3,4)", - org.springframework.web*;version="[3,4)" + org.springframework.web*;version="[3,4)", + com.sun.syndication.feed.synd, + com.sun.syndication.io, + org.apache.archiva.metadata.repository, + org.apache.archiva.rss.processor, + org.apache.archiva.security, + org.apache.commons.codec, + org.apache.commons.codec.binary, + org.codehaus.plexus.redback.authentication, + org.codehaus.plexus.redback.authorization, + org.codehaus.plexus.redback.policy, + org.codehaus.plexus.redback.system, + org.codehaus.plexus.redback.users, + org.codehaus.redback.integration.filter.authentication + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + ${project.build.directory}/appserver-base + ${project.build.directory}/appserver-base + ${project.build.directory}/appserver-base + ${basedir}/target/archiva.xml + ${project.build.testOutputDirectory} + ${redbackTestJdbcUrl} + ${redbackTestJdbcDriver} + ${basedir} + + + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java b/archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java similarity index 100% rename from archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java rename to archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java index d2952c0a4..eb7bb0043 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java +++ b/archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java @@ -25,16 +25,16 @@ import com.sun.syndication.io.SyndFeedOutput; import org.apache.archiva.metadata.repository.RepositorySession; import org.apache.archiva.metadata.repository.RepositorySessionFactory; import org.apache.archiva.rss.processor.RssFeedProcessor; -import org.apache.archiva.security.common.ArchivaRoleConstants; -import org.apache.commons.codec.Decoder; -import org.apache.commons.codec.DecoderException; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.lang.StringUtils; import org.apache.archiva.security.AccessDeniedException; import org.apache.archiva.security.ArchivaSecurityException; import org.apache.archiva.security.PrincipalNotFoundException; import org.apache.archiva.security.ServletAuthenticator; import org.apache.archiva.security.UserRepositories; +import org.apache.archiva.security.common.ArchivaRoleConstants; +import org.apache.commons.codec.Decoder; +import org.apache.commons.codec.DecoderException; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang.StringUtils; import org.codehaus.plexus.redback.authentication.AuthenticationException; import org.codehaus.plexus.redback.authentication.AuthenticationResult; import org.codehaus.plexus.redback.authorization.AuthorizationException; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/security/UserRepositoriesStub.java b/archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/security/UserRepositoriesStub.java similarity index 100% rename from archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/security/UserRepositoriesStub.java rename to archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/security/UserRepositoriesStub.java diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java b/archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java similarity index 92% rename from archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java rename to archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java index 1984d8eca..90a5be6d5 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java +++ b/archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java @@ -18,12 +18,18 @@ package org.apache.archiva.web.rss; * under the License. */ +import org.apache.archiva.metadata.repository.RepositorySession; +import org.apache.archiva.metadata.repository.RepositorySessionFactory; +import org.apache.archiva.security.ArchivaSecurityException; +import org.apache.archiva.security.UserRepositories; import org.codehaus.plexus.redback.role.RoleManager; import org.codehaus.plexus.redback.role.RoleManagerException; import org.codehaus.plexus.redback.role.model.RedbackRoleModel; import org.springframework.stereotype.Service; import java.net.URL; +import java.util.Collections; +import java.util.List; /** * @author Olivier Lamy @@ -114,4 +120,6 @@ public class RoleManagerStub { //To change body of implemented methods use File | Settings | File Templates. } + + } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java b/archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java similarity index 100% rename from archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java rename to archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java b/archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java similarity index 100% rename from archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java rename to archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java b/archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java similarity index 100% rename from archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java rename to archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/webtest/memory/TestMetadataResolver.java b/archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataResolver.java similarity index 100% rename from archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/webtest/memory/TestMetadataResolver.java rename to archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataResolver.java diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java b/archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java similarity index 100% rename from archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java rename to archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/empty-archiva.xml b/archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/empty-archiva.xml new file mode 100644 index 000000000..997d62b00 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/empty-archiva.xml @@ -0,0 +1,111 @@ + + + + + + 2 + + + + + artifacts + + **/*.pom + **/*.jar + **/*.ear + **/*.war + **/*.car + **/*.sar + **/*.mar + **/*.rar + **/*.dtd + **/*.tld + **/*.tar.gz + **/*.tar.bz2 + **/*.zip + + + + indexable-content + + **/*.txt + **/*.TXT + **/*.block + **/*.config + **/*.pom + **/*.xml + **/*.xsd + **/*.dtd + **/*.tld + + + + auto-remove + + **/*.bak + **/*~ + **/*- + + + + ignored + + **/.htaccess + **/KEYS + **/*.rb + **/*.sh + **/.svn/** + **/.DAV/** + + + + + update-db-artifact + create-missing-checksums + update-db-repository-metadata + validate-checksum + validate-signature + index-content + auto-remove + auto-rename + + + update-db-bad-content + + + + + 0 0 * * * ? + + index-artifact + update-db-project + validate-repository-metadata + index-archive-toc + update-db-bytecode-stats + index-public-methods + + + not-present-remove-db-artifact + not-present-remove-db-project + not-present-remove-indexed + + + + diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/log4j.xml b/archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/log4j.xml new file mode 100644 index 000000000..aecb237a7 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/log4j.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-rss-servlet.xml b/archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/spring-context-rss-servlet.xml similarity index 100% rename from archiva-modules/archiva-web/archiva-webapp/src/test/resources/spring-context-rss-servlet.xml rename to archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/spring-context-rss-servlet.xml diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/webapp/WEB-INF/feedServletTest-web.xml b/archiva-modules/archiva-web/archiva-webapp-common/src/test/webapp/WEB-INF/feedServletTest-web.xml similarity index 100% rename from archiva-modules/archiva-web/archiva-webapp/src/test/webapp/WEB-INF/feedServletTest-web.xml rename to archiva-modules/archiva-web/archiva-webapp-common/src/test/webapp/WEB-INF/feedServletTest-web.xml diff --git a/archiva-modules/archiva-web/archiva-webapp/pom.xml b/archiva-modules/archiva-web/archiva-webapp/pom.xml index c627bec96..7a0a1cd43 100644 --- a/archiva-modules/archiva-web/archiva-webapp/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp/pom.xml @@ -808,6 +808,14 @@ true + + org.apache.archiva + archiva-webapp-common + tests + test + ${project.version} + +