Search in sources :

Example 86 with Builder

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

the class VerifierTest method testBundleActivationPolicyGood.

public static void testBundleActivationPolicyGood() throws Exception {
    Builder v = new Builder();
    v.setProperty("Private-Package", "test.activator");
    v.addClasspath(new File("bin"));
    v.setProperty(Constants.BUNDLE_ACTIVATIONPOLICY, "lazy   ;   hello:=1");
    v.build();
    assertTrue(v.check());
}
Also used : Builder(aQute.bnd.osgi.Builder) File(java.io.File)

Example 87 with Builder

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

the class VerifierTest method testStrict.

/**
	 * Test the strict flag
	 */
public void testStrict() throws Exception {
    Builder bmaker = new Builder();
    bmaker.addClasspath(IO.getFile("jar/osgi.jar"));
    bmaker.addClasspath(new File("bin"));
    bmaker.setProperty("Export-Package", "org.osgi.service.eventadmin;version='[1,2)',org.osgi.framework;version=x13,test;-remove-attribute:=version,test.lib;specification-version=12,test.split");
    bmaker.setProperty("Import-Package", "foo;version=1,bar;version='[1,x2)',baz;version='[2,1)',baz2;version='(1,1)',*");
    bmaker.setProperty("-strict", "true");
    bmaker.setProperty("-fixupmessages", "^Exception: ");
    Jar jar = bmaker.build();
    assertTrue(bmaker.check("\\QInvalid syntax for version: x13, for cmd: range, arguments; [range, [==,+)]\\E", "\\QImport Package org.osgi.framework has an invalid version range syntax ${range;[==,+)}\\E", "\\QNo translation found for macro: range;[==,+)\\E", "\\QExport-Package or -exportcontents refers to missing package 'org.osgi.service.eventadmin'\\E", "Import Package clauses without version range \\(excluding javax\\.\\*\\):", "Import Package bar has an invalid version range syntax \\[1,x2\\)", "Import Package baz2 has an empty version range syntax \\(1,1\\), likely want to use \\[1.0.0,1.0.0\\]", "Import Package baz has an invalid version range syntax \\[2,1\\): java.lang.IllegalArgumentException: Low Range is higher than High Range: 2.0.0-1.0.0", "Import Package clauses which use a version instead of a version range. This imports EVERY later package and not as many expect until the next major number: \\[foo\\]", "Export Package org.osgi.framework version has invalid syntax: x13", "Export Package test.lib uses deprecated specification-version instead of version", "Export Package org.osgi.service.eventadmin version is a range: \\[1,2\\); Exports do not allow for ranges."));
}
Also used : Builder(aQute.bnd.osgi.Builder) Jar(aQute.bnd.osgi.Jar) File(java.io.File)

Example 88 with Builder

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

the class VerifierTest method verifyNamespace.

/**
	 * Verify that an invalid namespace error is actually an error
	 */
public void verifyNamespace() throws Exception {
    Builder b = new Builder();
    b.setProperty("Require-Capability", "+++,bla.bla");
    b.setProperty("Provide-Capability", "===,bla.bla");
    b.setIncludeResource("foo;literal='foo'");
    Jar inner = b.build();
    assertTrue(b.check("The Require-Capability with namespace \\+\\+\\+ is not a symbolic name", "The Provide-Capability with namespace === is not a symbolic name"));
}
Also used : Builder(aQute.bnd.osgi.Builder) Jar(aQute.bnd.osgi.Jar)

Example 89 with Builder

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

the class VerifierTest method testnativeCode.

public static void testnativeCode() throws Exception {
    Builder b = new Builder();
    b.addClasspath(new File("bin"));
    b.setProperty("-resourceonly", "true");
    b.setProperty("Include-Resource", "native/win32/NTEventLogAppender-1.2.dll;literal='abc'");
    b.setProperty("Bundle-NativeCode", "native/win32/NTEventLogAppender-1.2.dll; osname=Win32; processor=x86");
    b.build();
    Verifier v = new Verifier(b);
    v.verifyNative();
    System.err.println(v.getErrors());
    assertEquals(0, v.getErrors().size());
    v.close();
    b.close();
}
Also used : Builder(aQute.bnd.osgi.Builder) Verifier(aQute.bnd.osgi.Verifier) File(java.io.File)

Example 90 with Builder

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

the class ResourcesTest method testCopyToRoot.

public static void testCopyToRoot() throws Exception {
    Builder bmaker = new Builder();
    Properties p = new Properties();
    p.setProperty("-resourceonly", "true");
    p.setProperty("Include-Resource", "/=src/test/activator");
    bmaker.setProperties(p);
    Jar jar = bmaker.build();
    for (String s : jar.getResources().keySet()) System.err.println(s);
    assertNotNull(jar.getResource("Activator.java"));
    assertEquals(0, bmaker.getErrors().size());
    assertEquals(0, bmaker.getWarnings().size());
}
Also used : Builder(aQute.bnd.osgi.Builder) Jar(aQute.bnd.osgi.Jar) Properties(java.util.Properties)

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