use of aQute.bnd.differ.DiffPluginImpl in project bnd by bndtools.
the class BaselineTest method testCompilerEnumDifference.
/**
* Test 2 jars compiled with different compilers
*/
public void testCompilerEnumDifference() throws Exception {
DiffPluginImpl diff = new DiffPluginImpl();
try (Jar ecj = new Jar(IO.getFile("jar/baseline/com.example.baseline.ecj.jar"));
Jar javac = new Jar(IO.getFile("jar/baseline/com.example.baseline.javac.jar"))) {
Tree tecj = diff.tree(ecj);
Tree tjavac = diff.tree(javac);
Diff d = tecj.diff(tjavac);
assertEquals(Delta.UNCHANGED, d.getDelta());
}
}
use of aQute.bnd.differ.DiffPluginImpl 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());
}
}
use of aQute.bnd.differ.DiffPluginImpl 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());
}
}
use of aQute.bnd.differ.DiffPluginImpl 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());
}
}
use of aQute.bnd.differ.DiffPluginImpl in project bnd by bndtools.
the class BaselineTest method testClassesDiffWithoutSource.
public void testClassesDiffWithoutSource() throws Exception {
DiffPluginImpl diff = new DiffPluginImpl();
try (Jar jar = new Jar(IO.getFile("jar/osgi.jar"));
Jar out = new Jar(".")) {
for (String path : jar.getResources().keySet()) {
if (!path.startsWith("OSGI-OPT/src/"))
out.putResource(path, jar.getResource(path));
}
Tree tree = diff.tree(out);
assertNull(tree.get("<resources>").get("OSGI-OPT/src/org/osgi/application/ApplicationContext.java"));
assertNotNull(tree.get("<resources>").get("org/osgi/application/ApplicationContext.class"));
}
}
Aggregations