use of org.eclipse.equinox.p2.metadata.ITouchpointData in project tycho by eclipse.
the class P2GeneratorImplTest method testGenerateSourceBundleMetadata.
@Test
public void testGenerateSourceBundleMetadata() throws Exception {
DependencyMetadataGenerator p2GeneratorImpl = new SourcesBundleDependencyMetadataGenerator();
File location = new File("resources/generator/bundle").getCanonicalFile();
ArtifactMock artifactMock = new ArtifactMock(location, "org.acme", "foo", "0.0.1", "eclipse-plugin");
Set<Object> units = p2GeneratorImpl.generateMetadata(artifactMock, getEnvironments(), null).getMetadata();
assertEquals(1, units.size());
IInstallableUnit sourceBundleUnit = getUnit("foo.source", units);
assertNotNull(sourceBundleUnit);
assertEquals(Version.create("0.0.1"), sourceBundleUnit.getVersion());
assertThat(sourceBundleUnit, hasGAV("org.acme", "foo", "0.0.1", "sources"));
ITouchpointData touchPointData = sourceBundleUnit.getTouchpointData().iterator().next();
String manifestContent = touchPointData.getInstruction("manifest").getBody();
Manifest manifest = new Manifest(new ByteArrayInputStream(manifestContent.getBytes("UTF-8")));
Attributes attributes = manifest.getMainAttributes();
assertEquals("foo.source", attributes.getValue("Bundle-SymbolicName"));
// assertEquals("foo;version=0.0.1;roots:=\".\"", attributes.getValue("Eclipse-SourceBundle"));
}
Aggregations