use of aQute.maven.provider.MetadataParser.ProgramMetadata in project bnd by bndtools.
the class MavenBackingRepository method getMetadata.
ProgramMetadata getMetadata(Program program) throws Exception {
File metafile = IO.getFile(local, program.metadata(id));
ProgramMetadata metadata = programs.get(program);
TaggedData tag = fetch(program.metadata(), metafile);
switch(tag.getState()) {
case NOT_FOUND:
return null;
case OTHER:
throw new IOException("Failed " + tag.getResponseCode());
case UNMODIFIED:
if (metadata != null)
return metadata;
case UPDATED:
default:
metadata = MetadataParser.parseProgramMetadata(metafile);
programs.put(program, metadata);
return metadata;
}
}
use of aQute.maven.provider.MetadataParser.ProgramMetadata in project bnd by bndtools.
the class MetadataTest method testProgramParsing.
public void testProgramParsing() throws Exception {
try (InputStream in = new FileInputStream(IO.getFile("testresources/parser/commons-dbcp.xml"))) {
ProgramMetadata parse = MetadataParser.parseProgramMetadata(in);
assertNotNull(parse);
assertEquals("commons.dbcp", parse.group);
assertEquals("commons-dbcp", parse.artifact);
assertEquals(2, parse.versions.size());
assertTrue(parse.versions.contains(new MavenVersion("1.4.1-SNAPSHOT")));
assertTrue(parse.versions.contains(new MavenVersion("1.5-SNAPSHOT")));
}
}
Aggregations