Search in sources :

Example 91 with Builder

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

the class ResourcesTest method testIncludeResourceDoNotCopyPath.

public static void testIncludeResourceDoNotCopyPath() throws Exception {
    Builder b = new Builder();
    // Use Properties file otherwise -donotcopy is not picked up
    Properties p = new Properties();
    p.put("-donotcopy", ".*/more/.*");
    p.put("Include-Resource", "TargetFolder=testresources/ws/p2/Resources");
    p.put("-resourceonly", "true");
    p.put("-upto", "3.0");
    b.setProperties(p);
    Jar jar = b.build();
    Resource r = jar.getResource("TargetFolder/resource3.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/resource4.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/more/resource6.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/more/resource7.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/stuff/resource9.res");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/text.txt");
    assertNotNull(r);
}
Also used : Builder(aQute.bnd.osgi.Builder) JarResource(aQute.bnd.osgi.JarResource) Resource(aQute.bnd.osgi.Resource) Jar(aQute.bnd.osgi.Jar) Properties(java.util.Properties)

Example 92 with Builder

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

the class ResourcesTest method testIncludeResourceDirectivesDefault.

public static void testIncludeResourceDirectivesDefault() throws Exception {
    Builder b = new Builder();
    b.setProperty("Include-Resource", "TargetFolder=testresources/ws/p2/Resources");
    b.setProperty("-resourceonly", "true");
    Jar jar = b.build();
    Resource r = jar.getResource("TargetFolder/resource3.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/resource4.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/more/resource6.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/more/resource7.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/stuff/resource9.res");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/text.txt");
    assertNotNull(r);
}
Also used : Builder(aQute.bnd.osgi.Builder) JarResource(aQute.bnd.osgi.JarResource) Resource(aQute.bnd.osgi.Resource) Jar(aQute.bnd.osgi.Jar)

Example 93 with Builder

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

the class ResourcesTest method testIncludeResourceDoNotCopy.

public static void testIncludeResourceDoNotCopy() throws Exception {
    Builder b = new Builder();
    // Use Properties file otherwise -donotcopy is not picked up
    Properties p = new Properties();
    p.put("-donotcopy", "CVS|.svn|stuff");
    p.put("Include-Resource", "TargetFolder=testresources/ws/p2/Resources");
    p.put("-resourceonly", "true");
    b.setProperties(p);
    Jar jar = b.build();
    Resource r = jar.getResource("TargetFolder/resource3.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/resource4.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/more/resource6.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/more/resource7.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/stuff/resource9.res");
    assertNull(r);
    r = jar.getResource("TargetFolder/text.txt");
    assertNotNull(r);
}
Also used : Builder(aQute.bnd.osgi.Builder) JarResource(aQute.bnd.osgi.JarResource) Resource(aQute.bnd.osgi.Resource) Jar(aQute.bnd.osgi.Jar) Properties(java.util.Properties)

Example 94 with Builder

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

the class ResourcesTest method testCommand.

/**
	 * Command facility in Include-Resource
	 */
public void testCommand() throws Exception {
    if (!onWindows()) {
        Builder b = new Builder();
        b.setProperty("Include-Resource", "xkeystore; requires='testresources/keystore';cmd='echo ${@requires}', ");
        b.setProperty("-resourceonly", "true");
        Jar jar = b.build();
        assertTrue(b.check());
        Resource r = jar.getResource("xkeystore");
        assertNotNull(r);
        String s = IO.collect(r.openInputStream());
        assertEquals("testresources/keystore\n", s);
    }
}
Also used : Builder(aQute.bnd.osgi.Builder) JarResource(aQute.bnd.osgi.JarResource) Resource(aQute.bnd.osgi.Resource) Jar(aQute.bnd.osgi.Jar)

Example 95 with Builder

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

the class ResourcesTest method testIncludeResourceDirectivesFilterRecursive.

public static void testIncludeResourceDirectivesFilterRecursive() throws Exception {
    Builder b = new Builder();
    b.setProperty("Include-Resource", "TargetFolder=testresources/ws/p2/Resources;filter:=re*.txt");
    b.setProperty("-resourceonly", "true");
    Jar jar = b.build();
    Resource r = jar.getResource("TargetFolder/resource3.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/resource4.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/more/resource6.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/more/resource7.txt");
    assertNotNull(r);
    r = jar.getResource("TargetFolder/text.txt");
    assertNull(r);
}
Also used : Builder(aQute.bnd.osgi.Builder) JarResource(aQute.bnd.osgi.JarResource) Resource(aQute.bnd.osgi.Resource) Jar(aQute.bnd.osgi.Jar)

Aggregations

Builder (aQute.bnd.osgi.Builder)440 Jar (aQute.bnd.osgi.Jar)228 File (java.io.File)203 Properties (java.util.Properties)99 Manifest (java.util.jar.Manifest)99 Resource (aQute.bnd.osgi.Resource)83 Attributes (java.util.jar.Attributes)43 DocumentBuilder (javax.xml.parsers.DocumentBuilder)41 XmlTester (aQute.bnd.test.XmlTester)39 Parameters (aQute.bnd.header.Parameters)35 Document (org.w3c.dom.Document)27 Attrs (aQute.bnd.header.Attrs)21 JarResource (aQute.bnd.osgi.JarResource)20 LogService (org.osgi.service.log.LogService)17 ProjectBuilder (aQute.bnd.build.ProjectBuilder)16 Domain (aQute.bnd.osgi.Domain)16 ArrayList (java.util.ArrayList)14 DependencyGraphBuilder (org.apache.maven.shared.dependency.graph.DependencyGraphBuilder)13 HashMap (java.util.HashMap)12 Project (aQute.bnd.build.Project)10