use of com.gargoylesoftware.htmlunit.WebRequest in project archiva by apache.
the class RepositoryServletDeployTest method testPutWithMissingParentCollection.
@Test
public void testPutWithMissingParentCollection() throws Exception {
setupCleanRepo(repoRootInternal);
String putUrl = "http://machine.com/repository/internal" + ARTIFACT_DEFAULT_LAYOUT;
InputStream is = getClass().getResourceAsStream("/artifact.jar");
// verify that the file exists in resources-dir
assertNotNull("artifact.jar inputstream", is);
WebRequest request = new PutMethodWebRequest(putUrl, is, "application/octet-stream");
WebResponse response = getServletUnitClient().getResponse(request);
assertResponseCreated(response);
assertFileContents("artifact.jar\n", repoRootInternal, ARTIFACT_DEFAULT_LAYOUT);
}
use of com.gargoylesoftware.htmlunit.WebRequest in project archiva by apache.
the class RepositoryServletNoProxyMetadataTest method testGetGroupMetadataDefaultLayout.
@Test
public void testGetGroupMetadataDefaultLayout() throws Exception {
String commonsLangMetadata = "commons-lang/maven-metadata.xml";
String expectedMetadataContents = "metadata-for-commons-lang-group";
Path checksumFile = repoRootInternal.resolve(commonsLangMetadata);
Files.createDirectories(checksumFile.getParent());
org.apache.archiva.common.utils.FileUtils.writeStringToFile(checksumFile, Charset.defaultCharset(), expectedMetadataContents);
WebRequest request = new GetMethodWebRequest("http://machine.com/repository/internal/" + commonsLangMetadata);
WebResponse response = getServletUnitClient().getResponse(request);
assertResponseOK(response);
assertEquals("Expected file contents", expectedMetadataContents, response.getContentAsString());
}
use of com.gargoylesoftware.htmlunit.WebRequest in project archiva by apache.
the class RepositoryServletNoProxyMetadataTest method testGetProjectMetadataDefaultLayout.
@Test
public void testGetProjectMetadataDefaultLayout() throws Exception {
String commonsLangMetadata = "commons-lang/commons-lang/maven-metadata.xml";
String expectedMetadataContents = "metadata-for-commons-lang-version-for-project";
Path checksumFile = repoRootInternal.resolve(commonsLangMetadata);
Files.createDirectories(checksumFile.getParent());
org.apache.archiva.common.utils.FileUtils.writeStringToFile(checksumFile, Charset.defaultCharset(), expectedMetadataContents);
WebRequest request = new GetMethodWebRequest("http://machine.com/repository/internal/" + commonsLangMetadata);
WebResponse response = getServletUnitClient().getResponse(request);
assertResponseOK(response);
assertEquals("Expected file contents", expectedMetadataContents, response.getContentAsString());
}
use of com.gargoylesoftware.htmlunit.WebRequest in project archiva by apache.
the class RepositoryServletNoProxyTest method testGetNoProxyVersionedMetadataDefaultLayoutManagedLegacy.
@Test
public void testGetNoProxyVersionedMetadataDefaultLayoutManagedLegacy() throws Exception {
String commonsLangMetadata = "commons-lang/commons-lang/2.1/maven-metadata.xml";
String expectedMetadataContents = "dummy-versioned-metadata";
// TODO: find out what this should be from maven-artifact
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 testGetNoProxyGroupMetadataDefaultLayoutManagedLegacy.
@Test
public void testGetNoProxyGroupMetadataDefaultLayoutManagedLegacy() throws Exception {
String commonsLangMetadata = "commons-lang/maven-metadata.xml";
String expectedMetadataContents = "dummy-group-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);
}
Aggregations