Search in sources :

Example 11 with JarResource

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

the class VerifierTest method verifyMetaPersistence.

/**
	 * Verify that the Meta-Persistence header is correctly verified
	 * 
	 * @throws Exception
	 */
public void verifyMetaPersistence() throws Exception {
    Builder b = new Builder();
    b.setIncludeResource("foo.xml;literal='I exist'");
    Jar inner = b.build();
    assertTrue(b.check());
    Jar outer = new Jar("x");
    outer.putResource("foo.jar", new JarResource(inner));
    Manifest m = new Manifest();
    m.getMainAttributes().putValue(Constants.META_PERSISTENCE, "foo.jar, foo.jar!/foo.xml, absent.xml");
    outer.setManifest(m);
    Verifier v = new Verifier(outer);
    v.verifyMetaPersistence();
    assertTrue(v.check("Meta-Persistence refers to resources not in the bundle: \\[absent.xml\\]"));
}
Also used : JarResource(aQute.bnd.osgi.JarResource) Builder(aQute.bnd.osgi.Builder) Jar(aQute.bnd.osgi.Jar) Manifest(java.util.jar.Manifest) Verifier(aQute.bnd.osgi.Verifier)

Aggregations

Jar (aQute.bnd.osgi.Jar)11 JarResource (aQute.bnd.osgi.JarResource)11 File (java.io.File)7 Builder (aQute.bnd.osgi.Builder)5 Manifest (java.util.jar.Manifest)5 Resource (aQute.bnd.osgi.Resource)4 Parameters (aQute.bnd.header.Parameters)3 Properties (java.util.Properties)3 Container (aQute.bnd.build.Container)2 Domain (aQute.bnd.osgi.Domain)2 EmbeddedResource (aQute.bnd.osgi.EmbeddedResource)2 FileResource (aQute.bnd.osgi.FileResource)2 BufferedInputStream (java.io.BufferedInputStream)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 Attrs (aQute.bnd.header.Attrs)1 Verifier (aQute.bnd.osgi.Verifier)1 RepositoryPlugin (aQute.bnd.service.RepositoryPlugin)1 PutResult (aQute.bnd.service.RepositoryPlugin.PutResult)1 MultiMap (aQute.lib.collections.MultiMap)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1