use of aQute.bnd.osgi.resource.FilterParser.Expression in project bnd by bndtools.
the class FilterParserTest method testVoidRange.
public void testVoidRange() throws IOException {
Expression exp = fp.parse("(&(osgi.wiring.package=package)(version>=0.0.0))");
System.out.println(exp);
}
use of aQute.bnd.osgi.resource.FilterParser.Expression in project bnd by bndtools.
the class FilterParserTest method testPackageRange.
public void testPackageRange() throws Exception {
Expression expression = fp.parse("(&(osgi.wiring.package=A)(version>=1.0.0)(!(version>=2.0.0)))");
assertTrue(expression instanceof WithRangeExpression);
assertEquals("[1.0.0,2.0.0)", ((WithRangeExpression) expression).getRangeExpression().getRangeString());
}
use of aQute.bnd.osgi.resource.FilterParser.Expression in project bnd by bndtools.
the class FilterParserTest method testCache.
/**
* Since the filters are cached we need to get similar filters to check if
* this works.
*
* @throws IOException
*/
public void testCache() throws IOException {
Expression exp = fp.parse("(&(osgi.wiring.package=a)(version>=1)(!(version>=2.0.0)))");
Expression exp2 = fp.parse("(&(osgi.wiring.package=b)(version>=1.1)(!(version>=2.0.0)))");
assertNotNull(exp2);
assertNotNull(exp);
}
use of aQute.bnd.osgi.resource.FilterParser.Expression in project bnd by bndtools.
the class FilterParserTest method testIdentity.
public void testIdentity() throws IOException {
Expression exp = fp.parse("(&(osgi.identity=identity)(version>=0.0.0))");
System.out.println(exp);
exp = fp.parse("(&(osgi.identity=identity)(!(version>=2.0.0))(version>=1.0.0))");
System.out.println(exp);
}
use of aQute.bnd.osgi.resource.FilterParser.Expression in project bnd by bndtools.
the class NativeCodeHeaderTest method testNative.
public void testNative() throws Exception {
ResourceBuilder rb = new ResourceBuilder();
Requirement nativeCode = //
rb.getNativeCode(//
"f1;" + //
" osname=Windows95;" + //
" processor=x86;" + //
" selection-filter='(com.acme.windowing=win32)';" + //
" language=en;" + //
" osname=Windows98;" + //
" language=se, " + //
"lib/solaris/libhttp.so;" + //
" osname=Solaris;" + //
" osname = SunOS ;" + //
" processor = sparc, " + //
"lib/linux/libhttp.so ; " + //
" osname = Linux ; " + //
" processor = mips; " + //
" selection-filter = '(com.acme.windowing=gtk)'," + "*").synthetic();
assertEquals(NativeNamespace.NATIVE_NAMESPACE, nativeCode.getNamespace());
assertEquals("optional", nativeCode.getDirectives().get("resolution"));
String filter = nativeCode.getDirectives().get("filter");
assertEquals(null, Verifier.validateFilter(filter));
FilterParser p = new FilterParser();
Expression parse = p.parse(filter);
assertEquals("(|(&(|(osgi.native.osname=Windows95)(osgi.native.osname=Windows98))(osgi.native.processor=x86)(|(osgi.native.language=en)(osgi.native.language=se))(com.acme.windowing=win32))(&(|(osgi.native.osname=Solaris)(osgi.native.osname=SunOS))(osgi.native.processor=sparc))(&(osgi.native.osname=Linux)(osgi.native.processor=mips)(com.acme.windowing=gtk)))", filter);
System.out.println(nativeCode);
}
Aggregations