*/
+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;
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;
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() )
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,
{
remoteSnapshots = createServer( "snapshots" );
+
assertServerSetupCorrectly( remoteSnapshots );
RemoteRepositoryConfiguration remoteRepositoryConfiguration =
archivaConfiguration.getConfiguration().getRemoteRepositoriesAsMap().get( remoteSnapshots.id );