use of org.eclipse.tycho.versions.bundle.MutableBundleManifest in project tycho by eclipse.
the class MutableBundleManifestTest method shouldRoundtripWithoutLineEnding.
@Test
public void shouldRoundtripWithoutLineEnding() throws Exception {
// given
String manifestStr = "Bundle-SymbolicName: name";
// when
InputStream manifestIs = new ByteArrayInputStream(manifestStr.getBytes("ascii"));
MutableBundleManifest manifest = MutableBundleManifest.read(manifestIs);
String written = toAsciiString(manifest);
// then
Assert.assertEquals(manifestStr, written);
Assert.assertEquals("name", manifest.getSymbolicName());
}
use of org.eclipse.tycho.versions.bundle.MutableBundleManifest in project tycho by eclipse.
the class MutableBundleManifestTest method assertRoundtrip.
private void assertRoundtrip(String path) throws IOException {
MutableBundleManifest mf = getManifest(path);
assertContents(mf, path);
}
use of org.eclipse.tycho.versions.bundle.MutableBundleManifest in project tycho by eclipse.
the class MutableBundleManifestTest method shouldPreserveUnixLineEndings.
@Test
public void shouldPreserveUnixLineEndings() throws Exception {
// given
String manifestStr = "Bundle-SymbolicName: name\nBundle-Version: version\n\nUnparsed1\nUnparsed2\n";
// when
InputStream manifestIs = new ByteArrayInputStream(manifestStr.getBytes("ascii"));
MutableBundleManifest manifest = MutableBundleManifest.read(manifestIs);
String written = toAsciiString(manifest);
// then
Assert.assertEquals(manifestStr, written);
Assert.assertEquals("name", manifest.getSymbolicName());
Assert.assertEquals("version", manifest.getVersion());
}
use of org.eclipse.tycho.versions.bundle.MutableBundleManifest in project tycho by eclipse.
the class MutableBundleManifestTest method getters.
@Test
public void getters() throws IOException {
MutableBundleManifest mf = getManifest("/manifests/getters.mf");
Assert.assertEquals("1.0.0.qualifier", mf.getVersion());
Assert.assertEquals("TYCHO0214versionChange.bundle01", mf.getSymbolicName());
Assert.assertEquals("host-bundle", mf.getFragmentHostSymbolicName());
Assert.assertEquals("1.0.0.qualifier", mf.getFragmentHostVersion());
Map<String, String> expectedRequiredBundleVersion = new HashMap<>();
expectedRequiredBundleVersion.put("bundle1", "1.0.0");
expectedRequiredBundleVersion.put("bundle2", "1.1.0");
expectedRequiredBundleVersion.put("bundle3", null);
Assert.assertEquals(expectedRequiredBundleVersion, mf.getRequiredBundleVersions());
Map<String, String> expectedImportPackage = new HashMap<>();
expectedImportPackage.put("com.package1", null);
expectedImportPackage.put("com.package2", "2.6.0");
Assert.assertEquals(expectedImportPackage, mf.getImportPackagesVersions());
}
use of org.eclipse.tycho.versions.bundle.MutableBundleManifest in project tycho by eclipse.
the class MutableBundleManifestTest method shouldPreserveOldMacLineEndings.
@Test
public void shouldPreserveOldMacLineEndings() throws Exception {
// given
String manifestStr = "Bundle-SymbolicName: name\rBundle-Version: version\r\rUnparsed1\rUnparsed2\r";
// when
InputStream manifestIs = new ByteArrayInputStream(manifestStr.getBytes("ascii"));
MutableBundleManifest manifest = MutableBundleManifest.read(manifestIs);
String written = toAsciiString(manifest);
// then
Assert.assertEquals(manifestStr, written);
Assert.assertEquals("name", manifest.getSymbolicName());
Assert.assertEquals("version", manifest.getVersion());
}
Aggregations