Search in sources :

Example 21 with Tree

use of aQute.bnd.service.diff.Tree in project bnd by bndtools.

the class DiffTest method testInheritanceII.

public void testInheritanceII() throws Exception {
    Builder b = new Builder();
    b.addClasspath(IO.getFile("bin"));
    b.setProperty(Constants.EXPORT_PACKAGE, "test.diff.inherit");
    b.build();
    Tree newer = differ.tree(b);
    System.out.println(newer.get("<api>"));
    Tree older = differ.tree(b);
    assertTrue(newer.diff(older).getDelta() == Delta.UNCHANGED);
}
Also used : Builder(aQute.bnd.osgi.Builder) Tree(aQute.bnd.service.diff.Tree)

Example 22 with Tree

use of aQute.bnd.service.diff.Tree in project bnd by bndtools.

the class DiffTest method testGuavaDiff.

/**
	 * The diff command reports changes on (at least) the guava bundles when
	 * they have not changed, even when I feed it the same file at both ends.
	 * Even stranger is the fact that, though always about the same class, the
	 * actual diff is not consistent. Tested with several versions of bnd
	 * (including master HEAD) as well as several versions of the guava bundles
	 * from maven central. Reproduced by @bnd .
	 * 
	 * <pre>
	 *  $ java -jar
	 * biz.aQute.bnd.jar diff guava-14.0.1.jar guava-14.0.1.jar MINOR PACKAGE
	 * com.google.common.collect MINOR CLASS
	 * com.google.common.collect.ContiguousSet MINOR METHOD
	 * tailSet(java.lang.Object,boolean) ADDED RETURN
	 * com.google.common.collect.ImmutableCollection ADDED RETURN
	 * com.google.common.collect.ImmutableSet ADDED RETURN
	 * com.google.common.collect.ImmutableSortedSet ADDED RETURN
	 * com.google.common.collect.ImmutableSortedSetFauxverideShim ADDED RETURN
	 * com.google.common.collect.SortedIterable ADDED RETURN
	 * java.io.Serializable ADDED RETURN java.lang.Iterable ADDED RETURN
	 * java.lang.Iterable ADDED RETURN java.lang.Iterable ADDED RETURN
	 * java.util.Collection ADDED RETURN java.util.Collection ADDED RETURN
	 * java.util.Set
	 * </pre>
	 * 
	 * @throws Exception
	 */
public void testGuavaDiff() throws Exception {
    File guava = IO.getFile("testresources/guava-14.0.1.jar");
    Tree one = differ.tree(guava);
    System.out.println(one.get("<api>"));
    Tree two = differ.tree(guava);
    Diff diff = one.diff(two);
    assertTrue(diff.getDelta() == Delta.UNCHANGED);
}
Also used : Diff(aQute.bnd.service.diff.Diff) Tree(aQute.bnd.service.diff.Tree) File(java.io.File)

Example 23 with Tree

use of aQute.bnd.service.diff.Tree in project bnd by bndtools.

the class DiffTest method testBaselineDiffs.

public void testBaselineDiffs() throws Exception {
    Tree newerTree = make(IO.getFile("testresources/baseline/test1.jar"));
    Tree olderTree = make(IO.getFile("testresources/baseline/test2.jar"));
    Diff diff = newerTree.diff(olderTree);
    show(diff, 2);
    assertEquals(Delta.UNCHANGED, diff.getDelta());
    assertEquals(Delta.UNCHANGED, diff.get("<init>()").getDelta());
    assertEquals(Delta.UNCHANGED, diff.get("putAll(java.util.List)").getDelta());
}
Also used : Diff(aQute.bnd.service.diff.Diff) Tree(aQute.bnd.service.diff.Tree)

Example 24 with Tree

use of aQute.bnd.service.diff.Tree in project bnd by bndtools.

the class UsesOrderingTest method testOrdering.

public static void testOrdering() throws Exception {
    Builder builder = new Builder();
    builder.addClasspath(new File("bin"));
    builder.setProperty(Constants.EXPORT_PACKAGE, "test.diff;uses:=\"d,c,a,b\"");
    Jar a = builder.build();
    String exa = (String) a.getManifest().getMainAttributes().getValue(Constants.EXPORT_PACKAGE);
    builder = new Builder();
    builder.addClasspath(new File("bin"));
    builder.setProperty(Constants.EXPORT_PACKAGE, "test.diff;uses:=\"d,b,a,c\"");
    Jar b = builder.build();
    String exb = (String) b.getManifest().getMainAttributes().getValue(Constants.EXPORT_PACKAGE);
    Tree newer = differ.tree(b);
    Tree older = differ.tree(a);
    Diff diff = newer.diff(older);
    show(diff, 0);
    assertEquals(Delta.UNCHANGED, diff.getDelta());
}
Also used : Diff(aQute.bnd.service.diff.Diff) Builder(aQute.bnd.osgi.Builder) Tree(aQute.bnd.service.diff.Tree) Jar(aQute.bnd.osgi.Jar) File(java.io.File)

Aggregations

Tree (aQute.bnd.service.diff.Tree)24 Diff (aQute.bnd.service.diff.Diff)17 Jar (aQute.bnd.osgi.Jar)10 File (java.io.File)9 Builder (aQute.bnd.osgi.Builder)6 DiffPluginImpl (aQute.bnd.differ.DiffPluginImpl)5 Instructions (aQute.bnd.osgi.Instructions)4 PrintWriter (java.io.PrintWriter)4 Parameters (aQute.bnd.header.Parameters)3 Baseline (aQute.bnd.differ.Baseline)2 DiffImpl (aQute.bnd.differ.DiffImpl)2 Attrs (aQute.bnd.header.Attrs)2 RepositoryPlugin (aQute.bnd.service.RepositoryPlugin)2 Version (aQute.bnd.version.Version)2 MultiMap (aQute.lib.collections.MultiMap)2 Tag (aQute.lib.tag.Tag)2 BundleInfo (aQute.bnd.differ.Baseline.BundleInfo)1 Info (aQute.bnd.differ.Baseline.Info)1 Analyzer (aQute.bnd.osgi.Analyzer)1 PackageRef (aQute.bnd.osgi.Descriptors.PackageRef)1