use of org.apache.archiva.model.ArchivaRepositoryMetadata in project archiva by apache.
the class RepositoryMetadataWriterTest method testWriteSimple.
@Test
public void testWriteSimple() throws Exception {
Path defaultRepoDir = Paths.get("src/test/repositories/default-repository");
Path expectedFile = defaultRepoDir.resolve("org/apache/maven/shared/maven-downloader/maven-metadata.xml");
String expectedContent = org.apache.archiva.common.utils.FileUtils.readFileToString(expectedFile, Charset.defaultCharset());
ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();
metadata.setGroupId("org.apache.maven.shared");
metadata.setArtifactId("maven-downloader");
metadata.setVersion("1.0");
metadata.setReleasedVersion("1.1");
metadata.getAvailableVersions().add("1.0");
metadata.getAvailableVersions().add("1.1");
metadata.setLastUpdated("20061212214311");
StringWriter actual = new StringWriter();
RepositoryMetadataWriter.write(metadata, actual);
XMLAssert.assertXMLEqual("XML Contents", expectedContent, actual.toString());
}
use of org.apache.archiva.model.ArchivaRepositoryMetadata in project archiva by apache.
the class MavenRepositoryMetadataReaderTest method testProjectVersionMetadata.
@Test
public void testProjectVersionMetadata() throws XMLException {
Path metadataFile = defaultRepoDir.resolve("org/apache/apache/5-SNAPSHOT/maven-metadata.xml");
ArchivaRepositoryMetadata metadata = MavenMetadataReader.read(metadataFile);
assertNotNull(metadata);
assertEquals("org.apache", metadata.getGroupId());
assertEquals("apache", metadata.getArtifactId());
assertNull(metadata.getReleasedVersion());
assertNull(metadata.getLatestVersion());
assertTrue(metadata.getAvailableVersions().isEmpty());
assertNotNull(metadata.getSnapshotVersion());
assertEquals("20080801.151215", metadata.getSnapshotVersion().getTimestamp());
assertEquals(1, metadata.getSnapshotVersion().getBuildNumber());
assertEquals("20080801151215", metadata.getLastUpdated());
}
Aggregations