aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-01-06 05:31:33 +0000
committerOlivier Lamy <olamy@apache.org>2014-01-06 05:31:33 +0000
commit3bef8aec700a2f1bf6a572f2b68bc74762f2d191 (patch)
tree326995255cbde13ce207fbb0889d6a23aaf03c55 /archiva-modules/archiva-web
parentf9e71786089bf6f346c44ceeff688376ade4606a (diff)
downloadarchiva-3bef8aec700a2f1bf6a572f2b68bc74762f2d191.tar.gz
archiva-3bef8aec700a2f1bf6a572f2b68bc74762f2d191.zip
fix unit test
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1555671 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-web')
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java16
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java2
2 files changed, 12 insertions, 6 deletions
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
index 8767cacce..0da0394af 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
@@ -20,8 +20,10 @@ package org.apache.archiva.webdav;
*/
+import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
+import com.google.common.io.Files;
import org.apache.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.archiva.policies.CachedFailuresPolicy;
@@ -34,9 +36,11 @@ import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
+import org.fest.assertions.api.Assertions;
import org.junit.After;
import org.junit.Before;
+import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.nio.charset.Charset;
@@ -117,7 +121,7 @@ public abstract class AbstractRepositoryServletProxiedTestCase
RemoteRepoInfo repo = new RemoteRepoInfo();
repo.id = id;
repo.context = "/" + id;
- repo.root = new File( "target/remote-repos/" + id + "/" );
+ repo.root = Files.createTempDir();// new File( System.getProperty( "basedir" ) + "target/remote-repos/" + id + "/" );
// Remove exising root contents.
if ( repo.root.exists() )
@@ -160,10 +164,11 @@ public abstract class AbstractRepositoryServletProxiedTestCase
protected void assertServerSetupCorrectly( RemoteRepoInfo remoteRepo )
throws Exception
{
- //WebConversation wc = new WebConversation();
- WebRequest request = new GetMethodWebRequest( remoteRepo.url );
- WebResponse response = getServletUnitClient().getResponse( request );
- assertResponseOK( response );
+
+ WebClient client = newClient();
+ int status = client.getPage( remoteRepo.url ).getWebResponse().getStatusCode();
+ Assertions.assertThat( status ).isEqualTo( HttpServletResponse.SC_OK );
+
}
private void setupConnector( String repoId, RemoteRepoInfo remoteRepo, String releasesPolicy,
@@ -255,6 +260,7 @@ public abstract class AbstractRepositoryServletProxiedTestCase
{
remoteSnapshots = createServer( "snapshots" );
+
assertServerSetupCorrectly( remoteSnapshots );
RemoteRepositoryConfiguration remoteRepositoryConfiguration =
archivaConfiguration.getConfiguration().getRemoteRepositoriesAsMap().get( remoteSnapshots.id );
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java
index 7e7a78396..5197688d3 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletProxiedTimestampedSnapshotPolicyTest.java
@@ -43,8 +43,8 @@ public class RepositoryServletProxiedTimestampedSnapshotPolicyTest
public void setup()
throws Exception
{
- archivaConfiguration.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>() );
super.setUp();
+ archivaConfiguration.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>() );
}
@After