Search in sources :

Example 6 with MutableBundleManifest

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());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) MutableBundleManifest(org.eclipse.tycho.versions.bundle.MutableBundleManifest) MutablePomFileTest(org.eclipse.tycho.versions.pom.tests.MutablePomFileTest) Test(org.junit.Test)

Example 7 with MutableBundleManifest

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);
}
Also used : MutableBundleManifest(org.eclipse.tycho.versions.bundle.MutableBundleManifest)

Example 8 with MutableBundleManifest

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());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) MutableBundleManifest(org.eclipse.tycho.versions.bundle.MutableBundleManifest) MutablePomFileTest(org.eclipse.tycho.versions.pom.tests.MutablePomFileTest) Test(org.junit.Test)

Example 9 with MutableBundleManifest

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());
}
Also used : HashMap(java.util.HashMap) MutableBundleManifest(org.eclipse.tycho.versions.bundle.MutableBundleManifest) MutablePomFileTest(org.eclipse.tycho.versions.pom.tests.MutablePomFileTest) Test(org.junit.Test)

Example 10 with MutableBundleManifest

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());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) MutableBundleManifest(org.eclipse.tycho.versions.bundle.MutableBundleManifest) MutablePomFileTest(org.eclipse.tycho.versions.pom.tests.MutablePomFileTest) Test(org.junit.Test)

Aggregations

MutableBundleManifest (org.eclipse.tycho.versions.bundle.MutableBundleManifest)19 MutablePomFileTest (org.eclipse.tycho.versions.pom.tests.MutablePomFileTest)11 Test (org.junit.Test)11 HashMap (java.util.HashMap)8 PackageVersionChange (org.eclipse.tycho.versions.engine.PackageVersionChange)5 PomVersionChange (org.eclipse.tycho.versions.engine.PomVersionChange)5 ByteArrayInputStream (java.io.ByteArrayInputStream)4 InputStream (java.io.InputStream)4 VersionChange (org.eclipse.tycho.versions.engine.VersionChange)4 File (java.io.File)1 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 ManifestAttribute (org.eclipse.tycho.versions.bundle.ManifestAttribute)1