mirror of https://github.com/apache/archiva.git
plexus-spring remove , fix test compilation in archiva-webdav
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1131428 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fa5bd3e98b
commit
dc25b2f5e6
|
@ -195,4 +195,14 @@ public class MimeTypes
|
||||||
IOUtils.closeQuietly( reader );
|
IOUtils.closeQuietly( reader );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getResource()
|
||||||
|
{
|
||||||
|
return resource;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResource( String resource )
|
||||||
|
{
|
||||||
|
this.resource = resource;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.custommonkey.xmlunit.DetailedDiff;
|
import org.custommonkey.xmlunit.DetailedDiff;
|
||||||
import org.custommonkey.xmlunit.Diff;
|
import org.custommonkey.xmlunit.Diff;
|
||||||
|
import org.junit.Before;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract TestCase for RepositoryServlet Tests, Proxied, Get of Metadata.
|
* Abstract TestCase for RepositoryServlet Tests, Proxied, Get of Metadata.
|
||||||
|
@ -242,7 +243,8 @@ public abstract class AbstractRepositoryServletProxiedMetadataTestCase
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
protected void tearDown()
|
@Before
|
||||||
|
public void tearDown()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
shutdownServer( remotePrivateSnapshots );
|
shutdownServer( remotePrivateSnapshots );
|
||||||
|
|
|
@ -19,8 +19,8 @@ package org.apache.maven.archiva.webdav;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import com.meterware.httpunit.WebConversation;
|
||||||
|
import com.meterware.httpunit.WebResponse;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
|
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||||
|
@ -28,17 +28,18 @@ import org.apache.maven.archiva.policies.CachedFailuresPolicy;
|
||||||
import org.apache.maven.archiva.policies.ChecksumPolicy;
|
import org.apache.maven.archiva.policies.ChecksumPolicy;
|
||||||
import org.apache.maven.archiva.policies.ReleasesPolicy;
|
import org.apache.maven.archiva.policies.ReleasesPolicy;
|
||||||
import org.apache.maven.archiva.policies.SnapshotsPolicy;
|
import org.apache.maven.archiva.policies.SnapshotsPolicy;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
import org.mortbay.jetty.Server;
|
import org.mortbay.jetty.Server;
|
||||||
import org.mortbay.jetty.handler.ContextHandler;
|
import org.mortbay.jetty.handler.ContextHandler;
|
||||||
import org.mortbay.jetty.handler.ContextHandlerCollection;
|
import org.mortbay.jetty.handler.ContextHandlerCollection;
|
||||||
import org.mortbay.jetty.servlet.DefaultServlet;
|
import org.mortbay.jetty.servlet.DefaultServlet;
|
||||||
import org.mortbay.jetty.servlet.ServletHandler;
|
import org.mortbay.jetty.servlet.ServletHandler;
|
||||||
|
|
||||||
import com.meterware.httpunit.WebConversation;
|
import java.io.File;
|
||||||
import com.meterware.httpunit.WebResponse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractRepositoryServletProxiedTestCase
|
* AbstractRepositoryServletProxiedTestCase
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
@ -89,11 +90,11 @@ public abstract class AbstractRepositoryServletProxiedTestCase
|
||||||
protected RemoteRepoInfo remoteCentral;
|
protected RemoteRepoInfo remoteCentral;
|
||||||
|
|
||||||
protected RemoteRepoInfo remoteSnapshots;
|
protected RemoteRepoInfo remoteSnapshots;
|
||||||
|
|
||||||
protected RemoteRepoInfo remotePrivateSnapshots;
|
protected RemoteRepoInfo remotePrivateSnapshots;
|
||||||
|
|
||||||
@Override
|
@Before
|
||||||
protected void setUp()
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
@ -105,7 +106,7 @@ public abstract class AbstractRepositoryServletProxiedTestCase
|
||||||
RemoteRepoInfo repo = new RemoteRepoInfo();
|
RemoteRepoInfo repo = new RemoteRepoInfo();
|
||||||
repo.id = id;
|
repo.id = id;
|
||||||
repo.context = "/" + id;
|
repo.context = "/" + id;
|
||||||
repo.root = getTestFile( "target/remote-repos/" + id + "/" );
|
repo.root = new File( "target/remote-repos/" + id + "/" );
|
||||||
|
|
||||||
// Remove exising root contents.
|
// Remove exising root contents.
|
||||||
if ( repo.root.exists() )
|
if ( repo.root.exists() )
|
||||||
|
@ -152,7 +153,8 @@ public abstract class AbstractRepositoryServletProxiedTestCase
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupConnector( String repoId, RemoteRepoInfo remoteRepo, String releasesPolicy, String snapshotsPolicy )
|
private void setupConnector( String repoId, RemoteRepoInfo remoteRepo, String releasesPolicy,
|
||||||
|
String snapshotsPolicy )
|
||||||
{
|
{
|
||||||
ProxyConnectorConfiguration connector = new ProxyConnectorConfiguration();
|
ProxyConnectorConfiguration connector = new ProxyConnectorConfiguration();
|
||||||
connector.setSourceRepoId( repoId );
|
connector.setSourceRepoId( repoId );
|
||||||
|
@ -234,7 +236,8 @@ public abstract class AbstractRepositoryServletProxiedTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown()
|
@After
|
||||||
|
public void tearDown()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
shutdownServer( remoteCentral );
|
shutdownServer( remoteCentral );
|
||||||
|
|
|
@ -24,25 +24,33 @@ import com.meterware.httpunit.WebResponse;
|
||||||
import com.meterware.servletunit.ServletRunner;
|
import com.meterware.servletunit.ServletRunner;
|
||||||
import com.meterware.servletunit.ServletUnitClient;
|
import com.meterware.servletunit.ServletUnitClient;
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
import junit.framework.TestCase;
|
||||||
import net.sf.ehcache.CacheManager;
|
import net.sf.ehcache.CacheManager;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.Configuration;
|
import org.apache.maven.archiva.configuration.Configuration;
|
||||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration;
|
||||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AbstractRepositoryServletTestCase
|
* AbstractRepositoryServletTestCase
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
@RunWith( SpringJUnit4ClassRunner.class )
|
||||||
|
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
|
||||||
public abstract class AbstractRepositoryServletTestCase
|
public abstract class AbstractRepositoryServletTestCase
|
||||||
extends PlexusInSpringTestCase
|
extends TestCase
|
||||||
{
|
{
|
||||||
protected static final String REPOID_INTERNAL = "internal";
|
protected static final String REPOID_INTERNAL = "internal";
|
||||||
|
|
||||||
|
@ -56,6 +64,7 @@ public abstract class AbstractRepositoryServletTestCase
|
||||||
|
|
||||||
private ServletRunner sr;
|
private ServletRunner sr;
|
||||||
|
|
||||||
|
@Inject
|
||||||
protected ArchivaConfiguration archivaConfiguration;
|
protected ArchivaConfiguration archivaConfiguration;
|
||||||
|
|
||||||
protected void saveConfiguration()
|
protected void saveConfiguration()
|
||||||
|
@ -155,19 +164,20 @@ public abstract class AbstractRepositoryServletTestCase
|
||||||
archivaConfiguration.save( archivaConfiguration.getConfiguration() );
|
archivaConfiguration.save( archivaConfiguration.getConfiguration() );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUp()
|
@Before
|
||||||
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
String appserverBase = getTestFile( "target/appserver-base" ).getAbsolutePath();
|
String appserverBase = new File( "target/appserver-base" ).getAbsolutePath();
|
||||||
System.setProperty( "appserver.base", appserverBase );
|
System.setProperty( "appserver.base", appserverBase );
|
||||||
|
|
||||||
File testConf = getTestFile( "src/test/resources/repository-archiva.xml" );
|
File testConf = new File( "src/test/resources/repository-archiva.xml" );
|
||||||
File testConfDest = new File( appserverBase, "conf/archiva.xml" );
|
File testConfDest = new File( appserverBase, "conf/archiva.xml" );
|
||||||
FileUtils.copyFile( testConf, testConfDest );
|
FileUtils.copyFile( testConf, testConfDest );
|
||||||
|
|
||||||
archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class );
|
//archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class );
|
||||||
repoRootInternal = new File( appserverBase, "data/repositories/internal" );
|
repoRootInternal = new File( appserverBase, "data/repositories/internal" );
|
||||||
repoRootLegacy = new File( appserverBase, "data/repositories/legacy" );
|
repoRootLegacy = new File( appserverBase, "data/repositories/legacy" );
|
||||||
Configuration config = archivaConfiguration.getConfiguration();
|
Configuration config = archivaConfiguration.getConfiguration();
|
||||||
|
@ -180,19 +190,14 @@ public abstract class AbstractRepositoryServletTestCase
|
||||||
|
|
||||||
HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );
|
HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );
|
||||||
|
|
||||||
sr = new ServletRunner( getTestFile( "src/test/resources/WEB-INF/web.xml" ) );
|
sr = new ServletRunner( new File( "src/test/resources/WEB-INF/web.xml" ) );
|
||||||
sr.registerServlet( "/repository/*", UnauthenticatedRepositoryServlet.class.getName() );
|
sr.registerServlet( "/repository/*", UnauthenticatedRepositoryServlet.class.getName() );
|
||||||
sc = sr.newClient();
|
sc = sr.newClient();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getPlexusConfigLocation()
|
@After
|
||||||
{
|
public void tearDown()
|
||||||
return "org/apache/maven/archiva/webdav/RepositoryServletTest.xml";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void tearDown()
|
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
if ( sc != null )
|
if ( sc != null )
|
||||||
|
@ -215,8 +220,6 @@ public abstract class AbstractRepositoryServletTestCase
|
||||||
FileUtils.deleteDirectory( repoRootLegacy );
|
FileUtils.deleteDirectory( repoRootLegacy );
|
||||||
}
|
}
|
||||||
|
|
||||||
release( archivaConfiguration );
|
|
||||||
|
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,7 @@ package org.apache.maven.archiva.webdav;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import junit.framework.TestCase;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.jackrabbit.webdav.DavException;
|
import org.apache.jackrabbit.webdav.DavException;
|
||||||
import org.apache.jackrabbit.webdav.DavResourceLocator;
|
import org.apache.jackrabbit.webdav.DavResourceLocator;
|
||||||
|
@ -36,17 +32,30 @@ import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
|
||||||
import org.apache.maven.archiva.proxy.DefaultRepositoryProxyConnectors;
|
import org.apache.maven.archiva.proxy.DefaultRepositoryProxyConnectors;
|
||||||
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
|
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
|
||||||
import org.apache.maven.archiva.repository.RepositoryContentFactory;
|
import org.apache.maven.archiva.repository.RepositoryContentFactory;
|
||||||
|
import org.apache.maven.archiva.repository.content.LegacyPathParser;
|
||||||
import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryContent;
|
import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryContent;
|
||||||
import org.apache.maven.archiva.repository.content.RepositoryRequest;
|
import org.apache.maven.archiva.repository.content.RepositoryRequest;
|
||||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
|
||||||
import org.easymock.MockControl;
|
import org.easymock.MockControl;
|
||||||
import org.easymock.classextension.MockClassControl;
|
import org.easymock.classextension.MockClassControl;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArchivaDavResourceFactoryTest
|
* ArchivaDavResourceFactoryTest
|
||||||
*/
|
*/
|
||||||
|
@RunWith( SpringJUnit4ClassRunner.class )
|
||||||
|
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
|
||||||
public class ArchivaDavResourceFactoryTest
|
public class ArchivaDavResourceFactoryTest
|
||||||
extends PlexusInSpringTestCase
|
extends TestCase
|
||||||
{
|
{
|
||||||
private static final String RELEASES_REPO = "releases";
|
private static final String RELEASES_REPO = "releases";
|
||||||
|
|
||||||
|
@ -81,7 +90,8 @@ public class ArchivaDavResourceFactoryTest
|
||||||
private MockControl repoContentFactoryControl;
|
private MockControl repoContentFactoryControl;
|
||||||
|
|
||||||
private RepositoryContentFactory repoFactory;
|
private RepositoryContentFactory repoFactory;
|
||||||
|
|
||||||
|
@Before
|
||||||
public void setUp()
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -98,12 +108,10 @@ public class ArchivaDavResourceFactoryTest
|
||||||
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
archivaConfiguration = (ArchivaConfiguration) archivaConfigurationControl.getMock();
|
||||||
|
|
||||||
config = new Configuration();
|
config = new Configuration();
|
||||||
config.addManagedRepository( createManagedRepository( RELEASES_REPO, new File( getBasedir(),
|
config.addManagedRepository( createManagedRepository( RELEASES_REPO, new File( "target/test-classes/" +
|
||||||
"target/test-classes/" +
|
|
||||||
RELEASES_REPO ).getPath(),
|
RELEASES_REPO ).getPath(),
|
||||||
"default" ) );
|
"default" ) );
|
||||||
config.addManagedRepository( createManagedRepository( INTERNAL_REPO, new File( getBasedir(),
|
config.addManagedRepository( createManagedRepository( INTERNAL_REPO, new File( "target/test-classes/" +
|
||||||
"target/test-classes/" +
|
|
||||||
INTERNAL_REPO ).getPath(),
|
INTERNAL_REPO ).getPath(),
|
||||||
"default" ) );
|
"default" ) );
|
||||||
|
|
||||||
|
@ -146,6 +154,7 @@ public class ArchivaDavResourceFactoryTest
|
||||||
return repoContent;
|
return repoContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
public void tearDown()
|
public void tearDown()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -153,6 +162,7 @@ public class ArchivaDavResourceFactoryTest
|
||||||
}
|
}
|
||||||
|
|
||||||
// MRM-1232 - Unable to get artifacts from repositories which requires Repository Manager role using repository group
|
// MRM-1232 - Unable to get artifacts from repositories which requires Repository Manager role using repository group
|
||||||
|
@Test
|
||||||
public void testRepositoryGroupFirstRepositoryRequiresAuthentication()
|
public void testRepositoryGroupFirstRepositoryRequiresAuthentication()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -210,6 +220,7 @@ public class ArchivaDavResourceFactoryTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testRepositoryGroupLastRepositoryRequiresAuthentication()
|
public void testRepositoryGroupLastRepositoryRequiresAuthentication()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -277,6 +288,7 @@ public class ArchivaDavResourceFactoryTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testRepositoryGroupArtifactDoesNotExistInAnyOfTheReposAuthenticationDisabled()
|
public void testRepositoryGroupArtifactDoesNotExistInAnyOfTheReposAuthenticationDisabled()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -286,8 +298,7 @@ public class ArchivaDavResourceFactoryTest
|
||||||
new ArchivaDavLocatorFactory() );
|
new ArchivaDavLocatorFactory() );
|
||||||
|
|
||||||
config.addManagedRepository( createManagedRepository( LOCAL_MIRROR_REPO,
|
config.addManagedRepository( createManagedRepository( LOCAL_MIRROR_REPO,
|
||||||
new File( getBasedir(),
|
new File( "target/test-classes/local-mirror" ).getPath(),
|
||||||
"target/test-classes/local-mirror" ).getPath(),
|
|
||||||
"default" ) );
|
"default" ) );
|
||||||
|
|
||||||
List<RepositoryGroupConfiguration> repoGroups = new ArrayList<RepositoryGroupConfiguration>();
|
List<RepositoryGroupConfiguration> repoGroups = new ArrayList<RepositoryGroupConfiguration>();
|
||||||
|
@ -359,6 +370,7 @@ public class ArchivaDavResourceFactoryTest
|
||||||
}
|
}
|
||||||
|
|
||||||
// MRM-1239
|
// MRM-1239
|
||||||
|
@Test
|
||||||
public void testRequestArtifactMetadataThreePartsRepoHasDefaultLayout()
|
public void testRequestArtifactMetadataThreePartsRepoHasDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -370,7 +382,7 @@ public class ArchivaDavResourceFactoryTest
|
||||||
ManagedRepositoryContent internalRepo = createManagedRepositoryContent( INTERNAL_REPO );
|
ManagedRepositoryContent internalRepo = createManagedRepositoryContent( INTERNAL_REPO );
|
||||||
|
|
||||||
// use actual object (this performs the isMetadata, isDefault and isSupportFile check!)
|
// use actual object (this performs the isMetadata, isDefault and isSupportFile check!)
|
||||||
RepositoryRequest repoRequest = (RepositoryRequest) lookup( RepositoryRequest.class );
|
RepositoryRequest repoRequest = new RepositoryRequest( new LegacyPathParser( this.archivaConfiguration ) );
|
||||||
resourceFactory.setRepositoryRequest( repoRequest );
|
resourceFactory.setRepositoryRequest( repoRequest );
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -411,6 +423,7 @@ public class ArchivaDavResourceFactoryTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testRequestArtifactMetadataTwoPartsRepoHasDefaultLayout()
|
public void testRequestArtifactMetadataTwoPartsRepoHasDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -422,7 +435,7 @@ public class ArchivaDavResourceFactoryTest
|
||||||
ManagedRepositoryContent internalRepo = createManagedRepositoryContent( INTERNAL_REPO );
|
ManagedRepositoryContent internalRepo = createManagedRepositoryContent( INTERNAL_REPO );
|
||||||
|
|
||||||
// use actual object (this performs the isMetadata, isDefault and isSupportFile check!)
|
// use actual object (this performs the isMetadata, isDefault and isSupportFile check!)
|
||||||
RepositoryRequest repoRequest = (RepositoryRequest) lookup( RepositoryRequest.class );
|
RepositoryRequest repoRequest = new RepositoryRequest( new LegacyPathParser( this.archivaConfiguration ) );
|
||||||
resourceFactory.setRepositoryRequest( repoRequest );
|
resourceFactory.setRepositoryRequest( repoRequest );
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -452,11 +465,11 @@ public class ArchivaDavResourceFactoryTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testRequestMetadataRepoIsLegacy()
|
public void testRequestMetadataRepoIsLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
config.addManagedRepository( createManagedRepository( LEGACY_REPO, new File( getBasedir(),
|
config.addManagedRepository( createManagedRepository( LEGACY_REPO, new File( "target/test-classes/" +
|
||||||
"target/test-classes/" +
|
|
||||||
LEGACY_REPO ).getPath(),
|
LEGACY_REPO ).getPath(),
|
||||||
"legacy" ) );
|
"legacy" ) );
|
||||||
DavResourceLocator locator =
|
DavResourceLocator locator =
|
||||||
|
@ -466,7 +479,7 @@ public class ArchivaDavResourceFactoryTest
|
||||||
ManagedRepositoryContent legacyRepo = createManagedRepositoryContent( LEGACY_REPO );
|
ManagedRepositoryContent legacyRepo = createManagedRepositoryContent( LEGACY_REPO );
|
||||||
|
|
||||||
// use actual object (this performs the isMetadata, isDefault and isSupportFile check!)
|
// use actual object (this performs the isMetadata, isDefault and isSupportFile check!)
|
||||||
RepositoryRequest repoRequest = (RepositoryRequest) lookup( RepositoryRequest.class );
|
RepositoryRequest repoRequest = new RepositoryRequest( new LegacyPathParser( this.archivaConfiguration ) );
|
||||||
resourceFactory.setRepositoryRequest( repoRequest );
|
resourceFactory.setRepositoryRequest( repoRequest );
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -527,7 +540,7 @@ public class ArchivaDavResourceFactoryTest
|
||||||
File target = new File( repository.getRepoRoot(), logicalPath );
|
File target = new File( repository.getRepoRoot(), logicalPath );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
FileUtils.copyFile( new File( getBasedir(), "target/test-classes/maven-metadata.xml" ), target );
|
FileUtils.copyFile( new File( "target/test-classes/maven-metadata.xml" ), target );
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,8 @@ import junit.framework.TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class ArchivaDavResourceLocatorTest extends TestCase
|
public class ArchivaDavResourceLocatorTest
|
||||||
|
extends TestCase
|
||||||
{
|
{
|
||||||
ArchivaDavLocatorFactory factory;
|
ArchivaDavLocatorFactory factory;
|
||||||
|
|
||||||
|
@ -34,22 +35,22 @@ public class ArchivaDavResourceLocatorTest extends TestCase
|
||||||
super.setUp();
|
super.setUp();
|
||||||
factory = new ArchivaDavLocatorFactory();
|
factory = new ArchivaDavLocatorFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAvoidDoubleSlashInHref()
|
public void testAvoidDoubleSlashInHref()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
String prefix = "http://myproxy/";
|
String prefix = "http://myproxy/";
|
||||||
String href = "/repository/internal/";
|
String href = "/repository/internal/";
|
||||||
ArchivaDavResourceLocator locator = getLocator(prefix, href);
|
ArchivaDavResourceLocator locator = getLocator( prefix, href );
|
||||||
|
|
||||||
assertEquals("internal", locator.getRepositoryId());
|
assertEquals( "internal", locator.getRepositoryId() );
|
||||||
assertEquals("", locator.getWorkspaceName());
|
assertEquals( "", locator.getWorkspaceName() );
|
||||||
assertEquals("", locator.getWorkspacePath());
|
assertEquals( "", locator.getWorkspacePath() );
|
||||||
assertEquals("http://myproxy/", locator.getPrefix());
|
assertEquals( "http://myproxy/", locator.getPrefix() );
|
||||||
assertEquals("http://myproxy/repository/internal/", locator.getHref(false));
|
assertEquals( "http://myproxy/repository/internal/", locator.getHref( false ) );
|
||||||
assertEquals("http://myproxy/repository/internal/", locator.getHref(true));
|
assertEquals( "http://myproxy/repository/internal/", locator.getHref( true ) );
|
||||||
assertEquals("/repository/internal", locator.getResourcePath());
|
assertEquals( "/repository/internal", locator.getResourcePath() );
|
||||||
assertEquals("/repository/internal", locator.getRepositoryPath());
|
assertEquals( "/repository/internal", locator.getRepositoryPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLocatorWithPrefixHref()
|
public void testLocatorWithPrefixHref()
|
||||||
|
@ -57,16 +58,16 @@ public class ArchivaDavResourceLocatorTest extends TestCase
|
||||||
{
|
{
|
||||||
String prefix = "http://myproxy/";
|
String prefix = "http://myproxy/";
|
||||||
String href = "/repository/internal";
|
String href = "/repository/internal";
|
||||||
ArchivaDavResourceLocator locator = getLocator(prefix, href);
|
ArchivaDavResourceLocator locator = getLocator( prefix, href );
|
||||||
|
|
||||||
assertEquals("internal", locator.getRepositoryId());
|
assertEquals( "internal", locator.getRepositoryId() );
|
||||||
assertEquals("", locator.getWorkspaceName());
|
assertEquals( "", locator.getWorkspaceName() );
|
||||||
assertEquals("", locator.getWorkspacePath());
|
assertEquals( "", locator.getWorkspacePath() );
|
||||||
assertEquals("http://myproxy/", locator.getPrefix());
|
assertEquals( "http://myproxy/", locator.getPrefix() );
|
||||||
assertEquals("http://myproxy/repository/internal", locator.getHref(false));
|
assertEquals( "http://myproxy/repository/internal", locator.getHref( false ) );
|
||||||
assertEquals("http://myproxy/repository/internal/", locator.getHref(true));
|
assertEquals( "http://myproxy/repository/internal/", locator.getHref( true ) );
|
||||||
assertEquals("/repository/internal", locator.getResourcePath());
|
assertEquals( "/repository/internal", locator.getResourcePath() );
|
||||||
assertEquals("/repository/internal", locator.getRepositoryPath());
|
assertEquals( "/repository/internal", locator.getRepositoryPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLocatorWithHrefThatContainsPrefix()
|
public void testLocatorWithHrefThatContainsPrefix()
|
||||||
|
@ -74,16 +75,16 @@ public class ArchivaDavResourceLocatorTest extends TestCase
|
||||||
{
|
{
|
||||||
String prefix = "http://myproxy/";
|
String prefix = "http://myproxy/";
|
||||||
String href = "http://myproxy/repository/internal";
|
String href = "http://myproxy/repository/internal";
|
||||||
ArchivaDavResourceLocator locator = getLocator(prefix, href);
|
ArchivaDavResourceLocator locator = getLocator( prefix, href );
|
||||||
|
|
||||||
assertEquals("internal", locator.getRepositoryId());
|
assertEquals( "internal", locator.getRepositoryId() );
|
||||||
assertEquals("", locator.getWorkspaceName());
|
assertEquals( "", locator.getWorkspaceName() );
|
||||||
assertEquals("", locator.getWorkspacePath());
|
assertEquals( "", locator.getWorkspacePath() );
|
||||||
assertEquals("http://myproxy/", locator.getPrefix());
|
assertEquals( "http://myproxy/", locator.getPrefix() );
|
||||||
assertEquals("http://myproxy/repository/internal", locator.getHref(false));
|
assertEquals( "http://myproxy/repository/internal", locator.getHref( false ) );
|
||||||
assertEquals("http://myproxy/repository/internal/", locator.getHref(true));
|
assertEquals( "http://myproxy/repository/internal/", locator.getHref( true ) );
|
||||||
assertEquals("/repository/internal", locator.getResourcePath());
|
assertEquals( "/repository/internal", locator.getResourcePath() );
|
||||||
assertEquals("/repository/internal", locator.getRepositoryPath());
|
assertEquals( "/repository/internal", locator.getRepositoryPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testLocatorWithRootHref()
|
public void testLocatorWithRootHref()
|
||||||
|
@ -91,20 +92,20 @@ public class ArchivaDavResourceLocatorTest extends TestCase
|
||||||
{
|
{
|
||||||
String prefix = "http://myproxy/";
|
String prefix = "http://myproxy/";
|
||||||
String href = "/";
|
String href = "/";
|
||||||
ArchivaDavResourceLocator locator = getLocator(prefix, href);
|
ArchivaDavResourceLocator locator = getLocator( prefix, href );
|
||||||
|
|
||||||
assertEquals("", locator.getRepositoryId());
|
assertEquals( "", locator.getRepositoryId() );
|
||||||
assertEquals("", locator.getWorkspaceName());
|
assertEquals( "", locator.getWorkspaceName() );
|
||||||
assertEquals("", locator.getWorkspacePath());
|
assertEquals( "", locator.getWorkspacePath() );
|
||||||
assertEquals("http://myproxy/", locator.getPrefix());
|
assertEquals( "http://myproxy/", locator.getPrefix() );
|
||||||
assertEquals("http://myproxy/", locator.getHref(false));
|
assertEquals( "http://myproxy/", locator.getHref( false ) );
|
||||||
assertEquals("http://myproxy/", locator.getHref(true));
|
assertEquals( "http://myproxy/", locator.getHref( true ) );
|
||||||
assertEquals("/", locator.getResourcePath());
|
assertEquals( "/", locator.getResourcePath() );
|
||||||
assertEquals("/", locator.getRepositoryPath());
|
assertEquals( "/", locator.getRepositoryPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArchivaDavResourceLocator getLocator( String prefix, String href )
|
private ArchivaDavResourceLocator getLocator( String prefix, String href )
|
||||||
{
|
{
|
||||||
return (ArchivaDavResourceLocator)factory.createResourceLocator(prefix, href);
|
return (ArchivaDavResourceLocator) factory.createResourceLocator( prefix, href );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,23 +19,7 @@ package org.apache.maven.archiva.webdav;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.security.Principal;
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.servlet.RequestDispatcher;
|
|
||||||
import javax.servlet.ServletInputStream;
|
|
||||||
import javax.servlet.http.Cookie;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.apache.jackrabbit.webdav.DavSessionProvider;
|
import org.apache.jackrabbit.webdav.DavSessionProvider;
|
||||||
import org.apache.jackrabbit.webdav.WebdavRequest;
|
import org.apache.jackrabbit.webdav.WebdavRequest;
|
||||||
import org.apache.jackrabbit.webdav.WebdavRequestImpl;
|
import org.apache.jackrabbit.webdav.WebdavRequestImpl;
|
||||||
|
@ -51,10 +35,25 @@ import org.codehaus.plexus.redback.system.SecuritySession;
|
||||||
import org.codehaus.plexus.redback.users.User;
|
import org.codehaus.plexus.redback.users.User;
|
||||||
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
|
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
|
||||||
|
|
||||||
public class ArchivaDavSessionProviderTest extends TestCase
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletInputStream;
|
||||||
|
import javax.servlet.http.Cookie;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.security.Principal;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ArchivaDavSessionProviderTest
|
||||||
|
extends TestCase
|
||||||
{
|
{
|
||||||
private DavSessionProvider sessionProvider;
|
private DavSessionProvider sessionProvider;
|
||||||
|
|
||||||
private WebdavRequest request;
|
private WebdavRequest request;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,131 +62,142 @@ public class ArchivaDavSessionProviderTest extends TestCase
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
sessionProvider = new ArchivaDavSessionProvider( new ServletAuthenticatorMock(), new HttpAuthenticatorMock() );
|
sessionProvider = new ArchivaDavSessionProvider( new ServletAuthenticatorMock(), new HttpAuthenticatorMock() );
|
||||||
request = new WebdavRequestImpl(new HttpServletRequestMock(), null);
|
request = new WebdavRequestImpl( new HttpServletRequestMock(), null );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testAttachSession()
|
public void testAttachSession()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertNull(request.getDavSession());
|
assertNull( request.getDavSession() );
|
||||||
sessionProvider.attachSession(request);
|
sessionProvider.attachSession( request );
|
||||||
assertNotNull(request.getDavSession());
|
assertNotNull( request.getDavSession() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testReleaseSession()
|
public void testReleaseSession()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertNull(request.getDavSession());
|
assertNull( request.getDavSession() );
|
||||||
sessionProvider.attachSession(request);
|
sessionProvider.attachSession( request );
|
||||||
assertNotNull(request.getDavSession());
|
assertNotNull( request.getDavSession() );
|
||||||
|
|
||||||
sessionProvider.releaseSession(request);
|
sessionProvider.releaseSession( request );
|
||||||
assertNull(request.getDavSession());
|
assertNull( request.getDavSession() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings( "unchecked" )
|
||||||
private class HttpServletRequestMock implements HttpServletRequest
|
private class HttpServletRequestMock
|
||||||
|
implements HttpServletRequest
|
||||||
{
|
{
|
||||||
public Object getAttribute(String arg0) {
|
public Object getAttribute( String arg0 )
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
{
|
||||||
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Enumeration getAttributeNames() {
|
public Enumeration getAttributeNames()
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
{
|
||||||
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCharacterEncoding() {
|
public String getCharacterEncoding()
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
{
|
||||||
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getContentLength() {
|
public int getContentLength()
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
{
|
||||||
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContentType() {
|
public String getContentType()
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
{
|
||||||
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServletInputStream getInputStream()
|
public ServletInputStream getInputStream()
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocalAddr() {
|
public String getLocalAddr()
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
{
|
||||||
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocalName() {
|
public String getLocalName()
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
{
|
||||||
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLocalPort() {
|
public int getLocalPort()
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
{
|
||||||
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Locale getLocale() {
|
public Locale getLocale()
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
{
|
||||||
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Enumeration getLocales()
|
public Enumeration getLocales()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getParameter(String arg0)
|
public String getParameter( String arg0 )
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map getParameterMap()
|
public Map getParameterMap()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Enumeration getParameterNames()
|
public Enumeration getParameterNames()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getParameterValues(String arg0)
|
public String[] getParameterValues( String arg0 )
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProtocol() {
|
public String getProtocol()
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
{
|
||||||
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public BufferedReader getReader()
|
public BufferedReader getReader()
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRealPath(String arg0)
|
public String getRealPath( String arg0 )
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRemoteAddr()
|
public String getRemoteAddr()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRemoteHost()
|
public String getRemoteHost()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRemotePort()
|
public int getRemotePort()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestDispatcher getRequestDispatcher(String arg0)
|
public RequestDispatcher getRequestDispatcher( String arg0 )
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getScheme()
|
public String getScheme()
|
||||||
|
@ -197,39 +207,39 @@ public class ArchivaDavSessionProviderTest extends TestCase
|
||||||
|
|
||||||
public String getServerName()
|
public String getServerName()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getServerPort()
|
public int getServerPort()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSecure()
|
public boolean isSecure()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeAttribute(String arg0)
|
public void removeAttribute( String arg0 )
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAttribute(String arg0, Object arg1)
|
public void setAttribute( String arg0, Object arg1 )
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCharacterEncoding(String arg0)
|
public void setCharacterEncoding( String arg0 )
|
||||||
throws UnsupportedEncodingException
|
throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getAuthType()
|
public String getAuthType()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContextPath()
|
public String getContextPath()
|
||||||
|
@ -239,56 +249,57 @@ public class ArchivaDavSessionProviderTest extends TestCase
|
||||||
|
|
||||||
public Cookie[] getCookies()
|
public Cookie[] getCookies()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getDateHeader(String arg0)
|
public long getDateHeader( String arg0 )
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHeader(String arg0) {
|
public String getHeader( String arg0 )
|
||||||
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Enumeration getHeaderNames()
|
public Enumeration getHeaderNames()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Enumeration getHeaders(String arg0)
|
public Enumeration getHeaders( String arg0 )
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getIntHeader(String arg0)
|
public int getIntHeader( String arg0 )
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getMethod()
|
public String getMethod()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPathInfo()
|
public String getPathInfo()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPathTranslated()
|
public String getPathTranslated()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQueryString()
|
public String getQueryString()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRemoteUser()
|
public String getRemoteUser()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRequestURI()
|
public String getRequestURI()
|
||||||
|
@ -296,65 +307,66 @@ public class ArchivaDavSessionProviderTest extends TestCase
|
||||||
return "/";
|
return "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
public StringBuffer getRequestURL()
|
public StringBuffer getRequestURL()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRequestedSessionId()
|
public String getRequestedSessionId()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getServletPath()
|
public String getServletPath()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpSession getSession(boolean arg0)
|
public HttpSession getSession( boolean arg0 )
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpSession getSession()
|
public HttpSession getSession()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Principal getUserPrincipal()
|
public Principal getUserPrincipal()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRequestedSessionIdFromCookie()
|
public boolean isRequestedSessionIdFromCookie()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRequestedSessionIdFromURL()
|
public boolean isRequestedSessionIdFromURL()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRequestedSessionIdFromUrl()
|
public boolean isRequestedSessionIdFromUrl()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRequestedSessionIdValid()
|
public boolean isRequestedSessionIdValid()
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUserInRole(String arg0)
|
public boolean isUserInRole( String arg0 )
|
||||||
{
|
{
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException( "Not supported yet." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ServletAuthenticatorMock implements ServletAuthenticator
|
private class ServletAuthenticatorMock
|
||||||
|
implements ServletAuthenticator
|
||||||
{
|
{
|
||||||
public boolean isAuthenticated(HttpServletRequest arg0, AuthenticationResult arg1)
|
public boolean isAuthenticated( HttpServletRequest arg0, AuthenticationResult arg1 )
|
||||||
throws AuthenticationException, AccountLockedException, MustChangePasswordException
|
throws AuthenticationException, AccountLockedException, MustChangePasswordException
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -371,56 +383,58 @@ public class ArchivaDavSessionProviderTest extends TestCase
|
||||||
throws UnauthorizedException
|
throws UnauthorizedException
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HttpAuthenticatorMock extends HttpAuthenticator
|
private class HttpAuthenticatorMock
|
||||||
|
extends HttpAuthenticator
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void challenge(HttpServletRequest arg0, HttpServletResponse arg1, String arg2, AuthenticationException arg3)
|
public void challenge( HttpServletRequest arg0, HttpServletResponse arg1, String arg2,
|
||||||
|
AuthenticationException arg3 )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
//Do nothing
|
//Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AuthenticationResult getAuthenticationResult(HttpServletRequest arg0, HttpServletResponse arg1)
|
public AuthenticationResult getAuthenticationResult( HttpServletRequest arg0, HttpServletResponse arg1 )
|
||||||
throws AuthenticationException, AccountLockedException, MustChangePasswordException
|
throws AuthenticationException, AccountLockedException, MustChangePasswordException
|
||||||
{
|
{
|
||||||
return new AuthenticationResult();
|
return new AuthenticationResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AuthenticationResult authenticate(AuthenticationDataSource arg0, HttpSession httpSession)
|
public AuthenticationResult authenticate( AuthenticationDataSource arg0, HttpSession httpSession )
|
||||||
throws AuthenticationException, AccountLockedException, MustChangePasswordException
|
throws AuthenticationException, AccountLockedException, MustChangePasswordException
|
||||||
{
|
{
|
||||||
return new AuthenticationResult();
|
return new AuthenticationResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void authenticate(HttpServletRequest arg0, HttpServletResponse arg1)
|
public void authenticate( HttpServletRequest arg0, HttpServletResponse arg1 )
|
||||||
throws AuthenticationException
|
throws AuthenticationException
|
||||||
{
|
{
|
||||||
//Do nothing
|
//Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SecuritySession getSecuritySession(HttpSession httpSession)
|
public SecuritySession getSecuritySession( HttpSession httpSession )
|
||||||
{
|
{
|
||||||
return super.getSecuritySession(httpSession);
|
return super.getSecuritySession( httpSession );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getSessionUser(HttpSession httpSession)
|
public User getSessionUser( HttpSession httpSession )
|
||||||
{
|
{
|
||||||
return super.getSessionUser(httpSession);
|
return super.getSessionUser( httpSession );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAlreadyAuthenticated(HttpSession httpSession)
|
public boolean isAlreadyAuthenticated( HttpSession httpSession )
|
||||||
{
|
{
|
||||||
return super.isAlreadyAuthenticated(httpSession);
|
return super.isAlreadyAuthenticated( httpSession );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.codehaus.plexus.redback.system.SecuritySystem;
|
||||||
import org.codehaus.plexus.redback.users.UserManager;
|
import org.codehaus.plexus.redback.users.UserManager;
|
||||||
import org.codehaus.plexus.redback.users.UserNotFoundException;
|
import org.codehaus.plexus.redback.users.UserNotFoundException;
|
||||||
import org.codehaus.plexus.redback.users.memory.MemoryUserManager;
|
import org.codehaus.plexus.redback.users.memory.MemoryUserManager;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BypassSecuritySystem - used to bypass the security system for testing reasons and allow
|
* BypassSecuritySystem - used to bypass the security system for testing reasons and allow
|
||||||
|
@ -43,9 +44,10 @@ import org.codehaus.plexus.redback.users.memory.MemoryUserManager;
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
*
|
||||||
* @plexus.component
|
* plexus.component
|
||||||
* role="org.codehaus.plexus.redback.system.SecuritySystem"
|
* role="org.codehaus.plexus.redback.system.SecuritySystem"
|
||||||
*/
|
*/
|
||||||
|
@Service("securitySystem#bypass")
|
||||||
public class BypassSecuritySystem
|
public class BypassSecuritySystem
|
||||||
extends DefaultSecuritySystem
|
extends DefaultSecuritySystem
|
||||||
implements SecuritySystem
|
implements SecuritySystem
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.maven.archiva.webdav;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
import org.apache.archiva.audit.AuditListener;
|
import org.apache.archiva.audit.AuditListener;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.jackrabbit.webdav.DavException;
|
import org.apache.jackrabbit.webdav.DavException;
|
||||||
|
@ -36,17 +37,25 @@ import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
|
||||||
import org.apache.jackrabbit.webdav.lock.Type;
|
import org.apache.jackrabbit.webdav.lock.Type;
|
||||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||||
import org.apache.maven.archiva.webdav.util.MimeTypes;
|
import org.apache.maven.archiva.webdav.util.MimeTypes;
|
||||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
import org.junit.After;
|
||||||
import org.codehaus.plexus.spring.PlexusToSpringUtils;
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
|
@RunWith( SpringJUnit4ClassRunner.class )
|
||||||
|
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
|
||||||
public class DavResourceTest
|
public class DavResourceTest
|
||||||
extends PlexusInSpringTestCase
|
extends TestCase
|
||||||
{
|
{
|
||||||
private DavSession session;
|
private DavSession session;
|
||||||
|
|
||||||
|
@Inject
|
||||||
private MimeTypes mimeTypes;
|
private MimeTypes mimeTypes;
|
||||||
|
|
||||||
private ArchivaDavResourceLocator resourceLocator;
|
private ArchivaDavResourceLocator resourceLocator;
|
||||||
|
@ -66,13 +75,13 @@ public class DavResourceTest
|
||||||
private ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
|
private ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp()
|
@Before
|
||||||
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
session = new ArchivaDavSession();
|
session = new ArchivaDavSession();
|
||||||
mimeTypes = (MimeTypes) getApplicationContext().getBean( PlexusToSpringUtils.buildSpringId( MimeTypes.class ) );
|
baseDir = new File( "target/DavResourceTest" );
|
||||||
baseDir = getTestFile( "target/DavResourceTest" );
|
|
||||||
baseDir.mkdirs();
|
baseDir.mkdirs();
|
||||||
myResource = new File( baseDir, "myresource.jar" );
|
myResource = new File( baseDir, "myresource.jar" );
|
||||||
assertTrue( "Could not create " + myResource.getAbsolutePath(), myResource.createNewFile() );
|
assertTrue( "Could not create " + myResource.getAbsolutePath(), myResource.createNewFile() );
|
||||||
|
@ -85,12 +94,11 @@ public class DavResourceTest
|
||||||
resource.addLockManager( lockManager );
|
resource.addLockManager( lockManager );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@After
|
||||||
protected void tearDown()
|
protected void tearDown()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
release( mimeTypes );
|
|
||||||
FileUtils.deleteDirectory( baseDir );
|
FileUtils.deleteDirectory( baseDir );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,6 +108,7 @@ public class DavResourceTest
|
||||||
resourceFactory, mimeTypes, Collections.<AuditListener> emptyList(), null );
|
resourceFactory, mimeTypes, Collections.<AuditListener> emptyList(), null );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testDeleteNonExistantResourceShould404()
|
public void testDeleteNonExistantResourceShould404()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -116,6 +125,7 @@ public class DavResourceTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testDeleteCollection()
|
public void testDeleteCollection()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -133,6 +143,7 @@ public class DavResourceTest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testDeleteResource()
|
public void testDeleteResource()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -141,12 +152,14 @@ public class DavResourceTest
|
||||||
assertFalse( myResource.exists() );
|
assertFalse( myResource.exists() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testIsLockable()
|
public void testIsLockable()
|
||||||
{
|
{
|
||||||
assertTrue( resource.isLockable( Type.WRITE, Scope.EXCLUSIVE ) );
|
assertTrue( resource.isLockable( Type.WRITE, Scope.EXCLUSIVE ) );
|
||||||
assertFalse( resource.isLockable( Type.WRITE, Scope.SHARED ) );
|
assertFalse( resource.isLockable( Type.WRITE, Scope.SHARED ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testLock()
|
public void testLock()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -158,6 +171,7 @@ public class DavResourceTest
|
||||||
assertEquals( 1, resource.getLocks().length );
|
assertEquals( 1, resource.getLocks().length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testLockIfResourceUnlockable()
|
public void testLockIfResourceUnlockable()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -176,6 +190,7 @@ public class DavResourceTest
|
||||||
assertEquals( 0, resource.getLocks().length );
|
assertEquals( 0, resource.getLocks().length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetLock()
|
public void testGetLock()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -191,6 +206,7 @@ public class DavResourceTest
|
||||||
assertNull( resource.getLock( Type.WRITE, Scope.SHARED ) );
|
assertNull( resource.getLock( Type.WRITE, Scope.SHARED ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testRefreshLockThrowsExceptionIfNoLockIsPresent()
|
public void testRefreshLockThrowsExceptionIfNoLockIsPresent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -211,6 +227,7 @@ public class DavResourceTest
|
||||||
assertEquals( 0, resource.getLocks().length );
|
assertEquals( 0, resource.getLocks().length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testRefreshLock()
|
public void testRefreshLock()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -229,6 +246,7 @@ public class DavResourceTest
|
||||||
assertEquals( 1, resource.getLocks().length );
|
assertEquals( 1, resource.getLocks().length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testUnlock()
|
public void testUnlock()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -247,6 +265,7 @@ public class DavResourceTest
|
||||||
assertEquals( 0, resource.getLocks().length );
|
assertEquals( 0, resource.getLocks().length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testUnlockThrowsDavExceptionIfNotLocked()
|
public void testUnlockThrowsDavExceptionIfNotLocked()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -271,6 +290,7 @@ public class DavResourceTest
|
||||||
assertEquals( 1, resource.getLocks().length );
|
assertEquals( 1, resource.getLocks().length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testUnlockThrowsDavExceptionIfResourceNotLocked()
|
public void testUnlockThrowsDavExceptionIfResourceNotLocked()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,22 +19,33 @@ package org.apache.maven.archiva.webdav;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
import org.apache.maven.archiva.webdav.util.MimeTypes;
|
import org.apache.maven.archiva.webdav.util.MimeTypes;
|
||||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArchivaMimeTypesTest
|
* ArchivaMimeTypesTest
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
@RunWith( SpringJUnit4ClassRunner.class )
|
||||||
|
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
|
||||||
public class MimeTypesLoaderTest
|
public class MimeTypesLoaderTest
|
||||||
extends PlexusInSpringTestCase
|
extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
MimeTypes mimeTypes;
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testArchivaTypes()
|
public void testArchivaTypes()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
lookup( MimeTypes.class );
|
|
||||||
MimeTypes mimeTypes = (MimeTypes) lookup( MimeTypes.class );
|
|
||||||
assertNotNull( mimeTypes );
|
assertNotNull( mimeTypes );
|
||||||
|
|
||||||
// Test for some added types.
|
// Test for some added types.
|
||||||
|
|
|
@ -23,6 +23,8 @@ import com.meterware.httpunit.GetMethodWebRequest;
|
||||||
import com.meterware.httpunit.WebLink;
|
import com.meterware.httpunit.WebLink;
|
||||||
import com.meterware.httpunit.WebRequest;
|
import com.meterware.httpunit.WebRequest;
|
||||||
import com.meterware.httpunit.WebResponse;
|
import com.meterware.httpunit.WebResponse;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -37,7 +39,8 @@ public class RepositoryServletBrowseTest
|
||||||
extends AbstractRepositoryServletTestCase
|
extends AbstractRepositoryServletTestCase
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected void setUp()
|
@Before
|
||||||
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
@ -47,7 +50,8 @@ public class RepositoryServletBrowseTest
|
||||||
new File( repoRootInternal, "net/sourceforge" ).mkdirs();
|
new File( repoRootInternal, "net/sourceforge" ).mkdirs();
|
||||||
new File( repoRootInternal, "commons-lang" ).mkdirs();
|
new File( repoRootInternal, "commons-lang" ).mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testBrowse()
|
public void testBrowse()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -60,7 +64,8 @@ public class RepositoryServletBrowseTest
|
||||||
String expectedLinks[] = new String[] { "commons-lang/", "net/", "org/" };
|
String expectedLinks[] = new String[] { "commons-lang/", "net/", "org/" };
|
||||||
assertLinks(expectedLinks, response.getLinks());
|
assertLinks(expectedLinks, response.getLinks());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testBrowseSubdirectory()
|
public void testBrowseSubdirectory()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -72,6 +77,7 @@ public class RepositoryServletBrowseTest
|
||||||
assertLinks(expectedLinks, response.getLinks());
|
assertLinks(expectedLinks, response.getLinks());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetDirectoryWhichHasMatchingFile() //MRM-893
|
public void testGetDirectoryWhichHasMatchingFile() //MRM-893
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,6 +30,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||||
import org.apache.maven.archiva.webdav.httpunit.MkColMethodWebRequest;
|
import org.apache.maven.archiva.webdav.httpunit.MkColMethodWebRequest;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,7 +42,8 @@ public class RepositoryServletDeployTest
|
||||||
extends AbstractRepositoryServletTestCase
|
extends AbstractRepositoryServletTestCase
|
||||||
{
|
{
|
||||||
private static final String ARTIFACT_DEFAULT_LAYOUT = "/path/to/artifact/1.0.0/artifact-1.0.0.jar";
|
private static final String ARTIFACT_DEFAULT_LAYOUT = "/path/to/artifact/1.0.0/artifact-1.0.0.jar";
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testPutWithMissingParentCollection()
|
public void testPutWithMissingParentCollection()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -65,6 +67,7 @@ public class RepositoryServletDeployTest
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testReleaseArtifactsRedeploymentValidPath()
|
public void testReleaseArtifactsRedeploymentValidPath()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -99,7 +102,8 @@ public class RepositoryServletDeployTest
|
||||||
response = sc.getResponse( request );
|
response = sc.getResponse( request );
|
||||||
assertResponseConflictError( response );
|
assertResponseConflictError( response );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testReleaseArtifactsRedeploymentIsAllowed()
|
public void testReleaseArtifactsRedeploymentIsAllowed()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -139,7 +143,8 @@ public class RepositoryServletDeployTest
|
||||||
response = sc.getResponse( request );
|
response = sc.getResponse( request );
|
||||||
assertResponseNoContent( response );
|
assertResponseNoContent( response );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testReleaseArtifactsRedeploymentInvalidPath()
|
public void testReleaseArtifactsRedeploymentInvalidPath()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -174,7 +179,8 @@ public class RepositoryServletDeployTest
|
||||||
response = sc.getResponse( request );
|
response = sc.getResponse( request );
|
||||||
assertResponseNoContent( response );
|
assertResponseNoContent( response );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testReleaseArtifactsRedeploymentArtifactIsSnapshot()
|
public void testReleaseArtifactsRedeploymentArtifactIsSnapshot()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -209,7 +215,8 @@ public class RepositoryServletDeployTest
|
||||||
response = sc.getResponse( request );
|
response = sc.getResponse( request );
|
||||||
assertResponseNoContent( response );
|
assertResponseNoContent( response );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testMkColWithMissingParentCollectionFails()
|
public void testMkColWithMissingParentCollectionFails()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,7 @@ import com.meterware.httpunit.GetMethodWebRequest;
|
||||||
import com.meterware.httpunit.WebRequest;
|
import com.meterware.httpunit.WebRequest;
|
||||||
import com.meterware.httpunit.WebResponse;
|
import com.meterware.httpunit.WebResponse;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ import java.io.File;
|
||||||
public class RepositoryServletNoProxyMetadataTest
|
public class RepositoryServletNoProxyMetadataTest
|
||||||
extends AbstractRepositoryServletTestCase
|
extends AbstractRepositoryServletTestCase
|
||||||
{
|
{
|
||||||
|
@Test
|
||||||
public void testGetVersionMetadataDefaultLayout()
|
public void testGetVersionMetadataDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -52,6 +54,7 @@ public class RepositoryServletNoProxyMetadataTest
|
||||||
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProjectMetadataDefaultLayout()
|
public void testGetProjectMetadataDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -70,6 +73,7 @@ public class RepositoryServletNoProxyMetadataTest
|
||||||
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetGroupMetadataDefaultLayout()
|
public void testGetGroupMetadataDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -88,6 +92,7 @@ public class RepositoryServletNoProxyMetadataTest
|
||||||
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetSnapshotVersionMetadataDefaultLayout()
|
public void testGetSnapshotVersionMetadataDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,7 @@ import com.meterware.httpunit.GetMethodWebRequest;
|
||||||
import com.meterware.httpunit.WebRequest;
|
import com.meterware.httpunit.WebRequest;
|
||||||
import com.meterware.httpunit.WebResponse;
|
import com.meterware.httpunit.WebResponse;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -34,6 +35,7 @@ import java.io.File;
|
||||||
public class RepositoryServletNoProxyTest
|
public class RepositoryServletNoProxyTest
|
||||||
extends AbstractRepositoryServletTestCase
|
extends AbstractRepositoryServletTestCase
|
||||||
{
|
{
|
||||||
|
@Test
|
||||||
public void testLastModifiedHeaderExists()
|
public void testLastModifiedHeaderExists()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -50,6 +52,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertNotNull( response.getHeaderField( "last-modified" ) );
|
assertNotNull( response.getHeaderField( "last-modified" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyChecksumDefaultLayout()
|
public void testGetNoProxyChecksumDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -67,6 +70,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", "dummy-checksum", response.getText() );
|
assertEquals( "Expected file contents", "dummy-checksum", response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyChecksumLegacyLayout()
|
public void testGetNoProxyChecksumLegacyLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -85,6 +89,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", "dummy-checksum", response.getText() );
|
assertEquals( "Expected file contents", "dummy-checksum", response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyVersionedMetadataDefaultLayout()
|
public void testGetNoProxyVersionedMetadataDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -103,6 +108,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyProjectMetadataDefaultLayout()
|
public void testGetNoProxyProjectMetadataDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -121,6 +127,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyGroupMetadataDefaultLayout()
|
public void testGetNoProxyGroupMetadataDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -139,6 +146,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyArtifactDefaultLayout()
|
public void testGetNoProxyArtifactDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -157,6 +165,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyArtifactLegacyLayout()
|
public void testGetNoProxyArtifactLegacyLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -176,6 +185,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxySnapshotArtifactDefaultLayout()
|
public void testGetNoProxySnapshotArtifactDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -194,6 +204,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxySnapshotArtifactLegacyLayout()
|
public void testGetNoProxySnapshotArtifactLegacyLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -213,6 +224,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyTimestampedSnapshotArtifactDefaultLayout()
|
public void testGetNoProxyTimestampedSnapshotArtifactDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -231,6 +243,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyTimestampedSnapshotArtifactLegacyLayout()
|
public void testGetNoProxyTimestampedSnapshotArtifactLegacyLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -253,6 +266,7 @@ public class RepositoryServletNoProxyTest
|
||||||
/**
|
/**
|
||||||
* [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error
|
* [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testGetNoProxyDualExtensionDefaultLayout()
|
public void testGetNoProxyDualExtensionDefaultLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -271,6 +285,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedContents, response.getText() );
|
assertEquals( "Expected file contents", expectedContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyDistributionLegacyLayout()
|
public void testGetNoProxyDistributionLegacyLayout()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -290,6 +305,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedContents, response.getText() );
|
assertEquals( "Expected file contents", expectedContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyChecksumDefaultLayoutManagedLegacy()
|
public void testGetNoProxyChecksumDefaultLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -307,6 +323,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", "dummy-checksum", response.getText() );
|
assertEquals( "Expected file contents", "dummy-checksum", response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyChecksumLegacyLayoutManagedLegacy()
|
public void testGetNoProxyChecksumLegacyLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -323,6 +340,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", "dummy-checksum", response.getText() );
|
assertEquals( "Expected file contents", "dummy-checksum", response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyVersionedMetadataDefaultLayoutManagedLegacy()
|
public void testGetNoProxyVersionedMetadataDefaultLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -342,6 +360,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyProjectMetadataDefaultLayoutManagedLegacy()
|
public void testGetNoProxyProjectMetadataDefaultLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -361,6 +380,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyGroupMetadataDefaultLayoutManagedLegacy()
|
public void testGetNoProxyGroupMetadataDefaultLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -379,6 +399,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
assertEquals( "Expected file contents", expectedMetadataContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyArtifactDefaultLayoutManagedLegacy()
|
public void testGetNoProxyArtifactDefaultLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -397,6 +418,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyArtifactLegacyLayoutManagedLegacy()
|
public void testGetNoProxyArtifactLegacyLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -415,6 +437,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxySnapshotArtifactDefaultLayoutManagedLegacy()
|
public void testGetNoProxySnapshotArtifactDefaultLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -433,6 +456,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxySnapshotArtifactLegacyLayoutManagedLegacy()
|
public void testGetNoProxySnapshotArtifactLegacyLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -451,6 +475,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyTimestampedSnapshotArtifactDefaultLayoutManagedLegacy()
|
public void testGetNoProxyTimestampedSnapshotArtifactDefaultLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -470,6 +495,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
assertEquals( "Expected file contents", expectedArtifactContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyTimestampedSnapshotArtifactLegacyLayoutManagedLegacy()
|
public void testGetNoProxyTimestampedSnapshotArtifactLegacyLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -491,6 +517,7 @@ public class RepositoryServletNoProxyTest
|
||||||
/**
|
/**
|
||||||
* [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error
|
* [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error
|
||||||
*/
|
*/
|
||||||
|
@Test
|
||||||
public void testGetNoProxyDualExtensionDefaultLayoutManagedLegacy()
|
public void testGetNoProxyDualExtensionDefaultLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -509,6 +536,7 @@ public class RepositoryServletNoProxyTest
|
||||||
assertEquals( "Expected file contents", expectedContents, response.getText() );
|
assertEquals( "Expected file contents", expectedContents, response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetNoProxyDistributionLegacyLayoutManagedLegacy()
|
public void testGetNoProxyDistributionLegacyLayoutManagedLegacy()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.maven.archiva.webdav;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RepositoryServlet Tests, Proxied, Get of Metadata, exists on local managed repository only.
|
* RepositoryServlet Tests, Proxied, Get of Metadata, exists on local managed repository only.
|
||||||
*
|
*
|
||||||
|
@ -27,6 +29,8 @@ package org.apache.maven.archiva.webdav;
|
||||||
public class RepositoryServletProxiedMetadataLocalOnlyTest
|
public class RepositoryServletProxiedMetadataLocalOnlyTest
|
||||||
extends AbstractRepositoryServletProxiedMetadataTestCase
|
extends AbstractRepositoryServletProxiedMetadataTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotVersionMetadataLocalOnly()
|
public void testGetProxiedSnapshotVersionMetadataLocalOnly()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -51,6 +55,7 @@ public class RepositoryServletProxiedMetadataLocalOnlyTest
|
||||||
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedVersionMetadataLocalOnly()
|
public void testGetProxiedVersionMetadataLocalOnly()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -72,6 +77,7 @@ public class RepositoryServletProxiedMetadataLocalOnlyTest
|
||||||
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedProjectMetadataLocalOnly()
|
public void testGetProxiedProjectMetadataLocalOnly()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -95,6 +101,7 @@ public class RepositoryServletProxiedMetadataLocalOnlyTest
|
||||||
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedGroupMetadataLocalOnly()
|
public void testGetProxiedGroupMetadataLocalOnly()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,6 +20,8 @@ package org.apache.maven.archiva.webdav;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RepositoryServlet Tests, Proxied, Get of Metadata, exists on remote repository only.
|
* RepositoryServlet Tests, Proxied, Get of Metadata, exists on remote repository only.
|
||||||
*
|
*
|
||||||
|
@ -28,6 +30,7 @@ package org.apache.maven.archiva.webdav;
|
||||||
public class RepositoryServletProxiedMetadataRemoteOnlyTest
|
public class RepositoryServletProxiedMetadataRemoteOnlyTest
|
||||||
extends AbstractRepositoryServletProxiedMetadataTestCase
|
extends AbstractRepositoryServletProxiedMetadataTestCase
|
||||||
{
|
{
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotVersionMetadataRemoteOnly()
|
public void testGetProxiedSnapshotVersionMetadataRemoteOnly()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -57,6 +60,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
|
||||||
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedPluginSnapshotVersionMetadataRemoteOnly()
|
public void testGetProxiedPluginSnapshotVersionMetadataRemoteOnly()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -86,6 +90,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
|
||||||
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedVersionMetadataRemoteOnly()
|
public void testGetProxiedVersionMetadataRemoteOnly()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -111,6 +116,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
|
||||||
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedProjectMetadataRemoteOnly()
|
public void testGetProxiedProjectMetadataRemoteOnly()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -138,6 +144,7 @@ public class RepositoryServletProxiedMetadataRemoteOnlyTest
|
||||||
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
assertExpectedMetadata( expectedMetadata, actualMetadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedGroupMetadataRemoteOnly()
|
public void testGetProxiedGroupMetadataRemoteOnly()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.meterware.httpunit.GetMethodWebRequest;
|
||||||
import com.meterware.httpunit.HttpUnitOptions;
|
import com.meterware.httpunit.HttpUnitOptions;
|
||||||
import com.meterware.httpunit.WebRequest;
|
import com.meterware.httpunit.WebRequest;
|
||||||
import com.meterware.httpunit.WebResponse;
|
import com.meterware.httpunit.WebResponse;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RepositoryServlet Tests, Proxied, Get of resources that are not artifacts or metadata, with varying policy settings.
|
* RepositoryServlet Tests, Proxied, Get of resources that are not artifacts or metadata, with varying policy settings.
|
||||||
|
@ -45,6 +46,7 @@ public class RepositoryServletProxiedPassthroughTest
|
||||||
|
|
||||||
private static final String PATH_ASC = "org/apache/archiva/test/1.0/test-1.0.jar.asc";
|
private static final String PATH_ASC = "org/apache/archiva/test/1.0/test-1.0.jar.asc";
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedManagedNewerSha1()
|
public void testGetProxiedManagedNewerSha1()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -52,6 +54,7 @@ public class RepositoryServletProxiedPassthroughTest
|
||||||
CONTENT_SHA1 );
|
CONTENT_SHA1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedManagedOlderSha1()
|
public void testGetProxiedManagedOlderSha1()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -59,18 +62,21 @@ public class RepositoryServletProxiedPassthroughTest
|
||||||
CONTENT_SHA1 );
|
CONTENT_SHA1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedNoManagedContentSha1()
|
public void testGetProxiedNoManagedContentSha1()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedResource( EXPECT_REMOTE_CONTENTS, NO_MANAGED_COPY, PATH_SHA1, CONTENT_SHA1 );
|
assertGetProxiedResource( EXPECT_REMOTE_CONTENTS, NO_MANAGED_COPY, PATH_SHA1, CONTENT_SHA1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedEqualSha1()
|
public void testGetProxiedEqualSha1()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedResource( EXPECT_MANAGED_CONTENTS, HAS_MANAGED_COPY, PATH_SHA1, CONTENT_SHA1 );
|
assertGetProxiedResource( EXPECT_MANAGED_CONTENTS, HAS_MANAGED_COPY, PATH_SHA1, CONTENT_SHA1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedManagedNewerAsc()
|
public void testGetProxiedManagedNewerAsc()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -78,6 +84,7 @@ public class RepositoryServletProxiedPassthroughTest
|
||||||
CONTENT_ASC );
|
CONTENT_ASC );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedManagedOlderAsc()
|
public void testGetProxiedManagedOlderAsc()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -85,12 +92,14 @@ public class RepositoryServletProxiedPassthroughTest
|
||||||
CONTENT_ASC );
|
CONTENT_ASC );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedNoManagedContentAsc()
|
public void testGetProxiedNoManagedContentAsc()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedResource( EXPECT_REMOTE_CONTENTS, NO_MANAGED_COPY, PATH_ASC, CONTENT_ASC );
|
assertGetProxiedResource( EXPECT_REMOTE_CONTENTS, NO_MANAGED_COPY, PATH_ASC, CONTENT_ASC );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedEqualAsc()
|
public void testGetProxiedEqualAsc()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.meterware.httpunit.WebRequest;
|
||||||
import com.meterware.httpunit.WebResponse;
|
import com.meterware.httpunit.WebResponse;
|
||||||
|
|
||||||
import org.apache.maven.archiva.policies.SnapshotsPolicy;
|
import org.apache.maven.archiva.policies.SnapshotsPolicy;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -36,6 +37,8 @@ import java.io.File;
|
||||||
public class RepositoryServletProxiedPluginSnapshotPolicyTest
|
public class RepositoryServletProxiedPluginSnapshotPolicyTest
|
||||||
extends AbstractRepositoryServletProxiedTestCase
|
extends AbstractRepositoryServletProxiedTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedNewer()
|
public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedNewer()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -43,6 +46,7 @@ public class RepositoryServletProxiedPluginSnapshotPolicyTest
|
||||||
HAS_MANAGED_COPY, ( NEWER * OVER_ONE_DAY ) );
|
HAS_MANAGED_COPY, ( NEWER * OVER_ONE_DAY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedOlder()
|
public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedOlder()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -50,12 +54,14 @@ public class RepositoryServletProxiedPluginSnapshotPolicyTest
|
||||||
( OLDER * OVER_ONE_DAY ) );
|
( OLDER * OVER_ONE_DAY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyAlwaysNoManagedContent()
|
public void testGetProxiedSnapshotsArtifactPolicyAlwaysNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ALWAYS, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ALWAYS, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyDailyFail()
|
public void testGetProxiedSnapshotsArtifactPolicyDailyFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -63,12 +69,14 @@ public class RepositoryServletProxiedPluginSnapshotPolicyTest
|
||||||
( NEWER * ONE_MINUTE ) );
|
( NEWER * ONE_MINUTE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyDailyNoManagedContent()
|
public void testGetProxiedSnapshotsArtifactPolicyDailyNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.DAILY, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.DAILY, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyDailyPass()
|
public void testGetProxiedSnapshotsArtifactPolicyDailyPass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -76,6 +84,7 @@ public class RepositoryServletProxiedPluginSnapshotPolicyTest
|
||||||
( OLDER * OVER_ONE_DAY ) );
|
( OLDER * OVER_ONE_DAY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyRejectFail()
|
public void testGetProxiedSnapshotsArtifactPolicyRejectFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -83,12 +92,14 @@ public class RepositoryServletProxiedPluginSnapshotPolicyTest
|
||||||
HAS_MANAGED_COPY );
|
HAS_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyRejectNoManagedContentFail()
|
public void testGetProxiedSnapshotsArtifactPolicyRejectNoManagedContentFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.NEVER, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.NEVER, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyRejectPass()
|
public void testGetProxiedSnapshotsArtifactPolicyRejectPass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -96,6 +107,7 @@ public class RepositoryServletProxiedPluginSnapshotPolicyTest
|
||||||
HAS_MANAGED_COPY );
|
HAS_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyHourlyFail()
|
public void testGetProxiedSnapshotsArtifactPolicyHourlyFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -103,12 +115,14 @@ public class RepositoryServletProxiedPluginSnapshotPolicyTest
|
||||||
( NEWER * ONE_MINUTE ) );
|
( NEWER * ONE_MINUTE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyHourlyNoManagedContent()
|
public void testGetProxiedSnapshotsArtifactPolicyHourlyNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.HOURLY, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.HOURLY, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyHourlyPass()
|
public void testGetProxiedSnapshotsArtifactPolicyHourlyPass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -116,18 +130,21 @@ public class RepositoryServletProxiedPluginSnapshotPolicyTest
|
||||||
( OLDER * OVER_ONE_HOUR ) );
|
( OLDER * OVER_ONE_HOUR ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyOnceFail()
|
public void testGetProxiedSnapshotsArtifactPolicyOnceFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.ONCE, HAS_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.ONCE, HAS_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyOnceNoManagedContent()
|
public void testGetProxiedSnapshotsArtifactPolicyOnceNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ONCE, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ONCE, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyOncePass()
|
public void testGetProxiedSnapshotsArtifactPolicyOncePass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.meterware.httpunit.WebRequest;
|
||||||
import com.meterware.httpunit.WebResponse;
|
import com.meterware.httpunit.WebResponse;
|
||||||
|
|
||||||
import org.apache.maven.archiva.policies.ReleasesPolicy;
|
import org.apache.maven.archiva.policies.ReleasesPolicy;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ import java.io.File;
|
||||||
public class RepositoryServletProxiedReleasePolicyTest
|
public class RepositoryServletProxiedReleasePolicyTest
|
||||||
extends AbstractRepositoryServletProxiedTestCase
|
extends AbstractRepositoryServletProxiedTestCase
|
||||||
{
|
{
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyAlwaysManagedNewer()
|
public void testGetProxiedReleaseArtifactPolicyAlwaysManagedNewer()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -43,6 +45,7 @@ public class RepositoryServletProxiedReleasePolicyTest
|
||||||
( NEWER * OVER_ONE_DAY ) );
|
( NEWER * OVER_ONE_DAY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyAlwaysManagedOlder()
|
public void testGetProxiedReleaseArtifactPolicyAlwaysManagedOlder()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -50,12 +53,14 @@ public class RepositoryServletProxiedReleasePolicyTest
|
||||||
( OLDER * OVER_ONE_DAY ) );
|
( OLDER * OVER_ONE_DAY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyAlwaysNoManagedContent()
|
public void testGetProxiedReleaseArtifactPolicyAlwaysNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.ALWAYS, NO_MANAGED_COPY );
|
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.ALWAYS, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyDailyFail()
|
public void testGetProxiedReleaseArtifactPolicyDailyFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -63,12 +68,14 @@ public class RepositoryServletProxiedReleasePolicyTest
|
||||||
( NEWER * ONE_MINUTE ) );
|
( NEWER * ONE_MINUTE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyDailyNoManagedContent()
|
public void testGetProxiedReleaseArtifactPolicyDailyNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.DAILY, NO_MANAGED_COPY );
|
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.DAILY, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyDailyPass()
|
public void testGetProxiedReleaseArtifactPolicyDailyPass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -76,24 +83,28 @@ public class RepositoryServletProxiedReleasePolicyTest
|
||||||
( OLDER * OVER_ONE_DAY ) );
|
( OLDER * OVER_ONE_DAY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyRejectFail()
|
public void testGetProxiedReleaseArtifactPolicyRejectFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.NEVER, HAS_MANAGED_COPY );
|
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.NEVER, HAS_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyRejectNoManagedContentFail()
|
public void testGetProxiedReleaseArtifactPolicyRejectNoManagedContentFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_NOT_FOUND, ReleasesPolicy.NEVER, NO_MANAGED_COPY );
|
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_NOT_FOUND, ReleasesPolicy.NEVER, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyRejectPass()
|
public void testGetProxiedReleaseArtifactPolicyRejectPass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.NEVER, HAS_MANAGED_COPY );
|
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.NEVER, HAS_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyHourlyFail()
|
public void testGetProxiedReleaseArtifactPolicyHourlyFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -101,12 +112,14 @@ public class RepositoryServletProxiedReleasePolicyTest
|
||||||
( NEWER * ONE_MINUTE ) );
|
( NEWER * ONE_MINUTE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyHourlyNoManagedContent()
|
public void testGetProxiedReleaseArtifactPolicyHourlyNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.HOURLY, NO_MANAGED_COPY );
|
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.HOURLY, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyHourlyPass()
|
public void testGetProxiedReleaseArtifactPolicyHourlyPass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -114,18 +127,21 @@ public class RepositoryServletProxiedReleasePolicyTest
|
||||||
( OLDER * OVER_ONE_HOUR ) );
|
( OLDER * OVER_ONE_HOUR ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyOnceFail()
|
public void testGetProxiedReleaseArtifactPolicyOnceFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.ONCE, HAS_MANAGED_COPY );
|
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, ReleasesPolicy.ONCE, HAS_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyOnceNoManagedContent()
|
public void testGetProxiedReleaseArtifactPolicyOnceNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.ONCE, NO_MANAGED_COPY );
|
assertGetProxiedReleaseArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, ReleasesPolicy.ONCE, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyOncePass()
|
public void testGetProxiedReleaseArtifactPolicyOncePass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.meterware.httpunit.WebRequest;
|
||||||
import com.meterware.httpunit.WebResponse;
|
import com.meterware.httpunit.WebResponse;
|
||||||
|
|
||||||
import org.apache.maven.archiva.policies.ReleasesPolicy;
|
import org.apache.maven.archiva.policies.ReleasesPolicy;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RepositoryServlet Tests, Proxied, Get of Release Artifacts, with varying policy settings.
|
* RepositoryServlet Tests, Proxied, Get of Release Artifacts, with varying policy settings.
|
||||||
|
@ -34,6 +35,8 @@ import org.apache.maven.archiva.policies.ReleasesPolicy;
|
||||||
public class RepositoryServletProxiedRelocatedTest
|
public class RepositoryServletProxiedRelocatedTest
|
||||||
extends AbstractRepositoryServletProxiedTestCase
|
extends AbstractRepositoryServletProxiedTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedReleaseArtifactPolicyOncePass()
|
public void testGetProxiedReleaseArtifactPolicyOncePass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.meterware.httpunit.WebRequest;
|
||||||
import com.meterware.httpunit.WebResponse;
|
import com.meterware.httpunit.WebResponse;
|
||||||
|
|
||||||
import org.apache.maven.archiva.policies.SnapshotsPolicy;
|
import org.apache.maven.archiva.policies.SnapshotsPolicy;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -36,6 +37,8 @@ import java.io.File;
|
||||||
public class RepositoryServletProxiedSnapshotPolicyTest
|
public class RepositoryServletProxiedSnapshotPolicyTest
|
||||||
extends AbstractRepositoryServletProxiedTestCase
|
extends AbstractRepositoryServletProxiedTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedNewer()
|
public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedNewer()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -43,6 +46,7 @@ public class RepositoryServletProxiedSnapshotPolicyTest
|
||||||
HAS_MANAGED_COPY, ( NEWER * OVER_ONE_DAY ) );
|
HAS_MANAGED_COPY, ( NEWER * OVER_ONE_DAY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedOlder()
|
public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedOlder()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -50,12 +54,14 @@ public class RepositoryServletProxiedSnapshotPolicyTest
|
||||||
( OLDER * OVER_ONE_DAY ) );
|
( OLDER * OVER_ONE_DAY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyAlwaysNoManagedContent()
|
public void testGetProxiedSnapshotsArtifactPolicyAlwaysNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ALWAYS, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ALWAYS, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyDailyFail()
|
public void testGetProxiedSnapshotsArtifactPolicyDailyFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -63,12 +69,14 @@ public class RepositoryServletProxiedSnapshotPolicyTest
|
||||||
( NEWER * ONE_MINUTE ) );
|
( NEWER * ONE_MINUTE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyDailyNoManagedContent()
|
public void testGetProxiedSnapshotsArtifactPolicyDailyNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.DAILY, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.DAILY, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyDailyPass()
|
public void testGetProxiedSnapshotsArtifactPolicyDailyPass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -76,6 +84,7 @@ public class RepositoryServletProxiedSnapshotPolicyTest
|
||||||
( OLDER * OVER_ONE_DAY ) );
|
( OLDER * OVER_ONE_DAY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyRejectFail()
|
public void testGetProxiedSnapshotsArtifactPolicyRejectFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -83,12 +92,14 @@ public class RepositoryServletProxiedSnapshotPolicyTest
|
||||||
HAS_MANAGED_COPY );
|
HAS_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyRejectNoManagedContentFail()
|
public void testGetProxiedSnapshotsArtifactPolicyRejectNoManagedContentFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.NEVER, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.NEVER, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyRejectPass()
|
public void testGetProxiedSnapshotsArtifactPolicyRejectPass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -96,6 +107,7 @@ public class RepositoryServletProxiedSnapshotPolicyTest
|
||||||
HAS_MANAGED_COPY );
|
HAS_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyHourlyFail()
|
public void testGetProxiedSnapshotsArtifactPolicyHourlyFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -103,12 +115,14 @@ public class RepositoryServletProxiedSnapshotPolicyTest
|
||||||
( NEWER * ONE_MINUTE ) );
|
( NEWER * ONE_MINUTE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyHourlyNoManagedContent()
|
public void testGetProxiedSnapshotsArtifactPolicyHourlyNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.HOURLY, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.HOURLY, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyHourlyPass()
|
public void testGetProxiedSnapshotsArtifactPolicyHourlyPass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -116,18 +130,21 @@ public class RepositoryServletProxiedSnapshotPolicyTest
|
||||||
( OLDER * OVER_ONE_HOUR ) );
|
( OLDER * OVER_ONE_HOUR ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyOnceFail()
|
public void testGetProxiedSnapshotsArtifactPolicyOnceFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.ONCE, HAS_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.ONCE, HAS_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyOnceNoManagedContent()
|
public void testGetProxiedSnapshotsArtifactPolicyOnceNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ONCE, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ONCE, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyOncePass()
|
public void testGetProxiedSnapshotsArtifactPolicyOncePass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@ import com.meterware.httpunit.WebRequest;
|
||||||
import com.meterware.httpunit.WebResponse;
|
import com.meterware.httpunit.WebResponse;
|
||||||
|
|
||||||
import org.apache.maven.archiva.policies.SnapshotsPolicy;
|
import org.apache.maven.archiva.policies.SnapshotsPolicy;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -36,6 +37,8 @@ import java.io.File;
|
||||||
public class RepositoryServletProxiedTimestampedSnapshotPolicyTest
|
public class RepositoryServletProxiedTimestampedSnapshotPolicyTest
|
||||||
extends AbstractRepositoryServletProxiedTestCase
|
extends AbstractRepositoryServletProxiedTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedNewer()
|
public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedNewer()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -43,6 +46,7 @@ public class RepositoryServletProxiedTimestampedSnapshotPolicyTest
|
||||||
HAS_MANAGED_COPY, ( NEWER * OVER_ONE_DAY ) );
|
HAS_MANAGED_COPY, ( NEWER * OVER_ONE_DAY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedOlder()
|
public void testGetProxiedSnapshotsArtifactPolicyAlwaysManagedOlder()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -50,12 +54,14 @@ public class RepositoryServletProxiedTimestampedSnapshotPolicyTest
|
||||||
( OLDER * OVER_ONE_DAY ) );
|
( OLDER * OVER_ONE_DAY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyAlwaysNoManagedContent()
|
public void testGetProxiedSnapshotsArtifactPolicyAlwaysNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ALWAYS, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ALWAYS, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyDailyFail()
|
public void testGetProxiedSnapshotsArtifactPolicyDailyFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -63,12 +69,14 @@ public class RepositoryServletProxiedTimestampedSnapshotPolicyTest
|
||||||
( NEWER * ONE_MINUTE ) );
|
( NEWER * ONE_MINUTE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyDailyNoManagedContent()
|
public void testGetProxiedSnapshotsArtifactPolicyDailyNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.DAILY, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.DAILY, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyDailyPass()
|
public void testGetProxiedSnapshotsArtifactPolicyDailyPass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -76,6 +84,7 @@ public class RepositoryServletProxiedTimestampedSnapshotPolicyTest
|
||||||
( OLDER * OVER_ONE_DAY ) );
|
( OLDER * OVER_ONE_DAY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyRejectFail()
|
public void testGetProxiedSnapshotsArtifactPolicyRejectFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -83,12 +92,14 @@ public class RepositoryServletProxiedTimestampedSnapshotPolicyTest
|
||||||
HAS_MANAGED_COPY );
|
HAS_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyRejectNoManagedContentFail()
|
public void testGetProxiedSnapshotsArtifactPolicyRejectNoManagedContentFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.NEVER, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_NOT_FOUND, SnapshotsPolicy.NEVER, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyRejectPass()
|
public void testGetProxiedSnapshotsArtifactPolicyRejectPass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -96,6 +107,7 @@ public class RepositoryServletProxiedTimestampedSnapshotPolicyTest
|
||||||
HAS_MANAGED_COPY );
|
HAS_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyHourlyFail()
|
public void testGetProxiedSnapshotsArtifactPolicyHourlyFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -103,12 +115,14 @@ public class RepositoryServletProxiedTimestampedSnapshotPolicyTest
|
||||||
( NEWER * ONE_MINUTE ) );
|
( NEWER * ONE_MINUTE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyHourlyNoManagedContent()
|
public void testGetProxiedSnapshotsArtifactPolicyHourlyNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.HOURLY, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.HOURLY, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyHourlyPass()
|
public void testGetProxiedSnapshotsArtifactPolicyHourlyPass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -116,18 +130,21 @@ public class RepositoryServletProxiedTimestampedSnapshotPolicyTest
|
||||||
( OLDER * OVER_ONE_HOUR ) );
|
( OLDER * OVER_ONE_HOUR ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyOnceFail()
|
public void testGetProxiedSnapshotsArtifactPolicyOnceFail()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.ONCE, HAS_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_MANAGED_CONTENTS, SnapshotsPolicy.ONCE, HAS_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyOnceNoManagedContent()
|
public void testGetProxiedSnapshotsArtifactPolicyOnceNoManagedContent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ONCE, NO_MANAGED_COPY );
|
assertGetProxiedSnapshotsArtifactWithPolicy( EXPECT_REMOTE_CONTENTS, SnapshotsPolicy.ONCE, NO_MANAGED_COPY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetProxiedSnapshotsArtifactPolicyOncePass()
|
public void testGetProxiedSnapshotsArtifactPolicyOncePass()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,13 +19,10 @@ package org.apache.maven.archiva.webdav;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import com.meterware.httpunit.GetMethodWebRequest;
|
||||||
import java.io.InputStream;
|
import com.meterware.httpunit.PutMethodWebRequest;
|
||||||
import java.util.ArrayList;
|
import com.meterware.httpunit.WebRequest;
|
||||||
import java.util.List;
|
import com.meterware.httpunit.WebResponse;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.maven.archiva.configuration.Configuration;
|
import org.apache.maven.archiva.configuration.Configuration;
|
||||||
|
@ -33,282 +30,299 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
|
import org.apache.maven.archiva.configuration.RepositoryGroupConfiguration;
|
||||||
import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
|
import org.apache.maven.archiva.model.ArchivaRepositoryMetadata;
|
||||||
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader;
|
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
|
||||||
import com.meterware.httpunit.GetMethodWebRequest;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import com.meterware.httpunit.PutMethodWebRequest;
|
import java.io.File;
|
||||||
import com.meterware.httpunit.WebRequest;
|
import java.io.InputStream;
|
||||||
import com.meterware.httpunit.WebResponse;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RepositoryServletRepositoryGroupTest
|
* RepositoryServletRepositoryGroupTest
|
||||||
*
|
* <p/>
|
||||||
* Test Case 1. Accessing a valid repository group root url (e.g. http://machine.com/repository/repository-group/) returns a Bad Request (HTTP 400)
|
* Test Case 1. Accessing a valid repository group root url (e.g. http://machine.com/repository/repository-group/) returns a Bad Request (HTTP 400)
|
||||||
* Test Case 2. Accessing an invalid repository group root url is forwarded to managed repository checking (this is not covered here)
|
* Test Case 2. Accessing an invalid repository group root url is forwarded to managed repository checking (this is not covered here)
|
||||||
* Test Case 3. Accessing an artifact in a valid repository group will iterate over the managed repositories in the repository group
|
* Test Case 3. Accessing an artifact in a valid repository group will iterate over the managed repositories in the repository group
|
||||||
* Test Case 3.a. If an invalid managed repository is encountered (managed repository doesn't exist),
|
* Test Case 3.a. If an invalid managed repository is encountered (managed repository doesn't exist),
|
||||||
* a Not Found (HTTP 404) is returned and the iteration is broken
|
* a Not Found (HTTP 404) is returned and the iteration is broken
|
||||||
* Test Case 3.b. If an artifact is not found in a valid managed repository (after proxying, etc.),
|
* Test Case 3.b. If an artifact is not found in a valid managed repository (after proxying, etc.),
|
||||||
* a Not Found (HTTP 404) is set but not returned yet, the iteration continues to the next managed repository.
|
* a Not Found (HTTP 404) is set but not returned yet, the iteration continues to the next managed repository.
|
||||||
* The Not Found (HTTP 404) is returned after exhausting all valid managed repositories
|
* The Not Found (HTTP 404) is returned after exhausting all valid managed repositories
|
||||||
* Test Case 3.c. If an artifact is found in a valid managed repository,
|
* Test Case 3.c. If an artifact is found in a valid managed repository,
|
||||||
* the artifact is returned, the iteration is broken and any Not Found (HTTP 404) is disregarded
|
* the artifact is returned, the iteration is broken and any Not Found (HTTP 404) is disregarded
|
||||||
* Test Case 4. Accessing a valid repository group with any http write method returns a Bad Request (HTTP 400)
|
* Test Case 4. Accessing a valid repository group with any http write method returns a Bad Request (HTTP 400)
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class RepositoryServletRepositoryGroupTest
|
public class RepositoryServletRepositoryGroupTest
|
||||||
extends AbstractRepositoryServletTestCase
|
extends AbstractRepositoryServletTestCase
|
||||||
{
|
{
|
||||||
protected File repoRootFirst;
|
protected File repoRootFirst;
|
||||||
|
|
||||||
protected File repoRootLast;
|
protected File repoRootLast;
|
||||||
|
|
||||||
protected File repoRootInvalid;
|
protected File repoRootInvalid;
|
||||||
|
|
||||||
protected static final String MANAGED_REPO_FIRST = "first";
|
protected static final String MANAGED_REPO_FIRST = "first";
|
||||||
|
|
||||||
protected static final String MANAGED_REPO_LAST = "last";
|
protected static final String MANAGED_REPO_LAST = "last";
|
||||||
|
|
||||||
protected static final String MANAGED_REPO_INVALID = "invalid";
|
protected static final String MANAGED_REPO_INVALID = "invalid";
|
||||||
|
|
||||||
protected static final String REPO_GROUP_WITH_VALID_REPOS = "group-with-valid-repos";
|
protected static final String REPO_GROUP_WITH_VALID_REPOS = "group-with-valid-repos";
|
||||||
|
|
||||||
protected static final String REPO_GROUP_WITH_INVALID_REPOS = "group-with-invalid-repos";
|
protected static final String REPO_GROUP_WITH_INVALID_REPOS = "group-with-invalid-repos";
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUp()
|
@Before
|
||||||
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
String appserverBase = System.getProperty( "appserver.base" );
|
String appserverBase = System.getProperty( "appserver.base" );
|
||||||
|
|
||||||
Configuration configuration = archivaConfiguration.getConfiguration();
|
Configuration configuration = archivaConfiguration.getConfiguration();
|
||||||
|
|
||||||
repoRootFirst = new File( appserverBase, "data/repositories/" + MANAGED_REPO_FIRST );
|
repoRootFirst = new File( appserverBase, "data/repositories/" + MANAGED_REPO_FIRST );
|
||||||
repoRootLast = new File( appserverBase, "data/repositories/" + MANAGED_REPO_LAST );
|
repoRootLast = new File( appserverBase, "data/repositories/" + MANAGED_REPO_LAST );
|
||||||
|
|
||||||
configuration.addManagedRepository( createManagedRepository( MANAGED_REPO_FIRST, "First Test Repo", repoRootFirst, true ) );
|
configuration.addManagedRepository(
|
||||||
configuration.addManagedRepository( createManagedRepository( MANAGED_REPO_LAST, "Last Test Repo", repoRootLast, true ) );
|
createManagedRepository( MANAGED_REPO_FIRST, "First Test Repo", repoRootFirst, true ) );
|
||||||
|
configuration.addManagedRepository(
|
||||||
|
createManagedRepository( MANAGED_REPO_LAST, "Last Test Repo", repoRootLast, true ) );
|
||||||
|
|
||||||
List<String> managedRepoIds = new ArrayList<String>();
|
List<String> managedRepoIds = new ArrayList<String>();
|
||||||
managedRepoIds.add( MANAGED_REPO_FIRST );
|
managedRepoIds.add( MANAGED_REPO_FIRST );
|
||||||
managedRepoIds.add( MANAGED_REPO_LAST );
|
managedRepoIds.add( MANAGED_REPO_LAST );
|
||||||
|
|
||||||
configuration.addRepositoryGroup( createRepositoryGroup( REPO_GROUP_WITH_VALID_REPOS, managedRepoIds ) );
|
configuration.addRepositoryGroup( createRepositoryGroup( REPO_GROUP_WITH_VALID_REPOS, managedRepoIds ) );
|
||||||
|
|
||||||
// Create the repository group with an invalid managed repository
|
// Create the repository group with an invalid managed repository
|
||||||
repoRootInvalid = new File( appserverBase, "data/repositories/" + MANAGED_REPO_INVALID );
|
repoRootInvalid = new File( appserverBase, "data/repositories/" + MANAGED_REPO_INVALID );
|
||||||
ManagedRepositoryConfiguration managedRepositoryConfiguration = createManagedRepository( MANAGED_REPO_INVALID, "Invalid Test Repo", repoRootInvalid, true );
|
ManagedRepositoryConfiguration managedRepositoryConfiguration =
|
||||||
|
createManagedRepository( MANAGED_REPO_INVALID, "Invalid Test Repo", repoRootInvalid, true );
|
||||||
configuration.addManagedRepository( createManagedRepository( MANAGED_REPO_FIRST, "First Test Repo", repoRootFirst, true ) );
|
|
||||||
|
configuration.addManagedRepository(
|
||||||
|
createManagedRepository( MANAGED_REPO_FIRST, "First Test Repo", repoRootFirst, true ) );
|
||||||
configuration.addManagedRepository( managedRepositoryConfiguration );
|
configuration.addManagedRepository( managedRepositoryConfiguration );
|
||||||
configuration.addManagedRepository( createManagedRepository( MANAGED_REPO_LAST, "Last Test Repo", repoRootLast, true ) );
|
configuration.addManagedRepository(
|
||||||
|
createManagedRepository( MANAGED_REPO_LAST, "Last Test Repo", repoRootLast, true ) );
|
||||||
|
|
||||||
List<String> invalidManagedRepoIds = new ArrayList<String>();
|
List<String> invalidManagedRepoIds = new ArrayList<String>();
|
||||||
invalidManagedRepoIds.add( MANAGED_REPO_FIRST );
|
invalidManagedRepoIds.add( MANAGED_REPO_FIRST );
|
||||||
invalidManagedRepoIds.add( MANAGED_REPO_INVALID );
|
invalidManagedRepoIds.add( MANAGED_REPO_INVALID );
|
||||||
invalidManagedRepoIds.add( MANAGED_REPO_LAST );
|
invalidManagedRepoIds.add( MANAGED_REPO_LAST );
|
||||||
|
|
||||||
configuration.addRepositoryGroup( createRepositoryGroup( REPO_GROUP_WITH_INVALID_REPOS, invalidManagedRepoIds ) );
|
configuration.addRepositoryGroup(
|
||||||
|
createRepositoryGroup( REPO_GROUP_WITH_INVALID_REPOS, invalidManagedRepoIds ) );
|
||||||
|
|
||||||
configuration.removeManagedRepository( managedRepositoryConfiguration );
|
configuration.removeManagedRepository( managedRepositoryConfiguration );
|
||||||
FileUtils.deleteDirectory( repoRootInvalid );
|
FileUtils.deleteDirectory( repoRootInvalid );
|
||||||
|
|
||||||
saveConfiguration( archivaConfiguration );
|
saveConfiguration( archivaConfiguration );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void tearDown()
|
@After
|
||||||
|
public void tearDown()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
setupCleanRepo( repoRootFirst );
|
setupCleanRepo( repoRootFirst );
|
||||||
setupCleanRepo( repoRootLast );
|
setupCleanRepo( repoRootLast );
|
||||||
|
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test Case 3.c
|
* Test Case 3.c
|
||||||
*/
|
*/
|
||||||
public void testGetFromFirstManagedRepositoryReturnOk()
|
public void testGetFromFirstManagedRepositoryReturnOk()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
String resourceName = "dummy/dummy-first-resource/1.0/dummy-first-resource-1.0.txt";
|
String resourceName = "dummy/dummy-first-resource/1.0/dummy-first-resource-1.0.txt";
|
||||||
|
|
||||||
File dummyInternalResourceFile = new File( repoRootFirst, resourceName );
|
File dummyInternalResourceFile = new File( repoRootFirst, resourceName );
|
||||||
dummyInternalResourceFile.getParentFile().mkdirs();
|
dummyInternalResourceFile.getParentFile().mkdirs();
|
||||||
FileUtils.writeStringToFile( dummyInternalResourceFile, "first", null );
|
FileUtils.writeStringToFile( dummyInternalResourceFile, "first", null );
|
||||||
|
|
||||||
WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/" + resourceName );
|
WebRequest request = new GetMethodWebRequest(
|
||||||
|
"http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/" + resourceName );
|
||||||
WebResponse response = sc.getResponse( request );
|
WebResponse response = sc.getResponse( request );
|
||||||
|
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
assertEquals( "Expected file contents", "first", response.getText() );
|
assertEquals( "Expected file contents", "first", response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test Case 3.c
|
* Test Case 3.c
|
||||||
*/
|
*/
|
||||||
public void testGetFromLastManagedRepositoryReturnOk()
|
public void testGetFromLastManagedRepositoryReturnOk()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
String resourceName = "dummy/dummy-last-resource/1.0/dummy-last-resource-1.0.txt";
|
String resourceName = "dummy/dummy-last-resource/1.0/dummy-last-resource-1.0.txt";
|
||||||
|
|
||||||
File dummyReleasesResourceFile = new File( repoRootLast, resourceName );
|
File dummyReleasesResourceFile = new File( repoRootLast, resourceName );
|
||||||
dummyReleasesResourceFile.getParentFile().mkdirs();
|
dummyReleasesResourceFile.getParentFile().mkdirs();
|
||||||
FileUtils.writeStringToFile( dummyReleasesResourceFile, "last", null );
|
FileUtils.writeStringToFile( dummyReleasesResourceFile, "last", null );
|
||||||
|
|
||||||
WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/" + resourceName );
|
WebRequest request = new GetMethodWebRequest(
|
||||||
|
"http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/" + resourceName );
|
||||||
WebResponse response = sc.getResponse( request );
|
WebResponse response = sc.getResponse( request );
|
||||||
|
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
assertEquals( "Expected file contents", "last", response.getText() );
|
assertEquals( "Expected file contents", "last", response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test Case 3.b
|
* Test Case 3.b
|
||||||
*/
|
*/
|
||||||
public void testGetFromValidRepositoryGroupReturnNotFound()
|
public void testGetFromValidRepositoryGroupReturnNotFound()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
String resourceName = "dummy/dummy-no-resource/1.0/dummy-no-resource-1.0.txt";
|
String resourceName = "dummy/dummy-no-resource/1.0/dummy-no-resource-1.0.txt";
|
||||||
|
|
||||||
WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/" + resourceName );
|
WebRequest request = new GetMethodWebRequest(
|
||||||
|
"http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/" + resourceName );
|
||||||
WebResponse response = sc.getResponse( request );
|
WebResponse response = sc.getResponse( request );
|
||||||
|
|
||||||
assertResponseNotFound( response );
|
assertResponseNotFound( response );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test Case 3.a
|
* Test Case 3.a
|
||||||
*/
|
*/
|
||||||
public void testGetInvalidManagedRepositoryInGroupReturnNotFound()
|
public void testGetInvalidManagedRepositoryInGroupReturnNotFound()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
String resourceName = "dummy/dummy-no-resource/1.0/dummy-no-resource-1.0.txt";
|
String resourceName = "dummy/dummy-no-resource/1.0/dummy-no-resource-1.0.txt";
|
||||||
|
|
||||||
WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_INVALID_REPOS + "/" + resourceName );
|
WebRequest request = new GetMethodWebRequest(
|
||||||
|
"http://machine.com/repository/" + REPO_GROUP_WITH_INVALID_REPOS + "/" + resourceName );
|
||||||
WebResponse response = sc.getResponse( request );
|
WebResponse response = sc.getResponse( request );
|
||||||
|
|
||||||
assertResponseInternalServerError( response );
|
assertResponseInternalServerError( response );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test Case 4
|
* Test Case 4
|
||||||
*/
|
*/
|
||||||
public void testPutValidRepositoryGroupReturnBadRequest()
|
public void testPutValidRepositoryGroupReturnBadRequest()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
String resourceName = "dummy/dummy-put-resource/1.0/dummy-put-resource-1.0.txt";
|
String resourceName = "dummy/dummy-put-resource/1.0/dummy-put-resource-1.0.txt";
|
||||||
String putUrl = "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/" + resourceName;
|
String putUrl = "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/" + resourceName;
|
||||||
InputStream is = getClass().getResourceAsStream( "/artifact.jar" );
|
InputStream is = getClass().getResourceAsStream( "/artifact.jar" );
|
||||||
|
|
||||||
WebRequest request = new PutMethodWebRequest( putUrl, is, "text/plain" );
|
WebRequest request = new PutMethodWebRequest( putUrl, is, "text/plain" );
|
||||||
WebResponse response = sc.getResponse( request );
|
WebResponse response = sc.getResponse( request );
|
||||||
|
|
||||||
assertResponseMethodNotAllowed( response );
|
assertResponseMethodNotAllowed( response );
|
||||||
}
|
}
|
||||||
|
|
||||||
// MRM-872
|
// MRM-872
|
||||||
public void testGetMergedMetadata()
|
public void testGetMergedMetadata()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
// first metadata file
|
// first metadata file
|
||||||
String resourceName = "dummy/dummy-merged-metadata-resource/maven-metadata.xml";
|
String resourceName = "dummy/dummy-merged-metadata-resource/maven-metadata.xml";
|
||||||
|
|
||||||
File dummyInternalResourceFile = new File( repoRootFirst, resourceName );
|
File dummyInternalResourceFile = new File( repoRootFirst, resourceName );
|
||||||
dummyInternalResourceFile.getParentFile().mkdirs();
|
dummyInternalResourceFile.getParentFile().mkdirs();
|
||||||
FileUtils.writeStringToFile( dummyInternalResourceFile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
FileUtils.writeStringToFile( dummyInternalResourceFile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||||
"<metadata>\n<groupId>dummy</groupId>\n<artifactId>dummy-merged-metadata-resource</artifactId>\n" +
|
+ "<metadata>\n<groupId>dummy</groupId>\n<artifactId>dummy-merged-metadata-resource</artifactId>\n"
|
||||||
"<versioning>\n<latest>1.0</latest>\n<release>1.0</release>\n<versions>\n<version>1.0</version>\n" +
|
+ "<versioning>\n<latest>1.0</latest>\n<release>1.0</release>\n<versions>\n<version>1.0</version>\n"
|
||||||
"<version>2.5</version>\n</versions>\n<lastUpdated>20080708095554</lastUpdated>\n</versioning>\n</metadata>", null );
|
+ "<version>2.5</version>\n</versions>\n<lastUpdated>20080708095554</lastUpdated>\n</versioning>\n</metadata>",
|
||||||
|
null );
|
||||||
|
|
||||||
//second metadata file
|
//second metadata file
|
||||||
resourceName = "dummy/dummy-merged-metadata-resource/maven-metadata.xml";
|
resourceName = "dummy/dummy-merged-metadata-resource/maven-metadata.xml";
|
||||||
dummyInternalResourceFile = new File( repoRootLast, resourceName );
|
dummyInternalResourceFile = new File( repoRootLast, resourceName );
|
||||||
dummyInternalResourceFile.getParentFile().mkdirs();
|
dummyInternalResourceFile.getParentFile().mkdirs();
|
||||||
FileUtils.writeStringToFile( dummyInternalResourceFile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
|
FileUtils.writeStringToFile( dummyInternalResourceFile, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
|
||||||
"<metadata><groupId>dummy</groupId><artifactId>dummy-merged-metadata-resource</artifactId>" +
|
+ "<metadata><groupId>dummy</groupId><artifactId>dummy-merged-metadata-resource</artifactId>"
|
||||||
"<versioning><latest>2.0</latest><release>2.0</release><versions><version>1.0</version>" +
|
+ "<versioning><latest>2.0</latest><release>2.0</release><versions><version>1.0</version>"
|
||||||
"<version>1.5</version><version>2.0</version></versions><lastUpdated>20080709095554</lastUpdated>" +
|
+ "<version>1.5</version><version>2.0</version></versions><lastUpdated>20080709095554</lastUpdated>"
|
||||||
"</versioning></metadata>", null );
|
+ "</versioning></metadata>", null );
|
||||||
|
|
||||||
WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/" +
|
WebRequest request = new GetMethodWebRequest(
|
||||||
"dummy-merged-metadata-resource/maven-metadata.xml" );
|
"http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/"
|
||||||
WebResponse response = sc.getResource( request );
|
+ "dummy-merged-metadata-resource/maven-metadata.xml" );
|
||||||
|
WebResponse response = sc.getResource( request );
|
||||||
File returnedMetadata = new File( getBasedir(), "/target/test-classes/retrievedMetadataFile.xml");
|
|
||||||
|
File returnedMetadata = new File( "target/test-classes/retrievedMetadataFile.xml" );
|
||||||
FileUtils.writeStringToFile( returnedMetadata, response.getText() );
|
FileUtils.writeStringToFile( returnedMetadata, response.getText() );
|
||||||
ArchivaRepositoryMetadata metadata = RepositoryMetadataReader.read( returnedMetadata );
|
ArchivaRepositoryMetadata metadata = RepositoryMetadataReader.read( returnedMetadata );
|
||||||
|
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
assertEquals( "Versions list size", 4, metadata.getAvailableVersions().size() );
|
assertEquals( "Versions list size", 4, metadata.getAvailableVersions().size() );
|
||||||
assertTrue( "Versions list contains version 1.0", metadata.getAvailableVersions().contains( "1.0" ) );
|
assertTrue( "Versions list contains version 1.0", metadata.getAvailableVersions().contains( "1.0" ) );
|
||||||
assertTrue( "Versions list contains version 1.5", metadata.getAvailableVersions().contains( "1.5" ) );
|
assertTrue( "Versions list contains version 1.5", metadata.getAvailableVersions().contains( "1.5" ) );
|
||||||
assertTrue( "Versions list contains version 2.0", metadata.getAvailableVersions().contains( "2.0" ) );
|
assertTrue( "Versions list contains version 2.0", metadata.getAvailableVersions().contains( "2.0" ) );
|
||||||
assertTrue( "Versions list contains version 2.5", metadata.getAvailableVersions().contains( "2.5" ) );
|
assertTrue( "Versions list contains version 2.5", metadata.getAvailableVersions().contains( "2.5" ) );
|
||||||
|
|
||||||
//check if the checksum files were generated
|
//check if the checksum files were generated
|
||||||
File checksumFileSha1 = new File( repoRootFirst, resourceName + ".sha1" );
|
File checksumFileSha1 = new File( repoRootFirst, resourceName + ".sha1" );
|
||||||
checksumFileSha1.getParentFile().mkdirs();
|
checksumFileSha1.getParentFile().mkdirs();
|
||||||
FileUtils.writeStringToFile( checksumFileSha1, "3290853214d3687134", null );
|
FileUtils.writeStringToFile( checksumFileSha1, "3290853214d3687134", null );
|
||||||
|
|
||||||
File checksumFileMd5 = new File( repoRootFirst, resourceName + ".md5" );
|
File checksumFileMd5 = new File( repoRootFirst, resourceName + ".md5" );
|
||||||
checksumFileMd5.getParentFile().mkdirs();
|
checksumFileMd5.getParentFile().mkdirs();
|
||||||
FileUtils.writeStringToFile( checksumFileMd5, "98745897234eda12836423", null );
|
FileUtils.writeStringToFile( checksumFileMd5, "98745897234eda12836423", null );
|
||||||
|
|
||||||
// request the sha1 checksum of the metadata
|
// request the sha1 checksum of the metadata
|
||||||
request =
|
request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/"
|
||||||
new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/" +
|
+ "dummy-merged-metadata-resource/maven-metadata.xml.sha1" );
|
||||||
"dummy-merged-metadata-resource/maven-metadata.xml.sha1" );
|
|
||||||
response = sc.getResource( request );
|
response = sc.getResource( request );
|
||||||
|
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
assertEquals( "add113b0d7f8c6adb92a5015a7a3701081edf998 maven-metadata-group-with-valid-repos.xml", response.getText() );
|
assertEquals( "add113b0d7f8c6adb92a5015a7a3701081edf998 maven-metadata-group-with-valid-repos.xml",
|
||||||
|
response.getText() );
|
||||||
|
|
||||||
// request the md5 checksum of the metadata
|
// request the md5 checksum of the metadata
|
||||||
request =
|
request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/"
|
||||||
new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/" +
|
+ "dummy-merged-metadata-resource/maven-metadata.xml.md5" );
|
||||||
"dummy-merged-metadata-resource/maven-metadata.xml.md5" );
|
|
||||||
response = sc.getResource( request );
|
response = sc.getResource( request );
|
||||||
|
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
assertEquals( "5b85ea4aa5f52bb76760041a52f98de8 maven-metadata-group-with-valid-repos.xml", response.getText().trim() );
|
assertEquals( "5b85ea4aa5f52bb76760041a52f98de8 maven-metadata-group-with-valid-repos.xml",
|
||||||
|
response.getText().trim() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// MRM-901
|
// MRM-901
|
||||||
public void testBrowseWithTwoArtifactsWithSameGroupIdInRepos()
|
public void testBrowseWithTwoArtifactsWithSameGroupIdInRepos()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
String resourceName = "dummy/dummy-artifact/1.0/dummy-artifact-1.0.txt";
|
String resourceName = "dummy/dummy-artifact/1.0/dummy-artifact-1.0.txt";
|
||||||
|
|
||||||
File dummyInternalResourceFile = new File( repoRootFirst, resourceName );
|
File dummyInternalResourceFile = new File( repoRootFirst, resourceName );
|
||||||
dummyInternalResourceFile.getParentFile().mkdirs();
|
dummyInternalResourceFile.getParentFile().mkdirs();
|
||||||
FileUtils.writeStringToFile( dummyInternalResourceFile, "first", null );
|
FileUtils.writeStringToFile( dummyInternalResourceFile, "first", null );
|
||||||
|
|
||||||
resourceName = "dummy/dummy-artifact/2.0/dummy-artifact-2.0.txt";
|
resourceName = "dummy/dummy-artifact/2.0/dummy-artifact-2.0.txt";
|
||||||
|
|
||||||
File dummyReleasesResourceFile = new File( repoRootLast, resourceName );
|
File dummyReleasesResourceFile = new File( repoRootLast, resourceName );
|
||||||
dummyReleasesResourceFile.getParentFile().mkdirs();
|
dummyReleasesResourceFile.getParentFile().mkdirs();
|
||||||
FileUtils.writeStringToFile( dummyReleasesResourceFile, "last", null );
|
FileUtils.writeStringToFile( dummyReleasesResourceFile, "last", null );
|
||||||
|
|
||||||
WebRequest request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/dummy-artifact/" );
|
WebRequest request = new GetMethodWebRequest(
|
||||||
|
"http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/dummy-artifact/" );
|
||||||
WebResponse response = sc.getResource( request );
|
WebResponse response = sc.getResource( request );
|
||||||
|
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
assertTrue( StringUtils.contains( response.getText(), "Collection" ) );
|
assertTrue( StringUtils.contains( response.getText(), "Collection" ) );
|
||||||
assertTrue( StringUtils.contains( response.getText(), "dummy/dummy-artifact" ) );
|
assertTrue( StringUtils.contains( response.getText(), "dummy/dummy-artifact" ) );
|
||||||
assertTrue( StringUtils.contains( response.getText(), "1.0" ) );
|
assertTrue( StringUtils.contains( response.getText(), "1.0" ) );
|
||||||
assertTrue( StringUtils.contains( response.getText(), "2.0" ) );
|
assertTrue( StringUtils.contains( response.getText(), "2.0" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertResponseMethodNotAllowed( WebResponse response )
|
protected void assertResponseMethodNotAllowed( WebResponse response )
|
||||||
{
|
{
|
||||||
assertNotNull( "Should have recieved a response", response );
|
assertNotNull( "Should have recieved a response", response );
|
||||||
assertEquals( "Should have been an 405/Method Not Allowed response code.", HttpServletResponse.SC_METHOD_NOT_ALLOWED, response.getResponseCode() );
|
assertEquals( "Should have been an 405/Method Not Allowed response code.",
|
||||||
|
HttpServletResponse.SC_METHOD_NOT_ALLOWED, response.getResponseCode() );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RepositoryGroupConfiguration createRepositoryGroup( String id, List<String> repositories )
|
protected RepositoryGroupConfiguration createRepositoryGroup( String id, List<String> repositories )
|
||||||
|
|
|
@ -27,6 +27,7 @@ import com.meterware.httpunit.WebResponse;
|
||||||
import com.meterware.servletunit.InvocationContext;
|
import com.meterware.servletunit.InvocationContext;
|
||||||
import com.meterware.servletunit.ServletRunner;
|
import com.meterware.servletunit.ServletRunner;
|
||||||
import com.meterware.servletunit.ServletUnitClient;
|
import com.meterware.servletunit.ServletUnitClient;
|
||||||
|
import junit.framework.TestCase;
|
||||||
import net.sf.ehcache.CacheManager;
|
import net.sf.ehcache.CacheManager;
|
||||||
import org.apache.archiva.repository.audit.TestAuditListener;
|
import org.apache.archiva.repository.audit.TestAuditListener;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
@ -43,16 +44,21 @@ import org.codehaus.plexus.redback.system.DefaultSecuritySession;
|
||||||
import org.codehaus.plexus.redback.system.SecuritySession;
|
import org.codehaus.plexus.redback.system.SecuritySession;
|
||||||
import org.codehaus.plexus.redback.users.User;
|
import org.codehaus.plexus.redback.users.User;
|
||||||
import org.codehaus.plexus.redback.users.memory.SimpleUser;
|
import org.codehaus.plexus.redback.users.memory.SimpleUser;
|
||||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
|
||||||
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
|
import org.codehaus.redback.integration.filter.authentication.HttpAuthenticator;
|
||||||
import org.codehaus.redback.integration.filter.authentication.basic.HttpBasicAuthentication;
|
import org.codehaus.redback.integration.filter.authentication.basic.HttpBasicAuthentication;
|
||||||
import org.easymock.MockControl;
|
import org.easymock.MockControl;
|
||||||
import org.easymock.classextension.MockClassControl;
|
import org.easymock.classextension.MockClassControl;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RepositoryServletSecurityTest Test the flow of the authentication and authorization checks. This does not necessarily
|
* RepositoryServletSecurityTest Test the flow of the authentication and authorization checks. This does not necessarily
|
||||||
|
@ -60,8 +66,10 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
*
|
*
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
@RunWith( SpringJUnit4ClassRunner.class )
|
||||||
|
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
|
||||||
public class RepositoryServletSecurityTest
|
public class RepositoryServletSecurityTest
|
||||||
extends PlexusInSpringTestCase
|
extends TestCase
|
||||||
{
|
{
|
||||||
protected static final String REPOID_INTERNAL = "internal";
|
protected static final String REPOID_INTERNAL = "internal";
|
||||||
|
|
||||||
|
@ -71,6 +79,7 @@ public class RepositoryServletSecurityTest
|
||||||
|
|
||||||
private ServletRunner sr;
|
private ServletRunner sr;
|
||||||
|
|
||||||
|
@Inject
|
||||||
protected ArchivaConfiguration archivaConfiguration;
|
protected ArchivaConfiguration archivaConfiguration;
|
||||||
|
|
||||||
private DavSessionProvider davSessionProvider;
|
private DavSessionProvider davSessionProvider;
|
||||||
|
@ -85,19 +94,19 @@ public class RepositoryServletSecurityTest
|
||||||
|
|
||||||
private RepositoryServlet servlet;
|
private RepositoryServlet servlet;
|
||||||
|
|
||||||
|
@Before
|
||||||
public void setUp()
|
public void setUp()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
String appserverBase = getTestFile( "target/appserver-base" ).getAbsolutePath();
|
String appserverBase = new File( "target/appserver-base" ).getAbsolutePath();
|
||||||
System.setProperty( "appserver.base", appserverBase );
|
System.setProperty( "appserver.base", appserverBase );
|
||||||
|
|
||||||
File testConf = getTestFile( "src/test/resources/repository-archiva.xml" );
|
File testConf = new File( "src/test/resources/repository-archiva.xml" );
|
||||||
File testConfDest = new File( appserverBase, "conf/archiva.xml" );
|
File testConfDest = new File( appserverBase, "conf/archiva.xml" );
|
||||||
FileUtils.copyFile( testConf, testConfDest );
|
FileUtils.copyFile( testConf, testConfDest );
|
||||||
|
|
||||||
archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class );
|
|
||||||
repoRootInternal = new File( appserverBase, "data/repositories/internal" );
|
repoRootInternal = new File( appserverBase, "data/repositories/internal" );
|
||||||
Configuration config = archivaConfiguration.getConfiguration();
|
Configuration config = archivaConfiguration.getConfiguration();
|
||||||
|
|
||||||
|
@ -108,7 +117,7 @@ public class RepositoryServletSecurityTest
|
||||||
|
|
||||||
HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );
|
HttpUnitOptions.setExceptionsThrownOnErrorStatus( false );
|
||||||
|
|
||||||
sr = new ServletRunner( getTestFile( "src/test/resources/WEB-INF/repository-servlet-security-test/web.xml" ) );
|
sr = new ServletRunner( new File( "src/test/resources/WEB-INF/repository-servlet-security-test/web.xml" ) );
|
||||||
sr.registerServlet( "/repository/*", RepositoryServlet.class.getName() );
|
sr.registerServlet( "/repository/*", RepositoryServlet.class.getName() );
|
||||||
sc = sr.newClient();
|
sc = sr.newClient();
|
||||||
|
|
||||||
|
@ -156,12 +165,7 @@ public class RepositoryServletSecurityTest
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getPlexusConfigLocation()
|
@After
|
||||||
{
|
|
||||||
return "org/apache/maven/archiva/webdav/RepositoryServletSecurityTest.xml";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void tearDown()
|
protected void tearDown()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.apache.maven.archiva.webdav.RepositoryServlet;
|
||||||
import com.meterware.httpunit.GetMethodWebRequest;
|
import com.meterware.httpunit.GetMethodWebRequest;
|
||||||
import com.meterware.httpunit.WebRequest;
|
import com.meterware.httpunit.WebRequest;
|
||||||
import com.meterware.httpunit.WebResponse;
|
import com.meterware.httpunit.WebResponse;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ public class RepositoryServletTest
|
||||||
|
|
||||||
private static final String NEW_REPOSITORY_NAME = "New Repository";
|
private static final String NEW_REPOSITORY_NAME = "New Repository";
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetRepository()
|
public void testGetRepository()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -53,6 +55,7 @@ public class RepositoryServletTest
|
||||||
assertRepositoryValid( servlet, REPOID_INTERNAL );
|
assertRepositoryValid( servlet, REPOID_INTERNAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetRepositoryAfterDelete()
|
public void testGetRepositoryAfterDelete()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -68,6 +71,7 @@ public class RepositoryServletTest
|
||||||
assertNull( repository );
|
assertNull( repository );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetRepositoryAfterAdd()
|
public void testGetRepositoryAfterAdd()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -79,7 +83,7 @@ public class RepositoryServletTest
|
||||||
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
|
ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration();
|
||||||
repo.setId( NEW_REPOSITORY_ID );
|
repo.setId( NEW_REPOSITORY_ID );
|
||||||
repo.setName( NEW_REPOSITORY_NAME );
|
repo.setName( NEW_REPOSITORY_NAME );
|
||||||
File repoRoot = new File( getBasedir(), "target/test-repository-root" );
|
File repoRoot = new File( "target/test-repository-root" );
|
||||||
if ( !repoRoot.exists() )
|
if ( !repoRoot.exists() )
|
||||||
{
|
{
|
||||||
repoRoot.mkdirs();
|
repoRoot.mkdirs();
|
||||||
|
@ -96,6 +100,7 @@ public class RepositoryServletTest
|
||||||
assertRepositoryValid( servlet, REPOID_INTERNAL );
|
assertRepositoryValid( servlet, REPOID_INTERNAL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetRepositoryInvalidPathPassthroughPresent()
|
public void testGetRepositoryInvalidPathPassthroughPresent()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -109,6 +114,7 @@ public class RepositoryServletTest
|
||||||
assertEquals( "index file", response.getText() );
|
assertEquals( "index file", response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testGetRepositoryInvalidPathPassthroughMissing()
|
public void testGetRepositoryInvalidPathPassthroughMissing()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,18 +19,31 @@ package org.apache.maven.archiva.webdav.util;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
|
import junit.framework.TestCase;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MimeTypesTest
|
* MimeTypesTest
|
||||||
*
|
*
|
||||||
* @version $Id: MimeTypesTest.java 6556 2007-06-20 20:44:46Z joakime $
|
* @version $Id: MimeTypesTest.java 6556 2007-06-20 20:44:46Z joakime $
|
||||||
*/
|
*/
|
||||||
public class MimeTypesTest extends PlexusInSpringTestCase
|
@RunWith( SpringJUnit4ClassRunner.class )
|
||||||
|
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
|
||||||
|
public class MimeTypesTest
|
||||||
|
extends TestCase
|
||||||
{
|
{
|
||||||
public void testGetMimeType() throws Exception
|
@Inject
|
||||||
|
MimeTypes mime;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetMimeType()
|
||||||
|
throws Exception
|
||||||
{
|
{
|
||||||
MimeTypes mime = (MimeTypes) lookup( MimeTypes.class );
|
|
||||||
assertNotNull( "MimeTypes should not be null.", mime );
|
assertNotNull( "MimeTypes should not be null.", mime );
|
||||||
|
|
||||||
assertEquals( "application/pdf", mime.getMimeType( "big-book.pdf" ) );
|
assertEquals( "application/pdf", mime.getMimeType( "big-book.pdf" ) );
|
||||||
|
|
|
@ -23,28 +23,29 @@ import junit.framework.TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class RepositoryPathUtilTest extends TestCase
|
public class RepositoryPathUtilTest
|
||||||
|
extends TestCase
|
||||||
{
|
{
|
||||||
public void testGetRepositoryId()
|
public void testGetRepositoryId()
|
||||||
{
|
{
|
||||||
String href = "/path/to/my/resource";
|
String href = "/path/to/my/resource";
|
||||||
assertEquals("to", RepositoryPathUtil.getRepositoryName(href));
|
assertEquals( "to", RepositoryPathUtil.getRepositoryName( href ) );
|
||||||
|
|
||||||
href = "path/to/my/resource";
|
href = "path/to/my/resource";
|
||||||
assertEquals("to", RepositoryPathUtil.getRepositoryName(href));
|
assertEquals( "to", RepositoryPathUtil.getRepositoryName( href ) );
|
||||||
|
|
||||||
href = "mypath";
|
href = "mypath";
|
||||||
assertEquals("/", RepositoryPathUtil.getLogicalResource(href));
|
assertEquals( "/", RepositoryPathUtil.getLogicalResource( href ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetLogicalPath()
|
public void testGetLogicalPath()
|
||||||
{
|
{
|
||||||
String href = "/repository/internal/org/apache/maven/someartifact.jar";
|
String href = "/repository/internal/org/apache/maven/someartifact.jar";
|
||||||
assertEquals("/org/apache/maven/someartifact.jar", RepositoryPathUtil.getLogicalResource(href));
|
assertEquals( "/org/apache/maven/someartifact.jar", RepositoryPathUtil.getLogicalResource( href ) );
|
||||||
|
|
||||||
href = "repository/internal/org/apache/maven/someartifact.jar";
|
href = "repository/internal/org/apache/maven/someartifact.jar";
|
||||||
assertEquals("/org/apache/maven/someartifact.jar", RepositoryPathUtil.getLogicalResource(href));
|
assertEquals( "/org/apache/maven/someartifact.jar", RepositoryPathUtil.getLogicalResource( href ) );
|
||||||
|
|
||||||
href = "repository/internal/org/apache/maven/";
|
href = "repository/internal/org/apache/maven/";
|
||||||
assertEquals( "/org/apache/maven/", RepositoryPathUtil.getLogicalResource( href ) );
|
assertEquals( "/org/apache/maven/", RepositoryPathUtil.getLogicalResource( href ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?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:annotation-config/>
|
||||||
|
<context:component-scan base-package="org.apache.maven.archiva.webdav"/>
|
||||||
|
|
||||||
|
</beans>
|
|
@ -29,14 +29,10 @@
|
||||||
</listener>
|
</listener>
|
||||||
|
|
||||||
<context-param>
|
<context-param>
|
||||||
<param-name>contextClass</param-name>
|
|
||||||
<param-value>org.codehaus.plexus.spring.PlexusWebApplicationContext</param-value>
|
|
||||||
</context-param>
|
|
||||||
|
|
||||||
<context-param>
|
|
||||||
<param-name>contextConfigLocation</param-name>
|
<param-name>contextConfigLocation</param-name>
|
||||||
<param-value>
|
<param-value>
|
||||||
classpath*:/META-INF/plexus/components.xml
|
classpath*:/META-INF/spring-context.xml,
|
||||||
|
classpath*:spring-context.xml
|
||||||
</param-value>
|
</param-value>
|
||||||
</context-param>
|
</context-param>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue