mirror of https://github.com/apache/archiva.git
[MRM-1496] Broken remote repository confuses Archiva
fixed with wagon 2.0 upgrade but add a unit test. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1177570 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
43e77d0636
commit
3734ce78c8
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<jettyVersion>7.4.5.v20110725</jettyVersion>
|
<jettyVersion>7.4.5.v20110725</jettyVersion>
|
||||||
<archiva.baseRestUrl></archiva.baseRestUrl>
|
<archiva.base.admUrl></archiva.baseRestUrl>
|
||||||
<rest.admin.pwd></rest.admin.pwd>
|
<rest.admin.pwd></rest.admin.pwd>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,13 @@
|
||||||
<artifactId>archiva-webapp</artifactId>
|
<artifactId>archiva-webapp</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<name>Archiva Web :: Application</name>
|
<name>Archiva Web :: Application</name>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<jettyVersion>7.4.5.v20110725</jettyVersion>
|
||||||
|
<archiva.baseRestUrl></archiva.baseRestUrl>
|
||||||
|
<rest.admin.pwd></rest.admin.pwd>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.archiva</groupId>
|
<groupId>org.apache.archiva</groupId>
|
||||||
|
@ -134,6 +141,10 @@
|
||||||
<groupId>org.apache.archiva</groupId>
|
<groupId>org.apache.archiva</groupId>
|
||||||
<artifactId>archiva-rest-services</artifactId>
|
<artifactId>archiva-rest-services</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.archiva</groupId>
|
||||||
|
<artifactId>archiva-rest-api</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>servlet-api</artifactId>
|
<artifactId>servlet-api</artifactId>
|
||||||
|
@ -491,6 +502,24 @@
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-server</artifactId>
|
||||||
|
<version>${jettyVersion}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
<artifactId>jetty-plus</artifactId>
|
||||||
|
<version>${jettyVersion}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.codehaus.redback</groupId>
|
||||||
|
<artifactId>redback-rest-services</artifactId>
|
||||||
|
<classifier>tests</classifier>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
|
@ -511,6 +540,8 @@
|
||||||
<systemPropertyVariables>
|
<systemPropertyVariables>
|
||||||
<plexus.home>${project.build.outputDirectory}</plexus.home>
|
<plexus.home>${project.build.outputDirectory}</plexus.home>
|
||||||
<appserver.base>${project.build.outputDirectory}</appserver.base>
|
<appserver.base>${project.build.outputDirectory}</appserver.base>
|
||||||
|
<archiva.baseRestUrl>${archiva.baseRestUrl}</archiva.baseRestUrl>
|
||||||
|
<rest.admin.pwd>${rest.admin.pwd}</rest.admin.pwd>
|
||||||
</systemPropertyVariables>
|
</systemPropertyVariables>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -0,0 +1,327 @@
|
||||||
|
package org.apache.archiva;
|
||||||
|
/*
|
||||||
|
* 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 junit.framework.TestCase;
|
||||||
|
import org.apache.archiva.admin.model.beans.RemoteRepository;
|
||||||
|
import org.apache.archiva.rest.api.services.ProxyConnectorService;
|
||||||
|
import org.apache.archiva.rest.api.services.RemoteRepositoriesService;
|
||||||
|
import org.apache.archiva.security.common.ArchivaRoleConstants;
|
||||||
|
import org.apache.archiva.webdav.RepositoryServlet;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.cxf.common.util.Base64Utility;
|
||||||
|
import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
|
||||||
|
import org.apache.cxf.jaxrs.client.WebClient;
|
||||||
|
import org.apache.cxf.transport.servlet.CXFServlet;
|
||||||
|
import org.codehaus.plexus.util.IOUtil;
|
||||||
|
import org.codehaus.redback.integration.security.role.RedbackRoleConstants;
|
||||||
|
import org.codehaus.redback.rest.api.services.RoleManagementService;
|
||||||
|
import org.codehaus.redback.rest.api.services.UserService;
|
||||||
|
import org.codehaus.redback.rest.services.FakeCreateAdminService;
|
||||||
|
import org.eclipse.jetty.server.Connector;
|
||||||
|
import org.eclipse.jetty.server.Server;
|
||||||
|
import org.eclipse.jetty.server.session.SessionHandler;
|
||||||
|
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||||
|
import org.eclipse.jetty.servlet.ServletHolder;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.JUnit4;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.web.context.ContextLoaderListener;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Olivier Lamy
|
||||||
|
*/
|
||||||
|
@RunWith( JUnit4.class )
|
||||||
|
public class DownloadArtifactsTest
|
||||||
|
extends TestCase
|
||||||
|
{
|
||||||
|
|
||||||
|
protected static Logger log = LoggerFactory.getLogger( DownloadArtifactsTest.class );
|
||||||
|
|
||||||
|
public String authorizationHeader = getAdminAuthzHeader();
|
||||||
|
|
||||||
|
public Server server = null;
|
||||||
|
|
||||||
|
public Server redirectServer = null;
|
||||||
|
|
||||||
|
public int port;
|
||||||
|
|
||||||
|
public int redirectPort;
|
||||||
|
|
||||||
|
public static String encode( String uid, String password )
|
||||||
|
{
|
||||||
|
return "Basic " + Base64Utility.encode( ( uid + ":" + password ).getBytes() );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getAdminAuthzHeader()
|
||||||
|
{
|
||||||
|
String adminPwdSysProps = System.getProperty( "rest.admin.pwd" );
|
||||||
|
if ( StringUtils.isBlank( adminPwdSysProps ) )
|
||||||
|
{
|
||||||
|
return encode( RedbackRoleConstants.ADMINISTRATOR_ACCOUNT_NAME, FakeCreateAdminService.ADMIN_TEST_PWD );
|
||||||
|
}
|
||||||
|
return encode( RedbackRoleConstants.ADMINISTRATOR_ACCOUNT_NAME, adminPwdSysProps );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getSpringConfigLocation()
|
||||||
|
{
|
||||||
|
return "classpath*:META-INF/spring-context.xml classpath*:spring-context-artifacts-download.xml";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected String getRestServicesPath()
|
||||||
|
{
|
||||||
|
return "restServices";
|
||||||
|
}
|
||||||
|
|
||||||
|
static String previousAppServerBase;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setAppServerBase()
|
||||||
|
{
|
||||||
|
|
||||||
|
previousAppServerBase = System.getProperty( "appserver.base" );
|
||||||
|
System.setProperty( "appserver.base", "target/" + DownloadArtifactsTest.class.getName() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void resetAppServerBase()
|
||||||
|
{
|
||||||
|
|
||||||
|
System.setProperty( "appserver.base", previousAppServerBase );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void startServer()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
System.setProperty( "redback.admin.creation.file", "target/auto-admin-creation.properties" );
|
||||||
|
this.server = new Server( 0 );
|
||||||
|
|
||||||
|
ServletContextHandler context = new ServletContextHandler();
|
||||||
|
|
||||||
|
context.setContextPath( "/" );
|
||||||
|
|
||||||
|
context.setInitParameter( "contextConfigLocation", getSpringConfigLocation() );
|
||||||
|
|
||||||
|
ContextLoaderListener contextLoaderListener = new ContextLoaderListener();
|
||||||
|
|
||||||
|
context.addEventListener( contextLoaderListener );
|
||||||
|
|
||||||
|
ServletHolder sh = new ServletHolder( CXFServlet.class );
|
||||||
|
|
||||||
|
SessionHandler sessionHandler = new SessionHandler();
|
||||||
|
|
||||||
|
context.setSessionHandler( sessionHandler );
|
||||||
|
|
||||||
|
context.addServlet( sh, "/" + getRestServicesPath() + "/*" );
|
||||||
|
|
||||||
|
ServletHolder repoSh = new ServletHolder( RepositoryServlet.class );
|
||||||
|
context.addServlet( repoSh, "/repository/*" );
|
||||||
|
|
||||||
|
server.setHandler( context );
|
||||||
|
this.server.start();
|
||||||
|
Connector connector = this.server.getConnectors()[0];
|
||||||
|
this.port = connector.getLocalPort();
|
||||||
|
log.info( "start server on port " + this.port );
|
||||||
|
|
||||||
|
//redirect handler
|
||||||
|
|
||||||
|
this.redirectServer = new Server( 0 );
|
||||||
|
ServletHolder shRedirect = new ServletHolder( RedirectServlet.class );
|
||||||
|
ServletContextHandler contextRedirect = new ServletContextHandler();
|
||||||
|
|
||||||
|
contextRedirect.setContextPath( "/" );
|
||||||
|
contextRedirect.addServlet( shRedirect, "/*" );
|
||||||
|
|
||||||
|
redirectServer.setHandler( contextRedirect );
|
||||||
|
redirectServer.start();
|
||||||
|
this.redirectPort = redirectServer.getConnectors()[0].getLocalPort();
|
||||||
|
log.info( "redirect server port {}", redirectPort );
|
||||||
|
|
||||||
|
FakeCreateAdminService fakeCreateAdminService = getFakeCreateAdminService();
|
||||||
|
|
||||||
|
Boolean res = fakeCreateAdminService.createAdminIfNeeded();
|
||||||
|
assertTrue( res.booleanValue() );
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
System.clearProperty( "redback.admin.creation.file" );
|
||||||
|
super.tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void downloadWithRemoteRedirect()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
RemoteRepository remoteRepository = getRemoteRepositoriesService().getRemoteRepository( "central" );
|
||||||
|
remoteRepository.setUrl( "http://localhost:" + redirectPort );
|
||||||
|
getRemoteRepositoriesService().updateRemoteRepository( remoteRepository );
|
||||||
|
|
||||||
|
RoleManagementService roleManagementService = getRoleManagementService( authorizationHeader );
|
||||||
|
|
||||||
|
if ( !roleManagementService.templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER,
|
||||||
|
"internal" ) )
|
||||||
|
{
|
||||||
|
roleManagementService.createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, "internal" );
|
||||||
|
}
|
||||||
|
|
||||||
|
getUserService( authorizationHeader ).createGuestUser();
|
||||||
|
roleManagementService.assignRole( ArchivaRoleConstants.TEMPLATE_GUEST, "guest" );
|
||||||
|
|
||||||
|
roleManagementService.assignTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, "internal",
|
||||||
|
"guest" );
|
||||||
|
|
||||||
|
getUserService( authorizationHeader ).removeFromCache( "guest" );
|
||||||
|
|
||||||
|
URL url = new URL( "http://localhost:" + port + "/repository/internal/junit/junit/4.9/junit-4.9.jar" );
|
||||||
|
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
|
||||||
|
//urlConnection.setRequestProperty( "Authorization", authorizationHeader );
|
||||||
|
InputStream is = urlConnection.getInputStream();
|
||||||
|
File file = new File( "target/junit-4.9.jar" );
|
||||||
|
if ( file.exists() )
|
||||||
|
{
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
FileWriter fw = new FileWriter( file );
|
||||||
|
IOUtil.copy( is, fw );
|
||||||
|
// assert jar contains org/junit/runners/JUnit4.class
|
||||||
|
ZipFile zipFile = new ZipFile( file );
|
||||||
|
ZipEntry zipEntry = zipFile.getEntry( "org/junit/runners/JUnit4.class" );
|
||||||
|
assertNotNull( zipEntry );
|
||||||
|
zipFile.close();
|
||||||
|
file.deleteOnExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class RedirectServlet
|
||||||
|
extends HttpServlet
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
protected void doGet( HttpServletRequest req, HttpServletResponse resp )
|
||||||
|
throws ServletException, IOException
|
||||||
|
{
|
||||||
|
|
||||||
|
log.info( "redirect servlet receive: {}", req.getRequestURI() );
|
||||||
|
resp.setStatus( 302 );
|
||||||
|
resp.getWriter().write( "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n" + "<html><head>\n"
|
||||||
|
+ "<title>302 Found</title>\n" + "</head><body>\n" + "<h1>Found</h1>\n"
|
||||||
|
+ "<p>The document has moved <a href=\"http://repo1.maven.apache.org/maven2/junit/junit/4.9/junit-4.9.jar\">here</a>.</p>\n"
|
||||||
|
+ "</body></html>\n" + "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n"
|
||||||
|
+ "<html><head>\n" );
|
||||||
|
resp.sendRedirect( "http://repo1.maven.apache.org/maven2/" + req.getRequestURI() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ProxyConnectorService getProxyConnectorService()
|
||||||
|
{
|
||||||
|
ProxyConnectorService service =
|
||||||
|
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
|
||||||
|
ProxyConnectorService.class );
|
||||||
|
|
||||||
|
WebClient.client( service ).header( "Authorization", authorizationHeader );
|
||||||
|
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected RemoteRepositoriesService getRemoteRepositoriesService()
|
||||||
|
{
|
||||||
|
RemoteRepositoriesService service =
|
||||||
|
JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/",
|
||||||
|
RemoteRepositoriesService.class );
|
||||||
|
|
||||||
|
WebClient.client( service ).header( "Authorization", authorizationHeader );
|
||||||
|
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000L );
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getBaseUrl()
|
||||||
|
{
|
||||||
|
String baseUrlSysProps = System.getProperty( "archiva.baseRestUrl" );
|
||||||
|
return StringUtils.isBlank( baseUrlSysProps ) ? "http://localhost:" + port : baseUrlSysProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected RoleManagementService getRoleManagementService( String authzHeader )
|
||||||
|
{
|
||||||
|
RoleManagementService service =
|
||||||
|
JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/redbackServices/",
|
||||||
|
RoleManagementService.class );
|
||||||
|
|
||||||
|
// for debuging purpose
|
||||||
|
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L );
|
||||||
|
|
||||||
|
if ( authzHeader != null )
|
||||||
|
{
|
||||||
|
WebClient.client( service ).header( "Authorization", authzHeader );
|
||||||
|
}
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected UserService getUserService( String authzHeader )
|
||||||
|
{
|
||||||
|
UserService service =
|
||||||
|
JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/redbackServices/",
|
||||||
|
UserService.class );
|
||||||
|
|
||||||
|
// for debuging purpose
|
||||||
|
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L );
|
||||||
|
|
||||||
|
if ( authzHeader != null )
|
||||||
|
{
|
||||||
|
WebClient.client( service ).header( "Authorization", authzHeader );
|
||||||
|
}
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected FakeCreateAdminService getFakeCreateAdminService()
|
||||||
|
{
|
||||||
|
return JAXRSClientFactory.create(
|
||||||
|
"http://localhost:" + port + "/" + getRestServicesPath() + "/fakeCreateAdminService/",
|
||||||
|
FakeCreateAdminService.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -33,7 +33,7 @@ import org.apache.archiva.metadata.model.License;
|
||||||
import org.apache.archiva.metadata.model.Organization;
|
import org.apache.archiva.metadata.model.Organization;
|
||||||
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
||||||
import org.apache.archiva.metadata.model.Scm;
|
import org.apache.archiva.metadata.model.Scm;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestMetadataResolver;
|
import org.apache.archiva.webtest.memory.TestMetadataResolver;
|
||||||
import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
|
import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectFacet;
|
||||||
import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectParent;
|
import org.apache.archiva.metadata.repository.storage.maven2.MavenProjectParent;
|
||||||
import org.apache.archiva.security.UserRepositoriesStub;
|
import org.apache.archiva.security.UserRepositoriesStub;
|
||||||
|
|
|
@ -23,10 +23,9 @@ import com.google.common.collect.Lists;
|
||||||
import com.opensymphony.xwork2.Action;
|
import com.opensymphony.xwork2.Action;
|
||||||
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
||||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestMetadataResolver;
|
import org.apache.archiva.webtest.memory.TestMetadataResolver;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
|
import org.apache.archiva.webtest.memory.TestRepositorySessionFactory;
|
||||||
import org.apache.archiva.scheduler.indexing.DefaultDownloadRemoteIndexScheduler;
|
import org.apache.archiva.scheduler.indexing.DefaultDownloadRemoteIndexScheduler;
|
||||||
import org.springframework.context.support.GenericApplicationContext;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin
|
||||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
|
import org.apache.archiva.webtest.memory.TestRepositorySessionFactory;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.archiva.configuration.ArchivaConfiguration;
|
import org.apache.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.apache.archiva.configuration.Configuration;
|
import org.apache.archiva.configuration.Configuration;
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.apache.archiva.indexer.util.SearchUtil;
|
||||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
|
import org.apache.archiva.webtest.memory.TestRepositorySessionFactory;
|
||||||
import org.apache.archiva.security.UserRepositories;
|
import org.apache.archiva.security.UserRepositories;
|
||||||
import org.apache.archiva.configuration.ArchivaConfiguration;
|
import org.apache.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.easymock.MockControl;
|
import org.easymock.MockControl;
|
||||||
|
|
|
@ -29,8 +29,8 @@ import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
||||||
import org.apache.archiva.metadata.model.ProjectVersionReference;
|
import org.apache.archiva.metadata.model.ProjectVersionReference;
|
||||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestMetadataResolver;
|
import org.apache.archiva.webtest.memory.TestMetadataResolver;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
|
import org.apache.archiva.webtest.memory.TestRepositorySessionFactory;
|
||||||
import org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacet;
|
import org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacet;
|
||||||
import org.apache.archiva.reports.RepositoryProblemFacet;
|
import org.apache.archiva.reports.RepositoryProblemFacet;
|
||||||
import org.apache.archiva.common.utils.VersionUtil;
|
import org.apache.archiva.common.utils.VersionUtil;
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.apache.archiva.audit.AuditEvent;
|
||||||
import org.apache.archiva.audit.AuditListener;
|
import org.apache.archiva.audit.AuditListener;
|
||||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
|
import org.apache.archiva.webtest.memory.TestRepositorySessionFactory;
|
||||||
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
|
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
|
||||||
import org.apache.archiva.security.ArchivaRoleConstants;
|
import org.apache.archiva.security.ArchivaRoleConstants;
|
||||||
import org.apache.archiva.configuration.ArchivaConfiguration;
|
import org.apache.archiva.configuration.ArchivaConfiguration;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin
|
||||||
import org.apache.archiva.audit.AuditListener;
|
import org.apache.archiva.audit.AuditListener;
|
||||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
|
import org.apache.archiva.webtest.memory.TestRepositorySessionFactory;
|
||||||
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
|
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
|
||||||
import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
|
import org.apache.archiva.scheduler.repository.RepositoryArchivaTaskScheduler;
|
||||||
import org.apache.archiva.scheduler.repository.RepositoryTask;
|
import org.apache.archiva.scheduler.repository.RepositoryTask;
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin
|
||||||
import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin;
|
import org.apache.archiva.admin.repository.remote.DefaultRemoteRepositoryAdmin;
|
||||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
|
import org.apache.archiva.webtest.memory.TestRepositorySessionFactory;
|
||||||
import org.apache.archiva.metadata.repository.stats.RepositoryStatistics;
|
import org.apache.archiva.metadata.repository.stats.RepositoryStatistics;
|
||||||
import org.apache.archiva.configuration.ArchivaConfiguration;
|
import org.apache.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.apache.struts2.StrutsSpringTestCase;
|
import org.apache.struts2.StrutsSpringTestCase;
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
|
||||||
import org.apache.archiva.metadata.model.MetadataFacet;
|
import org.apache.archiva.metadata.model.MetadataFacet;
|
||||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
|
import org.apache.archiva.webtest.memory.TestRepositorySessionFactory;
|
||||||
import org.apache.archiva.metadata.repository.stats.RepositoryStatistics;
|
import org.apache.archiva.metadata.repository.stats.RepositoryStatistics;
|
||||||
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
|
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
|
||||||
import org.apache.archiva.reports.RepositoryProblemFacet;
|
import org.apache.archiva.reports.RepositoryProblemFacet;
|
||||||
|
|
|
@ -29,8 +29,8 @@ import junit.framework.TestCase;
|
||||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
|
||||||
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
||||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestMetadataResolver;
|
import org.apache.archiva.webtest.memory.TestMetadataResolver;
|
||||||
import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
|
import org.apache.archiva.webtest.memory.TestRepositorySessionFactory;
|
||||||
import org.apache.archiva.common.ArchivaException;
|
import org.apache.archiva.common.ArchivaException;
|
||||||
import org.apache.archiva.configuration.ArchivaConfiguration;
|
import org.apache.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.apache.archiva.configuration.Configuration;
|
import org.apache.archiva.configuration.Configuration;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.apache.archiva.metadata.repository.memory;
|
package org.apache.archiva.webtest.memory;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
||||||
package org.apache.archiva.metadata.repository.memory;
|
package org.apache.archiva.webtest.memory;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -1,4 +1,4 @@
|
||||||
package org.apache.archiva.metadata.repository.memory;
|
package org.apache.archiva.webtest.memory;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
@ -30,7 +30,7 @@
|
||||||
<context:property-placeholder system-properties-mode="OVERRIDE"/>
|
<context:property-placeholder system-properties-mode="OVERRIDE"/>
|
||||||
|
|
||||||
<context:annotation-config/>
|
<context:annotation-config/>
|
||||||
<context:component-scan base-package="org.apache.archiva.metadata.repository.memory"/>
|
<context:component-scan base-package="org.apache.archiva.webtest.memory"/>
|
||||||
|
|
||||||
<bean name="archivaConfiguration#test" class="org.apache.archiva.configuration.TestConfiguration" />
|
<bean name="archivaConfiguration#test" class="org.apache.archiva.configuration.TestConfiguration" />
|
||||||
<alias name="archivaConfiguration#test" alias="archivaConfiguration#default" />
|
<alias name="archivaConfiguration#test" alias="archivaConfiguration#default" />
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?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"/>
|
||||||
|
|
||||||
|
|
||||||
|
<bean name="commons-configuration" class="org.codehaus.redback.components.registry.commons.CommonsConfigurationRegistry">
|
||||||
|
<property name="properties">
|
||||||
|
<value>
|
||||||
|
<![CDATA[
|
||||||
|
<configuration>
|
||||||
|
<system/>
|
||||||
|
|
||||||
|
<xml fileName="${appserver.base}/conf/archiva-test-download-artifacts.xml" config-optional="true"
|
||||||
|
config-name="org.apache.maven.archiva.base"
|
||||||
|
config-at="org.apache.maven.archiva"/>
|
||||||
|
|
||||||
|
<properties fileName="${appserver.base}/conf/security.properties" config-optional="true"
|
||||||
|
config-at="org.codehaus.plexus.redback"/>
|
||||||
|
<properties fileName="org/apache/archiva/security.properties" config-at="org.codehaus.plexus.redback"/>
|
||||||
|
</configuration>
|
||||||
|
]]>
|
||||||
|
</value>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
|
||||||
|
</beans>
|
|
@ -30,7 +30,7 @@
|
||||||
<context:property-placeholder system-properties-mode="OVERRIDE"/>
|
<context:property-placeholder system-properties-mode="OVERRIDE"/>
|
||||||
|
|
||||||
<context:annotation-config/>
|
<context:annotation-config/>
|
||||||
<context:component-scan base-package="org.apache.archiva.metadata.repository.memory"/>
|
<context:component-scan base-package="org.apache.archiva.webtest.memory"/>
|
||||||
|
|
||||||
<alias name="repositorySessionFactory#test" alias="repositorySessionFactory"/>
|
<alias name="repositorySessionFactory#test" alias="repositorySessionFactory"/>
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<context:property-placeholder system-properties-mode="OVERRIDE"/>
|
<context:property-placeholder system-properties-mode="OVERRIDE"/>
|
||||||
|
|
||||||
<context:annotation-config/>
|
<context:annotation-config/>
|
||||||
<context:component-scan base-package="org.apache.archiva.metadata.repository.memory"/>
|
<context:component-scan base-package="org.apache.archiva.webtest.memory"/>
|
||||||
|
|
||||||
<alias name="repositorySessionFactory#test" alias="repositorySessionFactory"/>
|
<alias name="repositorySessionFactory#test" alias="repositorySessionFactory"/>
|
||||||
|
|
||||||
|
@ -38,6 +38,6 @@
|
||||||
|
|
||||||
<alias name="userRepositories#test" alias="userRepositories"/>
|
<alias name="userRepositories#test" alias="userRepositories"/>
|
||||||
|
|
||||||
<bean name="metadataResolver#test" class="org.apache.archiva.metadata.repository.memory.TestMetadataResolver"/>
|
<bean name="metadataResolver#test" class="org.apache.archiva.webtest.memory.TestMetadataResolver"/>
|
||||||
<alias name="metadataResolver#test" alias="metadataResolver#default"/>
|
<alias name="metadataResolver#test" alias="metadataResolver#default"/>
|
||||||
</beans>
|
</beans>
|
||||||
|
|
Loading…
Reference in New Issue