use of com.gargoylesoftware.htmlunit.WebRequest in project archiva by apache.
the class RepositoryServletNoProxyTest method testGetNoProxyProjectMetadataDefaultLayoutManagedLegacy.
@Test
public void testGetNoProxyProjectMetadataDefaultLayoutManagedLegacy() throws Exception {
// TODO: find out what it is meant to be from maven-artifact
String commonsLangMetadata = "commons-lang/commons-lang/maven-metadata.xml";
String expectedMetadataContents = "dummy-project-metadata";
Path metadataFile = repoRootLegacy.resolve(commonsLangMetadata);
Files.createDirectories(metadataFile.getParent());
org.apache.archiva.common.utils.FileUtils.writeStringToFile(metadataFile, Charset.defaultCharset(), expectedMetadataContents);
WebRequest request = new GetMethodWebRequest("http://machine.com/repository/legacy/" + commonsLangMetadata);
WebResponse response = getServletUnitClient().getResponse(request);
assertResponseNotFound(response);
}
use of com.gargoylesoftware.htmlunit.WebRequest in project archiva by apache.
the class RepositoryServletNoProxyTest method testGetNoProxySnapshotArtifactLegacyLayoutManagedLegacy.
@Test
public void testGetNoProxySnapshotArtifactLegacyLayoutManagedLegacy() throws Exception {
String commonsLangJar = "commons-lang/jars/commons-lang-2.1-SNAPSHOT.jar";
String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
Path artifactFile = repoRootLegacy.resolve(commonsLangJar);
Files.createDirectories(artifactFile.getParent());
org.apache.archiva.common.utils.FileUtils.writeStringToFile(artifactFile, Charset.defaultCharset(), expectedArtifactContents);
WebRequest request = new GetMethodWebRequest("http://machine.com/repository/legacy/" + commonsLangJar);
WebResponse response = getServletUnitClient().getResponse(request);
assertResponseNotFound(response);
}
use of com.gargoylesoftware.htmlunit.WebRequest in project archiva by apache.
the class RepositoryServletNoProxyTest method testGetNoProxyArtifactLegacyLayoutManagedLegacy.
@Test
public void testGetNoProxyArtifactLegacyLayoutManagedLegacy() throws Exception {
String commonsLangJar = "commons-lang/jars/commons-lang-2.1.jar";
String expectedArtifactContents = "dummy-commons-lang-artifact";
Path artifactFile = repoRootLegacy.resolve(commonsLangJar);
Files.createDirectories(artifactFile.getParent());
org.apache.archiva.common.utils.FileUtils.writeStringToFile(artifactFile, Charset.defaultCharset(), expectedArtifactContents);
WebRequest request = new GetMethodWebRequest("http://machine.com/repository/legacy/" + commonsLangJar);
WebResponse response = getServletUnitClient().getResponse(request);
assertResponseNotFound(response);
}
use of com.gargoylesoftware.htmlunit.WebRequest in project archiva by apache.
the class RepositoryServletNoProxyTest method testGetNoProxyChecksumLegacyLayoutManagedLegacy.
@Test
public void testGetNoProxyChecksumLegacyLayoutManagedLegacy() throws Exception {
String commonsLangSha1 = "commons-lang/jars/commons-lang-2.1.jar.sha1";
Path checksumFile = repoRootLegacy.resolve(commonsLangSha1);
Files.createDirectories(checksumFile.getParent());
org.apache.archiva.common.utils.FileUtils.writeStringToFile(checksumFile, Charset.defaultCharset(), "dummy-checksum");
WebRequest request = new GetMethodWebRequest("http://machine.com/repository/legacy/" + commonsLangSha1);
WebResponse response = getServletUnitClient().getResponse(request);
assertResponseNotFound(response);
}
use of com.gargoylesoftware.htmlunit.WebRequest in project archiva by apache.
the class RepositoryServletNoProxyTest method testGetNoProxySnapshotRedirectToTimestampedSnapshot.
@Test
public void testGetNoProxySnapshotRedirectToTimestampedSnapshot() throws Exception {
String commonsLangQuery = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-SNAPSHOT.jar";
String commonsLangMetadata = "commons-lang/commons-lang/2.1-SNAPSHOT/maven-metadata.xml";
String commonsLangJar = "commons-lang/commons-lang/2.1-SNAPSHOT/commons-lang-2.1-20050821.023400-1.jar";
String expectedArtifactContents = "dummy-commons-lang-snapshot-artifact";
archivaConfiguration.getConfiguration().getWebapp().getUi().setApplicationUrl("http://localhost");
Path artifactFile = repoRootInternal.resolve(commonsLangJar);
Files.createDirectories(artifactFile.getParent());
org.apache.archiva.common.utils.FileUtils.writeStringToFile(artifactFile, Charset.defaultCharset(), expectedArtifactContents);
Path metadataFile = repoRootInternal.resolve(commonsLangMetadata);
Files.createDirectories(metadataFile.getParent());
org.apache.archiva.common.utils.FileUtils.writeStringToFile(metadataFile, Charset.defaultCharset(), createVersionMetadata("commons-lang", "commons-lang", "2.1-SNAPSHOT", "20050821.023400", "1", "20050821.023400"));
WebRequest webRequest = new GetMethodWebRequest("http://localhost/repository/internal/" + commonsLangQuery);
MockHttpServletRequest request = new MockHttpServletRequest();
request.setRequestURI(webRequest.getUrl().getPath());
request.addHeader("User-Agent", "Apache Archiva unit test");
request.setMethod(webRequest.getHttpMethod().name());
final MockHttpServletResponse response = execute(request);
assertEquals(HttpServletResponse.SC_MOVED_TEMPORARILY, response.getStatus());
assertEquals("http://localhost/repository/internal/" + commonsLangJar, response.getHeader("Location"));
}
Aggregations