You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by jo...@apache.org on 2007/10/26 01:39:07 UTC
svn commit: r588391 [2/2] - in
/maven/archiva/trunk/archiva-web/archiva-webapp: ./
src/main/java/org/apache/maven/archiva/web/repository/ src/main/resources/
src/main/resources/META-INF/plexus/ src/main/resources/org/codehaus/
src/test/java/org/apache/...
Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedReleasePolicyTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedReleasePolicyTest.java?rev=588391&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedReleasePolicyTest.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedReleasePolicyTest.java Thu Oct 25 16:39:05 2007
@@ -0,0 +1,193 @@
+package org.apache.maven.archiva.web.repository;
+
+/*
+ * 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.HttpUnitOptions;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+import org.apache.maven.archiva.policies.ReleasesPolicy;
+
+import java.io.File;
+
+/**
+ * RepositoryServlet Tests, Proxied, Get of Release Artifacts, with varying policy settings.
+ *
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryServletProxiedReleasePolicyTest
+ extends AbstractRepositoryServletProxiedTestCase
+{
+ public void testGetProxiedReleaseArtifactPolicyAlwaysManagedNewer()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.IGNORED, HAS_MANAGED_COPY,
+ ( NEWER * OVER_ONE_DAY ) );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyAlwaysManagedOlder()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.IGNORED, HAS_MANAGED_COPY,
+ ( OLDER * OVER_ONE_DAY ) );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyAlwaysNoManagedContent()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.IGNORED, NO_MANAGED_COPY );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyDailyFail()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.DAILY, HAS_MANAGED_COPY,
+ ( NEWER * ONE_MINUTE ) );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyDailyNoManagedContent()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.DAILY, NO_MANAGED_COPY );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyDailyPass()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.DAILY, HAS_MANAGED_COPY,
+ ( OLDER * OVER_ONE_DAY ) );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyDisabledFail()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.DISABLED, HAS_MANAGED_COPY );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyDisabledNoManagedContentFail()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_NOT_FOUND, ReleasesPolicy.DISABLED, NO_MANAGED_COPY );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyDisabledPass()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.DISABLED, HAS_MANAGED_COPY );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyHourlyFail()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.HOURLY, HAS_MANAGED_COPY,
+ ( NEWER * ONE_MINUTE ) );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyHourlyNoManagedContent()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.HOURLY, NO_MANAGED_COPY );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyHourlyPass()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.HOURLY, HAS_MANAGED_COPY,
+ ( OLDER * OVER_ONE_HOUR ) );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyOnceFail()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.ONCE, HAS_MANAGED_COPY );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyOnceNoManagedContent()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.ONCE, NO_MANAGED_COPY );
+ }
+
+ public void testGetProxiedReleaseArtifactPolicyOncePass()
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.ONCE, NO_MANAGED_COPY );
+ }
+
+ private void assertGetProxiedReleaseArtifactWithPolicy( int expectation, String releasePolicy,
+ boolean hasManagedCopy )
+ throws Exception
+ {
+ assertGetProxiedReleaseArtifactWithPolicy( expectation, releasePolicy, hasManagedCopy, 0 );
+ }
+
+ private void assertGetProxiedReleaseArtifactWithPolicy( int expectation, String releasePolicy,
+ boolean hasManagedCopy, long deltaManagedToRemoteTimestamp )
+ throws Exception
+ {
+ // --- Setup
+ setupCentralRemoteRepo();
+ setupCleanInternalRepo();
+
+ String resourcePath = "org/apache/archiva/test/1.0/test-1.0.jar";
+ String expectedRemoteContents = "archiva-test-1.0|jar-remote-contents";
+ String expectedManagedContents = null;
+ File remoteFile = populateRepo( remoteCentral, resourcePath, expectedRemoteContents );
+
+ if ( hasManagedCopy )
+ {
+ expectedManagedContents = "archiva-test-1.0|jar-managed-contents";
+ File managedFile = populateRepo( repoRootInternal, resourcePath, expectedManagedContents );
+ managedFile.setLastModified( remoteFile.lastModified() + deltaManagedToRemoteTimestamp );
+ }
+
+ setupReleaseConnector( REPOID_INTERNAL, remoteCentral, releasePolicy );
+ saveConfiguration();
+
+ // --- Execution
+ // process the response code later, not via an exception.
+ HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );
+
+ WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + resourcePath );
+ WebResponse response = sc.getResponse( request );
+
+ // --- Verification
+
+ switch ( expectation )
+ {
+ case EXPECT_MANAGED_CONTENTS:
+ assertResponseOK( response );
+ assertTrue( "Invalid Test Case: Can't expect managed contents with "
+ + "test that doesn't have a managed copy in the first place.", hasManagedCopy );
+ assertEquals( "Expected managed file contents", expectedManagedContents, response.getText() );
+ break;
+ case EXPECT_REMOTE_CONTENTS:
+ assertResponseOK( response );
+ assertEquals( "Expected remote file contents", expectedRemoteContents, response.getText() );
+ break;
+ case EXPECT_NOT_FOUND:
+ assertResponseNotFound( response );
+ assertManagedFileNotExists( repoRootInternal, resourcePath );
+ break;
+ }
+ }
+}
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedReleasePolicyTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedReleasePolicyTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedReleasePolicyTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedSnapshotPolicyTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedSnapshotPolicyTest.java?rev=588391&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedSnapshotPolicyTest.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedSnapshotPolicyTest.java Thu Oct 25 16:39:05 2007
@@ -0,0 +1,195 @@
+package org.apache.maven.archiva.web.repository;
+
+/*
+ * 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.HttpUnitOptions;
+import com.meterware.httpunit.WebRequest;
+import com.meterware.httpunit.WebResponse;
+
+import org.apache.maven.archiva.policies.SnapshotsPolicy;
+
+import java.io.File;
+
+/**
+ * RepositoryServlet Tests, Proxied, Get of Snapshot Artifacts, with varying policy settings.
+ *
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryServletProxiedSnapshotPolicyTest
+ extends AbstractRepositoryServletProxiedTestCase
+{
+ public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedNewer()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.IGNORED,
+ HAS_MANAGED_COPY, ( NEWER * OVER_ONE_DAY ) );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedOlder()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.IGNORED, HAS_MANAGED_COPY,
+ ( OLDER * OVER_ONE_DAY ) );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyAlwaysNoManagedContent()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.IGNORED, NO_MANAGED_COPY );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyDailyFail()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.DAILY, HAS_MANAGED_COPY,
+ ( NEWER * ONE_MINUTE ) );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyDailyNoManagedContent()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.DAILY, NO_MANAGED_COPY );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyDailyPass()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.DAILY, HAS_MANAGED_COPY,
+ ( OLDER * OVER_ONE_DAY ) );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyDisabledFail()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.DISABLED,
+ HAS_MANAGED_COPY );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyDisabledNoManagedContentFail()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.DISABLED, NO_MANAGED_COPY );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyDisabledPass()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.DISABLED,
+ HAS_MANAGED_COPY );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyHourlyFail()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.HOURLY, HAS_MANAGED_COPY,
+ ( NEWER * ONE_MINUTE ) );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyHourlyNoManagedContent()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.HOURLY, NO_MANAGED_COPY );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyHourlyPass()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.HOURLY, HAS_MANAGED_COPY,
+ ( OLDER * OVER_ONE_HOUR ) );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyOnceFail()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.ONCE, HAS_MANAGED_COPY );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyOnceNoManagedContent()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ONCE, NO_MANAGED_COPY );
+ }
+
+ public void testGetProxiedSnapshotsArtifactPolicyOncePass()
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ONCE, NO_MANAGED_COPY );
+ }
+
+ private void assertGetProxiedSnapshotsArtifactWithPolicy( int expectation, String snapshotsPolicy,
+ boolean hasManagedCopy )
+ throws Exception
+ {
+ assertGetProxiedSnapshotsArtifactWithPolicy( expectation, snapshotsPolicy, hasManagedCopy, 0 );
+ }
+
+ private void assertGetProxiedSnapshotsArtifactWithPolicy( int expectation, String snapshotsPolicy,
+ boolean hasManagedCopy, long deltaManagedToRemoteTimestamp )
+ throws Exception
+ {
+ // --- Setup
+ setupSnapshotsRemoteRepo();
+ setupCleanInternalRepo();
+
+ String resourcePath = "org/apache/archiva/test/2.0-SNAPSHOT/test-2.0-SNAPSHOT.jar";
+ String expectedRemoteContents = "archiva-test-2.0-SNAPSHOT|jar-remote-contents";
+ String expectedManagedContents = null;
+ File remoteFile = populateRepo( remoteSnapshots, resourcePath, expectedRemoteContents );
+
+ if ( hasManagedCopy )
+ {
+ expectedManagedContents = "archiva-test-2.0-SNAPSHOT|jar-managed-contents";
+ File managedFile = populateRepo( repoRootInternal, resourcePath, expectedManagedContents );
+ managedFile.setLastModified( remoteFile.lastModified() + deltaManagedToRemoteTimestamp );
+ }
+
+ setupSnapshotConnector( REPOID_INTERNAL, remoteSnapshots, snapshotsPolicy );
+ saveConfiguration();
+
+ // --- Execution
+ // process the response code later, not via an exception.
+ HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );
+
+ WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + resourcePath );
+ WebResponse response = sc.getResponse( request );
+
+ // --- Verification
+
+ switch ( expectation )
+ {
+ case EXPECT_MANAGED_CONTENTS:
+ assertResponseOK( response );
+ assertTrue( "Invalid Test Case: Can't expect managed contents with "
+ + "test that doesn't have a managed copy in the first place.", hasManagedCopy );
+ assertEquals( "Expected managed file contents", expectedManagedContents, response.getText() );
+ break;
+ case EXPECT_REMOTE_CONTENTS:
+ assertResponseOK( response );
+ assertEquals( "Expected remote file contents", expectedRemoteContents, response.getText() );
+ break;
+ case EXPECT_NOT_FOUND:
+ assertResponseNotFound( response );
+ assertManagedFileNotExists( repoRootInternal, resourcePath );
+ break;
+ }
+ }
+}
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedSnapshotPolicyTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedSnapshotPolicyTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletProxiedSnapshotPolicyTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.java?rev=588391&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.java (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.java Thu Oct 25 16:39:05 2007
@@ -0,0 +1,21 @@
+package org.apache.maven.archiva.web.repository;
+
+/**
+ * RepositoryServletSecurityTest
+ *
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public class RepositoryServletSecurityTest
+ extends AbstractRepositoryServletTestCase
+{
+ public void testSecuredGet()
+ {
+
+ }
+
+ public void testSecuredBrowse()
+ {
+
+ }
+}
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletTest.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletTest.java?rev=588391&r1=588390&r2=588391&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletTest.java (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/RepositoryServletTest.java Thu Oct 25 16:39:05 2007
@@ -19,29 +19,10 @@
* under the License.
*/
-import com.meterware.httpunit.GetMethodWebRequest;
-import com.meterware.httpunit.PutMethodWebRequest;
-import com.meterware.httpunit.WebLink;
-import com.meterware.httpunit.WebRequest;
-import com.meterware.httpunit.WebResponse;
-import com.meterware.servletunit.ServletRunner;
-import com.meterware.servletunit.ServletUnitClient;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
-import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
-import org.codehaus.plexus.webdav.util.MimeTypes;
import java.io.File;
-import java.io.IOException;
-
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
/**
* RepositoryServletTest
@@ -50,69 +31,21 @@
* @version $Id$
*/
public class RepositoryServletTest
- extends PlexusTestCase
+ extends AbstractRepositoryServletTestCase
{
- private ServletUnitClient sc;
-
- private static final String REQUEST_PATH = "http://localhost/repository/internal/path/to/artifact.jar";
-
- private File repositoryLocation;
-
- private ArchivaConfiguration configuration;
-
- private static final String REPOSITORY_ID = "internal";
+ private static final String REQUEST_PATH = "http://machine.com/repository/internal/";
private static final String NEW_REPOSITORY_ID = "new-id";
private static final String NEW_REPOSITORY_NAME = "New Repository";
- protected void setUp()
- throws Exception
- {
- super.setUp();
-
- String appserverBase = getTestFile( "target/appserver-base" ).getAbsolutePath();
- System.setProperty( "appserver.base", appserverBase );
-
- File testConf = getTestFile( "src/test/resources/repository-archiva.xml" );
- File testConfDest = new File( appserverBase, "conf/archiva.xml" );
- FileUtils.copyFile( testConf, testConfDest );
-
- configuration = (ArchivaConfiguration) lookup( ArchivaConfiguration.ROLE );
- repositoryLocation = new File( appserverBase, "data/repositories/internal" );
- Configuration config = configuration.getConfiguration();
-
- config.addManagedRepository( createManagedRepository( "internal", "Internal Test Repo", repositoryLocation ) );
- saveConfiguration();
-
- ServletRunner sr = new ServletRunner();
- sr.registerServlet( "/repository/*", UnauthenticatedRepositoryServlet.class.getName() );
- sc = sr.newClient();
- HttpSession session = sc.getSession( true );
- ServletContext servletContext = session.getServletContext();
- servletContext.setAttribute( PlexusConstants.PLEXUS_KEY, getContainer() );
- }
-
- public void testPutWithMissingParentCollection()
- throws Exception
- {
- FileUtils.deleteDirectory( repositoryLocation );
-
- WebRequest request = new PutMethodWebRequest( REQUEST_PATH, getClass().getResourceAsStream( "/artifact.jar" ),
- "application/octet-stream" );
- WebResponse response = sc.getResponse( request );
- assertNotNull( "Should have received response", response );
- assertEquals( "file contents", "artifact.jar\n", FileUtils
- .readFileToString( new File( repositoryLocation, "path/to/artifact.jar" ), null ) );
- }
-
public void testGetRepository()
throws Exception
{
RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
assertNotNull( servlet );
- assertRepositoryValid( servlet, REPOSITORY_ID );
+ assertRepositoryValid( servlet, REPOID_INTERNAL );
}
public void testGetRepositoryAfterDelete()
@@ -121,11 +54,11 @@
RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
assertNotNull( servlet );
- Configuration c = configuration.getConfiguration();
- c.removeManagedRepository( c.findManagedRepositoryById( REPOSITORY_ID ) );
+ Configuration c = archivaConfiguration.getConfiguration();
+ c.removeManagedRepository( c.findManagedRepositoryById( REPOID_INTERNAL ) );
saveConfiguration();
- ManagedRepositoryConfiguration repository = servlet.getRepository( REPOSITORY_ID );
+ ManagedRepositoryConfiguration repository = servlet.getRepository( REPOID_INTERNAL );
assertNull( repository );
}
@@ -135,7 +68,7 @@
RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
assertNotNull( servlet );
- Configuration c = configuration.getConfiguration();
+ Configuration c = archivaConfiguration.getConfiguration();
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
repo.setId( NEW_REPOSITORY_ID );
repo.setName( NEW_REPOSITORY_NAME );
@@ -153,324 +86,6 @@
assertEquals( NEW_REPOSITORY_NAME, repository.getName() );
// check other is still intact
- assertRepositoryValid( servlet, REPOSITORY_ID );
- }
-
- public void testBrowse()
- throws Exception
- {
- RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
- assertNotNull( servlet );
- assertRepositoryValid( servlet, REPOSITORY_ID );
-
- new File( repositoryLocation, "org/apache/archiva" ).mkdirs();
- new File( repositoryLocation, "net/sourceforge" ).mkdirs();
- new File( repositoryLocation, "commons-lang" ).mkdirs();
-
- WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" );
- WebResponse response = sc.getResponse( request );
- assertEquals( "Response", HttpServletResponse.SC_OK, response.getResponseCode() );
-
- // dumpResponse( response );
-
- WebLink links[] = response.getLinks();
- String expectedLinks[] = new String[] { "./commons-lang/", "./net/", "./org/", "./path/" };
-
- assertEquals( "Links.length", expectedLinks.length, links.length );
- for ( int i = 0; i < links.length; i++ )
- {
- assertEquals( "Link[" + i + "]", expectedLinks[i], links[i].getURLString() );
- }
- }
-
- public void testGetNoProxyChecksumDefaultLayout()
- throws Exception
- {
- RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
- assertNotNull( servlet );
- assertRepositoryValid( servlet, REPOSITORY_ID );
-
- String commonsLangSha1 = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar.sha1";
-
- File checksumFile = new File( repositoryLocation, commonsLangSha1 );
- checksumFile.getParentFile().mkdirs();
-
- FileUtils.writeStringToFile( checksumFile, "dummy-checksum", null );
-
- WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangSha1 );
- WebResponse response = sc.getResponse( request );
- assertEquals( "Response OK", HttpServletResponse.SC_OK, response.getResponseCode() );
-
- assertEquals( "Expected file contents", "dummy-checksum", response.getText() );
- }
-
- public void testGetNoProxyChecksumLegacyLayout()
- throws Exception
- {
- RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
- assertNotNull( servlet );
- assertRepositoryValid( servlet, REPOSITORY_ID );
-
- String commonsLangSha1 = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar.sha1";
-
- File checksumFile = new File( repositoryLocation, commonsLangSha1 );
- checksumFile.getParentFile().mkdirs();
-
- FileUtils.writeStringToFile( checksumFile, "dummy-checksum", null );
-
- WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" +
- "commons-lang/jars/commons-lang-2.1.jar.sha1" );
- WebResponse response = sc.getResponse( request );
- assertEquals( "Response OK", HttpServletResponse.SC_OK, response.getResponseCode() );
-
- assertEquals( "Expected file contents", "dummy-checksum", response.getText() );
- }
-
- public void testGetNoProxyVersionedMetadataDefaultLayout()
- throws Exception
- {
- RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
- assertNotNull( servlet );
- assertRepositoryValid( servlet, REPOSITORY_ID );
-
- String commonsLangMetadata = "commons-lang/commons-lang/2.1/maven-metadata.xml";
- String expectedMetadataContents = "dummy-versioned-metadata";
-
- File metadataFile = new File( repositoryLocation, commonsLangMetadata );
- metadataFile.getParentFile().mkdirs();
-
- FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, null );
-
- WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata );
- WebResponse response = sc.getResponse( request );
- assertEquals( "Response OK", HttpServletResponse.SC_OK, response.getResponseCode() );
-
- assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
- }
-
- public void testGetNoProxyProjectMetadataDefaultLayout()
- throws Exception
- {
- RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
- assertNotNull( servlet );
- assertRepositoryValid( servlet, REPOSITORY_ID );
-
- String commonsLangMetadata = "commons-lang/commons-lang/maven-metadata.xml";
- String expectedMetadataContents = "dummy-project-metadata";
-
- File metadataFile = new File( repositoryLocation, commonsLangMetadata );
- metadataFile.getParentFile().mkdirs();
-
- FileUtils.writeStringToFile( metadataFile, expectedMetadataContents, null );
-
- WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangMetadata );
- WebResponse response = sc.getResponse( request );
- assertEquals( "Response OK", HttpServletResponse.SC_OK, response.getResponseCode() );
-
- assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
- }
-
- public void testGetNoProxyArtifactDefaultLayout()
- throws Exception
- {
- RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
- assertNotNull( servlet );
- assertRepositoryValid( servlet, REPOSITORY_ID );
-
- String commonsLangJar = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar";
- String expectedArtifactContents = "dummy-commons-lang-artifact";
-
- File artifactFile = new File( repositoryLocation, commonsLangJar );
- artifactFile.getParentFile().mkdirs();
-
- FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, null );
-
- WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar );
- WebResponse response = sc.getResponse( request );
- assertEquals( "Response OK", HttpServletResponse.SC_OK, response.getResponseCode() );
-
- assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
- }
-
- public void testGetNoProxyArtifactLegacyLayout()
- throws Exception
- {
- RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
- assertNotNull( servlet );
- assertRepositoryValid( servlet, REPOSITORY_ID );
-
- String commonsLangJar = "commons-lang/commons-lang/2.1/commons-lang-2.1.jar";
- String expectedArtifactContents = "dummy-commons-lang-artifact";
-
- File artifactFile = new File( repositoryLocation, commonsLangJar );
- artifactFile.getParentFile().mkdirs();
-
- FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, null );
-
- WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" +
- "commons-lang/jars/commons-lang-2.1.jar" );
- WebResponse response = sc.getResponse( request );
- assertEquals( "Response OK", HttpServletResponse.SC_OK, response.getResponseCode() );
-
- assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
- }
-
- public void testGetNoProxySnapshotArtifactDefaultLayout()
- throws Exception
- {
- RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
- assertNotNull( servlet );
- assertRepositoryValid( servlet, REPOSITORY_ID );
-
- String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-SNAPSHOT.jar";
- String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
-
- File artifactFile = new File( repositoryLocation, commonsLangJar );
- artifactFile.getParentFile().mkdirs();
-
- FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, null );
-
- WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar );
- WebResponse response = sc.getResponse( request );
- assertEquals( "Response OK", HttpServletResponse.SC_OK, response.getResponseCode() );
-
- assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
- }
-
- public void testGetNoProxySnapshotArtifactLegacyLayout()
- throws Exception
- {
- RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
- assertNotNull( servlet );
- assertRepositoryValid( servlet, REPOSITORY_ID );
-
- String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-SNAPSHOT.jar";
- String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
-
- File artifactFile = new File( repositoryLocation, commonsLangJar );
- artifactFile.getParentFile().mkdirs();
-
- FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, null );
-
- WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" +
- "commons-lang/jars/commons-lang-2.1-SNAPSHOT.jar" );
- WebResponse response = sc.getResponse( request );
- assertEquals( "Response OK", HttpServletResponse.SC_OK, response.getResponseCode() );
-
- assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
- }
-
- public void testGetNoProxyTimestampedSnapshotArtifactDefaultLayout()
- throws Exception
- {
- RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
- assertNotNull( servlet );
- assertRepositoryValid( servlet, REPOSITORY_ID );
-
- String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-20050821.023400-1.jar";
- String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
-
- File artifactFile = new File( repositoryLocation, commonsLangJar );
- artifactFile.getParentFile().mkdirs();
-
- FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, null );
-
- WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/" + commonsLangJar );
- WebResponse response = sc.getResponse( request );
- assertEquals( "Response OK", HttpServletResponse.SC_OK, response.getResponseCode() );
-
- assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
- }
-
- public void testGetNoProxyTimestampedSnapshotArtifactLegacyLayout()
- throws Exception
- {
- RepositoryServlet servlet = (RepositoryServlet) sc.newInvocation( REQUEST_PATH ).getServlet();
- assertNotNull( servlet );
- assertRepositoryValid( servlet, REPOSITORY_ID );
-
- String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-20050821.023400-1.jar";
- String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
-
- File artifactFile = new File( repositoryLocation, commonsLangJar );
- artifactFile.getParentFile().mkdirs();
-
- FileUtils.writeStringToFile( artifactFile, expectedArtifactContents, null );
-
- WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/internal/"
- + "commons-lang/jars/commons-lang-2.1-20050821.023400-1.jar" );
- WebResponse response = sc.getResponse( request );
- assertEquals( "Response OK", HttpServletResponse.SC_OK, response.getResponseCode() );
-
- assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
- }
-
- public void testMimeTypesAvailable()
- throws Exception
- {
- MimeTypes mimeTypes = (MimeTypes) lookup( MimeTypes.class );
- assertNotNull( mimeTypes );
-
- // Test for some added types.
- assertEquals( "sha1", "text/plain", mimeTypes.getMimeType( "foo.sha1" ) );
- assertEquals( "md5", "text/plain", mimeTypes.getMimeType( "foo.md5" ) );
- assertEquals( "pgp", "application/pgp-encrypted", mimeTypes.getMimeType( "foo.pgp" ) );
- assertEquals( "jar", "application/java-archive", mimeTypes.getMimeType( "foo.jar" ) );
- }
-
- public static void dumpResponse( WebResponse response )
- {
- System.out.println( "---(response)---" );
- System.out.println( "" + response.getResponseCode() + " " + response.getResponseMessage() );
-
- String headerNames[] = response.getHeaderFieldNames();
- for ( String headerName : headerNames )
- {
- System.out.println( "[header] " + headerName + ": " + response.getHeaderField( headerName ) );
- }
-
- System.out.println( "---(text)---" );
- try
- {
- System.out.println( response.getText() );
- }
- catch ( IOException e )
- {
- System.err.print( "[Exception] : " );
- e.printStackTrace( System.err );
- }
- }
-
- private void assertRepositoryValid( RepositoryServlet servlet, String repoId )
- {
- ManagedRepositoryConfiguration repository = servlet.getRepository( repoId );
- assertNotNull( "Archiva Managed Repository id:<" + repoId + "> should exist.", repository );
- File repoRoot = new File( repository.getLocation() );
- assertTrue( "Archiva Managed Repository id:<" + repoId + "> should have a valid location on disk.",
- repoRoot.exists() && repoRoot.isDirectory() );
- }
-
- private void saveConfiguration()
- throws Exception
- {
- configuration.save( configuration.getConfiguration() );
- }
-
- private ManagedRepositoryConfiguration createManagedRepository( String id, String name, File location )
- {
- ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
- repo.setId( id );
- repo.setName( name );
- repo.setLocation( location.getAbsolutePath() );
- return repo;
- }
-
- private RemoteRepositoryConfiguration createRemoteRepository( String id, String name, String url )
- {
- RemoteRepositoryConfiguration repo = new RemoteRepositoryConfiguration();
- repo.setId( id );
- repo.setName( name );
- repo.setUrl( url );
- return repo;
+ assertRepositoryValid( servlet, REPOID_INTERNAL );
}
}
Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/UnauthenticatedRepositoryServlet.java
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/UnauthenticatedRepositoryServlet.java?rev=588391&r1=588390&r2=588391&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/UnauthenticatedRepositoryServlet.java (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/repository/UnauthenticatedRepositoryServlet.java Thu Oct 25 16:39:05 2007
@@ -1,11 +1,5 @@
package org.apache.maven.archiva.web.repository;
-import org.codehaus.plexus.webdav.servlet.DavServerRequest;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -25,10 +19,29 @@
* under the License.
*/
+import org.codehaus.plexus.webdav.servlet.DavServerRequest;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * UnauthenticatedRepositoryServlet
+ *
+ * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
+ * @version $Id$
+ */
public class UnauthenticatedRepositoryServlet
extends RepositoryServlet
{
public boolean isAuthorized( DavServerRequest davRequest, HttpServletResponse response )
+ throws ServletException, IOException
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isAuthenticated( DavServerRequest davRequest, HttpServletResponse response )
throws ServletException, IOException
{
return true;
Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/META-INF/plexus/components.xml?rev=588391&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/META-INF/plexus/components.xml (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/META-INF/plexus/components.xml Thu Oct 25 16:39:05 2007
@@ -0,0 +1,33 @@
+<?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.
+ -->
+
+<component-set>
+ <components>
+ <!-- Components that are common for all test cases -->
+ <component>
+ <role>org.codehaus.plexus.webdav.util.MimeTypes</role>
+ <implementation>org.codehaus.plexus.webdav.util.MimeTypes</implementation>
+ <description>MimeTypes</description>
+ <configuration>
+ <resource>archiva-mime-types.txt</resource>
+ </configuration>
+ </component>
+ </components>
+</component-set>
\ No newline at end of file
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/META-INF/plexus/components.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.xml?rev=588391&view=auto
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.xml (added)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.xml Thu Oct 25 16:39:05 2007
@@ -0,0 +1,265 @@
+<?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.
+ -->
+
+<plexus>
+ <components>
+ <!--
+ | Logger manager
+ -->
+ <component>
+ <role>org.codehaus.plexus.logging.LoggerManager</role>
+ <implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation>
+ <lifecycle-handler>basic</lifecycle-handler>
+ </component>
+
+ <!--
+ | Configuration
+ -->
+ <component>
+ <role>org.apache.maven.archiva.configuration.ArchivaConfiguration</role>
+ <implementation>org.apache.maven.archiva.configuration.DefaultArchivaConfiguration</implementation>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.registry.Registry</role>
+ <role-hint>configured</role-hint>
+ </requirement>
+ </requirements>
+ </component>
+ <component>
+ <role>org.codehaus.plexus.registry.Registry</role>
+ <role-hint>configured</role-hint>
+ <implementation>org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry</implementation>
+ <configuration>
+ <properties>
+ <system/>
+ <xml fileName="${appserver.base}/conf/archiva.xml"
+ config-name="org.apache.maven.archiva.base" config-at="org.apache.maven.archiva"/>
+ </properties>
+ </configuration>
+ </component>
+
+ <component>
+ <role>org.codehaus.plexus.webdav.DavServerManager</role>
+ <role-hint>default</role-hint>
+ <implementation>org.codehaus.plexus.webdav.DefaultDavServerManager</implementation>
+ <description>DefaultDavServerManager</description>
+ <configuration>
+ <provider-hint>proxied</provider-hint>
+ </configuration>
+ </component>
+
+ <component>
+ <role>org.codehaus.plexus.cache.Cache</role>
+ <role-hint>url-failures-cache</role-hint>
+ <implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation>
+ <description>URL Failure Cache</description>
+ <configuration>
+ <disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds>
+ <disk-persistent>false</disk-persistent> <!--disabling disk persistence for unit testing. -->
+ <disk-store-path>${java.io.tmpdir}/archiva/urlcache</disk-store-path>
+ <eternal>false</eternal>
+ <max-elements-in-memory>1000</max-elements-in-memory>
+ <memory-eviction-policy>LRU</memory-eviction-policy>
+ <name>url-failures-cache</name>
+ <overflow-to-disk>false</overflow-to-disk>
+ <!-- 45 minutes = 2700 seconds -->
+ <time-to-idle-seconds>2700</time-to-idle-seconds>
+ <!-- 30 minutes = 1800 seconds -->
+ <time-to-live-seconds>1800</time-to-live-seconds>
+ </configuration>
+ </component>
+
+
+ <!-- Don't drag in the world just to test this -->
+ <component>
+ <role>org.apache.maven.archiva.repository.scanner.RepositoryContentConsumers</role>
+ <role-hint>default</role-hint>
+ <implementation>org.apache.maven.archiva.web.repository.StubRepositoryContentConsumers</implementation>
+ </component>
+
+ <!-- TODO: shouldn't need so many components just to use in-memory - is flaky since these are auto-generated -->
+ <component>
+ <role>org.codehaus.plexus.redback.system.SecuritySystem</role>
+ <role-hint>default</role-hint>
+ <implementation>org.codehaus.plexus.redback.system.DefaultSecuritySystem</implementation>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.authentication.AuthenticationManager</role>
+ <field-name>authnManager</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.authorization.Authorizer</role>
+ <role-hint>rbac</role-hint>
+ <field-name>authorizer</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.users.UserManager</role>
+ <role-hint>memory</role-hint>
+ <field-name>userManager</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.keys.KeyManager</role>
+ <role-hint>memory</role-hint>
+ <field-name>keyManager</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.policy.UserSecurityPolicy</role>
+ <field-name>policy</field-name>
+ </requirement>
+ </requirements>
+ </component>
+
+ <component>
+ <role>org.codehaus.plexus.redback.authentication.Authenticator</role>
+ <role-hint>user-manager</role-hint>
+ <implementation>org.codehaus.plexus.redback.authentication.users.UserManagerAuthenticator</implementation>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.users.UserManager</role>
+ <role-hint>memory</role-hint>
+ <field-name>userManager</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.policy.UserSecurityPolicy</role>
+ <field-name>securityPolicy</field-name>
+ </requirement>
+ </requirements>
+ </component>
+
+ <component>
+ <role>org.codehaus.plexus.redback.authentication.Authenticator</role>
+ <role-hint>keystore</role-hint>
+ <implementation>org.codehaus.plexus.redback.authentication.keystore.KeyStoreAuthenticator</implementation>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.keys.KeyManager</role>
+ <role-hint>memory</role-hint>
+ <field-name>keystore</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.users.UserManager</role>
+ <role-hint>memory</role-hint>
+ <field-name>userManager</field-name>
+ </requirement>
+ </requirements>
+ </component>
+
+ <component>
+ <role>org.codehaus.plexus.redback.authorization.rbac.evaluator.PermissionEvaluator</role>
+ <role-hint>default</role-hint>
+ <implementation>org.codehaus.plexus.redback.authorization.rbac.evaluator.DefaultPermissionEvaluator
+ </implementation>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.users.UserManager</role>
+ <role-hint>memory</role-hint>
+ <field-name>userManager</field-name>
+ </requirement>
+ </requirements>
+ </component>
+
+ <component>
+ <role>org.codehaus.plexus.redback.authorization.Authorizer</role>
+ <role-hint>rbac</role-hint>
+ <implementation>org.codehaus.plexus.redback.authorization.rbac.RbacAuthorizer</implementation>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.rbac.RBACManager</role>
+ <role-hint>memory</role-hint>
+ <field-name>manager</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.users.UserManager</role>
+ <role-hint>memory</role-hint>
+ <field-name>userManager</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.authorization.rbac.evaluator.PermissionEvaluator</role>
+ <role-hint>default</role-hint>
+ <field-name>evaluator</field-name>
+ </requirement>
+ </requirements>
+ </component>
+
+ <component>
+ <role>org.codehaus.plexus.redback.role.RoleManager</role>
+ <role-hint>default</role-hint>
+ <implementation>org.codehaus.plexus.redback.role.DefaultRoleManager</implementation>
+ <instantiation-strategy>singleton</instantiation-strategy>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.role.merger.RoleModelMerger</role>
+ <role-hint>default</role-hint>
+ <field-name>modelMerger</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.role.validator.RoleModelValidator</role>
+ <role-hint>default</role-hint>
+ <field-name>modelValidator</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.role.processor.RoleModelProcessor</role>
+ <role-hint>default</role-hint>
+ <field-name>modelProcessor</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.role.template.RoleTemplateProcessor</role>
+ <role-hint>default</role-hint>
+ <field-name>templateProcessor</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.redback.rbac.RBACManager</role>
+ <role-hint>memory</role-hint>
+ <field-name>rbacManager</field-name>
+ </requirement>
+ <requirement>
+ <role>org.codehaus.plexus.PlexusContainer</role>
+ <field-name>container</field-name>
+ </requirement>
+ </requirements>
+ </component>
+
+ <component>
+ <role>org.codehaus.plexus.redback.role.processor.RoleModelProcessor</role>
+ <role-hint>default</role-hint>
+ <implementation>org.codehaus.plexus.redback.role.processor.DefaultRoleModelProcessor</implementation>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.rbac.RBACManager</role>
+ <role-hint>memory</role-hint>
+ <field-name>rbacManager</field-name>
+ </requirement>
+ </requirements>
+ </component>
+
+ <component>
+ <role>org.codehaus.plexus.redback.role.template.RoleTemplateProcessor</role>
+ <role-hint>default</role-hint>
+ <implementation>org.codehaus.plexus.redback.role.template.DefaultRoleTemplateProcessor</implementation>
+ <requirements>
+ <requirement>
+ <role>org.codehaus.plexus.redback.rbac.RBACManager</role>
+ <role-hint>memory</role-hint>
+ <field-name>rbacManager</field-name>
+ </requirement>
+ </requirements>
+ </component>
+ </components>
+</plexus>
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Propchange: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletSecurityTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletTest.xml
URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletTest.xml?rev=588391&r1=588390&r2=588391&view=diff
==============================================================================
--- maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletTest.xml (original)
+++ maven/archiva/trunk/archiva-web/archiva-webapp/src/test/resources/org/apache/maven/archiva/web/repository/RepositoryServletTest.xml Thu Oct 25 16:39:05 2007
@@ -93,173 +93,12 @@
<role-hint>default</role-hint>
<implementation>org.apache.maven.archiva.web.repository.StubRepositoryContentConsumers</implementation>
</component>
-
- <!-- TODO: shouldn't need so many components just to use in-memory - is flaky since these are auto-generated -->
+
<component>
<role>org.codehaus.plexus.redback.system.SecuritySystem</role>
<role-hint>default</role-hint>
- <implementation>org.codehaus.plexus.redback.system.DefaultSecuritySystem</implementation>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.redback.authentication.AuthenticationManager</role>
- <field-name>authnManager</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.authorization.Authorizer</role>
- <role-hint>rbac</role-hint>
- <field-name>authorizer</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.users.UserManager</role>
- <role-hint>memory</role-hint>
- <field-name>userManager</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.keys.KeyManager</role>
- <role-hint>memory</role-hint>
- <field-name>keyManager</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.policy.UserSecurityPolicy</role>
- <field-name>policy</field-name>
- </requirement>
- </requirements>
- </component>
-
- <component>
- <role>org.codehaus.plexus.redback.authentication.Authenticator</role>
- <role-hint>user-manager</role-hint>
- <implementation>org.codehaus.plexus.redback.authentication.users.UserManagerAuthenticator</implementation>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.redback.users.UserManager</role>
- <role-hint>memory</role-hint>
- <field-name>userManager</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.policy.UserSecurityPolicy</role>
- <field-name>securityPolicy</field-name>
- </requirement>
- </requirements>
- </component>
-
- <component>
- <role>org.codehaus.plexus.redback.authentication.Authenticator</role>
- <role-hint>keystore</role-hint>
- <implementation>org.codehaus.plexus.redback.authentication.keystore.KeyStoreAuthenticator</implementation>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.redback.keys.KeyManager</role>
- <role-hint>memory</role-hint>
- <field-name>keystore</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.users.UserManager</role>
- <role-hint>memory</role-hint>
- <field-name>userManager</field-name>
- </requirement>
- </requirements>
+ <implementation>org.apache.maven.archiva.web.repository.BypassSecuritySystem</implementation>
</component>
- <component>
- <role>org.codehaus.plexus.redback.authorization.rbac.evaluator.PermissionEvaluator</role>
- <role-hint>default</role-hint>
- <implementation>org.codehaus.plexus.redback.authorization.rbac.evaluator.DefaultPermissionEvaluator
- </implementation>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.redback.users.UserManager</role>
- <role-hint>memory</role-hint>
- <field-name>userManager</field-name>
- </requirement>
- </requirements>
- </component>
-
- <component>
- <role>org.codehaus.plexus.redback.authorization.Authorizer</role>
- <role-hint>rbac</role-hint>
- <implementation>org.codehaus.plexus.redback.authorization.rbac.RbacAuthorizer</implementation>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.redback.rbac.RBACManager</role>
- <role-hint>memory</role-hint>
- <field-name>manager</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.users.UserManager</role>
- <role-hint>memory</role-hint>
- <field-name>userManager</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.authorization.rbac.evaluator.PermissionEvaluator</role>
- <role-hint>default</role-hint>
- <field-name>evaluator</field-name>
- </requirement>
- </requirements>
- </component>
-
- <component>
- <role>org.codehaus.plexus.redback.role.RoleManager</role>
- <role-hint>default</role-hint>
- <implementation>org.codehaus.plexus.redback.role.DefaultRoleManager</implementation>
- <instantiation-strategy>singleton</instantiation-strategy>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.redback.role.merger.RoleModelMerger</role>
- <role-hint>default</role-hint>
- <field-name>modelMerger</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.role.validator.RoleModelValidator</role>
- <role-hint>default</role-hint>
- <field-name>modelValidator</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.role.processor.RoleModelProcessor</role>
- <role-hint>default</role-hint>
- <field-name>modelProcessor</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.role.template.RoleTemplateProcessor</role>
- <role-hint>default</role-hint>
- <field-name>templateProcessor</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.redback.rbac.RBACManager</role>
- <role-hint>memory</role-hint>
- <field-name>rbacManager</field-name>
- </requirement>
- <requirement>
- <role>org.codehaus.plexus.PlexusContainer</role>
- <field-name>container</field-name>
- </requirement>
- </requirements>
- </component>
-
- <component>
- <role>org.codehaus.plexus.redback.role.processor.RoleModelProcessor</role>
- <role-hint>default</role-hint>
- <implementation>org.codehaus.plexus.redback.role.processor.DefaultRoleModelProcessor</implementation>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.redback.rbac.RBACManager</role>
- <role-hint>memory</role-hint>
- <field-name>rbacManager</field-name>
- </requirement>
- </requirements>
- </component>
-
- <component>
- <role>org.codehaus.plexus.redback.role.template.RoleTemplateProcessor</role>
- <role-hint>default</role-hint>
- <implementation>org.codehaus.plexus.redback.role.template.DefaultRoleTemplateProcessor</implementation>
- <requirements>
- <requirement>
- <role>org.codehaus.plexus.redback.rbac.RBACManager</role>
- <role-hint>memory</role-hint>
- <field-name>rbacManager</field-name>
- </requirement>
- </requirements>
- </component>
</components>
</plexus>