public static UrlProvisionOption gradleBundle(String module) { return bundle(artifact(module).toUri().toString()); }
@Configuration public Option[] config() { return options( junitBundles(), bundle("file:" + System.getProperty("caffeine.osgi.jar")), bundle("file:" + System.getProperty("caffeine-jcache.osgi.jar")), mavenBundle("com.typesafe", "config", System.getProperty("config.osgi.version")), mavenBundle("javax.cache", "cache-api", System.getProperty("jcache.osgi.version"))); }
@Configuration public Option[] config() { return options( junitBundles(), bundle("file:" + System.getProperty("caffeine.osgi.jar"))); }
/** * Creates a bundle option for a bundle link generated by the exam-maven-plugin. * * @param symbolicName * bundle symbolic name * @return bundle provisioning option */ public static UrlProvisionOption linkBundle(String symbolicName) { return bundle(String.format("link:classpath:%s.link", symbolicName)); }
/** * Creates a bundle option for a bundle link generated by the exam-maven-plugin. * * @param symbolicName * bundle symbolic name * @return bundle provisioning option */ public static UrlProvisionOption linkBundle(String symbolicName) { return bundle(String.format("link:classpath:%s.link", symbolicName)); }
private Option getComponentUnderTestOptions() { String componentArtifactId = System.getProperty("component.artifactId"); String componentVersion = System.getProperty("component.version"); String bundleJarName = String.format("%s-%s.jar", componentArtifactId, componentVersion); String bundleJarUrl = Paths.get(PathUtils.getBaseDir(), "target", bundleJarName).toUri().toString(); LOGGER.info("Component under test artifact name: {}", bundleJarUrl); return bundle(bundleJarUrl).start(); } }
protected static UrlProvisionOption resolveJar( Path targetFolder, final String nameStart ) { File[] candidateFiles = targetFolder.toFile().listFiles( new FileFilter( nameStart ) ); if( candidateFiles != null && candidateFiles.length > 0 ) { try { return CoreOptions.bundle( candidateFiles[0].toURI().toURL().toString() ); } catch( MalformedURLException e ) { log.warn( "Problem resolving bundle " + nameStart, e ); } } throw new RuntimeException( "Could not resolve project bundle with name starting with " + nameStart ); }
public static UrlProvisionOption thisBundle() { File classes = new File(PathUtils.getBaseDir() + "/target/classes"); Manifest manifest; try { InputStream stream = new File(classes, "META-INF/MANIFEST.MF").toURI().toURL().openStream(); try { manifest = new Manifest(stream); } finally { stream.close(); }} catch (IOException e) { throw new RuntimeException(e); } String components = manifest.getMainAttributes().getValue("Service-Component"); if (components != null) for (String component : components.split(",")) if (!(new File(classes, component)).exists()) { Properties dependencies = new Properties(); try { dependencies.load(new FileInputStream(new File(classes, "META-INF/maven/dependencies.properties"))); } catch (IOException e) { throw new RuntimeException(e); } String artifactId = dependencies.getProperty("artifactId"); String version = dependencies.getProperty("version"); // assuming JAR is named ${artifactId}-${version}.jar return bundle("reference:" + new File(PathUtils.getBaseDir() + "/target/" + artifactId + "-" + version + ".jar").toURI()); } return bundle("reference:" + classes.toURI()); }
/** * Constructor. */ public JUnitBundlesOption() { super(bundle("link:classpath:META-INF/links/org.ops4j.pax.tipi.junit.link")); noUpdate(); startLevel(START_LEVEL_SYSTEM_BUNDLES); }
/** * Constructor. */ public JUnitBundlesOption() { super(bundle("link:classpath:META-INF/links/org.ops4j.pax.tipi.junit.link")); noUpdate(); startLevel(START_LEVEL_SYSTEM_BUNDLES); }
/** * Creates a {@link JUnitBundlesOption}. * * @return junit bundles option */ public static CompositeOption junitBundles() { return new DefaultCompositeOption(new JUnitBundlesOption(), systemProperty( "pax.exam.invoker").value("junit"), bundle("link:classpath:META-INF/links/org.ops4j.pax.tipi.hamcrest.core.link"), bundle("link:classpath:META-INF/links/org.ops4j.pax.exam.invoker.junit.link")); }
/** * Creates a {@link JUnitBundlesOption}. * * @return junit bundles option */ public static CompositeOption junitBundles() { return new DefaultCompositeOption(new JUnitBundlesOption(), systemProperty( "pax.exam.invoker").value("junit"), bundle("link:classpath:META-INF/links/org.ops4j.pax.tipi.hamcrest.core.link"), bundle("link:classpath:META-INF/links/org.ops4j.pax.exam.invoker.junit.link")); }
@Override protected Option toOption() { return CoreOptions.bundle(getArtifactInfo().getContext().getUrl().toExternalForm()); }
@Override protected Option toOption() { return CoreOptions.bundle(getArtifactInfo().getContext().getFile().getAbsolutePath()); }
private Option jarBundles() throws MalformedURLException { DefaultCompositeOption composite = new DefaultCompositeOption(); for (File bundle : new File("target", "test-bundles").listFiles()) { if (bundle.getName().endsWith(".jar") && bundle.isFile()) { composite.add(bundle(bundle.toURI().toURL().toString())); } } return composite; }
@Override protected Option toOption() { URL url = getBundleInfo().getContext().getUrl(); File cacheFile = P2Cache.getCacheFile(url); UrlProvisionOption bundle; if (cacheFile.exists()) { bundle = CoreOptions.bundle(cacheFile.toURI().toASCIIString()); } else { bundle = CoreOptions.bundle(url.toExternalForm()); } bundle.startLevel(getStartLevel()); bundle.start(shouldStart()); bundle.update(shouldUpdate()); return bundle; }
@Override protected Option toOption() { UrlProvisionOption bundle = CoreOptions .bundle(getBundleInfo().getContext().getAbsolutePath()); bundle.startLevel(getStartLevel()); bundle.start(shouldStart()); bundle.update(shouldUpdate()); return bundle; }
@Configuration public Option[] config() { return new Option[] { CoreOptions.systemProperty("ogema.resources.useByteCodeGeneration").value("true"), CoreOptions.frameworkProperty("osgi.console").value("true"), CoreOptions.frameworkProperty("osgi.console.enable.builtin").value("true"), CoreOptions.frameworkProperty("org.osgi.service.http.port").value(Integer.toString(HTTP_PORT)), CoreOptions.frameworkProperty("org.osgi.framework.bsnversion").value("multiple"), // CoreOptions.systemProperty("org.ogema.security").value("on"), CoreOptions.junitBundles(), // load the bundle of the extending class directly from maven build dir: CoreOptions.when(includeTestBundle) .useOptions(CoreOptions.bundle("reference:file:target/classes/").start()), CoreOptions.composite(frameworkBundles()), // ogemaWebFrontentOption(), // wicketGuiOption(), // webConsoleOption(), // felixGogoShellOption(), }; }
@Configuration public Option[] config() { return new Option[] { CoreOptions.systemProperty("ogema.resources.useByteCodeGeneration").value("true"), CoreOptions.frameworkProperty("osgi.console").value("true"), CoreOptions.frameworkProperty("osgi.console.enable.builtin").value("true"), CoreOptions.frameworkProperty("org.osgi.service.http.port").value(Integer.toString(HTTP_PORT)), CoreOptions.frameworkProperty("org.osgi.framework.bsnversion").value("multiple"), CoreOptions.frameworkProperty(Constants.FRAMEWORK_SYSTEMCAPABILITIES_EXTRA).value("osgi.contract;osgi.contract=\"JavaServlet\";version:Version=\"3.1\""), // CoreOptions.systemProperty("org.ogema.security").value("on"), CoreOptions.junitBundles(), // load the bundle of the extending class directly from maven build dir: CoreOptions.when(includeTestBundle) .useOptions(CoreOptions.bundle("reference:file:target/classes/").start()), CoreOptions.composite(frameworkBundles()), // ogemaWebFrontentOption(), // wicketGuiOption(), // webConsoleOption(), // felixGogoShellOption(), }; }