]> source.dussan.org Git - archiva.git/commitdiff
rename webapp-common module to web-common as it will be used in rest services: this...
authorOlivier Lamy <olamy@apache.org>
Mon, 9 Jan 2012 12:49:13 +0000 (12:49 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 9 Jan 2012 12:49:13 +0000 (12:49 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1229124 13f79535-47bb-0310-9956-ffa450edef68

52 files changed:
archiva-modules/archiva-web/archiva-web-common/pom.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/main/filtered-resources/application.properties [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/runtime/ArchivaRuntimeInfo.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/spring/RepositoryListenerFactoryBean.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/Banner.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/main/resources/META-INF/spring-context.xml [new file with mode: 0755]
archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default_fr.properties [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/security.properties [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/security_en.properties [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/security/UserRepositoriesStub.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataResolver.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/test/resources/empty-archiva.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/test/resources/log4j.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/test/resources/spring-context-rss-servlet.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-web-common/src/test/webapp/WEB-INF/feedServletTest-web.xml [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp-common/pom.xml [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/main/filtered-resources/application.properties [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/runtime/ArchivaRuntimeInfo.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/spring/RepositoryListenerFactoryBean.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/startup/Banner.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/META-INF/spring-context.xml [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/org/apache/archiva/i18n/default.properties [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/org/apache/archiva/i18n/default_fr.properties [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/org/apache/archiva/security.properties [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/org/apache/archiva/security_en.properties [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/security/UserRepositoriesStub.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataResolver.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/test/java/org/apache/archiva/webtest/memory/TestRepositorySessionFactory.java [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/empty-archiva.xml [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/log4j.xml [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/spring-context-rss-servlet.xml [deleted file]
archiva-modules/archiva-web/archiva-webapp-common/src/test/webapp/WEB-INF/feedServletTest-web.xml [deleted file]
archiva-modules/archiva-web/archiva-webapp-js/pom.xml
archiva-modules/archiva-web/archiva-webapp/pom.xml
archiva-modules/archiva-web/pom.xml
pom.xml

diff --git a/archiva-modules/archiva-web/archiva-web-common/pom.xml b/archiva-modules/archiva-web/archiva-web-common/pom.xml
new file mode 100644 (file)
index 0000000..46ccf70
--- /dev/null
@@ -0,0 +1,307 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.archiva</groupId>
+    <artifactId>archiva-web</artifactId>
+    <version>1.4-M3-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>archiva-webapp-common</artifactId>
+  <packaging>bundle</packaging>
+  <name>Archiva Web :: Webapp Common</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>metadata-repository-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-configuration</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-security-common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-rss</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-security</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-common-integrations</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>stax</groupId>
+          <artifactId>stax-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-plexus-bridge</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-scheduler-repository</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-rbac-model</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-rbac-role-manager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-system</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback.components</groupId>
+      <artifactId>spring-taskqueue</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback.components</groupId>
+      <artifactId>spring-quartz</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.quartz-scheduler</groupId>
+      <artifactId>quartz</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>c3p0</groupId>
+          <artifactId>c3p0</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>javax.transaction</groupId>
+          <artifactId>jta</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-beans</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context-support</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>httpunit</groupId>
+      <artifactId>httpunit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+      </resource>
+      <resource>
+        <directory>src/main/filtered-resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <configuration>
+          <instructions>
+            <Bundle-SymbolicName>org.apache.archiva.webapp.common</Bundle-SymbolicName>
+            <Bundle-Version>${project.version}</Bundle-Version>
+            <Export-Package>
+              org.apache.archiva.web.spring;version=${project.version},
+              org.apache.archiva.web.startup;version=${project.version}
+            </Export-Package>
+            <Import-Package>
+              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},
+              org.apache.archiva.repository.events;version=${project.version},
+              org.apache.archiva.scheduler.repository;version=${project.version},
+              org.apache.archiva.security.common;version=${project.version},
+              org.apache.commons.collections;version="[3.2,4)",
+              org.apache.commons.lang;version="[2.4,3)",
+              org.apache.maven.index,
+              org.apache.maven.index.context,
+              org.codehaus.plexus.redback.rbac,
+              org.codehaus.plexus.redback.role,
+              org.codehaus.plexus.redback.system.check,
+              org.codehaus.plexus.registry,
+              org.codehaus.plexus.taskqueue,
+              org.codehaus.plexus.taskqueue.execution,
+              org.codehaus.redback.components.scheduler,
+              org.quartz;version="[2,3)",
+              org.slf4j;resolution:=optional,
+              org.springframework*;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
+            </Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <executions>
+          <execution>
+            <goals>
+              <goal>test-jar</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <systemPropertyVariables>
+            <appserver.base>${project.build.directory}/appserver-base</appserver.base>
+            <plexus.home>${project.build.directory}/appserver-base</plexus.home>
+            <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>
+            <archiva.user.configFileName>${basedir}/target/archiva.xml</archiva.user.configFileName>
+            <test.resources.path>${project.build.testOutputDirectory}</test.resources.path>
+            <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>
+            <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>
+            <basedir>${basedir}</basedir>
+          </systemPropertyVariables>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <id>svn-buildnumber</id>
+      <activation>
+        <file>
+          <exists>.svn</exists>
+        </file>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>buildnumber-maven-plugin</artifactId>
+            <executions>
+              <execution>
+                <phase>generate-resources</phase>
+                <goals>
+                  <goal>create</goal>
+                </goals>
+              </execution>
+            </executions>
+            <configuration>
+              <doCheck>false</doCheck>
+              <doUpdate>false</doUpdate>
+              <providerImplementations>
+                <svn>javasvn</svn>
+              </providerImplementations>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <id>non-canonical-buildnumber</id>
+      <activation>
+        <file>
+          <missing>.svn</missing>
+        </file>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>buildnumber-maven-plugin</artifactId>
+            <executions>
+              <execution>
+                <phase>generate-resources</phase>
+                <goals>
+                  <goal>create</goal>
+                </goals>
+              </execution>
+            </executions>
+            <configuration>
+              <doCheck>false</doCheck>
+              <doUpdate>false</doUpdate>
+              <format>NON-CANONICAL_{0,date,yyyy-MM-dd_HH-mm}_{1}</format>
+              <items>
+                <item>timestamp</item>
+                <item>${user.name}</item>
+              </items>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+
+</project>
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/filtered-resources/application.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/filtered-resources/application.properties
new file mode 100644 (file)
index 0000000..12806aa
--- /dev/null
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+user.agent=Apache Archiva/${project.version}
+archiva.version=${project.version}
+archiva.buildNumber=${buildNumber}
+archiva.timestamp=${timestamp}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/rss/RssFeedServlet.java
new file mode 100644 (file)
index 0000000..eb7bb00
--- /dev/null
@@ -0,0 +1,335 @@
+package org.apache.archiva.web.rss;
+
+/*
+ * 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 com.sun.syndication.feed.synd.SyndFeed;
+import com.sun.syndication.io.FeedException;
+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.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;
+import org.codehaus.plexus.redback.authorization.UnauthorizedException;
+import org.codehaus.plexus.redback.policy.AccountLockedException;
+import org.codehaus.plexus.redback.policy.MustChangePasswordException;
+import org.codehaus.plexus.redback.system.SecuritySession;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.plexus.redback.users.UserNotFoundException;
+import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Servlet for handling rss feed requests.
+ */
+public class RssFeedServlet
+    extends HttpServlet
+{
+    public static final String MIME_TYPE = "application/rss+xml; charset=UTF-8";
+
+    private static final String COULD_NOT_GENERATE_FEED_ERROR = "Could not generate feed";
+
+    private static final String COULD_NOT_AUTHENTICATE_USER = "Could not authenticate user";
+
+    private static final String USER_NOT_AUTHORIZED = "User not authorized to access feed.";
+
+    private Logger log = LoggerFactory.getLogger( RssFeedServlet.class );
+
+    private RssFeedProcessor processor;
+
+    private WebApplicationContext wac;
+
+    private UserRepositories userRepositories;
+
+    private ServletAuthenticator servletAuth;
+
+    private HttpAuthenticator httpAuth;
+
+    private RepositorySessionFactory repositorySessionFactory;
+
+    public void init( javax.servlet.ServletConfig servletConfig )
+        throws ServletException
+    {
+        super.init( servletConfig );
+        wac = WebApplicationContextUtils.getRequiredWebApplicationContext( servletConfig.getServletContext() );
+        userRepositories = wac.getBean( UserRepositories.class );
+        servletAuth = wac.getBean( ServletAuthenticator.class );
+        httpAuth = wac.getBean( "httpAuthenticator#basic", HttpAuthenticator.class );
+        // TODO: what if there are other types?
+        repositorySessionFactory = wac.getBean( "repositorySessionFactory", RepositorySessionFactory.class );
+    }
+
+    public void doGet( HttpServletRequest req, HttpServletResponse res )
+        throws ServletException, IOException
+    {
+        String repoId = null;
+        String groupId = null;
+        String artifactId = null;
+
+        String url = StringUtils.removeEnd( req.getRequestURL().toString(), "/" );
+        if ( StringUtils.countMatches( StringUtils.substringAfter( url, "feeds/" ), "/" ) > 0 )
+        {
+            artifactId = StringUtils.substringAfterLast( url, "/" );
+            groupId = StringUtils.substringBeforeLast( StringUtils.substringAfter( url, "feeds/" ), "/" );
+            groupId = StringUtils.replaceChars( groupId, '/', '.' );
+        }
+        else if ( StringUtils.countMatches( StringUtils.substringAfter( url, "feeds/" ), "/" ) == 0 )
+        {
+            repoId = StringUtils.substringAfterLast( url, "/" );
+        }
+        else
+        {
+            res.sendError( HttpServletResponse.SC_BAD_REQUEST, "Invalid request url." );
+            return;
+        }
+
+        try
+        {
+            Map<String, String> map = new HashMap<String, String>();
+            SyndFeed feed = null;
+
+            if ( isAllowed( req, repoId, groupId, artifactId ) )
+            {
+                if ( repoId != null )
+                {
+                    // new artifacts in repo feed request
+                    processor = wac.getBean( "rssFeedProcessor#new-artifacts", RssFeedProcessor.class );
+                    map.put( RssFeedProcessor.KEY_REPO_ID, repoId );
+                }
+                else if ( ( groupId != null ) && ( artifactId != null ) )
+                {
+                    // TODO: this only works for guest - we could pass in the list of repos
+                    // new versions of artifact feed request
+                    processor = wac.getBean( "rssFeedProcessor#new-versions", RssFeedProcessor.class );
+                    map.put( RssFeedProcessor.KEY_GROUP_ID, groupId );
+                    map.put( RssFeedProcessor.KEY_ARTIFACT_ID, artifactId );
+                }
+            }
+            else
+            {
+                res.sendError( HttpServletResponse.SC_UNAUTHORIZED, USER_NOT_AUTHORIZED );
+                return;
+            }
+
+            RepositorySession repositorySession = repositorySessionFactory.createSession();
+            try
+            {
+                feed = processor.process( map, repositorySession.getRepository() );
+            }
+            finally
+            {
+                repositorySession.close();
+            }
+            if ( feed == null )
+            {
+                res.sendError( HttpServletResponse.SC_NO_CONTENT, "No information available." );
+                return;
+            }
+
+            res.setContentType( MIME_TYPE );
+
+            if ( repoId != null )
+            {
+                feed.setLink( req.getRequestURL().toString() );
+            }
+            else if ( ( groupId != null ) && ( artifactId != null ) )
+            {
+                feed.setLink( req.getRequestURL().toString() );
+            }
+
+            SyndFeedOutput output = new SyndFeedOutput();
+            output.output( feed, res.getWriter() );
+        }
+        catch ( UserNotFoundException unfe )
+        {
+            log.debug( COULD_NOT_AUTHENTICATE_USER, unfe );
+            res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
+        }
+        catch ( AccountLockedException acce )
+        {
+            res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
+        }
+        catch ( AuthenticationException authe )
+        {
+            log.debug( COULD_NOT_AUTHENTICATE_USER, authe );
+            res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
+        }
+        catch ( FeedException ex )
+        {
+            log.debug( COULD_NOT_GENERATE_FEED_ERROR, ex );
+            res.sendError( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, COULD_NOT_GENERATE_FEED_ERROR );
+        }
+        catch ( MustChangePasswordException e )
+        {
+            res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
+        }
+        catch ( UnauthorizedException e )
+        {
+            log.debug( e.getMessage() );
+            if ( repoId != null )
+            {
+                res.setHeader( "WWW-Authenticate",
+                               "Basic realm=\"Repository Archiva Managed " + repoId + " Repository" );
+            }
+            else
+            {
+                res.setHeader( "WWW-Authenticate", "Basic realm=\"Artifact " + groupId + ":" + artifactId );
+            }
+
+            res.sendError( HttpServletResponse.SC_UNAUTHORIZED, USER_NOT_AUTHORIZED );
+        }
+    }
+
+    /**
+     * Basic authentication.
+     *
+     * @param req
+     * @param repositoryId TODO
+     * @param groupId      TODO
+     * @param artifactId   TODO
+     * @return
+     */
+    private boolean isAllowed( HttpServletRequest req, String repositoryId, String groupId, String artifactId )
+        throws UserNotFoundException, AccountLockedException, AuthenticationException, MustChangePasswordException,
+        UnauthorizedException
+    {
+        String auth = req.getHeader( "Authorization" );
+        List<String> repoIds = new ArrayList<String>();
+
+        if ( repositoryId != null )
+        {
+            repoIds.add( repositoryId );
+        }
+        else if ( artifactId != null && groupId != null )
+        {
+            if ( auth != null )
+            {
+                if ( !auth.toUpperCase().startsWith( "BASIC " ) )
+                {
+                    return false;
+                }
+
+                Decoder dec = new Base64();
+                String usernamePassword = "";
+
+                try
+                {
+                    usernamePassword = new String( (byte[]) dec.decode( auth.substring( 6 ).getBytes() ) );
+                }
+                catch ( DecoderException ie )
+                {
+                    log.warn( "Error decoding username and password.", ie.getMessage() );
+                }
+
+                if ( usernamePassword == null || usernamePassword.trim().equals( "" ) )
+                {
+                    repoIds = getObservableRepos( UserManager.GUEST_USERNAME );
+                }
+                else
+                {
+                    String[] userCredentials = usernamePassword.split( ":" );
+                    repoIds = getObservableRepos( userCredentials[0] );
+                }
+            }
+            else
+            {
+                repoIds = getObservableRepos( UserManager.GUEST_USERNAME );
+            }
+        }
+        else
+        {
+            return false;
+        }
+
+        for ( String repoId : repoIds )
+        {
+            try
+            {
+                AuthenticationResult result = httpAuth.getAuthenticationResult( req, null );
+                SecuritySession securitySession = httpAuth.getSecuritySession( req.getSession( true ) );
+
+                if ( servletAuth.isAuthenticated( req, result ) && servletAuth.isAuthorized( req, securitySession,
+                                                                                             repoId,
+                                                                                             ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS ) )
+                {
+                    return true;
+                }
+            }
+            catch ( AuthorizationException e )
+            {
+
+            }
+            catch ( UnauthorizedException e )
+            {
+
+            }
+        }
+
+        throw new UnauthorizedException( "Access denied." );
+    }
+
+    private List<String> getObservableRepos( String principal )
+    {
+        try
+        {
+            return userRepositories.getObservableRepositoryIds( principal );
+        }
+        catch ( PrincipalNotFoundException e )
+        {
+            log.warn( e.getMessage(), e );
+        }
+        catch ( AccessDeniedException e )
+        {
+            log.warn( e.getMessage(), e );
+        }
+        catch ( ArchivaSecurityException e )
+        {
+            log.warn( e.getMessage(), e );
+        }
+
+        return Collections.emptyList();
+    }
+
+}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/runtime/ArchivaRuntimeInfo.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/runtime/ArchivaRuntimeInfo.java
new file mode 100644 (file)
index 0000000..23f013b
--- /dev/null
@@ -0,0 +1,92 @@
+package org.apache.archiva.web.runtime;
+/*
+ * 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.commons.lang.math.NumberUtils;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.util.Properties;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4-M3
+ */
+@Service( "archivaRuntimeInfo" )
+public class ArchivaRuntimeInfo
+{
+
+    private String version;
+
+    private String buildNumber;
+
+    private long timestamp;
+
+
+    @Inject
+    public ArchivaRuntimeInfo( @Named( value = "archivaRuntimeProperties" ) Properties archivaRuntimeProperties )
+    {
+        this.version = (String) archivaRuntimeProperties.get( "archiva.version" );
+        this.buildNumber = (String) archivaRuntimeProperties.get( "archiva.buildNumber" );
+        this.timestamp = NumberUtils.createLong( (String) archivaRuntimeProperties.get( "archiva.timestamp" ) );
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+
+    public String getBuildNumber()
+    {
+        return buildNumber;
+    }
+
+    public void setBuildNumber( String buildNumber )
+    {
+        this.buildNumber = buildNumber;
+    }
+
+    public long getTimestamp()
+    {
+        return timestamp;
+    }
+
+    public void setTimestamp( long timestamp )
+    {
+        this.timestamp = timestamp;
+    }
+
+    @Override
+    public String toString()
+    {
+        final StringBuilder sb = new StringBuilder();
+        sb.append( "ArchivaRuntimeInfo" );
+        sb.append( "{version='" ).append( version ).append( '\'' );
+        sb.append( ", buildNumber='" ).append( buildNumber ).append( '\'' );
+        sb.append( ", timestamp=" ).append( timestamp );
+        sb.append( '}' );
+        return sb.toString();
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/spring/RepositoryListenerFactoryBean.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/spring/RepositoryListenerFactoryBean.java
new file mode 100644 (file)
index 0000000..5822902
--- /dev/null
@@ -0,0 +1,64 @@
+package org.apache.archiva.web.spring;
+
+/*
+ * 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.repository.events.RepositoryListener;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.FactoryBean;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+import java.util.List;
+
+/**
+ * @todo though we will eventually remove this altogether, an interim cleanup would be to genericise this
+ * and replace the calls in RepositoryContentConsumers with calls to the same thing
+ */
+public class RepositoryListenerFactoryBean
+    implements FactoryBean, ApplicationContextAware
+{
+
+    private ApplicationContext applicationContext;
+
+    public void setApplicationContext( ApplicationContext applicationContext )
+        throws BeansException
+    {
+        this.applicationContext = applicationContext;
+    }
+
+    public Object getObject()
+        throws Exception
+    {
+        return applicationContext.getBeansOfType( RepositoryListener.class ).values();
+    }
+
+    @SuppressWarnings("unchecked")
+    public Class<List> getObjectType()
+    {
+        return List.class;
+    }
+
+    public boolean isSingleton()
+    {
+        return true;
+    }
+
+    
+}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java
new file mode 100644 (file)
index 0000000..46aca0b
--- /dev/null
@@ -0,0 +1,208 @@
+package org.apache.archiva.web.startup;
+
+/*
+ * 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.common.ArchivaException;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
+import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
+import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
+import org.apache.maven.index.NexusIndexer;
+import org.apache.maven.index.context.IndexingContext;
+import org.codehaus.plexus.taskqueue.Task;
+import org.codehaus.plexus.taskqueue.execution.ThreadedTaskQueueExecutor;
+import org.codehaus.redback.components.scheduler.DefaultScheduler;
+import org.quartz.SchedulerException;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import java.lang.reflect.Field;
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+
+/**
+ * ArchivaStartup - the startup of all archiva features in a deterministic order.
+ *
+ * @version $Id$
+ */
+public class ArchivaStartup
+    implements ServletContextListener
+{
+    private ThreadedTaskQueueExecutor tqeDbScanning;
+
+    private ThreadedTaskQueueExecutor tqeRepoScanning;
+
+    private ThreadedTaskQueueExecutor tqeIndexing;
+
+    private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
+
+    private PlexusSisuBridge plexusSisuBridge;
+
+    private NexusIndexer nexusIndexer;
+
+    public void contextInitialized( ServletContextEvent contextEvent )
+    {
+        WebApplicationContext wac =
+            WebApplicationContextUtils.getRequiredWebApplicationContext( contextEvent.getServletContext() );
+
+        SecuritySynchronization securitySync = wac.getBean( SecuritySynchronization.class );
+
+        repositoryTaskScheduler =
+            wac.getBean( "archivaTaskScheduler#repository", RepositoryArchivaTaskScheduler.class );
+
+        Properties archivaRuntimeProperties = wac.getBean( "archivaRuntimeProperties", Properties.class );
+
+        tqeRepoScanning = wac.getBean( "taskQueueExecutor#repository-scanning", ThreadedTaskQueueExecutor.class );
+
+        tqeIndexing = wac.getBean( "taskQueueExecutor#indexing", ThreadedTaskQueueExecutor.class );
+
+        plexusSisuBridge = wac.getBean( PlexusSisuBridge.class );
+
+        try
+        {
+            nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
+        }
+        catch ( PlexusSisuBridgeException e )
+        {
+            throw new RuntimeException( "Unable to get NexusIndexer: " + e.getMessage(), e );
+        }
+        try
+        {
+            securitySync.startup();
+            repositoryTaskScheduler.startup();
+            Banner.display( (String) archivaRuntimeProperties.get( "archiva.version" ) );
+        }
+        catch ( ArchivaException e )
+        {
+            throw new RuntimeException( "Unable to properly startup archiva: " + e.getMessage(), e );
+        }
+    }
+
+    public void contextDestroyed( ServletContextEvent contextEvent )
+    {
+        WebApplicationContext applicationContext =
+            WebApplicationContextUtils.getRequiredWebApplicationContext( contextEvent.getServletContext() );
+
+        // TODO check this stop
+
+        /*
+        if ( applicationContext != null && applicationContext instanceof ClassPathXmlApplicationContext )
+        {
+            ( (ClassPathXmlApplicationContext) applicationContext ).close();
+        } */
+
+        if ( applicationContext != null ) //&& applicationContext instanceof PlexusWebApplicationContext )
+        {
+            // stop task queue executors
+            stopTaskQueueExecutor( tqeDbScanning );
+            stopTaskQueueExecutor( tqeRepoScanning );
+            stopTaskQueueExecutor( tqeIndexing );
+
+            // stop the DefaultArchivaTaskScheduler and its scheduler
+            if ( repositoryTaskScheduler != null )
+            {
+                try
+                {
+                    repositoryTaskScheduler.stop();
+                }
+                catch ( SchedulerException e )
+                {
+                    e.printStackTrace();
+                }
+
+                try
+                {
+                    // shutdown the scheduler, otherwise Quartz scheduler and Threads still exists
+                    Field schedulerField = repositoryTaskScheduler.getClass().getDeclaredField( "scheduler" );
+                    schedulerField.setAccessible( true );
+
+                    DefaultScheduler scheduler = (DefaultScheduler) schedulerField.get( repositoryTaskScheduler );
+                    scheduler.stop();
+                }
+                catch ( Exception e )
+                {
+                    e.printStackTrace();
+                }
+            }
+
+            // close the application context
+            //applicationContext.close();
+            // TODO fix close call
+            //applicationContext.
+        }
+
+        // closing correctly indexer to close correctly lock and file
+        for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
+        {
+            try
+            {
+                indexingContext.close( false );
+            }
+            catch ( Exception e )
+            {
+                contextEvent.getServletContext().log( "skip error closing indexingContext " + e.getMessage() );
+            }
+        }
+
+    }
+
+    private void stopTaskQueueExecutor( ThreadedTaskQueueExecutor taskQueueExecutor )
+    {
+        if ( taskQueueExecutor != null )
+        {
+            Task currentTask = taskQueueExecutor.getCurrentTask();
+            if ( currentTask != null )
+            {
+                taskQueueExecutor.cancelTask( currentTask );
+            }
+
+            try
+            {
+                taskQueueExecutor.stop();
+                ExecutorService service = getExecutorServiceForTTQE( taskQueueExecutor );
+                if ( service != null )
+                {
+                    service.shutdown();
+                }
+            }
+            catch ( Exception e )
+            {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private ExecutorService getExecutorServiceForTTQE( ThreadedTaskQueueExecutor ttqe )
+    {
+        ExecutorService service = null;
+        try
+        {
+            Field executorServiceField = ttqe.getClass().getDeclaredField( "executorService" );
+            executorServiceField.setAccessible( true );
+            service = (ExecutorService) executorServiceField.get( ttqe );
+        }
+        catch ( Exception e )
+        {
+            e.printStackTrace();
+        }
+        return service;
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/Banner.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/Banner.java
new file mode 100644 (file)
index 0000000..343358f
--- /dev/null
@@ -0,0 +1,229 @@
+package org.apache.archiva.web.startup;
+
+/*
+ * 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.commons.lang.StringUtils;
+import org.slf4j.LoggerFactory;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Banner 
+ *
+ * @version $Id$
+ */
+public class Banner
+{
+    private static final String eol = System.getProperty("line.separator");
+
+    public static String encode( String raw )
+    {
+        // Canonicalize line ends to make them easier to process
+        raw = raw.replace("\r\n", "\n").replace("\r", "\n");
+
+        StringBuilder encoded = new StringBuilder();
+        int rawlen = raw.length();
+
+        for ( int i = 0; i < rawlen; i++ )
+        {
+            char c = raw.charAt( i );
+            if ( c == '\\' )
+            {
+                encoded.append( "$." );
+            }
+            else if ( c == '$' )
+            {
+                encoded.append( "$$" );
+            }
+            else if ( c == '\n' )
+            {
+                encoded.append( "$n" );
+            }
+            else if ( Character.isDigit( c ) )
+            {
+                encoded.append( c );
+            }
+            else if ( Character.isLetter( c ) )
+            {
+                encoded.append( rot13( c ) );
+            }
+            else if ( i < raw.length() - 1 )
+            {
+                char nc;
+                boolean done = false;
+                int count = 0;
+                for ( int n = i; !done; n++ )
+                {
+                    if ( n >= rawlen )
+                    {
+                        break;
+                    }
+
+                    nc = raw.charAt( n );
+
+                    if ( nc != c )
+                    {
+                        done = true;
+                    }
+                    else
+                    {
+                        count++;
+                    }
+                }
+                if ( count < 3 )
+                {
+                    encoded.append( c );
+                }
+                else
+                {
+                    encoded.append( "$" ).append( String.valueOf( count ) ).append( c );
+                    i += count - 1;
+                }
+            }
+            else
+            {
+                encoded.append( c );
+            }
+        }
+
+        return encoded.toString();
+    }
+
+    public static String decode( String encoded )
+    {
+        StringBuilder decoded = new StringBuilder();
+        int enlen = encoded.length();
+        for ( int i = 0; i < enlen; i++ )
+        {
+            char c = encoded.charAt( i );
+            if ( c == '$' )
+            {
+                char nc = encoded.charAt( i + 1 );
+                if ( nc == '$' )
+                {
+                    decoded.append( '$' );
+                    i++;
+                }
+                else if ( nc == '.' )
+                {
+                    decoded.append( '\\' );
+                    i++;
+                }
+                else if ( nc == 'n' )
+                {
+                    decoded.append( eol );
+                    i++;
+                }
+                else if ( Character.isDigit( nc ) )
+                {
+                    int count = 0;
+                    int nn = i + 1;
+                    while ( Character.isDigit( nc ) )
+                    {
+                        count = ( count * 10 );
+                        count += ( nc - '0' );
+                        nc = encoded.charAt( ++nn );
+                    }
+                    for ( int d = 0; d < count; d++ )
+                    {
+                        decoded.append( nc );
+                    }
+                    i = nn;
+                }
+            }
+            else if ( Character.isLetter( c ) )
+            {
+                decoded.append( rot13( c ) );
+            }
+            else
+            {
+                decoded.append( c );
+            }
+        }
+
+        return decoded.toString();
+    }
+
+    private static char rot13( char c )
+    {
+        if ( ( c >= 'a' ) && ( c <= 'z' ) )
+        {
+            char dc = c += 13;
+            if ( dc > 'z' )
+            {
+                dc -= 26;
+            }
+            return dc;
+        }
+        else if ( ( c >= 'A' ) && ( c <= 'Z' ) )
+        {
+            char dc = c += 13;
+            if ( dc > 'Z' )
+            {
+                dc -= 26;
+            }
+            return dc;
+        }
+        else
+        {
+            return c;
+        }
+    }
+
+    public static String injectVersion( String text, String version )
+    {
+        Pattern pat = Pattern.compile( "#{2,}" );
+        Matcher mat = pat.matcher( text );
+        StringBuilder ret = new StringBuilder();
+        int off = 0;
+
+        while ( mat.find( off ) )
+        {
+            ret.append( text.substring( off, mat.start() ) );
+            String repl = mat.group();
+            ret.append( StringUtils.center( version, repl.length() ) );
+            off = mat.end();
+        }
+
+        ret.append( text.substring( off ) );
+
+        return ret.toString();
+    }
+
+    public static String getBanner( String version )
+    {
+        String encodedBanner = "$26 $34_$n$15 /$._$7 /$34 $.$n$14 /`/@),$4 |  Ba" +
+                " orunys bs nyy bs gur nycnpnf   |$n$14 |  (~'  __| gbvyvat njnl ba " +
+                "gur Ncnpur Nepuvin |$n$6 _,--.$3_/  |$4 $.$5  cebwrpg grnz, V jbhyq y" +
+                "vxr gb$3 |$n$4 ,' ,$5 ($3 |$5 $.$5     jrypbzr lbh gb Nepuvin$6 |$" +
+                "n$4 |  ($6 $.  /$6 |  $32#  |$n$5 $.  )$._/  ,_/$7 |$36 |$n$5 / /$3 " +
+                "( |/$9 |     uggc://nepuvin.ncnpur.bet/     |$n$4 ( |$4 ( |$10 |     hf" +
+                "ref@nepuvin.ncnpur.bet$7 |$n$5 $.|$5 $.|$11 $.$34_/$n$n";
+
+        return injectVersion( decode( encodedBanner ), version );
+    }
+
+    public static void display( String version )
+    {
+        String banner = getBanner( version );
+        LoggerFactory.getLogger( Banner.class ).info( StringUtils.repeat( "_", 25 ) + eol + banner );
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java
new file mode 100644 (file)
index 0000000..76d81fe
--- /dev/null
@@ -0,0 +1,245 @@
+package org.apache.archiva.web.startup;
+
+/*
+ * 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.common.ArchivaException;
+import org.apache.archiva.configuration.ArchivaConfiguration;
+import org.apache.archiva.configuration.ConfigurationNames;
+import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.security.common.ArchivaRoleConstants;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.StringUtils;
+import org.codehaus.plexus.redback.rbac.RBACManager;
+import org.codehaus.plexus.redback.rbac.RbacManagerException;
+import org.codehaus.plexus.redback.rbac.UserAssignment;
+import org.codehaus.plexus.redback.role.RoleManager;
+import org.codehaus.plexus.redback.role.RoleManagerException;
+import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.plexus.registry.Registry;
+import org.codehaus.plexus.registry.RegistryListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import javax.inject.Named;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * ConfigurationSynchronization
+ *
+ * @version $Id$
+ */
+@Service
+public class SecuritySynchronization
+    implements RegistryListener
+{
+    private Logger log = LoggerFactory.getLogger( SecuritySynchronization.class );
+
+    @Inject
+    private RoleManager roleManager;
+
+    @Inject
+    @Named( value = "rBACManager#cached" )
+    private RBACManager rbacManager;
+
+    private Map<String, EnvironmentCheck> checkers;
+
+    @Inject
+    private ArchivaConfiguration archivaConfiguration;
+
+    @Inject
+    private ApplicationContext applicationContext;
+
+    @PostConstruct
+    public void initialize()
+    {
+        checkers = getBeansOfType( EnvironmentCheck.class );
+    }
+
+    protected <T> Map<String, T> getBeansOfType( Class<T> clazz )
+    {
+        //TODO do some caching here !!!
+        // olamy : with plexus we get only roleHint
+        // as per convention we named spring bean role#hint remove role# if exists
+        Map<String, T> springBeans = applicationContext.getBeansOfType( clazz );
+
+        Map<String, T> beans = new HashMap<String, T>( springBeans.size() );
+
+        for ( Entry<String, T> entry : springBeans.entrySet() )
+        {
+            String key = StringUtils.substringAfterLast( entry.getKey(), "#" );
+            beans.put( key, entry.getValue() );
+        }
+        return beans;
+    }
+
+    public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
+    {
+        if ( ConfigurationNames.isManagedRepositories( propertyName ) )
+        {
+            synchConfiguration( archivaConfiguration.getConfiguration().getManagedRepositories() );
+        }
+    }
+
+    public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue )
+    {
+        /* do nothing */
+    }
+
+    private void synchConfiguration( List<ManagedRepositoryConfiguration> repos )
+    {
+        // NOTE: Remote Repositories do not have roles or security placed around them.
+
+        for ( ManagedRepositoryConfiguration repoConfig : repos )
+        {
+            // manage roles for repositories
+            try
+            {
+                if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
+                                                       repoConfig.getId() ) )
+                {
+                    roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
+                                                     repoConfig.getId() );
+                }
+                else
+                {
+                    roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
+                                                     repoConfig.getId() );
+                }
+
+                if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
+                                                       repoConfig.getId() ) )
+                {
+                    roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
+                                                     repoConfig.getId() );
+                }
+                else
+                {
+                    roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
+                                                     repoConfig.getId() );
+                }
+            }
+            catch ( RoleManagerException e )
+            {
+                // Log error.
+                log.error( "Unable to create roles for configured repositories: " + e.getMessage(), e );
+            }
+        }
+    }
+
+    public void startup()
+        throws ArchivaException
+    {
+        executeEnvironmentChecks();
+
+        synchConfiguration( archivaConfiguration.getConfiguration().getManagedRepositories() );
+        archivaConfiguration.addChangeListener( this );
+
+        if ( archivaConfiguration.isDefaulted() )
+        {
+            assignRepositoryObserverToGuestUser( archivaConfiguration.getConfiguration().getManagedRepositories() );
+        }
+    }
+
+    private void executeEnvironmentChecks()
+        throws ArchivaException
+    {
+        if ( ( checkers == null ) || CollectionUtils.isEmpty( checkers.values() ) )
+        {
+            throw new ArchivaException(
+                "Unable to initialize the Redback Security Environment, " + "no Environment Check components found." );
+        }
+
+        List<String> violations = new ArrayList<String>();
+
+        for ( Entry<String, EnvironmentCheck> entry : checkers.entrySet() )
+        {
+            EnvironmentCheck check = entry.getValue();
+            List<String> v = new ArrayList<String>();
+            check.validateEnvironment( v );
+            log.info( "Environment Check: " + entry.getKey() + " -> " + v.size() + " violation(s)" );
+            for ( String s : v )
+            {
+                violations.add( "[" + entry.getKey() + "] " + s );
+            }
+        }
+
+        if ( CollectionUtils.isNotEmpty( violations ) )
+        {
+            StringBuilder msg = new StringBuilder();
+            msg.append( "EnvironmentCheck Failure.\n" );
+            msg.append( "======================================================================\n" );
+            msg.append( " ENVIRONMENT FAILURE !! \n" );
+            msg.append( "\n" );
+
+            for ( String violation : violations )
+            {
+                msg.append( violation ).append( "\n" );
+            }
+
+            msg.append( "\n" );
+            msg.append( "======================================================================" );
+            log.error( msg.toString() );
+
+            throw new ArchivaException( "Unable to initialize Redback Security Environment, [" + violations.size()
+                                            + "] violation(s) encountered, See log for details." );
+        }
+    }
+
+    private void assignRepositoryObserverToGuestUser( List<ManagedRepositoryConfiguration> repos )
+    {
+        for ( ManagedRepositoryConfiguration repoConfig : repos )
+        {
+            String repoId = repoConfig.getId();
+
+            String principal = UserManager.GUEST_USERNAME;
+
+            try
+            {
+                UserAssignment ua;
+
+                if ( rbacManager.userAssignmentExists( principal ) )
+                {
+                    ua = rbacManager.getUserAssignment( principal );
+                }
+                else
+                {
+                    ua = rbacManager.createUserAssignment( principal );
+                }
+
+                ua.addRoleName( ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ) );
+                rbacManager.saveUserAssignment( ua );
+            }
+            catch ( RbacManagerException e )
+            {
+                log.warn( "Unable to add role [" + ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ) + "] to "
+                              + principal + " user.", e );
+            }
+        }
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/META-INF/spring-context.xml
new file mode 100755 (executable)
index 0000000..261b885
--- /dev/null
@@ -0,0 +1,38 @@
+<?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"
+       xmlns:util="http://www.springframework.org/schema/util"
+       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
+           http://www.springframework.org/schema/util
+           http://www.springframework.org/schema/util/spring-util-3.0.xsd"
+       default-lazy-init="true">
+
+  <context:annotation-config/>
+  <context:component-scan base-package="org.apache.archiva.web.spring, org.apache.archiva.web.startup, org.apache.archiva.web.runtime"/>
+
+  <util:properties id="archivaRuntimeProperties" location="classpath:application.properties" />
+
+</beans>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default.properties
new file mode 100644 (file)
index 0000000..22d5265
--- /dev/null
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+# --------------------------------------------------------------------
+#  Archiva webapp i18n default en file
+# --------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default_fr.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/i18n/default_fr.properties
new file mode 100644 (file)
index 0000000..9ad0368
--- /dev/null
@@ -0,0 +1,21 @@
+#
+# 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.
+#
+# --------------------------------------------------------------------
+#  Archiva webapp i18n fr file
+# --------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/security.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/security.properties
new file mode 100644 (file)
index 0000000..2074ef0
--- /dev/null
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+
+# --------------------------------------------------------------------
+# Email Settings
+
+# The subject line for the email message.
+email.validation.subject=Welcome to Archiva
+
+# Feedback page
+email.feedback.path=http://archiva.apache.org/mail-lists.html
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/security_en.properties b/archiva-modules/archiva-web/archiva-web-common/src/main/resources/org/apache/archiva/security_en.properties
new file mode 100644 (file)
index 0000000..661b0cb
--- /dev/null
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/security/UserRepositoriesStub.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/security/UserRepositoriesStub.java
new file mode 100644 (file)
index 0000000..3e8cf50
--- /dev/null
@@ -0,0 +1,77 @@
+package org.apache.archiva.security;
+
+/*
+ * 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 java.util.Collections;
+import java.util.List;
+
+/**
+ * UserRepositories stub used for testing.
+ *
+ * @version $Id$
+ */
+public class UserRepositoriesStub
+    implements UserRepositories
+{
+    private List<String> repoIds = Collections.singletonList( "test-repo" );
+
+    public void createMissingRepositoryRoles( String repoId )
+        throws ArchivaSecurityException
+    {
+    }
+
+    public List<String> getObservableRepositoryIds( String principal )
+        throws ArchivaSecurityException
+    {
+        return repoIds;
+    }
+
+    public void setObservableRepositoryIds( List<String> repoIds )
+    {
+        this.repoIds = repoIds;
+    }
+
+    public boolean isAuthorizedToUploadArtifacts( String principal, String repoId )
+        throws ArchivaSecurityException
+    {
+        return false;
+    }
+
+    public boolean isAuthorizedToDeleteArtifacts( String principal, String repoId )
+    {
+        return false;
+    }
+
+    public List<String> getManagableRepositoryIds( String principal )
+        throws ArchivaSecurityException
+    {
+        return null;
+    }
+
+    public List<String> getRepoIds()
+    {
+        return repoIds;
+    }
+
+    public void setRepoIds( List<String> repoIds )
+    {
+        this.repoIds = repoIds;
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RoleManagerStub.java
new file mode 100644 (file)
index 0000000..90a5be6
--- /dev/null
@@ -0,0 +1,125 @@
+package org.apache.archiva.web.rss;
+/*
+ * 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.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
+ */
+@Service("RoleManagerStub")
+public class RoleManagerStub
+    implements RoleManager
+{
+    public void loadRoleModel( URL resourceLocation )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void loadRoleModel( RedbackRoleModel model )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void createTemplatedRole( String templateId, String resource )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void removeTemplatedRole( String templateId, String resource )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void updateRole( String templateId, String oldResource, String newResource )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void assignRole( String roleId, String principal )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void assignRoleByName( String roleName, String principal )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void assignTemplatedRole( String templateId, String resource, String principal )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void unassignRole( String roleId, String principal )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void unassignRoleByName( String roleName, String principal )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public boolean roleExists( String roleId )
+        throws RoleManagerException
+    {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public boolean templatedRoleExists( String templateId, String resource )
+        throws RoleManagerException
+    {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public RedbackRoleModel getModel()
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void verifyTemplatedRole( String templateID, String resource )
+        throws RoleManagerException
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+
+}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/RssFeedServletTest.java
new file mode 100644 (file)
index 0000000..9a55321
--- /dev/null
@@ -0,0 +1,222 @@
+package org.apache.archiva.web.rss;
+
+/*
+ * 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 com.meterware.httpunit.GetMethodWebRequest;
+import com.meterware.httpunit.HttpException;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+import com.meterware.servletunit.ServletRunner;
+import com.meterware.servletunit.ServletUnitClient;
+import junit.framework.TestCase;
+import org.apache.commons.codec.Encoder;
+import org.apache.commons.codec.binary.Base64;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.BlockJUnit4ClassRunner;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+
+@RunWith( BlockJUnit4ClassRunner.class )
+public class RssFeedServletTest
+    extends TestCase
+{
+    private ServletRunner sr;
+
+    private ServletUnitClient client;
+
+    static String PREVIOUS_ARCHIVA_PATH;
+
+    @BeforeClass
+    public static void initConfigurationPath()
+        throws Exception
+    {
+        PREVIOUS_ARCHIVA_PATH = System.getProperty( "archiva.user.configFileName" );
+        System.setProperty( "archiva.user.configFileName",
+                            System.getProperty( "test.resources.path/" ) + "empty-archiva.xml" );
+    }
+
+    @AfterClass
+    public static void restoreConfigurationPath()
+        throws Exception
+    {
+        System.setProperty( "archiva.user.configFileName", PREVIOUS_ARCHIVA_PATH );
+    }
+
+    @Before
+    public void setUp()
+        throws Exception
+    {
+        sr = new ServletRunner( new File( "src/test/webapp/WEB-INF/feedServletTest-web.xml" ) );
+        client = sr.newClient();
+    }
+
+    @After
+    public void tearDown()
+        throws Exception
+    {
+        if ( client != null )
+        {
+            client.clearContents();
+        }
+
+        if ( sr != null )
+        {
+            sr.shutDown();
+        }
+
+        super.tearDown();
+    }
+
+    @Test
+    public void testRetrieveServlet()
+        throws Exception
+    {
+
+        RssFeedServlet servlet =
+            (RssFeedServlet) client.newInvocation( "http://localhost/feeds/test-repo" ).getServlet();
+        assertNotNull( servlet );
+    }
+
+    @Test
+    public void testRequestNewArtifactsInRepo()
+        throws Exception
+    {
+        RssFeedServlet servlet =
+            (RssFeedServlet) client.newInvocation( "http://localhost/feeds/test-repo" ).getServlet();
+        assertNotNull( servlet );
+
+        WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/test-repo" );
+
+        Base64 encoder = new Base64( 0, new byte[0] );
+        String userPass = "user1:password1";
+        String encodedUserPass = encoder.encodeToString( userPass.getBytes() );
+        request.setHeaderField( "Authorization", "BASIC " + encodedUserPass );
+
+        WebResponse response = client.getResponse( request );
+        assertEquals( RssFeedServlet.MIME_TYPE, response.getHeaderField( "CONTENT-TYPE" ) );
+        assertNotNull( "Should have recieved a response", response );
+        assertEquals( "Should have been an OK response code.", HttpServletResponse.SC_OK, response.getResponseCode() );
+
+    }
+
+    @Test
+    public void testRequestNewVersionsOfArtifact()
+        throws Exception
+    {
+        RssFeedServlet servlet = (RssFeedServlet) client.newInvocation(
+            "http://localhost/feeds/org/apache/archiva/artifact-two" ).getServlet();
+        assertNotNull( servlet );
+
+        WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/org/apache/archiva/artifact-two" );
+
+        Base64 encoder = new Base64( 0, new byte[0] );
+        String userPass = "user1:password1";
+        String encodedUserPass = encoder.encodeToString( userPass.getBytes() );
+        request.setHeaderField( "Authorization", "BASIC " + encodedUserPass );
+
+        WebResponse response = client.getResponse( request );
+        assertEquals( RssFeedServlet.MIME_TYPE, response.getHeaderField( "CONTENT-TYPE" ) );
+        assertNotNull( "Should have recieved a response", response );
+        assertEquals( "Should have been an OK response code.", HttpServletResponse.SC_OK, response.getResponseCode() );
+    }
+
+    @Ignore
+    public void XXX_testInvalidRequest()
+        throws Exception
+    {
+        RssFeedServlet servlet =
+            (RssFeedServlet) client.newInvocation( "http://localhost/feeds?invalid_param=xxx" ).getServlet();
+        assertNotNull( servlet );
+
+        try
+        {
+            WebResponse resp = client.getResponse( "http://localhost/feeds?invalid_param=xxx" );
+            assertEquals( HttpServletResponse.SC_BAD_REQUEST, resp.getResponseCode() );
+        }
+        catch ( HttpException he )
+        {
+            assertEquals( "Should have been a bad request response code.", HttpServletResponse.SC_BAD_REQUEST,
+                          he.getResponseCode() );
+        }
+    }
+
+    @Ignore
+    public void XXX_testInvalidAuthenticationRequest()
+        throws Exception
+    {
+        RssFeedServlet servlet =
+            (RssFeedServlet) client.newInvocation( "http://localhost/feeds/unauthorized-repo" ).getServlet();
+        assertNotNull( servlet );
+
+        WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/unauthorized-repo" );
+
+        Encoder encoder = new Base64();
+        String userPass = "unauthUser:unauthPass";
+        String encodedUserPass = new String( (byte[]) encoder.encode( userPass.getBytes() ) );
+        request.setHeaderField( "Authorization", "BASIC " + encodedUserPass );
+
+        try
+        {
+            WebResponse resp = client.getResponse( request );
+            assertEquals( HttpServletResponse.SC_UNAUTHORIZED, resp.getResponseCode() );
+        }
+        catch ( HttpException he )
+        {
+            assertEquals( "Should have been a unauthorized response.", HttpServletResponse.SC_UNAUTHORIZED,
+                          he.getResponseCode() );
+        }
+    }
+
+    @Ignore
+    public void XXX_testUnauthorizedRequest()
+        throws Exception
+    {
+        RssFeedServlet servlet =
+            (RssFeedServlet) client.newInvocation( "http://localhost/feeds/unauthorized-repo" ).getServlet();
+        assertNotNull( servlet );
+
+        WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/unauthorized-repo" );
+
+        Base64 encoder = new Base64( 0, new byte[0] );
+        String userPass = "user1:password1";
+        String encodedUserPass = encoder.encodeToString( userPass.getBytes() );
+        request.setHeaderField( "Authorization", "BASIC " + encodedUserPass );
+
+        try
+        {
+            WebResponse resp = client.getResponse( request );
+            assertEquals( HttpServletResponse.SC_UNAUTHORIZED, resp.getResponseCode() );
+        }
+        catch ( HttpException he )
+        {
+            assertEquals( "Should have been a unauthorized response.", HttpServletResponse.SC_UNAUTHORIZED,
+                          he.getResponseCode() );
+        }
+    }
+
+
+}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/web/rss/SecuritySystemStub.java
new file mode 100644 (file)
index 0000000..918816d
--- /dev/null
@@ -0,0 +1,588 @@
+package org.apache.archiva.web.rss;
+
+/*
+ * 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.codehaus.plexus.redback.authentication.AuthenticationDataSource;
+import org.codehaus.plexus.redback.authentication.AuthenticationException;
+import org.codehaus.plexus.redback.authentication.AuthenticationResult;
+import org.codehaus.plexus.redback.authorization.AuthorizationException;
+import org.codehaus.plexus.redback.authorization.AuthorizationResult;
+import org.codehaus.plexus.redback.keys.KeyManager;
+import org.codehaus.plexus.redback.policy.AccountLockedException;
+import org.codehaus.plexus.redback.policy.UserSecurityPolicy;
+import org.codehaus.plexus.redback.system.DefaultSecuritySession;
+import org.codehaus.plexus.redback.system.SecuritySession;
+import org.codehaus.plexus.redback.system.SecuritySystem;
+import org.codehaus.plexus.redback.users.User;
+import org.codehaus.plexus.redback.users.UserManager;
+import org.codehaus.plexus.redback.users.UserManagerListener;
+import org.codehaus.plexus.redback.users.UserNotFoundException;
+import org.codehaus.plexus.redback.users.UserQuery;
+import org.codehaus.plexus.redback.users.jdo.JdoUser;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * SecuritySystem stub used for testing.
+ *
+ * @version $Id$
+ */
+public class SecuritySystemStub
+    implements SecuritySystem
+{
+    Map<String, String> users = new HashMap<String, String>();
+
+    List<String> repoIds = new ArrayList<String>();
+
+    public SecuritySystemStub()
+    {
+        users.put( "user1", "password1" );
+        users.put( "user2", "password2" );
+        users.put( "user3", "password3" );
+
+        repoIds.add( "test-repo" );
+    }
+
+    public SecuritySession authenticate( AuthenticationDataSource source )
+        throws AuthenticationException, UserNotFoundException, AccountLockedException
+    {
+        AuthenticationResult result = null;
+        SecuritySession session = null;
+
+        if ( users.get( source.getPrincipal() ) != null )
+        {
+            result = new AuthenticationResult( true, source.getPrincipal(), null );
+
+            User user = new JdoUser();
+            user.setUsername( source.getPrincipal() );
+            user.setPassword( users.get( source.getPrincipal() ) );
+
+            session = new DefaultSecuritySession( result, user );
+        }
+        else
+        {
+            result = new AuthenticationResult( false, source.getPrincipal(), null );
+            session = new DefaultSecuritySession( result );
+        }
+        return session;
+    }
+
+    public AuthorizationResult authorize( SecuritySession arg0, Object arg1 )
+        throws AuthorizationException
+    {
+        return null;
+    }
+
+    public AuthorizationResult authorize( SecuritySession arg0, Object arg1, Object arg2 )
+        throws AuthorizationException
+    {
+        AuthorizationResult result = new AuthorizationResult( true, arg1, null );
+
+        return result;
+    }
+
+    public String getAuthenticatorId()
+    {
+        return null;
+    }
+
+    public String getAuthorizerId()
+    {
+        return null;
+    }
+
+    public KeyManager getKeyManager()
+    {
+        return null;
+    }
+
+    public UserSecurityPolicy getPolicy()
+    {
+        return null;
+    }
+
+    public String getUserManagementId()
+    {
+        return null;
+    }
+
+    public UserManager getUserManager()
+    {
+        return new UserManager()
+        {
+            public boolean isReadOnly()
+            {
+                return false;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public String getId()
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public void addUserManagerListener( UserManagerListener listener )
+            {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public void removeUserManagerListener( UserManagerListener listener )
+            {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User createUser( String username, String fullName, String emailAddress )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User createGuestUser()
+            {
+                return new User()
+                {
+                    public Object getPrincipal()
+                    {
+                        return "guest";
+                    }
+
+                    public String getUsername()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setUsername( String name )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getFullName()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setFullName( String name )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getEmail()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setEmail( String address )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getPassword()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPassword( String rawPassword )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getEncodedPassword()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setEncodedPassword( String encodedPassword )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public Date getLastPasswordChange()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setLastPasswordChange( Date passwordChangeDate )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public List<String> getPreviousEncodedPasswords()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPreviousEncodedPasswords( List<String> encodedPasswordList )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void addPreviousEncodedPassword( String encodedPassword )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isPermanent()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPermanent( boolean permanent )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isLocked()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setLocked( boolean locked )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isPasswordChangeRequired()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPasswordChangeRequired( boolean changeRequired )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isValidated()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setValidated( boolean valid )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public int getCountFailedLoginAttempts()
+                    {
+                        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setCountFailedLoginAttempts( int count )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public Date getAccountCreationDate()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setAccountCreationDate( Date date )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public Date getLastLoginDate()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setLastLoginDate( Date date )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+                };
+            }
+
+            public UserQuery createUserQuery()
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public List<User> getUsers()
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public List<User> getUsers( boolean orderAscending )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User addUser( User user )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User updateUser( User user )
+                throws UserNotFoundException
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User findUser( String username )
+                throws UserNotFoundException
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User getGuestUser()
+                throws UserNotFoundException
+            {
+                return new User()
+                {
+                    public Object getPrincipal()
+                    {
+                        return "guest";
+                    }
+
+                    public String getUsername()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setUsername( String name )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getFullName()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setFullName( String name )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getEmail()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setEmail( String address )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getPassword()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPassword( String rawPassword )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public String getEncodedPassword()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setEncodedPassword( String encodedPassword )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public Date getLastPasswordChange()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setLastPasswordChange( Date passwordChangeDate )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public List<String> getPreviousEncodedPasswords()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPreviousEncodedPasswords( List<String> encodedPasswordList )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void addPreviousEncodedPassword( String encodedPassword )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isPermanent()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPermanent( boolean permanent )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isLocked()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setLocked( boolean locked )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isPasswordChangeRequired()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setPasswordChangeRequired( boolean changeRequired )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public boolean isValidated()
+                    {
+                        return false;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setValidated( boolean valid )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public int getCountFailedLoginAttempts()
+                    {
+                        return 0;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setCountFailedLoginAttempts( int count )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public Date getAccountCreationDate()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setAccountCreationDate( Date date )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public Date getLastLoginDate()
+                    {
+                        return null;  //To change body of implemented methods use File | Settings | File Templates.
+                    }
+
+                    public void setLastLoginDate( Date date )
+                    {
+                        //To change body of implemented methods use File | Settings | File Templates.
+                    }
+                };
+            }
+
+            public List<User> findUsersByUsernameKey( String usernameKey, boolean orderAscending )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public List<User> findUsersByFullNameKey( String fullNameKey, boolean orderAscending )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public List<User> findUsersByEmailKey( String emailKey, boolean orderAscending )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public List<User> findUsersByQuery( UserQuery query )
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User findUser( Object principal )
+                throws UserNotFoundException
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public boolean userExists( Object principal )
+            {
+                return false;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public void deleteUser( Object principal )
+                throws UserNotFoundException
+            {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public void deleteUser( String username )
+                throws UserNotFoundException
+            {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public void addUserUnchecked( User user )
+            {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public void eraseDatabase()
+            {
+                //To change body of implemented methods use File | Settings | File Templates.
+            }
+
+            public User updateUser( User user, boolean passwordChangeRequired )
+                throws UserNotFoundException
+            {
+                return null;  //To change body of implemented methods use File | Settings | File Templates.
+            }
+        };
+    }
+
+    public boolean isAuthenticated( AuthenticationDataSource arg0 )
+        throws AuthenticationException, UserNotFoundException, AccountLockedException
+    {
+        return false;
+    }
+
+    public boolean isAuthorized( SecuritySession arg0, Object arg1 )
+        throws AuthorizationException
+    {
+        return false;
+    }
+
+    public boolean isAuthorized( SecuritySession arg0, Object arg1, Object arg2 )
+        throws AuthorizationException
+    {
+        if ( repoIds.contains( arg2 ) )
+        {
+            return true;
+        }
+
+        return false;
+    }
+
+}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataRepository.java
new file mode 100644 (file)
index 0000000..482637f
--- /dev/null
@@ -0,0 +1,224 @@
+package org.apache.archiva.webtest.memory;
+
+/*
+ * 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.model.ArtifactMetadata;
+import org.apache.archiva.metadata.model.MetadataFacet;
+import org.apache.archiva.metadata.model.ProjectMetadata;
+import org.apache.archiva.metadata.model.ProjectVersionMetadata;
+import org.apache.archiva.metadata.model.ProjectVersionReference;
+import org.apache.archiva.metadata.repository.MetadataRepository;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+public class TestMetadataRepository
+    implements MetadataRepository
+{
+    private static final String TEST_REPO = "test-repo";
+
+    private static final String TEST_NAMESPACE = "org.apache.archiva";
+
+    private List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>();
+
+    private List<String> versions = new ArrayList<String>();
+
+    public TestMetadataRepository()
+    {
+        Date whenGathered = new Date( 123456789 );
+
+        addArtifact( "artifact-one", "1.0", whenGathered );
+        addArtifact( "artifact-one", "1.1", whenGathered );
+        addArtifact( "artifact-one", "2.0", whenGathered );
+        addArtifact( "artifact-two", "1.0.1", whenGathered );
+        addArtifact( "artifact-two", "1.0.2", whenGathered );
+        addArtifact( "artifact-two", "1.0.3-SNAPSHOT", whenGathered );
+        addArtifact( "artifact-three", "2.0-SNAPSHOT", whenGathered );
+        addArtifact( "artifact-four", "1.1-beta-2", whenGathered );
+    }
+
+    private void addArtifact( String projectId, String projectVersion, Date whenGathered )
+    {
+        ArtifactMetadata artifact = new ArtifactMetadata();
+        artifact.setFileLastModified( System.currentTimeMillis() );
+        artifact.setNamespace( TEST_NAMESPACE );
+        artifact.setProjectVersion( projectVersion );
+        artifact.setVersion( projectVersion );
+        artifact.setId( projectId + "-" + projectVersion + ".jar" );
+        artifact.setProject( projectId );
+        artifact.setRepositoryId( TEST_REPO );
+        artifact.setWhenGathered( whenGathered );
+        artifacts.add( artifact );
+
+        versions.add( projectVersion );
+    }
+
+    public ProjectMetadata getProject( String repoId, String namespace, String projectId )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
+                                                     String projectVersion )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
+                                                   String projectVersion )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
+                                                                     String projectVersion )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public Collection<String> getRootNamespaces( String repoId )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public Collection<String> getNamespaces( String repoId, String namespace )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public Collection<String> getProjects( String repoId, String namespace )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
+    {
+        return versions;
+    }
+
+    public void updateProject( String repoId, ProjectMetadata project )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
+                                ArtifactMetadata artifactMeta )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void updateProjectVersion( String repoId, String namespace, String projectId,
+                                      ProjectVersionMetadata versionMetadata )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void updateNamespace( String repoId, String namespace )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public List<String> getMetadataFacets( String repodId, String facetId )
+    {
+        return Collections.emptyList();
+    }
+
+    public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void removeMetadataFacets( String repositoryId, String facetId )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public void removeMetadataFacet( String repoId, String facetId, String name )
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
+    {
+        return artifacts;
+    }
+
+    public Collection<String> getRepositories()
+    {
+        return Collections.singletonList( TEST_REPO );
+    }
+
+    public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void removeRepository( String repoId )
+    {
+        //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
+                                                      String projectVersion )
+    {
+        return artifacts;
+    }
+
+    public void save()
+    {
+    }
+
+    public void close()
+    {
+    }
+
+    public void revert()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    public boolean canObtainAccess( Class<?> aClass )
+    {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public Object obtainAccess( Class<?> aClass )
+    {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public List<ArtifactMetadata> getArtifacts( String repositoryId )
+    {
+        return artifacts;
+    }
+}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataResolver.java b/archiva-modules/archiva-web/archiva-web-common/src/test/java/org/apache/archiva/webtest/memory/TestMetadataResolver.java
new file mode 100644 (file)
index 0000000..2a5ba06
--- /dev/null
@@ -0,0 +1,160 @@
+package org.apache.archiva.webtest.memory;
+
+/*
+ * 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.model.ArtifactMetadata;
+import org.apache.archiva.metadata.model.ProjectVersionMetadata;
+import org.apache.archiva.metadata.model.ProjectVersionReference;
+import org.apache.archiva.metadata.repository.MetadataResolver;
+import org.apache.archiva.metadata.repository.RepositorySession;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class TestMetadataResolver
+    implements MetadataResolver
+{
+    private Map<String, ProjectVersionMetadata> projectVersions = new HashMap<String, ProjectVersionMetadata>();
+
+    private Map<String, List<ArtifactMetadata>> artifacts = new HashMap<String, List<ArtifactMetadata>>();
+
+    private Map<String, List<ProjectVersionReference>> references =
+        new HashMap<String, List<ProjectVersionReference>>();
+
+    private Map<String, List<String>> namespaces = new HashMap<String, List<String>>();
+
+    private Map<String, Collection<String>> projectsInNamespace = new HashMap<String, Collection<String>>();
+
+    private Map<String, Collection<String>> versionsInProject = new HashMap<String, Collection<String>>();
+
+    public ProjectVersionMetadata resolveProjectVersion( RepositorySession repositorySession, String repoId,
+                                                         String namespace, String projectId, String projectVersion )
+    {
+        return projectVersions.get( createMapKey( repoId, namespace, projectId, projectVersion ) );
+    }
+
+    public Collection<ProjectVersionReference> resolveProjectReferences( RepositorySession repositorySession,
+                                                                         String repoId, String namespace,
+                                                                         String projectId, String projectVersion )
+    {
+        Collection<ProjectVersionReference> projectVersionReferences =
+            references.get( createMapKey( repoId, namespace, projectId, projectVersion ) );
+        return projectVersionReferences;
+    }
+
+    public Collection<String> resolveRootNamespaces( RepositorySession repositorySession, String repoId )
+    {
+        return resolveNamespaces( repositorySession, repoId, null );
+    }
+
+    public Collection<String> resolveNamespaces( RepositorySession repositorySession, String repoId,
+                                                 String baseNamespace )
+    {
+        Set<String> namespaces = new LinkedHashSet<String>();
+        int fromIndex = baseNamespace != null ? baseNamespace.length() + 1 : 0;
+        for ( String namespace : this.namespaces.get( repoId ) )
+        {
+            if ( baseNamespace == null || namespace.startsWith( baseNamespace + "." ) )
+            {
+                int i = namespace.indexOf( '.', fromIndex );
+                if ( i >= 0 )
+                {
+                    namespaces.add( namespace.substring( fromIndex, i ) );
+                }
+                else
+                {
+                    namespaces.add( namespace.substring( fromIndex ) );
+                }
+            }
+        }
+        return namespaces;
+    }
+
+    public Collection<String> resolveProjects( RepositorySession repositorySession, String repoId, String namespace )
+    {
+        Collection<String> list = projectsInNamespace.get( namespace );
+        return list != null ? list : Collections.<String>emptyList();
+    }
+
+    public Collection<String> resolveProjectVersions( RepositorySession repositorySession, String repoId,
+                                                      String namespace, String projectId )
+    {
+        Collection<String> list = versionsInProject.get( namespace + ":" + projectId );
+        return list != null ? list : Collections.<String>emptyList();
+    }
+
+    public Collection<ArtifactMetadata> resolveArtifacts( RepositorySession repositorySession, String repoId,
+                                                          String namespace, String projectId, String projectVersion )
+    {
+        List<ArtifactMetadata> artifacts =
+            this.artifacts.get( createMapKey( repoId, namespace, projectId, projectVersion ) );
+        return ( artifacts != null ? artifacts : Collections.<ArtifactMetadata>emptyList() );
+    }
+
+    public void setProjectVersion( String repoId, String namespace, String projectId,
+                                   ProjectVersionMetadata versionMetadata )
+    {
+        projectVersions.put( createMapKey( repoId, namespace, projectId, versionMetadata.getId() ), versionMetadata );
+
+        Collection<String> projects = projectsInNamespace.get( namespace );
+        if ( projects == null )
+        {
+            projects = new LinkedHashSet<String>();
+            projectsInNamespace.put( namespace, projects );
+        }
+        projects.add( projectId );
+
+        String key = namespace + ":" + projectId;
+        Collection<String> versions = versionsInProject.get( key );
+        if ( versions == null )
+        {
+            versions = new LinkedHashSet<String>();
+            versionsInProject.put( key, versions );
+        }
+        versions.add( versionMetadata.getId() );
+    }
+
+    public void setArtifacts( String repoId, String namespace, String projectId, String projectVersion,
+                              List<ArtifactMetadata> artifacts )
+    {
+        this.artifacts.put( createMapKey( repoId, namespace, projectId, projectVersion ), artifacts );
+    }
+
+    private String createMapKey( String repoId, String namespace, String projectId, String projectVersion )
+    {
+        return repoId + ":" + namespace + ":" + projectId + ":" + projectVersion;
+    }
+
+    public void setProjectReferences( String repoId, String namespace, String projectId, String projectVersion,
+                                      List<ProjectVersionReference> references )
+    {
+        this.references.put( createMapKey( repoId, namespace, projectId, projectVersion ), references );
+    }
+
+    public void setNamespaces( String repoId, List<String> namespaces )
+    {
+        this.namespaces.put( repoId, namespaces );
+    }
+}
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
new file mode 100644 (file)
index 0000000..f311d97
--- /dev/null
@@ -0,0 +1,42 @@
+package org.apache.archiva.webtest.memory;
+
+/*
+ * 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.RepositorySession;
+import org.apache.archiva.metadata.repository.RepositorySessionFactory;
+import org.springframework.stereotype.Service;
+
+@Service("repositorySessionFactory#test")
+public class TestRepositorySessionFactory
+    implements RepositorySessionFactory
+{
+    private RepositorySession repositorySession;
+
+    public void setRepositorySession( RepositorySession repositorySession )
+    {
+        this.repositorySession = repositorySession;
+    }
+
+    public RepositorySession createSession()
+    {
+        return repositorySession != null ? repositorySession : new RepositorySession( new TestMetadataRepository(),
+                                                                                      new TestMetadataResolver() );
+    }
+}
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/empty-archiva.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/empty-archiva.xml
new file mode 100644 (file)
index 0000000..997d62b
--- /dev/null
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  ~ 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.
+  -->
+
+<configuration>
+
+  <version>2</version>
+  
+  <repositoryScanning>
+    <fileTypes>
+      <fileType>
+        <id>artifacts</id>
+        <patterns>
+          <pattern>**/*.pom</pattern>
+          <pattern>**/*.jar</pattern>
+          <pattern>**/*.ear</pattern>
+          <pattern>**/*.war</pattern>
+          <pattern>**/*.car</pattern>
+          <pattern>**/*.sar</pattern>
+          <pattern>**/*.mar</pattern>
+          <pattern>**/*.rar</pattern>
+          <pattern>**/*.dtd</pattern>
+          <pattern>**/*.tld</pattern>
+          <pattern>**/*.tar.gz</pattern>
+          <pattern>**/*.tar.bz2</pattern>
+          <pattern>**/*.zip</pattern>
+        </patterns>
+      </fileType>
+      <fileType>
+        <id>indexable-content</id>
+        <patterns>
+          <pattern>**/*.txt</pattern>
+          <pattern>**/*.TXT</pattern>
+          <pattern>**/*.block</pattern>
+          <pattern>**/*.config</pattern>
+          <pattern>**/*.pom</pattern>
+          <pattern>**/*.xml</pattern>
+          <pattern>**/*.xsd</pattern>
+          <pattern>**/*.dtd</pattern>
+          <pattern>**/*.tld</pattern>
+        </patterns>
+      </fileType>
+      <fileType>
+        <id>auto-remove</id>
+        <patterns>
+          <pattern>**/*.bak</pattern>
+          <pattern>**/*~</pattern>
+          <pattern>**/*-</pattern>
+        </patterns>
+      </fileType>
+      <fileType>
+        <id>ignored</id>
+        <patterns>
+          <pattern>**/.htaccess</pattern>
+          <pattern>**/KEYS</pattern>
+          <pattern>**/*.rb</pattern>
+          <pattern>**/*.sh</pattern>
+          <pattern>**/.svn/**</pattern>
+          <pattern>**/.DAV/**</pattern>
+        </patterns>
+      </fileType>
+    </fileTypes>
+    <knownContentConsumers>
+      <knownContentConsumer>update-db-artifact</knownContentConsumer>
+      <knownContentConsumer>create-missing-checksums</knownContentConsumer>
+      <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
+      <knownContentConsumer>validate-checksum</knownContentConsumer>
+      <knownContentConsumer>validate-signature</knownContentConsumer>
+      <knownContentConsumer>index-content</knownContentConsumer>
+      <knownContentConsumer>auto-remove</knownContentConsumer>
+      <knownContentConsumer>auto-rename</knownContentConsumer>
+    </knownContentConsumers>
+    <invalidContentConsumers>
+      <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
+    </invalidContentConsumers>
+  </repositoryScanning>
+
+  <databaseScanning>
+    <cronExpression>0 0 * * * ?</cronExpression>
+    <unprocessedConsumers>
+      <unprocessedConsumer>index-artifact</unprocessedConsumer>
+      <unprocessedConsumer>update-db-project</unprocessedConsumer>
+      <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
+      <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
+      <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
+      <unprocessedConsumer>index-public-methods</unprocessedConsumer>
+    </unprocessedConsumers>
+    <cleanupConsumers>
+      <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
+      <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
+      <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
+    </cleanupConsumers>
+  </databaseScanning>
+
+</configuration>
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/resources/log4j.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/resources/log4j.xml
new file mode 100644 (file)
index 0000000..aecb237
--- /dev/null
@@ -0,0 +1,40 @@
+<?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.
+  -->
+
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+  <appender name="console" class="org.apache.log4j.ConsoleAppender">
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
+    </layout>
+  </appender>
+  <logger name="org.apache.archiva.web">
+    <level value="debug"/>
+  </logger>
+
+
+  <root>
+    <priority value ="info" />
+    <appender-ref ref="console" />
+  </root>
+
+</log4j:configuration>
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
new file mode 100644 (file)
index 0000000..6e3dc3e
--- /dev/null
@@ -0,0 +1,69 @@
+<?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:property-placeholder system-properties-mode="OVERRIDE"/>
+
+  <context:annotation-config/>
+  <context:component-scan base-package="org.apache.archiva.webtest.memory"/>
+
+  <alias name="repositorySessionFactory#test" alias="repositorySessionFactory"/>
+
+  <bean name="userRepositories#test" class="org.apache.archiva.security.UserRepositoriesStub"/>
+
+  <alias name="userRepositories#test" alias="userRepositories"/>
+
+
+  <bean name="securitySystem#test" class="org.apache.archiva.web.rss.SecuritySystemStub"/>
+
+  <alias name="securitySystem#test" alias="securitySystem"/>
+
+  <bean name="archivaConfiguration#default"  class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
+    <property name="registry" ref="registry#default"/>
+  </bean>
+
+  <alias name="archivaConfiguration#default" alias="archivaConfiguration"/>
+
+  <bean name="registry#default" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
+    <property name="properties">
+      <value>
+        <![CDATA[
+        <configuration>
+          <system/>
+          <xml fileName="${test.resources.path}/empty-archiva.xml" config-forceCreate="true"
+               config-optional="true"
+               config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
+        </configuration>
+        ]]>
+      </value>
+    </property>
+  </bean>
+  
+  <bean name="RoleManagerStub" class="org.apache.archiva.web.rss.RoleManagerStub"/>
+
+</beans>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-web-common/src/test/webapp/WEB-INF/feedServletTest-web.xml b/archiva-modules/archiva-web/archiva-web-common/src/test/webapp/WEB-INF/feedServletTest-web.xml
new file mode 100644 (file)
index 0000000..ad7386b
--- /dev/null
@@ -0,0 +1,54 @@
+<?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.
+  -->
+
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+  <display-name>Apache Archiva</display-name>
+
+  <listener>
+    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+  </listener>
+
+  <context-param>
+    <param-name>contextClass</param-name>
+    <param-value>org.codehaus.redback.components.springutils.CachingWebApplicationContext</param-value>
+  </context-param>
+
+  <servlet>
+    <servlet-name>RssFeedServlet</servlet-name>
+    <servlet-class>org.apache.archiva.web.rss.RssFeedServlet</servlet-class>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>RssFeedServlet</servlet-name>
+    <url-pattern>/feeds/*</url-pattern>
+  </servlet-mapping>
+
+  <context-param>
+    <param-name>contextConfigLocation</param-name>
+    <param-value>
+      classpath*:/META-INF/spring-context.xml
+      classpath*:/spring-context-rss-servlet.xml
+    </param-value>
+  </context-param>
+
+</web-app>
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/pom.xml b/archiva-modules/archiva-web/archiva-webapp-common/pom.xml
deleted file mode 100644 (file)
index 7f19d81..0000000
+++ /dev/null
@@ -1,307 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-  ~ Licensed to the Apache Software Foundation (ASF) under one\r
-  ~ or more contributor license agreements.  See the NOTICE file\r
-  ~ distributed with this work for additional information\r
-  ~ regarding copyright ownership.  The ASF licenses this file\r
-  ~ to you under the Apache License, Version 2.0 (the\r
-  ~ "License"); you may not use this file except in compliance\r
-  ~ with the License.  You may obtain a copy of the License at\r
-  ~\r
-  ~   http://www.apache.org/licenses/LICENSE-2.0\r
-  ~\r
-  ~ Unless required by applicable law or agreed to in writing,\r
-  ~ software distributed under the License is distributed on an\r
-  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
-  ~ KIND, either express or implied.  See the License for the\r
-  ~ specific language governing permissions and limitations\r
-  ~ under the License.\r
-  -->\r
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
-  <modelVersion>4.0.0</modelVersion>\r
-  <parent>\r
-    <groupId>org.apache.archiva</groupId>\r
-    <artifactId>archiva-web</artifactId>\r
-    <version>1.4-M3-SNAPSHOT</version>\r
-  </parent>\r
-\r
-  <artifactId>archiva-webapp-common</artifactId>\r
-  <packaging>bundle</packaging>\r
-  <name>Archiva Web :: Webapp Common</name>\r
-\r
-  <dependencies>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>metadata-repository-api</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-configuration</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-security-common</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-rss</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-security</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.codehaus.redback</groupId>\r
-      <artifactId>redback-common-integrations</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>stax</groupId>\r
-          <artifactId>stax-api</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-plexus-bridge</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-scheduler-repository</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.codehaus.redback</groupId>\r
-      <artifactId>redback-rbac-model</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.codehaus.redback</groupId>\r
-      <artifactId>redback-rbac-role-manager</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.codehaus.redback</groupId>\r
-      <artifactId>redback-system</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>javax.servlet</groupId>\r
-      <artifactId>servlet-api</artifactId>\r
-      <scope>provided</scope>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.codehaus.redback.components</groupId>\r
-      <artifactId>spring-taskqueue</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.codehaus.redback.components</groupId>\r
-      <artifactId>spring-quartz</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.quartz-scheduler</groupId>\r
-      <artifactId>quartz</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>c3p0</groupId>\r
-          <artifactId>c3p0</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>javax.transaction</groupId>\r
-          <artifactId>jta</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.springframework</groupId>\r
-      <artifactId>spring-core</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.springframework</groupId>\r
-      <artifactId>spring-beans</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.springframework</groupId>\r
-      <artifactId>spring-context-support</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.springframework</groupId>\r
-      <artifactId>spring-web</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>httpunit</groupId>\r
-      <artifactId>httpunit</artifactId>\r
-      <scope>test</scope>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>junit</groupId>\r
-      <artifactId>junit</artifactId>\r
-      <scope>test</scope>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.slf4j</groupId>\r
-      <artifactId>slf4j-log4j12</artifactId>\r
-      <scope>test</scope>\r
-    </dependency>\r
-  </dependencies>\r
-\r
-  <build>\r
-    <resources>\r
-      <resource>\r
-        <directory>src/main/resources</directory>\r
-      </resource>\r
-      <resource>\r
-        <directory>src/main/filtered-resources</directory>\r
-        <filtering>true</filtering>\r
-      </resource>\r
-    </resources>\r
-    <plugins>\r
-      <plugin>\r
-        <groupId>org.apache.felix</groupId>\r
-        <artifactId>maven-bundle-plugin</artifactId>\r
-        <configuration>\r
-          <instructions>\r
-            <Bundle-SymbolicName>org.apache.archiva.webapp.common</Bundle-SymbolicName>\r
-            <Bundle-Version>${project.version}</Bundle-Version>\r
-            <Export-Package>\r
-              org.apache.archiva.web.spring;version=${project.version},\r
-              org.apache.archiva.web.startup;version=${project.version}\r
-            </Export-Package>\r
-            <Import-Package>\r
-              javax.annotation,\r
-              javax.inject,\r
-              javax.servlet,\r
-              javax.servlet.http,\r
-              org.apache.archiva.common;version=${project.version},\r
-              org.apache.archiva.common.plexusbridge;version=${project.version},\r
-              org.apache.archiva.configuration;version=${project.version},\r
-              org.apache.archiva.repository.events;version=${project.version},\r
-              org.apache.archiva.scheduler.repository;version=${project.version},\r
-              org.apache.archiva.security.common;version=${project.version},\r
-              org.apache.commons.collections;version="[3.2,4)",\r
-              org.apache.commons.lang;version="[2.4,3)",\r
-              org.apache.maven.index,\r
-              org.apache.maven.index.context,\r
-              org.codehaus.plexus.redback.rbac,\r
-              org.codehaus.plexus.redback.role,\r
-              org.codehaus.plexus.redback.system.check,\r
-              org.codehaus.plexus.registry,\r
-              org.codehaus.plexus.taskqueue,\r
-              org.codehaus.plexus.taskqueue.execution,\r
-              org.codehaus.redback.components.scheduler,\r
-              org.quartz;version="[2,3)",\r
-              org.slf4j;resolution:=optional,\r
-              org.springframework*;version="[3,4)",\r
-              org.springframework.web*;version="[3,4)",\r
-              com.sun.syndication.feed.synd,\r
-              com.sun.syndication.io,\r
-              org.apache.archiva.metadata.repository,\r
-              org.apache.archiva.rss.processor,\r
-              org.apache.archiva.security,\r
-              org.apache.commons.codec,\r
-              org.apache.commons.codec.binary,\r
-              org.codehaus.plexus.redback.authentication,\r
-              org.codehaus.plexus.redback.authorization,\r
-              org.codehaus.plexus.redback.policy,\r
-              org.codehaus.plexus.redback.system,\r
-              org.codehaus.plexus.redback.users,\r
-              org.codehaus.redback.integration.filter.authentication\r
-            </Import-Package>\r
-          </instructions>\r
-        </configuration>\r
-      </plugin>\r
-      <plugin>\r
-        <groupId>org.apache.maven.plugins</groupId>\r
-        <artifactId>maven-jar-plugin</artifactId>\r
-        <executions>\r
-          <execution>\r
-            <goals>\r
-              <goal>test-jar</goal>\r
-            </goals>\r
-          </execution>\r
-        </executions>\r
-      </plugin>\r
-      <plugin>\r
-        <groupId>org.apache.maven.plugins</groupId>\r
-        <artifactId>maven-surefire-plugin</artifactId>\r
-        <configuration>\r
-          <systemPropertyVariables>\r
-            <appserver.base>${project.build.directory}/appserver-base</appserver.base>\r
-            <plexus.home>${project.build.directory}/appserver-base</plexus.home>\r
-            <derby.system.home>${project.build.directory}/appserver-base</derby.system.home>\r
-            <archiva.user.configFileName>${basedir}/target/archiva.xml</archiva.user.configFileName>\r
-            <test.resources.path>${project.build.testOutputDirectory}</test.resources.path>\r
-            <redback.jdbc.url>${redbackTestJdbcUrl}</redback.jdbc.url>\r
-            <redback.jdbc.driver.name>${redbackTestJdbcDriver}</redback.jdbc.driver.name>\r
-            <basedir>${basedir}</basedir>\r
-          </systemPropertyVariables>\r
-        </configuration>\r
-      </plugin>\r
-    </plugins>\r
-  </build>\r
-\r
-  <profiles>\r
-    <profile>\r
-      <id>svn-buildnumber</id>\r
-      <activation>\r
-        <file>\r
-          <exists>.svn</exists>\r
-        </file>\r
-      </activation>\r
-      <build>\r
-        <plugins>\r
-          <plugin>\r
-            <groupId>org.codehaus.mojo</groupId>\r
-            <artifactId>buildnumber-maven-plugin</artifactId>\r
-            <executions>\r
-              <execution>\r
-                <phase>generate-resources</phase>\r
-                <goals>\r
-                  <goal>create</goal>\r
-                </goals>\r
-              </execution>\r
-            </executions>\r
-            <configuration>\r
-              <doCheck>false</doCheck>\r
-              <doUpdate>false</doUpdate>\r
-              <providerImplementations>\r
-                <svn>javasvn</svn>\r
-              </providerImplementations>\r
-            </configuration>\r
-          </plugin>\r
-        </plugins>\r
-      </build>\r
-    </profile>\r
-    <profile>\r
-      <id>non-canonical-buildnumber</id>\r
-      <activation>\r
-        <file>\r
-          <missing>.svn</missing>\r
-        </file>\r
-      </activation>\r
-      <build>\r
-        <plugins>\r
-          <plugin>\r
-            <groupId>org.codehaus.mojo</groupId>\r
-            <artifactId>buildnumber-maven-plugin</artifactId>\r
-            <executions>\r
-              <execution>\r
-                <phase>generate-resources</phase>\r
-                <goals>\r
-                  <goal>create</goal>\r
-                </goals>\r
-              </execution>\r
-            </executions>\r
-            <configuration>\r
-              <doCheck>false</doCheck>\r
-              <doUpdate>false</doUpdate>\r
-              <format>NON-CANONICAL_{0,date,yyyy-MM-dd_HH-mm}_{1}</format>\r
-              <items>\r
-                <item>timestamp</item>\r
-                <item>${user.name}</item>\r
-              </items>\r
-            </configuration>\r
-          </plugin>\r
-        </plugins>\r
-      </build>\r
-    </profile>\r
-  </profiles>\r
-\r
-\r
-</project>\r
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/main/filtered-resources/application.properties b/archiva-modules/archiva-web/archiva-webapp-common/src/main/filtered-resources/application.properties
deleted file mode 100644 (file)
index 12806aa..0000000
+++ /dev/null
@@ -1,22 +0,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.
-#
-user.agent=Apache Archiva/${project.version}
-archiva.version=${project.version}
-archiva.buildNumber=${buildNumber}
-archiva.timestamp=${timestamp}
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/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
deleted file mode 100644 (file)
index eb7bb00..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-package org.apache.archiva.web.rss;
-
-/*
- * 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 com.sun.syndication.feed.synd.SyndFeed;
-import com.sun.syndication.io.FeedException;
-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.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;
-import org.codehaus.plexus.redback.authorization.UnauthorizedException;
-import org.codehaus.plexus.redback.policy.AccountLockedException;
-import org.codehaus.plexus.redback.policy.MustChangePasswordException;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.users.UserManager;
-import org.codehaus.plexus.redback.users.UserNotFoundException;
-import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Servlet for handling rss feed requests.
- */
-public class RssFeedServlet
-    extends HttpServlet
-{
-    public static final String MIME_TYPE = "application/rss+xml; charset=UTF-8";
-
-    private static final String COULD_NOT_GENERATE_FEED_ERROR = "Could not generate feed";
-
-    private static final String COULD_NOT_AUTHENTICATE_USER = "Could not authenticate user";
-
-    private static final String USER_NOT_AUTHORIZED = "User not authorized to access feed.";
-
-    private Logger log = LoggerFactory.getLogger( RssFeedServlet.class );
-
-    private RssFeedProcessor processor;
-
-    private WebApplicationContext wac;
-
-    private UserRepositories userRepositories;
-
-    private ServletAuthenticator servletAuth;
-
-    private HttpAuthenticator httpAuth;
-
-    private RepositorySessionFactory repositorySessionFactory;
-
-    public void init( javax.servlet.ServletConfig servletConfig )
-        throws ServletException
-    {
-        super.init( servletConfig );
-        wac = WebApplicationContextUtils.getRequiredWebApplicationContext( servletConfig.getServletContext() );
-        userRepositories = wac.getBean( UserRepositories.class );
-        servletAuth = wac.getBean( ServletAuthenticator.class );
-        httpAuth = wac.getBean( "httpAuthenticator#basic", HttpAuthenticator.class );
-        // TODO: what if there are other types?
-        repositorySessionFactory = wac.getBean( "repositorySessionFactory", RepositorySessionFactory.class );
-    }
-
-    public void doGet( HttpServletRequest req, HttpServletResponse res )
-        throws ServletException, IOException
-    {
-        String repoId = null;
-        String groupId = null;
-        String artifactId = null;
-
-        String url = StringUtils.removeEnd( req.getRequestURL().toString(), "/" );
-        if ( StringUtils.countMatches( StringUtils.substringAfter( url, "feeds/" ), "/" ) > 0 )
-        {
-            artifactId = StringUtils.substringAfterLast( url, "/" );
-            groupId = StringUtils.substringBeforeLast( StringUtils.substringAfter( url, "feeds/" ), "/" );
-            groupId = StringUtils.replaceChars( groupId, '/', '.' );
-        }
-        else if ( StringUtils.countMatches( StringUtils.substringAfter( url, "feeds/" ), "/" ) == 0 )
-        {
-            repoId = StringUtils.substringAfterLast( url, "/" );
-        }
-        else
-        {
-            res.sendError( HttpServletResponse.SC_BAD_REQUEST, "Invalid request url." );
-            return;
-        }
-
-        try
-        {
-            Map<String, String> map = new HashMap<String, String>();
-            SyndFeed feed = null;
-
-            if ( isAllowed( req, repoId, groupId, artifactId ) )
-            {
-                if ( repoId != null )
-                {
-                    // new artifacts in repo feed request
-                    processor = wac.getBean( "rssFeedProcessor#new-artifacts", RssFeedProcessor.class );
-                    map.put( RssFeedProcessor.KEY_REPO_ID, repoId );
-                }
-                else if ( ( groupId != null ) && ( artifactId != null ) )
-                {
-                    // TODO: this only works for guest - we could pass in the list of repos
-                    // new versions of artifact feed request
-                    processor = wac.getBean( "rssFeedProcessor#new-versions", RssFeedProcessor.class );
-                    map.put( RssFeedProcessor.KEY_GROUP_ID, groupId );
-                    map.put( RssFeedProcessor.KEY_ARTIFACT_ID, artifactId );
-                }
-            }
-            else
-            {
-                res.sendError( HttpServletResponse.SC_UNAUTHORIZED, USER_NOT_AUTHORIZED );
-                return;
-            }
-
-            RepositorySession repositorySession = repositorySessionFactory.createSession();
-            try
-            {
-                feed = processor.process( map, repositorySession.getRepository() );
-            }
-            finally
-            {
-                repositorySession.close();
-            }
-            if ( feed == null )
-            {
-                res.sendError( HttpServletResponse.SC_NO_CONTENT, "No information available." );
-                return;
-            }
-
-            res.setContentType( MIME_TYPE );
-
-            if ( repoId != null )
-            {
-                feed.setLink( req.getRequestURL().toString() );
-            }
-            else if ( ( groupId != null ) && ( artifactId != null ) )
-            {
-                feed.setLink( req.getRequestURL().toString() );
-            }
-
-            SyndFeedOutput output = new SyndFeedOutput();
-            output.output( feed, res.getWriter() );
-        }
-        catch ( UserNotFoundException unfe )
-        {
-            log.debug( COULD_NOT_AUTHENTICATE_USER, unfe );
-            res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
-        }
-        catch ( AccountLockedException acce )
-        {
-            res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
-        }
-        catch ( AuthenticationException authe )
-        {
-            log.debug( COULD_NOT_AUTHENTICATE_USER, authe );
-            res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
-        }
-        catch ( FeedException ex )
-        {
-            log.debug( COULD_NOT_GENERATE_FEED_ERROR, ex );
-            res.sendError( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, COULD_NOT_GENERATE_FEED_ERROR );
-        }
-        catch ( MustChangePasswordException e )
-        {
-            res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
-        }
-        catch ( UnauthorizedException e )
-        {
-            log.debug( e.getMessage() );
-            if ( repoId != null )
-            {
-                res.setHeader( "WWW-Authenticate",
-                               "Basic realm=\"Repository Archiva Managed " + repoId + " Repository" );
-            }
-            else
-            {
-                res.setHeader( "WWW-Authenticate", "Basic realm=\"Artifact " + groupId + ":" + artifactId );
-            }
-
-            res.sendError( HttpServletResponse.SC_UNAUTHORIZED, USER_NOT_AUTHORIZED );
-        }
-    }
-
-    /**
-     * Basic authentication.
-     *
-     * @param req
-     * @param repositoryId TODO
-     * @param groupId      TODO
-     * @param artifactId   TODO
-     * @return
-     */
-    private boolean isAllowed( HttpServletRequest req, String repositoryId, String groupId, String artifactId )
-        throws UserNotFoundException, AccountLockedException, AuthenticationException, MustChangePasswordException,
-        UnauthorizedException
-    {
-        String auth = req.getHeader( "Authorization" );
-        List<String> repoIds = new ArrayList<String>();
-
-        if ( repositoryId != null )
-        {
-            repoIds.add( repositoryId );
-        }
-        else if ( artifactId != null && groupId != null )
-        {
-            if ( auth != null )
-            {
-                if ( !auth.toUpperCase().startsWith( "BASIC " ) )
-                {
-                    return false;
-                }
-
-                Decoder dec = new Base64();
-                String usernamePassword = "";
-
-                try
-                {
-                    usernamePassword = new String( (byte[]) dec.decode( auth.substring( 6 ).getBytes() ) );
-                }
-                catch ( DecoderException ie )
-                {
-                    log.warn( "Error decoding username and password.", ie.getMessage() );
-                }
-
-                if ( usernamePassword == null || usernamePassword.trim().equals( "" ) )
-                {
-                    repoIds = getObservableRepos( UserManager.GUEST_USERNAME );
-                }
-                else
-                {
-                    String[] userCredentials = usernamePassword.split( ":" );
-                    repoIds = getObservableRepos( userCredentials[0] );
-                }
-            }
-            else
-            {
-                repoIds = getObservableRepos( UserManager.GUEST_USERNAME );
-            }
-        }
-        else
-        {
-            return false;
-        }
-
-        for ( String repoId : repoIds )
-        {
-            try
-            {
-                AuthenticationResult result = httpAuth.getAuthenticationResult( req, null );
-                SecuritySession securitySession = httpAuth.getSecuritySession( req.getSession( true ) );
-
-                if ( servletAuth.isAuthenticated( req, result ) && servletAuth.isAuthorized( req, securitySession,
-                                                                                             repoId,
-                                                                                             ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS ) )
-                {
-                    return true;
-                }
-            }
-            catch ( AuthorizationException e )
-            {
-
-            }
-            catch ( UnauthorizedException e )
-            {
-
-            }
-        }
-
-        throw new UnauthorizedException( "Access denied." );
-    }
-
-    private List<String> getObservableRepos( String principal )
-    {
-        try
-        {
-            return userRepositories.getObservableRepositoryIds( principal );
-        }
-        catch ( PrincipalNotFoundException e )
-        {
-            log.warn( e.getMessage(), e );
-        }
-        catch ( AccessDeniedException e )
-        {
-            log.warn( e.getMessage(), e );
-        }
-        catch ( ArchivaSecurityException e )
-        {
-            log.warn( e.getMessage(), e );
-        }
-
-        return Collections.emptyList();
-    }
-
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/runtime/ArchivaRuntimeInfo.java b/archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/runtime/ArchivaRuntimeInfo.java
deleted file mode 100644 (file)
index 23f013b..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.apache.archiva.web.runtime;
-/*
- * 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.commons.lang.math.NumberUtils;
-import org.springframework.stereotype.Service;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.util.Properties;
-
-/**
- * @author Olivier Lamy
- * @since 1.4-M3
- */
-@Service( "archivaRuntimeInfo" )
-public class ArchivaRuntimeInfo
-{
-
-    private String version;
-
-    private String buildNumber;
-
-    private long timestamp;
-
-
-    @Inject
-    public ArchivaRuntimeInfo( @Named( value = "archivaRuntimeProperties" ) Properties archivaRuntimeProperties )
-    {
-        this.version = (String) archivaRuntimeProperties.get( "archiva.version" );
-        this.buildNumber = (String) archivaRuntimeProperties.get( "archiva.buildNumber" );
-        this.timestamp = NumberUtils.createLong( (String) archivaRuntimeProperties.get( "archiva.timestamp" ) );
-    }
-
-    public String getVersion()
-    {
-        return version;
-    }
-
-    public void setVersion( String version )
-    {
-        this.version = version;
-    }
-
-    public String getBuildNumber()
-    {
-        return buildNumber;
-    }
-
-    public void setBuildNumber( String buildNumber )
-    {
-        this.buildNumber = buildNumber;
-    }
-
-    public long getTimestamp()
-    {
-        return timestamp;
-    }
-
-    public void setTimestamp( long timestamp )
-    {
-        this.timestamp = timestamp;
-    }
-
-    @Override
-    public String toString()
-    {
-        final StringBuilder sb = new StringBuilder();
-        sb.append( "ArchivaRuntimeInfo" );
-        sb.append( "{version='" ).append( version ).append( '\'' );
-        sb.append( ", buildNumber='" ).append( buildNumber ).append( '\'' );
-        sb.append( ", timestamp=" ).append( timestamp );
-        sb.append( '}' );
-        return sb.toString();
-    }
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/spring/RepositoryListenerFactoryBean.java b/archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/spring/RepositoryListenerFactoryBean.java
deleted file mode 100644 (file)
index 5822902..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.apache.archiva.web.spring;
-
-/*
- * 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.repository.events.RepositoryListener;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.FactoryBean;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-import java.util.List;
-
-/**
- * @todo though we will eventually remove this altogether, an interim cleanup would be to genericise this
- * and replace the calls in RepositoryContentConsumers with calls to the same thing
- */
-public class RepositoryListenerFactoryBean
-    implements FactoryBean, ApplicationContextAware
-{
-
-    private ApplicationContext applicationContext;
-
-    public void setApplicationContext( ApplicationContext applicationContext )
-        throws BeansException
-    {
-        this.applicationContext = applicationContext;
-    }
-
-    public Object getObject()
-        throws Exception
-    {
-        return applicationContext.getBeansOfType( RepositoryListener.class ).values();
-    }
-
-    @SuppressWarnings("unchecked")
-    public Class<List> getObjectType()
-    {
-        return List.class;
-    }
-
-    public boolean isSingleton()
-    {
-        return true;
-    }
-
-    
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java b/archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/startup/ArchivaStartup.java
deleted file mode 100644 (file)
index 46aca0b..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.apache.archiva.web.startup;
-
-/*
- * 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.common.ArchivaException;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
-import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
-import org.apache.maven.index.NexusIndexer;
-import org.apache.maven.index.context.IndexingContext;
-import org.codehaus.plexus.taskqueue.Task;
-import org.codehaus.plexus.taskqueue.execution.ThreadedTaskQueueExecutor;
-import org.codehaus.redback.components.scheduler.DefaultScheduler;
-import org.quartz.SchedulerException;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import java.lang.reflect.Field;
-import java.util.Properties;
-import java.util.concurrent.ExecutorService;
-
-/**
- * ArchivaStartup - the startup of all archiva features in a deterministic order.
- *
- * @version $Id$
- */
-public class ArchivaStartup
-    implements ServletContextListener
-{
-    private ThreadedTaskQueueExecutor tqeDbScanning;
-
-    private ThreadedTaskQueueExecutor tqeRepoScanning;
-
-    private ThreadedTaskQueueExecutor tqeIndexing;
-
-    private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
-
-    private PlexusSisuBridge plexusSisuBridge;
-
-    private NexusIndexer nexusIndexer;
-
-    public void contextInitialized( ServletContextEvent contextEvent )
-    {
-        WebApplicationContext wac =
-            WebApplicationContextUtils.getRequiredWebApplicationContext( contextEvent.getServletContext() );
-
-        SecuritySynchronization securitySync = wac.getBean( SecuritySynchronization.class );
-
-        repositoryTaskScheduler =
-            wac.getBean( "archivaTaskScheduler#repository", RepositoryArchivaTaskScheduler.class );
-
-        Properties archivaRuntimeProperties = wac.getBean( "archivaRuntimeProperties", Properties.class );
-
-        tqeRepoScanning = wac.getBean( "taskQueueExecutor#repository-scanning", ThreadedTaskQueueExecutor.class );
-
-        tqeIndexing = wac.getBean( "taskQueueExecutor#indexing", ThreadedTaskQueueExecutor.class );
-
-        plexusSisuBridge = wac.getBean( PlexusSisuBridge.class );
-
-        try
-        {
-            nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
-        }
-        catch ( PlexusSisuBridgeException e )
-        {
-            throw new RuntimeException( "Unable to get NexusIndexer: " + e.getMessage(), e );
-        }
-        try
-        {
-            securitySync.startup();
-            repositoryTaskScheduler.startup();
-            Banner.display( (String) archivaRuntimeProperties.get( "archiva.version" ) );
-        }
-        catch ( ArchivaException e )
-        {
-            throw new RuntimeException( "Unable to properly startup archiva: " + e.getMessage(), e );
-        }
-    }
-
-    public void contextDestroyed( ServletContextEvent contextEvent )
-    {
-        WebApplicationContext applicationContext =
-            WebApplicationContextUtils.getRequiredWebApplicationContext( contextEvent.getServletContext() );
-
-        // TODO check this stop
-
-        /*
-        if ( applicationContext != null && applicationContext instanceof ClassPathXmlApplicationContext )
-        {
-            ( (ClassPathXmlApplicationContext) applicationContext ).close();
-        } */
-
-        if ( applicationContext != null ) //&& applicationContext instanceof PlexusWebApplicationContext )
-        {
-            // stop task queue executors
-            stopTaskQueueExecutor( tqeDbScanning );
-            stopTaskQueueExecutor( tqeRepoScanning );
-            stopTaskQueueExecutor( tqeIndexing );
-
-            // stop the DefaultArchivaTaskScheduler and its scheduler
-            if ( repositoryTaskScheduler != null )
-            {
-                try
-                {
-                    repositoryTaskScheduler.stop();
-                }
-                catch ( SchedulerException e )
-                {
-                    e.printStackTrace();
-                }
-
-                try
-                {
-                    // shutdown the scheduler, otherwise Quartz scheduler and Threads still exists
-                    Field schedulerField = repositoryTaskScheduler.getClass().getDeclaredField( "scheduler" );
-                    schedulerField.setAccessible( true );
-
-                    DefaultScheduler scheduler = (DefaultScheduler) schedulerField.get( repositoryTaskScheduler );
-                    scheduler.stop();
-                }
-                catch ( Exception e )
-                {
-                    e.printStackTrace();
-                }
-            }
-
-            // close the application context
-            //applicationContext.close();
-            // TODO fix close call
-            //applicationContext.
-        }
-
-        // closing correctly indexer to close correctly lock and file
-        for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
-        {
-            try
-            {
-                indexingContext.close( false );
-            }
-            catch ( Exception e )
-            {
-                contextEvent.getServletContext().log( "skip error closing indexingContext " + e.getMessage() );
-            }
-        }
-
-    }
-
-    private void stopTaskQueueExecutor( ThreadedTaskQueueExecutor taskQueueExecutor )
-    {
-        if ( taskQueueExecutor != null )
-        {
-            Task currentTask = taskQueueExecutor.getCurrentTask();
-            if ( currentTask != null )
-            {
-                taskQueueExecutor.cancelTask( currentTask );
-            }
-
-            try
-            {
-                taskQueueExecutor.stop();
-                ExecutorService service = getExecutorServiceForTTQE( taskQueueExecutor );
-                if ( service != null )
-                {
-                    service.shutdown();
-                }
-            }
-            catch ( Exception e )
-            {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    private ExecutorService getExecutorServiceForTTQE( ThreadedTaskQueueExecutor ttqe )
-    {
-        ExecutorService service = null;
-        try
-        {
-            Field executorServiceField = ttqe.getClass().getDeclaredField( "executorService" );
-            executorServiceField.setAccessible( true );
-            service = (ExecutorService) executorServiceField.get( ttqe );
-        }
-        catch ( Exception e )
-        {
-            e.printStackTrace();
-        }
-        return service;
-    }
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/startup/Banner.java b/archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/startup/Banner.java
deleted file mode 100644 (file)
index 343358f..0000000
+++ /dev/null
@@ -1,229 +0,0 @@
-package org.apache.archiva.web.startup;
-
-/*
- * 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.commons.lang.StringUtils;
-import org.slf4j.LoggerFactory;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Banner 
- *
- * @version $Id$
- */
-public class Banner
-{
-    private static final String eol = System.getProperty("line.separator");
-
-    public static String encode( String raw )
-    {
-        // Canonicalize line ends to make them easier to process
-        raw = raw.replace("\r\n", "\n").replace("\r", "\n");
-
-        StringBuilder encoded = new StringBuilder();
-        int rawlen = raw.length();
-
-        for ( int i = 0; i < rawlen; i++ )
-        {
-            char c = raw.charAt( i );
-            if ( c == '\\' )
-            {
-                encoded.append( "$." );
-            }
-            else if ( c == '$' )
-            {
-                encoded.append( "$$" );
-            }
-            else if ( c == '\n' )
-            {
-                encoded.append( "$n" );
-            }
-            else if ( Character.isDigit( c ) )
-            {
-                encoded.append( c );
-            }
-            else if ( Character.isLetter( c ) )
-            {
-                encoded.append( rot13( c ) );
-            }
-            else if ( i < raw.length() - 1 )
-            {
-                char nc;
-                boolean done = false;
-                int count = 0;
-                for ( int n = i; !done; n++ )
-                {
-                    if ( n >= rawlen )
-                    {
-                        break;
-                    }
-
-                    nc = raw.charAt( n );
-
-                    if ( nc != c )
-                    {
-                        done = true;
-                    }
-                    else
-                    {
-                        count++;
-                    }
-                }
-                if ( count < 3 )
-                {
-                    encoded.append( c );
-                }
-                else
-                {
-                    encoded.append( "$" ).append( String.valueOf( count ) ).append( c );
-                    i += count - 1;
-                }
-            }
-            else
-            {
-                encoded.append( c );
-            }
-        }
-
-        return encoded.toString();
-    }
-
-    public static String decode( String encoded )
-    {
-        StringBuilder decoded = new StringBuilder();
-        int enlen = encoded.length();
-        for ( int i = 0; i < enlen; i++ )
-        {
-            char c = encoded.charAt( i );
-            if ( c == '$' )
-            {
-                char nc = encoded.charAt( i + 1 );
-                if ( nc == '$' )
-                {
-                    decoded.append( '$' );
-                    i++;
-                }
-                else if ( nc == '.' )
-                {
-                    decoded.append( '\\' );
-                    i++;
-                }
-                else if ( nc == 'n' )
-                {
-                    decoded.append( eol );
-                    i++;
-                }
-                else if ( Character.isDigit( nc ) )
-                {
-                    int count = 0;
-                    int nn = i + 1;
-                    while ( Character.isDigit( nc ) )
-                    {
-                        count = ( count * 10 );
-                        count += ( nc - '0' );
-                        nc = encoded.charAt( ++nn );
-                    }
-                    for ( int d = 0; d < count; d++ )
-                    {
-                        decoded.append( nc );
-                    }
-                    i = nn;
-                }
-            }
-            else if ( Character.isLetter( c ) )
-            {
-                decoded.append( rot13( c ) );
-            }
-            else
-            {
-                decoded.append( c );
-            }
-        }
-
-        return decoded.toString();
-    }
-
-    private static char rot13( char c )
-    {
-        if ( ( c >= 'a' ) && ( c <= 'z' ) )
-        {
-            char dc = c += 13;
-            if ( dc > 'z' )
-            {
-                dc -= 26;
-            }
-            return dc;
-        }
-        else if ( ( c >= 'A' ) && ( c <= 'Z' ) )
-        {
-            char dc = c += 13;
-            if ( dc > 'Z' )
-            {
-                dc -= 26;
-            }
-            return dc;
-        }
-        else
-        {
-            return c;
-        }
-    }
-
-    public static String injectVersion( String text, String version )
-    {
-        Pattern pat = Pattern.compile( "#{2,}" );
-        Matcher mat = pat.matcher( text );
-        StringBuilder ret = new StringBuilder();
-        int off = 0;
-
-        while ( mat.find( off ) )
-        {
-            ret.append( text.substring( off, mat.start() ) );
-            String repl = mat.group();
-            ret.append( StringUtils.center( version, repl.length() ) );
-            off = mat.end();
-        }
-
-        ret.append( text.substring( off ) );
-
-        return ret.toString();
-    }
-
-    public static String getBanner( String version )
-    {
-        String encodedBanner = "$26 $34_$n$15 /$._$7 /$34 $.$n$14 /`/@),$4 |  Ba" +
-                " orunys bs nyy bs gur nycnpnf   |$n$14 |  (~'  __| gbvyvat njnl ba " +
-                "gur Ncnpur Nepuvin |$n$6 _,--.$3_/  |$4 $.$5  cebwrpg grnz, V jbhyq y" +
-                "vxr gb$3 |$n$4 ,' ,$5 ($3 |$5 $.$5     jrypbzr lbh gb Nepuvin$6 |$" +
-                "n$4 |  ($6 $.  /$6 |  $32#  |$n$5 $.  )$._/  ,_/$7 |$36 |$n$5 / /$3 " +
-                "( |/$9 |     uggc://nepuvin.ncnpur.bet/     |$n$4 ( |$4 ( |$10 |     hf" +
-                "ref@nepuvin.ncnpur.bet$7 |$n$5 $.|$5 $.|$11 $.$34_/$n$n";
-
-        return injectVersion( decode( encodedBanner ), version );
-    }
-
-    public static void display( String version )
-    {
-        String banner = getBanner( version );
-        LoggerFactory.getLogger( Banner.class ).info( StringUtils.repeat( "_", 25 ) + eol + banner );
-    }
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java b/archiva-modules/archiva-web/archiva-webapp-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java
deleted file mode 100644 (file)
index 76d81fe..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-package org.apache.archiva.web.startup;
-
-/*
- * 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.common.ArchivaException;
-import org.apache.archiva.configuration.ArchivaConfiguration;
-import org.apache.archiva.configuration.ConfigurationNames;
-import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.archiva.security.common.ArchivaRoleConstants;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang.StringUtils;
-import org.codehaus.plexus.redback.rbac.RBACManager;
-import org.codehaus.plexus.redback.rbac.RbacManagerException;
-import org.codehaus.plexus.redback.rbac.UserAssignment;
-import org.codehaus.plexus.redback.role.RoleManager;
-import org.codehaus.plexus.redback.role.RoleManagerException;
-import org.codehaus.plexus.redback.system.check.EnvironmentCheck;
-import org.codehaus.plexus.redback.users.UserManager;
-import org.codehaus.plexus.registry.Registry;
-import org.codehaus.plexus.registry.RegistryListener;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-import javax.inject.Named;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-/**
- * ConfigurationSynchronization
- *
- * @version $Id$
- */
-@Service
-public class SecuritySynchronization
-    implements RegistryListener
-{
-    private Logger log = LoggerFactory.getLogger( SecuritySynchronization.class );
-
-    @Inject
-    private RoleManager roleManager;
-
-    @Inject
-    @Named( value = "rBACManager#cached" )
-    private RBACManager rbacManager;
-
-    private Map<String, EnvironmentCheck> checkers;
-
-    @Inject
-    private ArchivaConfiguration archivaConfiguration;
-
-    @Inject
-    private ApplicationContext applicationContext;
-
-    @PostConstruct
-    public void initialize()
-    {
-        checkers = getBeansOfType( EnvironmentCheck.class );
-    }
-
-    protected <T> Map<String, T> getBeansOfType( Class<T> clazz )
-    {
-        //TODO do some caching here !!!
-        // olamy : with plexus we get only roleHint
-        // as per convention we named spring bean role#hint remove role# if exists
-        Map<String, T> springBeans = applicationContext.getBeansOfType( clazz );
-
-        Map<String, T> beans = new HashMap<String, T>( springBeans.size() );
-
-        for ( Entry<String, T> entry : springBeans.entrySet() )
-        {
-            String key = StringUtils.substringAfterLast( entry.getKey(), "#" );
-            beans.put( key, entry.getValue() );
-        }
-        return beans;
-    }
-
-    public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
-    {
-        if ( ConfigurationNames.isManagedRepositories( propertyName ) )
-        {
-            synchConfiguration( archivaConfiguration.getConfiguration().getManagedRepositories() );
-        }
-    }
-
-    public void beforeConfigurationChange( Registry registry, String propertyName, Object propertyValue )
-    {
-        /* do nothing */
-    }
-
-    private void synchConfiguration( List<ManagedRepositoryConfiguration> repos )
-    {
-        // NOTE: Remote Repositories do not have roles or security placed around them.
-
-        for ( ManagedRepositoryConfiguration repoConfig : repos )
-        {
-            // manage roles for repositories
-            try
-            {
-                if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
-                                                       repoConfig.getId() ) )
-                {
-                    roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
-                                                     repoConfig.getId() );
-                }
-                else
-                {
-                    roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
-                                                     repoConfig.getId() );
-                }
-
-                if ( !roleManager.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
-                                                       repoConfig.getId() ) )
-                {
-                    roleManager.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
-                                                     repoConfig.getId() );
-                }
-                else
-                {
-                    roleManager.verifyTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER,
-                                                     repoConfig.getId() );
-                }
-            }
-            catch ( RoleManagerException e )
-            {
-                // Log error.
-                log.error( "Unable to create roles for configured repositories: " + e.getMessage(), e );
-            }
-        }
-    }
-
-    public void startup()
-        throws ArchivaException
-    {
-        executeEnvironmentChecks();
-
-        synchConfiguration( archivaConfiguration.getConfiguration().getManagedRepositories() );
-        archivaConfiguration.addChangeListener( this );
-
-        if ( archivaConfiguration.isDefaulted() )
-        {
-            assignRepositoryObserverToGuestUser( archivaConfiguration.getConfiguration().getManagedRepositories() );
-        }
-    }
-
-    private void executeEnvironmentChecks()
-        throws ArchivaException
-    {
-        if ( ( checkers == null ) || CollectionUtils.isEmpty( checkers.values() ) )
-        {
-            throw new ArchivaException(
-                "Unable to initialize the Redback Security Environment, " + "no Environment Check components found." );
-        }
-
-        List<String> violations = new ArrayList<String>();
-
-        for ( Entry<String, EnvironmentCheck> entry : checkers.entrySet() )
-        {
-            EnvironmentCheck check = entry.getValue();
-            List<String> v = new ArrayList<String>();
-            check.validateEnvironment( v );
-            log.info( "Environment Check: " + entry.getKey() + " -> " + v.size() + " violation(s)" );
-            for ( String s : v )
-            {
-                violations.add( "[" + entry.getKey() + "] " + s );
-            }
-        }
-
-        if ( CollectionUtils.isNotEmpty( violations ) )
-        {
-            StringBuilder msg = new StringBuilder();
-            msg.append( "EnvironmentCheck Failure.\n" );
-            msg.append( "======================================================================\n" );
-            msg.append( " ENVIRONMENT FAILURE !! \n" );
-            msg.append( "\n" );
-
-            for ( String violation : violations )
-            {
-                msg.append( violation ).append( "\n" );
-            }
-
-            msg.append( "\n" );
-            msg.append( "======================================================================" );
-            log.error( msg.toString() );
-
-            throw new ArchivaException( "Unable to initialize Redback Security Environment, [" + violations.size()
-                                            + "] violation(s) encountered, See log for details." );
-        }
-    }
-
-    private void assignRepositoryObserverToGuestUser( List<ManagedRepositoryConfiguration> repos )
-    {
-        for ( ManagedRepositoryConfiguration repoConfig : repos )
-        {
-            String repoId = repoConfig.getId();
-
-            String principal = UserManager.GUEST_USERNAME;
-
-            try
-            {
-                UserAssignment ua;
-
-                if ( rbacManager.userAssignmentExists( principal ) )
-                {
-                    ua = rbacManager.getUserAssignment( principal );
-                }
-                else
-                {
-                    ua = rbacManager.createUserAssignment( principal );
-                }
-
-                ua.addRoleName( ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ) );
-                rbacManager.saveUserAssignment( ua );
-            }
-            catch ( RbacManagerException e )
-            {
-                log.warn( "Unable to add role [" + ArchivaRoleConstants.toRepositoryObserverRoleName( repoId ) + "] to "
-                              + principal + " user.", e );
-            }
-        }
-    }
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/META-INF/spring-context.xml b/archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/META-INF/spring-context.xml
deleted file mode 100755 (executable)
index 261b885..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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"
-       xmlns:util="http://www.springframework.org/schema/util"
-       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
-           http://www.springframework.org/schema/util
-           http://www.springframework.org/schema/util/spring-util-3.0.xsd"
-       default-lazy-init="true">
-
-  <context:annotation-config/>
-  <context:component-scan base-package="org.apache.archiva.web.spring, org.apache.archiva.web.startup, org.apache.archiva.web.runtime"/>
-
-  <util:properties id="archivaRuntimeProperties" location="classpath:application.properties" />
-
-</beans>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/org/apache/archiva/i18n/default.properties b/archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/org/apache/archiva/i18n/default.properties
deleted file mode 100644 (file)
index 22d5265..0000000
+++ /dev/null
@@ -1,21 +0,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.
-#
-# --------------------------------------------------------------------
-#  Archiva webapp i18n default en file
-# --------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/org/apache/archiva/i18n/default_fr.properties b/archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/org/apache/archiva/i18n/default_fr.properties
deleted file mode 100644 (file)
index 9ad0368..0000000
+++ /dev/null
@@ -1,21 +0,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.
-#
-# --------------------------------------------------------------------
-#  Archiva webapp i18n fr file
-# --------------------------------------------------------------------
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/org/apache/archiva/security.properties b/archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/org/apache/archiva/security.properties
deleted file mode 100644 (file)
index 2074ef0..0000000
+++ /dev/null
@@ -1,27 +0,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.
-#
-
-# --------------------------------------------------------------------
-# Email Settings
-
-# The subject line for the email message.
-email.validation.subject=Welcome to Archiva
-
-# Feedback page
-email.feedback.path=http://archiva.apache.org/mail-lists.html
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/org/apache/archiva/security_en.properties b/archiva-modules/archiva-web/archiva-webapp-common/src/main/resources/org/apache/archiva/security_en.properties
deleted file mode 100644 (file)
index 661b0cb..0000000
+++ /dev/null
@@ -1,20 +0,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.
-#
-
-
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/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
deleted file mode 100644 (file)
index 3e8cf50..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.apache.archiva.security;
-
-/*
- * 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 java.util.Collections;
-import java.util.List;
-
-/**
- * UserRepositories stub used for testing.
- *
- * @version $Id$
- */
-public class UserRepositoriesStub
-    implements UserRepositories
-{
-    private List<String> repoIds = Collections.singletonList( "test-repo" );
-
-    public void createMissingRepositoryRoles( String repoId )
-        throws ArchivaSecurityException
-    {
-    }
-
-    public List<String> getObservableRepositoryIds( String principal )
-        throws ArchivaSecurityException
-    {
-        return repoIds;
-    }
-
-    public void setObservableRepositoryIds( List<String> repoIds )
-    {
-        this.repoIds = repoIds;
-    }
-
-    public boolean isAuthorizedToUploadArtifacts( String principal, String repoId )
-        throws ArchivaSecurityException
-    {
-        return false;
-    }
-
-    public boolean isAuthorizedToDeleteArtifacts( String principal, String repoId )
-    {
-        return false;
-    }
-
-    public List<String> getManagableRepositoryIds( String principal )
-        throws ArchivaSecurityException
-    {
-        return null;
-    }
-
-    public List<String> getRepoIds()
-    {
-        return repoIds;
-    }
-
-    public void setRepoIds( List<String> repoIds )
-    {
-        this.repoIds = repoIds;
-    }
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/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
deleted file mode 100644 (file)
index 90a5be6..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-package org.apache.archiva.web.rss;
-/*
- * 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.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
- */
-@Service("RoleManagerStub")
-public class RoleManagerStub
-    implements RoleManager
-{
-    public void loadRoleModel( URL resourceLocation )
-        throws RoleManagerException
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void loadRoleModel( RedbackRoleModel model )
-        throws RoleManagerException
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void createTemplatedRole( String templateId, String resource )
-        throws RoleManagerException
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void removeTemplatedRole( String templateId, String resource )
-        throws RoleManagerException
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void updateRole( String templateId, String oldResource, String newResource )
-        throws RoleManagerException
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void assignRole( String roleId, String principal )
-        throws RoleManagerException
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void assignRoleByName( String roleName, String principal )
-        throws RoleManagerException
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void assignTemplatedRole( String templateId, String resource, String principal )
-        throws RoleManagerException
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void unassignRole( String roleId, String principal )
-        throws RoleManagerException
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void unassignRoleByName( String roleName, String principal )
-        throws RoleManagerException
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public boolean roleExists( String roleId )
-        throws RoleManagerException
-    {
-        return false;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public boolean templatedRoleExists( String templateId, String resource )
-        throws RoleManagerException
-    {
-        return false;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public RedbackRoleModel getModel()
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void verifyTemplatedRole( String templateID, String resource )
-        throws RoleManagerException
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/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
deleted file mode 100644 (file)
index 9a55321..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-package org.apache.archiva.web.rss;
-
-/*
- * 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 com.meterware.httpunit.GetMethodWebRequest;
-import com.meterware.httpunit.HttpException;
-import com.meterware.httpunit.WebRequest;
-import com.meterware.httpunit.WebResponse;
-import com.meterware.servletunit.ServletRunner;
-import com.meterware.servletunit.ServletUnitClient;
-import junit.framework.TestCase;
-import org.apache.commons.codec.Encoder;
-import org.apache.commons.codec.binary.Base64;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.BlockJUnit4ClassRunner;
-
-import javax.servlet.http.HttpServletResponse;
-import java.io.File;
-
-@RunWith( BlockJUnit4ClassRunner.class )
-public class RssFeedServletTest
-    extends TestCase
-{
-    private ServletRunner sr;
-
-    private ServletUnitClient client;
-
-    static String PREVIOUS_ARCHIVA_PATH;
-
-    @BeforeClass
-    public static void initConfigurationPath()
-        throws Exception
-    {
-        PREVIOUS_ARCHIVA_PATH = System.getProperty( "archiva.user.configFileName" );
-        System.setProperty( "archiva.user.configFileName",
-                            System.getProperty( "test.resources.path/" ) + "empty-archiva.xml" );
-    }
-
-    @AfterClass
-    public static void restoreConfigurationPath()
-        throws Exception
-    {
-        System.setProperty( "archiva.user.configFileName", PREVIOUS_ARCHIVA_PATH );
-    }
-
-    @Before
-    public void setUp()
-        throws Exception
-    {
-        sr = new ServletRunner( new File( "src/test/webapp/WEB-INF/feedServletTest-web.xml" ) );
-        client = sr.newClient();
-    }
-
-    @After
-    public void tearDown()
-        throws Exception
-    {
-        if ( client != null )
-        {
-            client.clearContents();
-        }
-
-        if ( sr != null )
-        {
-            sr.shutDown();
-        }
-
-        super.tearDown();
-    }
-
-    @Test
-    public void testRetrieveServlet()
-        throws Exception
-    {
-
-        RssFeedServlet servlet =
-            (RssFeedServlet) client.newInvocation( "http://localhost/feeds/test-repo" ).getServlet();
-        assertNotNull( servlet );
-    }
-
-    @Test
-    public void testRequestNewArtifactsInRepo()
-        throws Exception
-    {
-        RssFeedServlet servlet =
-            (RssFeedServlet) client.newInvocation( "http://localhost/feeds/test-repo" ).getServlet();
-        assertNotNull( servlet );
-
-        WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/test-repo" );
-
-        Base64 encoder = new Base64( 0, new byte[0] );
-        String userPass = "user1:password1";
-        String encodedUserPass = encoder.encodeToString( userPass.getBytes() );
-        request.setHeaderField( "Authorization", "BASIC " + encodedUserPass );
-
-        WebResponse response = client.getResponse( request );
-        assertEquals( RssFeedServlet.MIME_TYPE, response.getHeaderField( "CONTENT-TYPE" ) );
-        assertNotNull( "Should have recieved a response", response );
-        assertEquals( "Should have been an OK response code.", HttpServletResponse.SC_OK, response.getResponseCode() );
-
-    }
-
-    @Test
-    public void testRequestNewVersionsOfArtifact()
-        throws Exception
-    {
-        RssFeedServlet servlet = (RssFeedServlet) client.newInvocation(
-            "http://localhost/feeds/org/apache/archiva/artifact-two" ).getServlet();
-        assertNotNull( servlet );
-
-        WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/org/apache/archiva/artifact-two" );
-
-        Base64 encoder = new Base64( 0, new byte[0] );
-        String userPass = "user1:password1";
-        String encodedUserPass = encoder.encodeToString( userPass.getBytes() );
-        request.setHeaderField( "Authorization", "BASIC " + encodedUserPass );
-
-        WebResponse response = client.getResponse( request );
-        assertEquals( RssFeedServlet.MIME_TYPE, response.getHeaderField( "CONTENT-TYPE" ) );
-        assertNotNull( "Should have recieved a response", response );
-        assertEquals( "Should have been an OK response code.", HttpServletResponse.SC_OK, response.getResponseCode() );
-    }
-
-    @Ignore
-    public void XXX_testInvalidRequest()
-        throws Exception
-    {
-        RssFeedServlet servlet =
-            (RssFeedServlet) client.newInvocation( "http://localhost/feeds?invalid_param=xxx" ).getServlet();
-        assertNotNull( servlet );
-
-        try
-        {
-            WebResponse resp = client.getResponse( "http://localhost/feeds?invalid_param=xxx" );
-            assertEquals( HttpServletResponse.SC_BAD_REQUEST, resp.getResponseCode() );
-        }
-        catch ( HttpException he )
-        {
-            assertEquals( "Should have been a bad request response code.", HttpServletResponse.SC_BAD_REQUEST,
-                          he.getResponseCode() );
-        }
-    }
-
-    @Ignore
-    public void XXX_testInvalidAuthenticationRequest()
-        throws Exception
-    {
-        RssFeedServlet servlet =
-            (RssFeedServlet) client.newInvocation( "http://localhost/feeds/unauthorized-repo" ).getServlet();
-        assertNotNull( servlet );
-
-        WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/unauthorized-repo" );
-
-        Encoder encoder = new Base64();
-        String userPass = "unauthUser:unauthPass";
-        String encodedUserPass = new String( (byte[]) encoder.encode( userPass.getBytes() ) );
-        request.setHeaderField( "Authorization", "BASIC " + encodedUserPass );
-
-        try
-        {
-            WebResponse resp = client.getResponse( request );
-            assertEquals( HttpServletResponse.SC_UNAUTHORIZED, resp.getResponseCode() );
-        }
-        catch ( HttpException he )
-        {
-            assertEquals( "Should have been a unauthorized response.", HttpServletResponse.SC_UNAUTHORIZED,
-                          he.getResponseCode() );
-        }
-    }
-
-    @Ignore
-    public void XXX_testUnauthorizedRequest()
-        throws Exception
-    {
-        RssFeedServlet servlet =
-            (RssFeedServlet) client.newInvocation( "http://localhost/feeds/unauthorized-repo" ).getServlet();
-        assertNotNull( servlet );
-
-        WebRequest request = new GetMethodWebRequest( "http://localhost/feeds/unauthorized-repo" );
-
-        Base64 encoder = new Base64( 0, new byte[0] );
-        String userPass = "user1:password1";
-        String encodedUserPass = encoder.encodeToString( userPass.getBytes() );
-        request.setHeaderField( "Authorization", "BASIC " + encodedUserPass );
-
-        try
-        {
-            WebResponse resp = client.getResponse( request );
-            assertEquals( HttpServletResponse.SC_UNAUTHORIZED, resp.getResponseCode() );
-        }
-        catch ( HttpException he )
-        {
-            assertEquals( "Should have been a unauthorized response.", HttpServletResponse.SC_UNAUTHORIZED,
-                          he.getResponseCode() );
-        }
-    }
-
-
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/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
deleted file mode 100644 (file)
index 918816d..0000000
+++ /dev/null
@@ -1,588 +0,0 @@
-package org.apache.archiva.web.rss;
-
-/*
- * 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.codehaus.plexus.redback.authentication.AuthenticationDataSource;
-import org.codehaus.plexus.redback.authentication.AuthenticationException;
-import org.codehaus.plexus.redback.authentication.AuthenticationResult;
-import org.codehaus.plexus.redback.authorization.AuthorizationException;
-import org.codehaus.plexus.redback.authorization.AuthorizationResult;
-import org.codehaus.plexus.redback.keys.KeyManager;
-import org.codehaus.plexus.redback.policy.AccountLockedException;
-import org.codehaus.plexus.redback.policy.UserSecurityPolicy;
-import org.codehaus.plexus.redback.system.DefaultSecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySession;
-import org.codehaus.plexus.redback.system.SecuritySystem;
-import org.codehaus.plexus.redback.users.User;
-import org.codehaus.plexus.redback.users.UserManager;
-import org.codehaus.plexus.redback.users.UserManagerListener;
-import org.codehaus.plexus.redback.users.UserNotFoundException;
-import org.codehaus.plexus.redback.users.UserQuery;
-import org.codehaus.plexus.redback.users.jdo.JdoUser;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * SecuritySystem stub used for testing.
- *
- * @version $Id$
- */
-public class SecuritySystemStub
-    implements SecuritySystem
-{
-    Map<String, String> users = new HashMap<String, String>();
-
-    List<String> repoIds = new ArrayList<String>();
-
-    public SecuritySystemStub()
-    {
-        users.put( "user1", "password1" );
-        users.put( "user2", "password2" );
-        users.put( "user3", "password3" );
-
-        repoIds.add( "test-repo" );
-    }
-
-    public SecuritySession authenticate( AuthenticationDataSource source )
-        throws AuthenticationException, UserNotFoundException, AccountLockedException
-    {
-        AuthenticationResult result = null;
-        SecuritySession session = null;
-
-        if ( users.get( source.getPrincipal() ) != null )
-        {
-            result = new AuthenticationResult( true, source.getPrincipal(), null );
-
-            User user = new JdoUser();
-            user.setUsername( source.getPrincipal() );
-            user.setPassword( users.get( source.getPrincipal() ) );
-
-            session = new DefaultSecuritySession( result, user );
-        }
-        else
-        {
-            result = new AuthenticationResult( false, source.getPrincipal(), null );
-            session = new DefaultSecuritySession( result );
-        }
-        return session;
-    }
-
-    public AuthorizationResult authorize( SecuritySession arg0, Object arg1 )
-        throws AuthorizationException
-    {
-        return null;
-    }
-
-    public AuthorizationResult authorize( SecuritySession arg0, Object arg1, Object arg2 )
-        throws AuthorizationException
-    {
-        AuthorizationResult result = new AuthorizationResult( true, arg1, null );
-
-        return result;
-    }
-
-    public String getAuthenticatorId()
-    {
-        return null;
-    }
-
-    public String getAuthorizerId()
-    {
-        return null;
-    }
-
-    public KeyManager getKeyManager()
-    {
-        return null;
-    }
-
-    public UserSecurityPolicy getPolicy()
-    {
-        return null;
-    }
-
-    public String getUserManagementId()
-    {
-        return null;
-    }
-
-    public UserManager getUserManager()
-    {
-        return new UserManager()
-        {
-            public boolean isReadOnly()
-            {
-                return false;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public String getId()
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public void addUserManagerListener( UserManagerListener listener )
-            {
-                //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public void removeUserManagerListener( UserManagerListener listener )
-            {
-                //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public User createUser( String username, String fullName, String emailAddress )
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public User createGuestUser()
-            {
-                return new User()
-                {
-                    public Object getPrincipal()
-                    {
-                        return "guest";
-                    }
-
-                    public String getUsername()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setUsername( String name )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public String getFullName()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setFullName( String name )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public String getEmail()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setEmail( String address )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public String getPassword()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setPassword( String rawPassword )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public String getEncodedPassword()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setEncodedPassword( String encodedPassword )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public Date getLastPasswordChange()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setLastPasswordChange( Date passwordChangeDate )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public List<String> getPreviousEncodedPasswords()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setPreviousEncodedPasswords( List<String> encodedPasswordList )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void addPreviousEncodedPassword( String encodedPassword )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public boolean isPermanent()
-                    {
-                        return false;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setPermanent( boolean permanent )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public boolean isLocked()
-                    {
-                        return false;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setLocked( boolean locked )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public boolean isPasswordChangeRequired()
-                    {
-                        return false;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setPasswordChangeRequired( boolean changeRequired )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public boolean isValidated()
-                    {
-                        return false;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setValidated( boolean valid )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public int getCountFailedLoginAttempts()
-                    {
-                        return 0;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setCountFailedLoginAttempts( int count )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public Date getAccountCreationDate()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setAccountCreationDate( Date date )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public Date getLastLoginDate()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setLastLoginDate( Date date )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-                };
-            }
-
-            public UserQuery createUserQuery()
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public List<User> getUsers()
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public List<User> getUsers( boolean orderAscending )
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public User addUser( User user )
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public User updateUser( User user )
-                throws UserNotFoundException
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public User findUser( String username )
-                throws UserNotFoundException
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public User getGuestUser()
-                throws UserNotFoundException
-            {
-                return new User()
-                {
-                    public Object getPrincipal()
-                    {
-                        return "guest";
-                    }
-
-                    public String getUsername()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setUsername( String name )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public String getFullName()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setFullName( String name )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public String getEmail()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setEmail( String address )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public String getPassword()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setPassword( String rawPassword )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public String getEncodedPassword()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setEncodedPassword( String encodedPassword )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public Date getLastPasswordChange()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setLastPasswordChange( Date passwordChangeDate )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public List<String> getPreviousEncodedPasswords()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setPreviousEncodedPasswords( List<String> encodedPasswordList )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void addPreviousEncodedPassword( String encodedPassword )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public boolean isPermanent()
-                    {
-                        return false;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setPermanent( boolean permanent )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public boolean isLocked()
-                    {
-                        return false;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setLocked( boolean locked )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public boolean isPasswordChangeRequired()
-                    {
-                        return false;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setPasswordChangeRequired( boolean changeRequired )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public boolean isValidated()
-                    {
-                        return false;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setValidated( boolean valid )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public int getCountFailedLoginAttempts()
-                    {
-                        return 0;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setCountFailedLoginAttempts( int count )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public Date getAccountCreationDate()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setAccountCreationDate( Date date )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public Date getLastLoginDate()
-                    {
-                        return null;  //To change body of implemented methods use File | Settings | File Templates.
-                    }
-
-                    public void setLastLoginDate( Date date )
-                    {
-                        //To change body of implemented methods use File | Settings | File Templates.
-                    }
-                };
-            }
-
-            public List<User> findUsersByUsernameKey( String usernameKey, boolean orderAscending )
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public List<User> findUsersByFullNameKey( String fullNameKey, boolean orderAscending )
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public List<User> findUsersByEmailKey( String emailKey, boolean orderAscending )
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public List<User> findUsersByQuery( UserQuery query )
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public User findUser( Object principal )
-                throws UserNotFoundException
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public boolean userExists( Object principal )
-            {
-                return false;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public void deleteUser( Object principal )
-                throws UserNotFoundException
-            {
-                //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public void deleteUser( String username )
-                throws UserNotFoundException
-            {
-                //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public void addUserUnchecked( User user )
-            {
-                //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public void eraseDatabase()
-            {
-                //To change body of implemented methods use File | Settings | File Templates.
-            }
-
-            public User updateUser( User user, boolean passwordChangeRequired )
-                throws UserNotFoundException
-            {
-                return null;  //To change body of implemented methods use File | Settings | File Templates.
-            }
-        };
-    }
-
-    public boolean isAuthenticated( AuthenticationDataSource arg0 )
-        throws AuthenticationException, UserNotFoundException, AccountLockedException
-    {
-        return false;
-    }
-
-    public boolean isAuthorized( SecuritySession arg0, Object arg1 )
-        throws AuthorizationException
-    {
-        return false;
-    }
-
-    public boolean isAuthorized( SecuritySession arg0, Object arg1, Object arg2 )
-        throws AuthorizationException
-    {
-        if ( repoIds.contains( arg2 ) )
-        {
-            return true;
-        }
-
-        return false;
-    }
-
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/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
deleted file mode 100644 (file)
index 482637f..0000000
+++ /dev/null
@@ -1,224 +0,0 @@
-package org.apache.archiva.webtest.memory;
-
-/*
- * 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.model.ArtifactMetadata;
-import org.apache.archiva.metadata.model.MetadataFacet;
-import org.apache.archiva.metadata.model.ProjectMetadata;
-import org.apache.archiva.metadata.model.ProjectVersionMetadata;
-import org.apache.archiva.metadata.model.ProjectVersionReference;
-import org.apache.archiva.metadata.repository.MetadataRepository;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-public class TestMetadataRepository
-    implements MetadataRepository
-{
-    private static final String TEST_REPO = "test-repo";
-
-    private static final String TEST_NAMESPACE = "org.apache.archiva";
-
-    private List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>();
-
-    private List<String> versions = new ArrayList<String>();
-
-    public TestMetadataRepository()
-    {
-        Date whenGathered = new Date( 123456789 );
-
-        addArtifact( "artifact-one", "1.0", whenGathered );
-        addArtifact( "artifact-one", "1.1", whenGathered );
-        addArtifact( "artifact-one", "2.0", whenGathered );
-        addArtifact( "artifact-two", "1.0.1", whenGathered );
-        addArtifact( "artifact-two", "1.0.2", whenGathered );
-        addArtifact( "artifact-two", "1.0.3-SNAPSHOT", whenGathered );
-        addArtifact( "artifact-three", "2.0-SNAPSHOT", whenGathered );
-        addArtifact( "artifact-four", "1.1-beta-2", whenGathered );
-    }
-
-    private void addArtifact( String projectId, String projectVersion, Date whenGathered )
-    {
-        ArtifactMetadata artifact = new ArtifactMetadata();
-        artifact.setFileLastModified( System.currentTimeMillis() );
-        artifact.setNamespace( TEST_NAMESPACE );
-        artifact.setProjectVersion( projectVersion );
-        artifact.setVersion( projectVersion );
-        artifact.setId( projectId + "-" + projectVersion + ".jar" );
-        artifact.setProject( projectId );
-        artifact.setRepositoryId( TEST_REPO );
-        artifact.setWhenGathered( whenGathered );
-        artifacts.add( artifact );
-
-        versions.add( projectVersion );
-    }
-
-    public ProjectMetadata getProject( String repoId, String namespace, String projectId )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public ProjectVersionMetadata getProjectVersion( String repoId, String namespace, String projectId,
-                                                     String projectVersion )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public Collection<String> getArtifactVersions( String repoId, String namespace, String projectId,
-                                                   String projectVersion )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public Collection<ProjectVersionReference> getProjectReferences( String repoId, String namespace, String projectId,
-                                                                     String projectVersion )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public Collection<String> getRootNamespaces( String repoId )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public Collection<String> getNamespaces( String repoId, String namespace )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public Collection<String> getProjects( String repoId, String namespace )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
-    {
-        return versions;
-    }
-
-    public void updateProject( String repoId, ProjectMetadata project )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public void updateArtifact( String repoId, String namespace, String projectId, String projectVersion,
-                                ArtifactMetadata artifactMeta )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public void updateProjectVersion( String repoId, String namespace, String projectId,
-                                      ProjectVersionMetadata versionMetadata )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public void updateNamespace( String repoId, String namespace )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public List<String> getMetadataFacets( String repodId, String facetId )
-    {
-        return Collections.emptyList();
-    }
-
-    public MetadataFacet getMetadataFacet( String repositoryId, String facetId, String name )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public void addMetadataFacet( String repositoryId, MetadataFacet metadataFacet )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public void removeMetadataFacets( String repositoryId, String facetId )
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public void removeMetadataFacet( String repoId, String facetId, String name )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public List<ArtifactMetadata> getArtifactsByDateRange( String repoId, Date startTime, Date endTime )
-    {
-        return artifacts;
-    }
-
-    public Collection<String> getRepositories()
-    {
-        return Collections.singletonList( TEST_REPO );
-    }
-
-    public List<ArtifactMetadata> getArtifactsByChecksum( String repoId, String checksum )
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void removeArtifact( String repositoryId, String namespace, String project, String version, String id )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public void removeRepository( String repoId )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
-                                                      String projectVersion )
-    {
-        return artifacts;
-    }
-
-    public void save()
-    {
-    }
-
-    public void close()
-    {
-    }
-
-    public void revert()
-    {
-        throw new UnsupportedOperationException();
-    }
-
-    public boolean canObtainAccess( Class<?> aClass )
-    {
-        return false;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public Object obtainAccess( Class<?> aClass )
-    {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
-    }
-
-    public List<ArtifactMetadata> getArtifacts( String repositoryId )
-    {
-        return artifacts;
-    }
-}
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/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
deleted file mode 100644 (file)
index 2a5ba06..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-package org.apache.archiva.webtest.memory;
-
-/*
- * 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.model.ArtifactMetadata;
-import org.apache.archiva.metadata.model.ProjectVersionMetadata;
-import org.apache.archiva.metadata.model.ProjectVersionReference;
-import org.apache.archiva.metadata.repository.MetadataResolver;
-import org.apache.archiva.metadata.repository.RepositorySession;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public class TestMetadataResolver
-    implements MetadataResolver
-{
-    private Map<String, ProjectVersionMetadata> projectVersions = new HashMap<String, ProjectVersionMetadata>();
-
-    private Map<String, List<ArtifactMetadata>> artifacts = new HashMap<String, List<ArtifactMetadata>>();
-
-    private Map<String, List<ProjectVersionReference>> references =
-        new HashMap<String, List<ProjectVersionReference>>();
-
-    private Map<String, List<String>> namespaces = new HashMap<String, List<String>>();
-
-    private Map<String, Collection<String>> projectsInNamespace = new HashMap<String, Collection<String>>();
-
-    private Map<String, Collection<String>> versionsInProject = new HashMap<String, Collection<String>>();
-
-    public ProjectVersionMetadata resolveProjectVersion( RepositorySession repositorySession, String repoId,
-                                                         String namespace, String projectId, String projectVersion )
-    {
-        return projectVersions.get( createMapKey( repoId, namespace, projectId, projectVersion ) );
-    }
-
-    public Collection<ProjectVersionReference> resolveProjectReferences( RepositorySession repositorySession,
-                                                                         String repoId, String namespace,
-                                                                         String projectId, String projectVersion )
-    {
-        Collection<ProjectVersionReference> projectVersionReferences =
-            references.get( createMapKey( repoId, namespace, projectId, projectVersion ) );
-        return projectVersionReferences;
-    }
-
-    public Collection<String> resolveRootNamespaces( RepositorySession repositorySession, String repoId )
-    {
-        return resolveNamespaces( repositorySession, repoId, null );
-    }
-
-    public Collection<String> resolveNamespaces( RepositorySession repositorySession, String repoId,
-                                                 String baseNamespace )
-    {
-        Set<String> namespaces = new LinkedHashSet<String>();
-        int fromIndex = baseNamespace != null ? baseNamespace.length() + 1 : 0;
-        for ( String namespace : this.namespaces.get( repoId ) )
-        {
-            if ( baseNamespace == null || namespace.startsWith( baseNamespace + "." ) )
-            {
-                int i = namespace.indexOf( '.', fromIndex );
-                if ( i >= 0 )
-                {
-                    namespaces.add( namespace.substring( fromIndex, i ) );
-                }
-                else
-                {
-                    namespaces.add( namespace.substring( fromIndex ) );
-                }
-            }
-        }
-        return namespaces;
-    }
-
-    public Collection<String> resolveProjects( RepositorySession repositorySession, String repoId, String namespace )
-    {
-        Collection<String> list = projectsInNamespace.get( namespace );
-        return list != null ? list : Collections.<String>emptyList();
-    }
-
-    public Collection<String> resolveProjectVersions( RepositorySession repositorySession, String repoId,
-                                                      String namespace, String projectId )
-    {
-        Collection<String> list = versionsInProject.get( namespace + ":" + projectId );
-        return list != null ? list : Collections.<String>emptyList();
-    }
-
-    public Collection<ArtifactMetadata> resolveArtifacts( RepositorySession repositorySession, String repoId,
-                                                          String namespace, String projectId, String projectVersion )
-    {
-        List<ArtifactMetadata> artifacts =
-            this.artifacts.get( createMapKey( repoId, namespace, projectId, projectVersion ) );
-        return ( artifacts != null ? artifacts : Collections.<ArtifactMetadata>emptyList() );
-    }
-
-    public void setProjectVersion( String repoId, String namespace, String projectId,
-                                   ProjectVersionMetadata versionMetadata )
-    {
-        projectVersions.put( createMapKey( repoId, namespace, projectId, versionMetadata.getId() ), versionMetadata );
-
-        Collection<String> projects = projectsInNamespace.get( namespace );
-        if ( projects == null )
-        {
-            projects = new LinkedHashSet<String>();
-            projectsInNamespace.put( namespace, projects );
-        }
-        projects.add( projectId );
-
-        String key = namespace + ":" + projectId;
-        Collection<String> versions = versionsInProject.get( key );
-        if ( versions == null )
-        {
-            versions = new LinkedHashSet<String>();
-            versionsInProject.put( key, versions );
-        }
-        versions.add( versionMetadata.getId() );
-    }
-
-    public void setArtifacts( String repoId, String namespace, String projectId, String projectVersion,
-                              List<ArtifactMetadata> artifacts )
-    {
-        this.artifacts.put( createMapKey( repoId, namespace, projectId, projectVersion ), artifacts );
-    }
-
-    private String createMapKey( String repoId, String namespace, String projectId, String projectVersion )
-    {
-        return repoId + ":" + namespace + ":" + projectId + ":" + projectVersion;
-    }
-
-    public void setProjectReferences( String repoId, String namespace, String projectId, String projectVersion,
-                                      List<ProjectVersionReference> references )
-    {
-        this.references.put( createMapKey( repoId, namespace, projectId, projectVersion ), references );
-    }
-
-    public void setNamespaces( String repoId, List<String> namespaces )
-    {
-        this.namespaces.put( repoId, namespaces );
-    }
-}
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/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
deleted file mode 100644 (file)
index f311d97..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.apache.archiva.webtest.memory;
-
-/*
- * 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.RepositorySession;
-import org.apache.archiva.metadata.repository.RepositorySessionFactory;
-import org.springframework.stereotype.Service;
-
-@Service("repositorySessionFactory#test")
-public class TestRepositorySessionFactory
-    implements RepositorySessionFactory
-{
-    private RepositorySession repositorySession;
-
-    public void setRepositorySession( RepositorySession repositorySession )
-    {
-        this.repositorySession = repositorySession;
-    }
-
-    public RepositorySession createSession()
-    {
-        return repositorySession != null ? repositorySession : new RepositorySession( new TestMetadataRepository(),
-                                                                                      new TestMetadataResolver() );
-    }
-}
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
deleted file mode 100644 (file)
index 997d62b..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-  ~ 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.
-  -->
-
-<configuration>
-
-  <version>2</version>
-  
-  <repositoryScanning>
-    <fileTypes>
-      <fileType>
-        <id>artifacts</id>
-        <patterns>
-          <pattern>**/*.pom</pattern>
-          <pattern>**/*.jar</pattern>
-          <pattern>**/*.ear</pattern>
-          <pattern>**/*.war</pattern>
-          <pattern>**/*.car</pattern>
-          <pattern>**/*.sar</pattern>
-          <pattern>**/*.mar</pattern>
-          <pattern>**/*.rar</pattern>
-          <pattern>**/*.dtd</pattern>
-          <pattern>**/*.tld</pattern>
-          <pattern>**/*.tar.gz</pattern>
-          <pattern>**/*.tar.bz2</pattern>
-          <pattern>**/*.zip</pattern>
-        </patterns>
-      </fileType>
-      <fileType>
-        <id>indexable-content</id>
-        <patterns>
-          <pattern>**/*.txt</pattern>
-          <pattern>**/*.TXT</pattern>
-          <pattern>**/*.block</pattern>
-          <pattern>**/*.config</pattern>
-          <pattern>**/*.pom</pattern>
-          <pattern>**/*.xml</pattern>
-          <pattern>**/*.xsd</pattern>
-          <pattern>**/*.dtd</pattern>
-          <pattern>**/*.tld</pattern>
-        </patterns>
-      </fileType>
-      <fileType>
-        <id>auto-remove</id>
-        <patterns>
-          <pattern>**/*.bak</pattern>
-          <pattern>**/*~</pattern>
-          <pattern>**/*-</pattern>
-        </patterns>
-      </fileType>
-      <fileType>
-        <id>ignored</id>
-        <patterns>
-          <pattern>**/.htaccess</pattern>
-          <pattern>**/KEYS</pattern>
-          <pattern>**/*.rb</pattern>
-          <pattern>**/*.sh</pattern>
-          <pattern>**/.svn/**</pattern>
-          <pattern>**/.DAV/**</pattern>
-        </patterns>
-      </fileType>
-    </fileTypes>
-    <knownContentConsumers>
-      <knownContentConsumer>update-db-artifact</knownContentConsumer>
-      <knownContentConsumer>create-missing-checksums</knownContentConsumer>
-      <knownContentConsumer>update-db-repository-metadata</knownContentConsumer>
-      <knownContentConsumer>validate-checksum</knownContentConsumer>
-      <knownContentConsumer>validate-signature</knownContentConsumer>
-      <knownContentConsumer>index-content</knownContentConsumer>
-      <knownContentConsumer>auto-remove</knownContentConsumer>
-      <knownContentConsumer>auto-rename</knownContentConsumer>
-    </knownContentConsumers>
-    <invalidContentConsumers>
-      <invalidContentConsumer>update-db-bad-content</invalidContentConsumer>
-    </invalidContentConsumers>
-  </repositoryScanning>
-
-  <databaseScanning>
-    <cronExpression>0 0 * * * ?</cronExpression>
-    <unprocessedConsumers>
-      <unprocessedConsumer>index-artifact</unprocessedConsumer>
-      <unprocessedConsumer>update-db-project</unprocessedConsumer>
-      <unprocessedConsumer>validate-repository-metadata</unprocessedConsumer>
-      <unprocessedConsumer>index-archive-toc</unprocessedConsumer>
-      <unprocessedConsumer>update-db-bytecode-stats</unprocessedConsumer>
-      <unprocessedConsumer>index-public-methods</unprocessedConsumer>
-    </unprocessedConsumers>
-    <cleanupConsumers>
-      <cleanupConsumer>not-present-remove-db-artifact</cleanupConsumer>
-      <cleanupConsumer>not-present-remove-db-project</cleanupConsumer>
-      <cleanupConsumer>not-present-remove-indexed</cleanupConsumer>
-    </cleanupConsumers>
-  </databaseScanning>
-
-</configuration>
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
deleted file mode 100644 (file)
index aecb237..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?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.
-  -->
-
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
-  <appender name="console" class="org.apache.log4j.ConsoleAppender">
-    <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
-    </layout>
-  </appender>
-  <logger name="org.apache.archiva.web">
-    <level value="debug"/>
-  </logger>
-
-
-  <root>
-    <priority value ="info" />
-    <appender-ref ref="console" />
-  </root>
-
-</log4j:configuration>
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/spring-context-rss-servlet.xml b/archiva-modules/archiva-web/archiva-webapp-common/src/test/resources/spring-context-rss-servlet.xml
deleted file mode 100644 (file)
index 6e3dc3e..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-<?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:property-placeholder system-properties-mode="OVERRIDE"/>
-
-  <context:annotation-config/>
-  <context:component-scan base-package="org.apache.archiva.webtest.memory"/>
-
-  <alias name="repositorySessionFactory#test" alias="repositorySessionFactory"/>
-
-  <bean name="userRepositories#test" class="org.apache.archiva.security.UserRepositoriesStub"/>
-
-  <alias name="userRepositories#test" alias="userRepositories"/>
-
-
-  <bean name="securitySystem#test" class="org.apache.archiva.web.rss.SecuritySystemStub"/>
-
-  <alias name="securitySystem#test" alias="securitySystem"/>
-
-  <bean name="archivaConfiguration#default"  class="org.apache.archiva.configuration.DefaultArchivaConfiguration">
-    <property name="registry" ref="registry#default"/>
-  </bean>
-
-  <alias name="archivaConfiguration#default" alias="archivaConfiguration"/>
-
-  <bean name="registry#default" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
-    <property name="properties">
-      <value>
-        <![CDATA[
-        <configuration>
-          <system/>
-          <xml fileName="${test.resources.path}/empty-archiva.xml" config-forceCreate="true"
-               config-optional="true"
-               config-name="org.apache.archiva.base" config-at="org.apache.archiva"/>
-        </configuration>
-        ]]>
-      </value>
-    </property>
-  </bean>
-  
-  <bean name="RoleManagerStub" class="org.apache.archiva.web.rss.RoleManagerStub"/>
-
-</beans>
\ No newline at end of file
diff --git a/archiva-modules/archiva-web/archiva-webapp-common/src/test/webapp/WEB-INF/feedServletTest-web.xml b/archiva-modules/archiva-web/archiva-webapp-common/src/test/webapp/WEB-INF/feedServletTest-web.xml
deleted file mode 100644 (file)
index ad7386b..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?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.
-  -->
-
-<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-
-  <display-name>Apache Archiva</display-name>
-
-  <listener>
-    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-  </listener>
-
-  <context-param>
-    <param-name>contextClass</param-name>
-    <param-value>org.codehaus.redback.components.springutils.CachingWebApplicationContext</param-value>
-  </context-param>
-
-  <servlet>
-    <servlet-name>RssFeedServlet</servlet-name>
-    <servlet-class>org.apache.archiva.web.rss.RssFeedServlet</servlet-class>
-  </servlet>
-
-  <servlet-mapping>
-    <servlet-name>RssFeedServlet</servlet-name>
-    <url-pattern>/feeds/*</url-pattern>
-  </servlet-mapping>
-
-  <context-param>
-    <param-name>contextConfigLocation</param-name>
-    <param-value>
-      classpath*:/META-INF/spring-context.xml
-      classpath*:/spring-context-rss-servlet.xml
-    </param-value>
-  </context-param>
-
-</web-app>
index a5335b8049593695b1be17fc25782ac06003f76d..ba159a8f47e1d5bb95523db52a2cb1a059bfb728 100644 (file)
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
-  ~ Licensed to the Apache Software Foundation (ASF) under one\r
-  ~ or more contributor license agreements.  See the NOTICE file\r
-  ~ distributed with this work for additional information\r
-  ~ regarding copyright ownership.  The ASF licenses this file\r
-  ~ to you under the Apache License, Version 2.0 (the\r
-  ~ "License"); you may not use this file except in compliance\r
-  ~ with the License.  You may obtain a copy of the License at\r
-  ~\r
-  ~   http://www.apache.org/licenses/LICENSE-2.0\r
-  ~\r
-  ~ Unless required by applicable law or agreed to in writing,\r
-  ~ software distributed under the License is distributed on an\r
-  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
-  ~ KIND, either express or implied.  See the License for the\r
-  ~ specific language governing permissions and limitations\r
-  ~ under the License.\r
-  -->\r
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
-  <modelVersion>4.0.0</modelVersion>\r
-  <parent>\r
-    <groupId>org.apache.archiva</groupId>\r
-    <artifactId>archiva-web</artifactId>\r
-    <version>1.4-M3-SNAPSHOT</version>\r
-  </parent>\r
-  <artifactId>archiva-webapp-js</artifactId>\r
-  <packaging>war</packaging>\r
-\r
-  <name>Archiva Web :: Javascript Application</name>\r
-\r
-  <properties>\r
-    <tomcatContextXml>${basedir}/src/test/tomcat/tomcat-context.xml</tomcatContextXml>\r
-  </properties>\r
-\r
-  <dependencies>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>generic-metadata-support</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>npanday-support</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>repository-statistics</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>problem-reports</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>audit</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-scheduler-repository</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-indexer</artifactId>\r
-    </dependency>\r
-\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-repository-admin-api</artifactId>\r
-    </dependency>\r
-\r
-\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-repository-admin-default</artifactId>\r
-    </dependency>\r
-\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>metadata-repository-api</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>metadata-store-jcr</artifactId>\r
-      <scope>runtime</scope>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.jackrabbit</groupId>\r
-      <artifactId>jackrabbit-core</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>commons-logging</groupId>\r
-          <artifactId>commons-logging</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-\r
-    <dependency>\r
-      <groupId>org.apache.velocity</groupId>\r
-      <artifactId>velocity</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.velocity</groupId>\r
-      <artifactId>velocity-tools</artifactId>\r
-      <version>1.3</version>\r
-      <scope>runtime</scope>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>commons-logging</groupId>\r
-          <artifactId>commons-logging</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>velocity</groupId>\r
-          <artifactId>velocity-dep</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>velocity</groupId>\r
-          <artifactId>velocity</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>struts</groupId>\r
-          <artifactId>struts</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <!--  FIXME: temporary coupling to plugin, should be runtime -->\r
-      <artifactId>maven2-repository</artifactId>\r
-    </dependency>\r
-\r
-    <dependency>\r
-      <groupId>org.codehaus.plexus</groupId>\r
-      <artifactId>plexus-slf4j-logging</artifactId>\r
-      <scope>runtime</scope>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>org.codehaus.plexus</groupId>\r
-          <artifactId>plexus-component-api</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.codehaus.plexus</groupId>\r
-      <artifactId>plexus-utils</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.maven.indexer</groupId>\r
-      <artifactId>indexer-core</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>org.codehaus.plexus</groupId>\r
-          <artifactId>plexus-container-default</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>classworlds</groupId>\r
-          <artifactId>classworlds</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>commons-logging</groupId>\r
-          <artifactId>commons-logging</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>velocity</groupId>\r
-          <artifactId>velocity-dep</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.apache.maven</groupId>\r
-          <artifactId>maven-plugin-registry</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.apache.maven</groupId>\r
-          <artifactId>maven-settings</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>com.google.code.atinject</groupId>\r
-          <artifactId>atinject</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-proxy</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-repository-layer</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-xml-tools</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>xerces</groupId>\r
-          <artifactId>xercesImpl</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-security</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-core-consumers</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-configuration</artifactId>\r
-      <!-- TODO uncomment when repository admin will be finished\r
-      <scope>runtime</scope>\r
-      -->\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-metadata-consumer</artifactId>\r
-      <scope>runtime</scope>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-lucene-consumers</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.lucene</groupId>\r
-      <artifactId>lucene-core</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.lucene</groupId>\r
-      <artifactId>lucene-queries</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>stage-repository-merge</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-signature-consumers</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-applet</artifactId>\r
-      <!-- TODO: actually, just exclude from WAR plugin -->\r
-      <scope>provided</scope>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-rss</artifactId>\r
-    </dependency>\r
-\r
-    <dependency>\r
-\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-rest-services</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-server</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-continuation</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-http</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-io</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-util</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-security</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>commons-logging</groupId>\r
-          <artifactId>commons-logging</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.apache.geronimo.specs</groupId>\r
-          <artifactId>geronimo-servlet_3.0_spec</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.apache.geronimo.specs</groupId>\r
-          <artifactId>geronimo-javamail_1.4_spec</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.apache.geronimo.specs</groupId>\r
-          <artifactId>geronimo-servlet_2.5_spec</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-rest-api</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-server</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-continuation</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-http</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-io</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-util</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-security</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>commons-logging</groupId>\r
-          <artifactId>commons-logging</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.apache.geronimo.specs</groupId>\r
-          <artifactId>geronimo-servlet_3.0_spec</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.apache.geronimo.specs</groupId>\r
-          <artifactId>geronimo-javamail_1.4_spec</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.apache.geronimo.specs</groupId>\r
-          <artifactId>geronimo-servlet_2.5_spec</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>javax.servlet</groupId>\r
-      <artifactId>servlet-api</artifactId>\r
-      <scope>provided</scope>\r
-    </dependency>\r
-\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-webapp-common</artifactId>\r
-    </dependency>\r
-\r
-    <dependency>\r
-      <groupId>org.apache.archiva</groupId>\r
-      <artifactId>archiva-webdav</artifactId>\r
-    </dependency>\r
-\r
-    <dependency>\r
-      <groupId>jpox</groupId>\r
-      <artifactId>jpox</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>javax.transaction</groupId>\r
-          <artifactId>jta</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>jpox</groupId>\r
-      <artifactId>jpox-ehcache</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>commons-logging</groupId>\r
-          <artifactId>commons-logging</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>ehcache</groupId>\r
-          <artifactId>ehcache</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-\r
-    <dependency>\r
-      <groupId>org.codehaus.redback.components.cache</groupId>\r
-      <artifactId>spring-cache-ehcache</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>commons-logging</groupId>\r
-          <artifactId>commons-logging</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>net.sf.ehcache</groupId>\r
-      <artifactId>ehcache-core</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>commons-logging</groupId>\r
-          <artifactId>commons-logging</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-\r
-    <dependency>\r
-      <groupId>org.codehaus.redback.components</groupId>\r
-      <artifactId>spring-quartz</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.quartz-scheduler</groupId>\r
-      <artifactId>quartz</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>c3p0</groupId>\r
-          <artifactId>c3p0</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>javax.transaction</groupId>\r
-          <artifactId>jta</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-\r
-    <dependency>\r
-      <groupId>org.codehaus.redback</groupId>\r
-      <artifactId>redback-rest-services</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.codehaus.redback</groupId>\r
-      <artifactId>redback-common-integrations</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>stax</groupId>\r
-          <artifactId>stax-api</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.codehaus.redback</groupId>\r
-      <artifactId>redback-integrations-security</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.slf4j</groupId>\r
-      <artifactId>slf4j-log4j12</artifactId>\r
-      <scope>runtime</scope>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.slf4j</groupId>\r
-      <artifactId>jcl-over-slf4j</artifactId>\r
-      <scope>runtime</scope>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.apache.cxf</groupId>\r
-      <artifactId>cxf-bundle-jaxrs</artifactId>\r
-      <exclusions>\r
-        <exclusion>\r
-          <groupId>org.eclipse.jetty</groupId>\r
-          <artifactId>jetty-server</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.apache.geronimo.specs</groupId>\r
-          <artifactId>geronimo-servlet_2.5_spec</artifactId>\r
-        </exclusion>\r
-        <exclusion>\r
-          <groupId>org.apache.geronimo.specs</groupId>\r
-          <artifactId>geronimo-javamail_1.4_spec</artifactId>\r
-        </exclusion>\r
-      </exclusions>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.springframework</groupId>\r
-      <artifactId>spring-core</artifactId>\r
-    </dependency>\r
-    <dependency>\r
-      <groupId>org.springframework</groupId>\r
-      <artifactId>spring-web</artifactId>\r
-    </dependency>\r
-\r
-  </dependencies>\r
-\r
-  <build>\r
-\r
-    <resources>\r
-      <resource>\r
-        <directory>src/main/resources</directory>\r
-      </resource>\r
-      <resource>\r
-        <directory>src/main/filtered-resources</directory>\r
-        <filtering>true</filtering>\r
-      </resource>\r
-    </resources>\r
-\r
-    <plugins>\r
-\r
-      <plugin>\r
-        <groupId>org.codehaus.mojo</groupId>\r
-        <artifactId>tomcat-maven-plugin</artifactId>\r
-        <configuration>\r
-          <port>9091</port>\r
-          <path>/archiva</path>\r
-          <contextFile>${tomcatContextXml}</contextFile>\r
-          <systemProperties>\r
-            <plexus.home>${project.build.directory}/appserver-base</plexus.home>\r
-            <appserver.base>${project.build.directory}/appserver-base</appserver.base>\r
-            <appserver.home>${project.build.directory}/appserver-home</appserver.home>\r
-            <derby.system.home>${project.build.directory}/appserver-base/logs</derby.system.home>\r
-            <redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file>\r
-            <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>\r
-          </systemProperties>\r
-        </configuration>\r
-        <dependencies>\r
-          <dependency>\r
-            <groupId>org.apache.derby</groupId>\r
-            <artifactId>derby</artifactId>\r
-            <version>${derbyVersion}</version>\r
-          </dependency>\r
-          <dependency>\r
-            <groupId>javax.mail</groupId>\r
-            <artifactId>mail</artifactId>\r
-            <version>${javaxMailVersion}</version>\r
-          </dependency>\r
-        </dependencies>\r
-      </plugin>\r
-    </plugins>\r
-  </build>\r
-\r
-  <profiles>\r
-    <profile>\r
-      <!-- profile for dev an log output in the console -->\r
-      <id>dev</id>\r
-      <build>\r
-        <plugins>\r
-          <plugin>\r
-            <artifactId>maven-antrun-plugin</artifactId>\r
-            <executions>\r
-              <execution>\r
-                <id>override-log4j-with-console-output</id>\r
-                <phase>process-resources</phase>\r
-                <goals>\r
-                  <goal>run</goal>\r
-                </goals>\r
-                <configuration>\r
-                  <tasks>\r
-                    <copy overwrite="true" file="${basedir}/src/test/tomcat/log4j.xml"\r
-                          todir="${basedir}/src/main/webapp/WEB-INF/classes"/>\r
-                    <copy overwrite="true" file="${basedir}/src/test/tomcat/auto-admin-creation.properties"\r
-                          todir="${basedir}/target/"/>\r
-                  </tasks>\r
-                </configuration>\r
-              </execution>\r
-            </executions>\r
-          </plugin>\r
-        </plugins>\r
-      </build>\r
-    </profile>\r
-    <profile>\r
-      <!-- olamy profile to test tomcat plugin dev -->\r
-      <id>tdev</id>\r
-      <build>\r
-        <plugins>\r
-          <plugin>\r
-            <groupId>org.apache.tomcat.maven</groupId>\r
-            <artifactId>tomcat6-maven-plugin</artifactId>\r
-            <configuration>\r
-              <port>9090</port>\r
-              <path>/</path>\r
-              <contextFile>${tomcatContextXml}</contextFile>\r
-              <systemProperties>\r
-                <plexus.home>${project.build.directory}/appserver-base</plexus.home>\r
-                <appserver.base>${project.build.directory}/appserver-base</appserver.base>\r
-                <appserver.home>${project.build.directory}/appserver-home</appserver.home>\r
-                <derby.system.home>${project.build.directory}/appserver-base/logs</derby.system.home>\r
-                <redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties\r
-                </redback.admin.creation.file>\r
-                <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>\r
-              </systemProperties>\r
-            </configuration>\r
-            <dependencies>\r
-              <dependency>\r
-                <groupId>org.apache.derby</groupId>\r
-                <artifactId>derby</artifactId>\r
-                <version>${derbyVersion}</version>\r
-              </dependency>\r
-              <dependency>\r
-                <groupId>javax.mail</groupId>\r
-                <artifactId>mail</artifactId>\r
-                <version>1.4</version>\r
-              </dependency>\r
-            </dependencies>\r
-          </plugin>\r
-          <plugin>\r
-            <groupId>org.apache.tomcat.maven</groupId>\r
-            <artifactId>tomcat7-maven-plugin</artifactId>\r
-            <version>2.0-SNAPSHOT</version>\r
-            <configuration>\r
-              <port>9090</port>\r
-              <path>/</path>\r
-              <contextFile>${tomcatContextXml}</contextFile>\r
-              <systemProperties>\r
-                <plexus.home>${project.build.directory}/appserver-base</plexus.home>\r
-                <appserver.base>${project.build.directory}/appserver-base</appserver.base>\r
-                <appserver.home>${project.build.directory}/appserver-home</appserver.home>\r
-                <derby.system.home>${project.build.directory}/appserver-base/logs</derby.system.home>\r
-                <redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties\r
-                </redback.admin.creation.file>\r
-                <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>\r
-              </systemProperties>\r
-            </configuration>\r
-            <dependencies>\r
-              <dependency>\r
-                <groupId>org.apache.derby</groupId>\r
-                <artifactId>derby</artifactId>\r
-                <version>${derbyVersion}</version>\r
-              </dependency>\r
-              <dependency>\r
-                <groupId>javax.mail</groupId>\r
-                <artifactId>mail</artifactId>\r
-                <version>1.4</version>\r
-              </dependency>\r
-            </dependencies>\r
-          </plugin>\r
-        </plugins>\r
-      </build>\r
-    </profile>\r
-  </profiles>\r
-\r
-</project>\r
+<?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">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.archiva</groupId>
+    <artifactId>archiva-web</artifactId>
+    <version>1.4-M3-SNAPSHOT</version>
+  </parent>
+  <artifactId>archiva-webapp-js</artifactId>
+  <packaging>war</packaging>
+
+  <name>Archiva Web :: Javascript Application</name>
+
+  <properties>
+    <tomcatContextXml>${basedir}/src/test/tomcat/tomcat-context.xml</tomcatContextXml>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>generic-metadata-support</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>npanday-support</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>repository-statistics</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>problem-reports</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>audit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-scheduler-repository</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-indexer</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-api</artifactId>
+    </dependency>
+
+
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-admin-default</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>metadata-repository-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>metadata-store-jcr</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.velocity</groupId>
+      <artifactId>velocity</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.velocity</groupId>
+      <artifactId>velocity-tools</artifactId>
+      <version>1.3</version>
+      <scope>runtime</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>velocity</groupId>
+          <artifactId>velocity-dep</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>velocity</groupId>
+          <artifactId>velocity</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>struts</groupId>
+          <artifactId>struts</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <!--  FIXME: temporary coupling to plugin, should be runtime -->
+      <artifactId>maven2-repository</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-slf4j-logging</artifactId>
+      <scope>runtime</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.codehaus.plexus</groupId>
+          <artifactId>plexus-component-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.indexer</groupId>
+      <artifactId>indexer-core</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.codehaus.plexus</groupId>
+          <artifactId>plexus-container-default</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>classworlds</groupId>
+          <artifactId>classworlds</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>velocity</groupId>
+          <artifactId>velocity-dep</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.maven</groupId>
+          <artifactId>maven-plugin-registry</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.maven</groupId>
+          <artifactId>maven-settings</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>com.google.code.atinject</groupId>
+          <artifactId>atinject</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-proxy</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-repository-layer</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-xml-tools</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>xerces</groupId>
+          <artifactId>xercesImpl</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-security</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-core-consumers</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-configuration</artifactId>
+      <!-- TODO uncomment when repository admin will be finished
+      <scope>runtime</scope>
+      -->
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-metadata-consumer</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-lucene-consumers</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.lucene</groupId>
+      <artifactId>lucene-queries</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>stage-repository-merge</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-signature-consumers</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-applet</artifactId>
+      <!-- TODO: actually, just exclude from WAR plugin -->
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-rss</artifactId>
+    </dependency>
+
+    <dependency>
+
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-rest-services</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-server</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-continuation</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-http</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-io</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-util</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-security</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-servlet_3.0_spec</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-javamail_1.4_spec</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-servlet_2.5_spec</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-rest-api</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-server</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-continuation</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-http</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-io</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-util</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-security</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-servlet_3.0_spec</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-javamail_1.4_spec</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-servlet_2.5_spec</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>javax.servlet</groupId>
+      <artifactId>servlet-api</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-weba-common</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.archiva</groupId>
+      <artifactId>archiva-webdav</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>jpox</groupId>
+      <artifactId>jpox</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>javax.transaction</groupId>
+          <artifactId>jta</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>jpox</groupId>
+      <artifactId>jpox-ehcache</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>ehcache</groupId>
+          <artifactId>ehcache</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.codehaus.redback.components.cache</groupId>
+      <artifactId>spring-cache-ehcache</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>net.sf.ehcache</groupId>
+      <artifactId>ehcache-core</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.codehaus.redback.components</groupId>
+      <artifactId>spring-quartz</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.quartz-scheduler</groupId>
+      <artifactId>quartz</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>c3p0</groupId>
+          <artifactId>c3p0</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>javax.transaction</groupId>
+          <artifactId>jta</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-rest-services</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-common-integrations</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>stax</groupId>
+          <artifactId>stax-api</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.redback</groupId>
+      <artifactId>redback-integrations-security</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl-over-slf4j</artifactId>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.cxf</groupId>
+      <artifactId>cxf-bundle-jaxrs</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.eclipse.jetty</groupId>
+          <artifactId>jetty-server</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-servlet_2.5_spec</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.geronimo.specs</groupId>
+          <artifactId>geronimo-javamail_1.4_spec</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+
+    <resources>
+      <resource>
+        <directory>src/main/resources</directory>
+      </resource>
+      <resource>
+        <directory>src/main/filtered-resources</directory>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+
+    <plugins>
+
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>tomcat-maven-plugin</artifactId>
+        <configuration>
+          <port>9091</port>
+          <path>/archiva</path>
+          <contextFile>${tomcatContextXml}</contextFile>
+          <systemProperties>
+            <plexus.home>${project.build.directory}/appserver-base</plexus.home>
+            <appserver.base>${project.build.directory}/appserver-base</appserver.base>
+            <appserver.home>${project.build.directory}/appserver-home</appserver.home>
+            <derby.system.home>${project.build.directory}/appserver-base/logs</derby.system.home>
+            <redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties</redback.admin.creation.file>
+            <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
+          </systemProperties>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derby</artifactId>
+            <version>${derbyVersion}</version>
+          </dependency>
+          <dependency>
+            <groupId>javax.mail</groupId>
+            <artifactId>mail</artifactId>
+            <version>${javaxMailVersion}</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+    </plugins>
+  </build>
+
+  <profiles>
+    <profile>
+      <!-- profile for dev an log output in the console -->
+      <id>dev</id>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-antrun-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>override-log4j-with-console-output</id>
+                <phase>process-resources</phase>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+                <configuration>
+                  <tasks>
+                    <copy overwrite="true" file="${basedir}/src/test/tomcat/log4j.xml"
+                          todir="${basedir}/src/main/webapp/WEB-INF/classes"/>
+                    <copy overwrite="true" file="${basedir}/src/test/tomcat/auto-admin-creation.properties"
+                          todir="${basedir}/target/"/>
+                  </tasks>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <!-- olamy profile to test tomcat plugin dev -->
+      <id>tdev</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.tomcat.maven</groupId>
+            <artifactId>tomcat6-maven-plugin</artifactId>
+            <configuration>
+              <port>9090</port>
+              <path>/</path>
+              <contextFile>${tomcatContextXml}</contextFile>
+              <systemProperties>
+                <plexus.home>${project.build.directory}/appserver-base</plexus.home>
+                <appserver.base>${project.build.directory}/appserver-base</appserver.base>
+                <appserver.home>${project.build.directory}/appserver-home</appserver.home>
+                <derby.system.home>${project.build.directory}/appserver-base/logs</derby.system.home>
+                <redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties
+                </redback.admin.creation.file>
+                <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
+              </systemProperties>
+            </configuration>
+            <dependencies>
+              <dependency>
+                <groupId>org.apache.derby</groupId>
+                <artifactId>derby</artifactId>
+                <version>${derbyVersion}</version>
+              </dependency>
+              <dependency>
+                <groupId>javax.mail</groupId>
+                <artifactId>mail</artifactId>
+                <version>1.4</version>
+              </dependency>
+            </dependencies>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.tomcat.maven</groupId>
+            <artifactId>tomcat7-maven-plugin</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <configuration>
+              <port>9090</port>
+              <path>/</path>
+              <contextFile>${tomcatContextXml}</contextFile>
+              <systemProperties>
+                <plexus.home>${project.build.directory}/appserver-base</plexus.home>
+                <appserver.base>${project.build.directory}/appserver-base</appserver.base>
+                <appserver.home>${project.build.directory}/appserver-home</appserver.home>
+                <derby.system.home>${project.build.directory}/appserver-base/logs</derby.system.home>
+                <redback.admin.creation.file>${basedir}/target/auto-admin-creation.properties
+                </redback.admin.creation.file>
+                <java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
+              </systemProperties>
+            </configuration>
+            <dependencies>
+              <dependency>
+                <groupId>org.apache.derby</groupId>
+                <artifactId>derby</artifactId>
+                <version>${derbyVersion}</version>
+              </dependency>
+              <dependency>
+                <groupId>javax.mail</groupId>
+                <artifactId>mail</artifactId>
+                <version>1.4</version>
+              </dependency>
+            </dependencies>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+</project>
index 9b61bef2418e3527937ebd87b464f86442e3bd0c..c1018e1c56653b0bc4cbfc657f4fa4293085fcc3 100644 (file)
     </dependency>
     <dependency>
       <groupId>org.apache.archiva</groupId>
-      <artifactId>archiva-webapp-common</artifactId>
+      <artifactId>archiva-web-common</artifactId>
     </dependency>
     <dependency>
       <groupId>org.apache.struts</groupId>
index 9d4955c6c4010b23f6ba286d62113d395798aae3..1a230393893e08707ac05993b4c4671709716954 100644 (file)
@@ -48,7 +48,7 @@
     <module>archiva-webdav</module>
     <module>archiva-rss</module>
     <module>archiva-rest</module>
-    <module>archiva-webapp-common</module>
+    <module>archiva-web-common</module>
     <module>archiva-webapp</module>
   </modules>
 
diff --git a/pom.xml b/pom.xml
index b5e0c0c0d09639e6387bc2055a2d14149b3382dd..2cb61e09939d0ee3e1ce7a31ef4b2e847b05c47e 100644 (file)
--- a/pom.xml
+++ b/pom.xml
       </dependency>
       <dependency>
         <groupId>org.apache.archiva</groupId>
-        <artifactId>archiva-webapp-common</artifactId>
+        <artifactId>archiva-web-common</artifactId>
         <version>${project.version}</version>
       </dependency>
       <dependency>