Search in sources :

Example 1 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class BaselineTest method testBundleVersionBumpDifferentSymbolicNames.

// Adding a method to a ProviderType produces a MINOR bump (1.0.0 -> 1.1.0)
public void testBundleVersionBumpDifferentSymbolicNames() throws Exception {
    Processor processor = new Processor();
    DiffPluginImpl differ = new DiffPluginImpl();
    Baseline baseline = new Baseline(processor, differ);
    try (Jar older = new Jar(IO.getFile("testresources/api-orig.jar"));
        Jar newer = new Jar(IO.getFile("testresources/api-providerbump.jar"))) {
        newer.getManifest().getMainAttributes().putValue(BUNDLE_SYMBOLICNAME, "a.different.name");
        baseline.baseline(newer, older, null);
        BundleInfo bundleInfo = baseline.getBundleInfo();
        assertFalse(bundleInfo.mismatch);
        assertEquals(newer.getVersion(), bundleInfo.suggestedVersion.toString());
    }
}
Also used : DiffPluginImpl(aQute.bnd.differ.DiffPluginImpl) Processor(aQute.bnd.osgi.Processor) BundleInfo(aQute.bnd.differ.Baseline.BundleInfo) Jar(aQute.bnd.osgi.Jar) Baseline(aQute.bnd.differ.Baseline)

Example 2 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class BaselineTest method testMinorAndRemovedChange.

// Adding a method to an exported class and unexporting a package produces a MINOR bump (1.0.0 -> 1.1.0)
public void testMinorAndRemovedChange() throws Exception {
    Processor processor = new Processor();
    DiffPluginImpl differ = new DiffPluginImpl();
    Baseline baseline = new Baseline(processor, differ);
    try (Jar older = new Jar(IO.getFile("testresources/minor-and-removed-change-1.0.0.jar"));
        Jar newer = new Jar(IO.getFile("testresources/minor-and-removed-change-1.0.1.jar"))) {
        baseline.baseline(newer, older, null);
        BundleInfo bundleInfo = baseline.getBundleInfo();
        assertTrue(bundleInfo.mismatch);
        assertEquals("2.0.0", bundleInfo.suggestedVersion.toString());
    }
}
Also used : DiffPluginImpl(aQute.bnd.differ.DiffPluginImpl) Processor(aQute.bnd.osgi.Processor) BundleInfo(aQute.bnd.differ.Baseline.BundleInfo) Jar(aQute.bnd.osgi.Jar) Baseline(aQute.bnd.differ.Baseline)

Example 3 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class BaselineTest method testProviderTypeBump.

// Adding a method to a ProviderType produces a MINOR bump (1.0.0 -> 1.1.0)
public void testProviderTypeBump() throws Exception {
    Processor processor = new Processor();
    DiffPluginImpl differ = new DiffPluginImpl();
    Baseline baseline = new Baseline(processor, differ);
    try (Jar older = new Jar(IO.getFile("testresources/api-orig.jar"));
        Jar newer = new Jar(IO.getFile("testresources/api-providerbump.jar"))) {
        Set<Info> infoSet = baseline.baseline(newer, older, null);
        System.out.println(differ.tree(newer).get("<api>"));
        assertEquals(1, infoSet.size());
        Info info = infoSet.iterator().next();
        assertTrue(info.mismatch);
        assertEquals("dummy.api", info.packageName);
        assertEquals("1.1.0", info.suggestedVersion.toString());
    }
}
Also used : DiffPluginImpl(aQute.bnd.differ.DiffPluginImpl) Processor(aQute.bnd.osgi.Processor) Jar(aQute.bnd.osgi.Jar) Baseline(aQute.bnd.differ.Baseline) BundleInfo(aQute.bnd.differ.Baseline.BundleInfo) Info(aQute.bnd.differ.Baseline.Info)

Example 4 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class BaselineTest method testMovePackageToBundleClassPath.

// Moving a package from the root into a jar on the Bundle-ClassPath
// should not result in DELETED
public void testMovePackageToBundleClassPath() throws Exception {
    Processor processor = new Processor();
    DiffPluginImpl differ = new DiffPluginImpl();
    Baseline baseline = new Baseline(processor, differ);
    try (Jar older = new Jar(IO.getFile("jar/baseline/com.liferay.calendar.api-2.0.5.jar"));
        Jar newer = new Jar(IO.getFile("jar/baseline/com.liferay.calendar.api-2.1.0.jar"))) {
        baseline.baseline(newer, older, null);
        BundleInfo bundleInfo = baseline.getBundleInfo();
        assertFalse(bundleInfo.mismatch);
        assertEquals("2.1.0", bundleInfo.suggestedVersion.toString());
        Set<Info> packageInfos = baseline.getPackageInfos();
        assertEquals(12, packageInfos.size());
        Info change = packageInfos.iterator().next();
        assertFalse(change.mismatch);
        assertEquals("com.google.ical.iter", change.packageName);
        assertEquals("20110304.0.0", change.suggestedVersion.toString());
    }
}
Also used : DiffPluginImpl(aQute.bnd.differ.DiffPluginImpl) Processor(aQute.bnd.osgi.Processor) BundleInfo(aQute.bnd.differ.Baseline.BundleInfo) Jar(aQute.bnd.osgi.Jar) Baseline(aQute.bnd.differ.Baseline) BundleInfo(aQute.bnd.differ.Baseline.BundleInfo) Info(aQute.bnd.differ.Baseline.Info)

Example 5 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class BaselineTest method testBundleVersionBump.

// Adding a method to a ProviderType produces a MINOR bump (1.0.0 -> 1.1.0)
public void testBundleVersionBump() throws Exception {
    Processor processor = new Processor();
    DiffPluginImpl differ = new DiffPluginImpl();
    Baseline baseline = new Baseline(processor, differ);
    try (Jar older = new Jar(IO.getFile("testresources/api-orig.jar"));
        Jar newer = new Jar(IO.getFile("testresources/api-providerbump.jar"))) {
        baseline.baseline(newer, older, null);
        BundleInfo bundleInfo = baseline.getBundleInfo();
        assertTrue(bundleInfo.mismatch);
        assertEquals("1.1.0", bundleInfo.suggestedVersion.toString());
    }
}
Also used : DiffPluginImpl(aQute.bnd.differ.DiffPluginImpl) Processor(aQute.bnd.osgi.Processor) BundleInfo(aQute.bnd.differ.Baseline.BundleInfo) Jar(aQute.bnd.osgi.Jar) Baseline(aQute.bnd.differ.Baseline)

Aggregations

Processor (aQute.bnd.osgi.Processor)185 HashMap (java.util.HashMap)43 File (java.io.File)37 Macro (aQute.bnd.osgi.Macro)29 Workspace (aQute.bnd.build.Workspace)27 Jar (aQute.bnd.osgi.Jar)17 HttpClient (aQute.bnd.http.HttpClient)14 Baseline (aQute.bnd.differ.Baseline)12 DiffPluginImpl (aQute.bnd.differ.DiffPluginImpl)12 BundleInfo (aQute.bnd.differ.Baseline.BundleInfo)10 IOException (java.io.IOException)10 Resource (org.osgi.resource.Resource)10 Info (aQute.bnd.differ.Baseline.Info)8 Version (aQute.bnd.version.Version)8 ArrayList (java.util.ArrayList)8 List (java.util.List)7 ProgressPlugin (aQute.bnd.service.progress.ProgressPlugin)6 Collection (java.util.Collection)6 Properties (java.util.Properties)6 Parameters (aQute.bnd.header.Parameters)5