Search in sources :

Example 11 with MutableBundleManifest

use of org.eclipse.tycho.versions.bundle.MutableBundleManifest in project tycho by eclipse.

the class MutableBundleManifestTest method addAttribute.

@Test
public void addAttribute() throws Exception {
    MutableBundleManifest mf = getManifest("/manifests/addheader.mf");
    mf.add(new ManifestAttribute("header", "value"));
    assertContents(mf, "/manifests/addheader.mf_expected");
}
Also used : MutableBundleManifest(org.eclipse.tycho.versions.bundle.MutableBundleManifest) ManifestAttribute(org.eclipse.tycho.versions.bundle.ManifestAttribute) MutablePomFileTest(org.eclipse.tycho.versions.pom.tests.MutablePomFileTest) Test(org.junit.Test)

Example 12 with MutableBundleManifest

use of org.eclipse.tycho.versions.bundle.MutableBundleManifest in project tycho by eclipse.

the class MutableBundleManifestTest method updateExportedPackageVersions.

@Test
public void updateExportedPackageVersions() throws IOException {
    MutableBundleManifest mf = getManifest("/manifests/updateExportedPackageVersions.mf");
    Map<String, String> importPackageVersionChanges = new HashMap<>();
    importPackageVersionChanges.put("com.package1", "1.0.1");
    importPackageVersionChanges.put("com.package2", "1.1.0");
    mf.updateExportedPackageVersions(importPackageVersionChanges);
    assertContents(mf, "/manifests/updateExportedPackageVersions.mf_expected");
}
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 13 with MutableBundleManifest

use of org.eclipse.tycho.versions.bundle.MutableBundleManifest in project tycho by eclipse.

the class MutableBundleManifestTest method updateExportedPackageVersionsDoesNotReformatIfNotNecessary.

@Test
public void updateExportedPackageVersionsDoesNotReformatIfNotNecessary() throws Exception {
    MutableBundleManifest mf = getManifest("/manifests/updateExportedPackageVersions.mf");
    // change nothing: the specified versions are already the version presents in the manifest
    Map<String, String> importPackageVersionChanges = new HashMap<>();
    importPackageVersionChanges.put("com.package1", "1.0.0");
    importPackageVersionChanges.put("com.package2", "1.0.0");
    // expect that nothing is changed (that is the formatting remains intact)
    assertContents(mf, "/manifests/updateExportedPackageVersions.mf");
}
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 14 with MutableBundleManifest

use of org.eclipse.tycho.versions.bundle.MutableBundleManifest in project tycho by eclipse.

the class MutableBundleManifestTest method shouldPreserveWindowsLineEndings.

@Test
public void shouldPreserveWindowsLineEndings() throws Exception {
    // given
    String manifestStr = "Bundle-SymbolicName: name\r\nBundle-Version: version\r\n\r\nUnparsed1\r\nUnparsed2\r\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 15 with MutableBundleManifest

use of org.eclipse.tycho.versions.bundle.MutableBundleManifest in project tycho by eclipse.

the class MutableBundleManifestTest method setFragmentHostVersion.

@Test
public void setFragmentHostVersion() throws IOException {
    MutableBundleManifest mf = getManifest("/manifests/setFragmentHostVersion.mf");
    mf.setFragmentHostVersion("1.0.1");
    assertContents(mf, "/manifests/setFragmentHostVersion.mf_expected");
}
Also used : 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