use of aQute.bnd.differ.DiffPluginImpl 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());
}
}
use of aQute.bnd.differ.DiffPluginImpl in project bnd by bndtools.
the class BaselineTest method testClassesDiffWithSource.
/**
* Test skipping classes when there is source
*/
public void testClassesDiffWithSource() throws Exception {
DiffPluginImpl diff = new DiffPluginImpl();
try (Jar jar = new Jar(IO.getFile("jar/osgi.jar"));
Jar out = new Jar(".")) {
out.putResource("OSGI-OPT/src/org/osgi/application/ApplicationContext.java", jar.getResource("OSGI-OPT/src/org/osgi/application/ApplicationContext.java"));
out.putResource("org/osgi/application/ApplicationContext.class", jar.getResource("org/osgi/application/ApplicationContext.class"));
Tree tree = diff.tree(out);
Tree src = tree.get("<resources>").get("OSGI-OPT/src/org/osgi/application/ApplicationContext.java").getChildren()[0];
assertNotNull(src);
assertNull(tree.get("<resources>").get("org/osgi/application/ApplicationContext.class"));
}
}
use of aQute.bnd.differ.DiffPluginImpl 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());
}
}
use of aQute.bnd.differ.DiffPluginImpl in project bnd by bndtools.
the class DiffCommand method showTree.
/**
* Just show the single tree
*
* @param bnd
* @param options
* @throws Exception
*/
private static void showTree(bnd bnd, diffOptions options) throws Exception {
File fout = options.output();
PrintWriter pw;
if (fout == null)
pw = IO.writer(bnd.out);
else
pw = IO.writer(fout, UTF_8);
Instructions packageFilters = new Instructions(options.pack());
try (Jar newer = new Jar(bnd.getFile(options._arguments().get(0)))) {
Differ di = new DiffPluginImpl();
Tree n = di.tree(newer);
boolean all = options.api() == false && options.resources() == false && options.manifest() == false;
if (all || options.api())
for (Tree packageDiff : n.get("<api>").getChildren()) {
if (packageFilters.matches(packageDiff.getName()))
show(pw, packageDiff, 0);
}
if (all || options.manifest())
show(pw, n.get("<manifest>"), 0);
if (all || options.resources())
show(pw, n.get("<resources>"), 0);
} finally {
pw.close();
}
}
use of aQute.bnd.differ.DiffPluginImpl in project bnd by bndtools.
the class DiffTest method testSimple.
public static void testSimple() throws Exception {
DiffPluginImpl differ = new DiffPluginImpl();
differ.setIgnore("Bundle-Copyright,Bundle-Description,Bundle-License,Bundle-Name,bundle-manifestversion,Export-Package,Import-Package,Bundle-Vendor,Bundle-Version");
Tree newer = differ.tree(new Jar(IO.getFile("jar/osgi.core-4.3.0.jar")));
// 4.2
Tree older = differ.tree(new Jar(IO.getFile("jar/osgi.core.jar")));
Diff diff = newer.get("<manifest>").diff(older.get("<manifest>"));
show(diff, 0);
assertEquals(Delta.UNCHANGED, diff.getDelta());
}
Aggregations