use of aQute.maven.provider.MetadataParser.RevisionMetadata in project bnd by bndtools.
the class MavenBackingRepository method getMetadata.
RevisionMetadata getMetadata(Revision revision) throws Exception {
File metafile = IO.getFile(local, revision.metadata(id));
RevisionMetadata metadata = revisions.get(revision);
TaggedData tag = fetch(revision.metadata(), metafile);
if (tag.getState() == State.NOT_FOUND || tag.getState() == State.OTHER) {
if (metadata == null) {
metadata = new RevisionMetadata();
revisions.put(revision, metadata);
}
return metadata;
}
if (metadata == null || tag.getState() == State.UPDATED) {
metadata = MetadataParser.parseRevisionMetadata(metafile);
revisions.put(revision, metadata);
}
return metadata;
}
use of aQute.maven.provider.MetadataParser.RevisionMetadata in project bnd by bndtools.
the class MavenBackingRepository method getSnapshotArchives.
public List<Archive> getSnapshotArchives(Revision revision) throws Exception {
RevisionMetadata metadata = getMetadata(revision);
List<Archive> archives = new ArrayList<>();
for (SnapshotVersion snapshotVersion : metadata.snapshotVersions) {
Archive archive = revision.archive(snapshotVersion.value, snapshotVersion.extension, snapshotVersion.classifier);
archives.add(archive);
}
return archives;
}
use of aQute.maven.provider.MetadataParser.RevisionMetadata in project bnd by bndtools.
the class MetadataTest method testSnapshotParsing.
public void testSnapshotParsing() throws Exception {
try (InputStream in = new FileInputStream(IO.getFile("testresources/parser/commons-dbcp-1.4.1-SNAPSHOT.xml"))) {
RevisionMetadata parse = MetadataParser.parseRevisionMetadata(in);
assertNotNull(parse);
assertEquals("commons.dbcp", parse.group);
assertEquals("commons-dbcp", parse.artifact);
assertEquals(MavenVersion.parseString("1.4.1-SNAPSHOT"), parse.version);
assertNotNull(parse.snapshot);
assertEquals("13", parse.snapshot.buildNumber);
assertEquals("20140107.141700", parse.snapshot.timestamp);
assertEquals(10, parse.snapshotVersions.size());
SnapshotVersion snapshotVersion = parse.snapshotVersions.get(0);
assertNotNull(snapshotVersion);
assertEquals("bin", snapshotVersion.classifier);
assertEquals("tar.gz", snapshotVersion.extension);
assertEquals(MavenVersion.parseString("1.4.1-20140107.141700-13"), snapshotVersion.value);
assertEquals(1389104220000L, snapshotVersion.updated);
snapshotVersion = parse.snapshotVersions.get(9);
assertNotNull(snapshotVersion);
assertNull(snapshotVersion.classifier);
assertEquals("pom", snapshotVersion.extension);
assertEquals(MavenVersion.parseString("1.4.1-20140107.141700-13"), snapshotVersion.value);
assertEquals(1389104220000L, snapshotVersion.updated);
}
}
Aggregations