use of org.apache.archiva.model.ProjectReference in project archiva by apache.
the class MetadataTransferTest method assertGroupMetadataContents.
private void assertGroupMetadataContents(String requestedResource, String[] expectedPlugins) throws Exception {
Path actualFile = managedDefaultDir.resolve(requestedResource);
assertTrue("Snapshot Metadata should exist: " + requestedResource, Files.exists(actualFile));
ProjectReference actualMetadata = createGroupReference(requestedResource);
assertGroupMetadata(actualFile, actualMetadata, expectedPlugins);
}
use of org.apache.archiva.model.ProjectReference in project archiva by apache.
the class MetadataTransferTest method assertFetchProjectOrGroupFailed.
/**
* Transfer the metadata file, not expected to succeed.
*
* @param requestedResource the requested resource
* @throws Exception
*/
private void assertFetchProjectOrGroupFailed(String requestedResource) throws Exception {
Path expectedFile = managedDefaultDir.resolve(requestedResource);
ProjectReference metadata = createProjectReference(requestedResource);
Path downloadedFile = proxyHandler.fetchMetadataFromProxies(managedDefaultRepository, managedDefaultRepository.toMetadataPath(metadata)).getFile();
assertNull(downloadedFile);
assertNoTempFiles(expectedFile);
}
use of org.apache.archiva.model.ProjectReference in project archiva by apache.
the class MetadataTransferTest method createGroupReference.
private ProjectReference createGroupReference(String requestedResource) throws RepositoryMetadataException {
ProjectReference projectReference = createProjectReference(requestedResource);
projectReference.setGroupId(projectReference.getGroupId() + "." + projectReference.getArtifactId());
projectReference.setArtifactId(null);
return projectReference;
}
use of org.apache.archiva.model.ProjectReference in project archiva by apache.
the class MetadataTransferTest method assertProjectMetadataContents.
/**
* Test for the existance of the requestedResource in the default managed repository, and if it exists,
* does it contain the specified list of expected versions?
*
* @param requestedResource the requested resource
* @throws Exception
*/
private void assertProjectMetadataContents(String requestedResource, String[] expectedVersions, String latestVersion, String releaseVersion) throws Exception {
Path actualFile = managedDefaultDir.resolve(requestedResource);
assertTrue(Files.exists(actualFile));
ProjectReference metadata = createProjectReference(requestedResource);
// Build expected metadata XML
StringWriter expectedMetadataXml = new StringWriter();
ArchivaRepositoryMetadata m = new ArchivaRepositoryMetadata();
m.setGroupId(metadata.getGroupId());
m.setArtifactId(metadata.getArtifactId());
m.setLatestVersion(latestVersion);
m.setReleasedVersion(releaseVersion);
if (expectedVersions != null) {
m.getAvailableVersions().addAll(Arrays.asList(expectedVersions));
}
RepositoryMetadataWriter.write(m, expectedMetadataXml);
// Compare the file to the actual contents.
assertMetadataEquals(expectedMetadataXml.toString(), actualFile);
}
use of org.apache.archiva.model.ProjectReference in project archiva by apache.
the class MetadataTransferTest method assertFetchProjectOrGroup.
/**
* Transfer the metadata file.
*
* @param requestedResource the requested resource
* @throws Exception
*/
private void assertFetchProjectOrGroup(String requestedResource) throws Exception {
Path expectedFile = managedDefaultDir.resolve(requestedResource);
ProjectReference metadata = createProjectReference(requestedResource);
Path downloadedFile = proxyHandler.fetchMetadataFromProxies(managedDefaultRepository, managedDefaultRepository.toMetadataPath(metadata)).getFile();
assertNotNull("Should have downloaded a file.", downloadedFile);
assertNoTempFiles(expectedFile);
}
Aggregations