public static Option baseConfiguration(String ... path) { return composite( gradleBundle("org.slf4j:slf4j-api"), gradleBundle("org.slf4j:slf4j-simple").noStart(), gradleBundle("org.apache.felix:org.apache.felix.scr"), systemProperty("pax.exam.osgi.unresolved.fail").value("true"), cleanCaches(true), workingDirectory(join(File.separator, "build", "osgi-container", join(File.separator, path))), junitBundles() ); }
/** * Base configuration for a Karaf container running the specified Ignite features. * * @return The configuration. */ public Option[] baseConfig() { return options( // Specify which version of Karaf to use. karafDistributionConfiguration() .frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz") .versionAsInProject()) .karafVersion(System.getProperty("karafVersion")) .useDeployFolder(false) .unpackDirectory(new File("target/paxexam/unpack")), // Add JUnit bundles. junitBundles(), // Add the additional JRE exports that Ignite requires. editConfigurationFileExtend("etc/jre.properties", "jre-1.7", "sun.nio.ch"), editConfigurationFileExtend("etc/jre.properties", "jre-1.8", "sun.nio.ch"), // Make log level INFO. logLevel(LogLevelOption.LogLevel.INFO), // Add our features repository. features(mavenBundle() .groupId("org.apache.ignite").artifactId("ignite-osgi-karaf") .version(System.getProperty("projectVersion")).type("xml/features"), featuresToInstall().toArray(new String[0])), // Propagate the projectVersion system property. systemProperty("projectVersion").value(System.getProperty("projectVersion")) ); }
/** * Configures the required system property to set the log-level in Karaf. * * @param logLevel the log level which should be used for pax-logging. Possible values are TRACE, DEBUG, INFO, WARN, * ERROR and FATAL * @return a pax-exam option */ public static SystemPropertyOption setLogLevel(String logLevel) { return systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value(logLevel); }
public static SystemPropertyOption logbackConfigFile() { File logbackXml = new File(PathUtils.getBaseDir(), "src/test/resources/logback.xml"); if (logbackXml.exists()) return systemProperty("logback.configurationFile").value("file:" + logbackXml); else return null; }
public static Option calabashConfigFile() { File configFile = new File(PathUtils.getBaseDir() + "/src/test/resources/config-calabash.xml"); return composite( configFile.exists() ? systemProperty("org.daisy.pipeline.xproc.configuration").value(configFile.toString()) : null, systemProperty("com.xmlcalabash.config.user").value("") ); }
/** * Make sure all system properties with a given prefix are also available inside the container */ public static DefaultCompositeOption passThroughAllSystemPropertiesWithPrefix(String prefix) { DefaultCompositeOption options = new DefaultCompositeOption(); for (String name : System.getProperties().stringPropertyNames()) { if (name.startsWith(prefix)) { options.add(systemProperty(name).value(System.getProperty(name))); } } return options; }
private Option getInvokerConfiguration() { KarafExamSystemConfigurationOption[] internalConfigurationOptions = system .getOptions(KarafExamSystemConfigurationOption.class); Option invokerConfiguration = systemProperty("pax.exam.invoker").value("junit"); if (internalConfigurationOptions != null && internalConfigurationOptions.length != 0) { invokerConfiguration = systemProperty("pax.exam.invoker").value( internalConfigurationOptions[0].getInvoker()); } return invokerConfiguration; }
private Option getInvokerConfiguration() { KarafExamSystemConfigurationOption[] internalConfigurationOptions = system .getOptions(KarafExamSystemConfigurationOption.class); Option invokerConfiguration = systemProperty("pax.exam.invoker").value("junit"); if (internalConfigurationOptions != null && internalConfigurationOptions.length != 0) { invokerConfiguration = systemProperty("pax.exam.invoker").value( internalConfigurationOptions[0].getInvoker()); } return invokerConfiguration; }
/** * Set the project version as a Karaf system property * <p/> * This method assumes that the test-support bundle has the same * version as the code being tested */ public static SystemPropertyOption projectVersionAsSystemProperty() { String version = MavenUtils.asInProject() .getVersion("org.apache.provisionr", "provisionr-test-support"); return systemProperty("project.version").value(version); }
/** * Add the pax logging provider with the given default logging level */ public static Option[] paxLogging(String defaultLogLevel) { return flatOptions( bundles("org.ops4j.pax.logging/pax-logging-api", "org.ops4j.pax.logging/pax-logging-service"), systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value(defaultLogLevel) ); }
@Configuration public Option[] config() throws IOException { return new Option[] { bootDelegationPackage("javax.crypto"), bootDelegationPackage("javax.crypto.interfaces"), bootDelegationPackage("javax.crypto.spec"), getKarafDistroOption(), vmOptions("-Xmx2048m","-XX:MaxPermSize=512m"), keepRuntimeFolder(), configureConsole().ignoreLocalConsole(), logLevel(LogLevel.WARN), mvnLocalRepoOption(), editConfigurationFilePut(ORG_OPS4J_PAX_LOGGING_CFG,LOG4J_LOGGER_ORG_OPENDAYLIGHT_YANGTOOLS_FEATURETEST,LogLevel.INFO.name()), CoreOptions.systemProperty(ORG_OPENDAYLIGHT_FEATURETEST_URI_PROP).value(System.getProperty(ORG_OPENDAYLIGHT_FEATURETEST_URI_PROP)), CoreOptions.systemProperty(ORG_OPENDAYLIGHT_FEATURETEST_FEATURENAME_PROP).value(System.getProperty(ORG_OPENDAYLIGHT_FEATURETEST_FEATURENAME_PROP)), CoreOptions.systemProperty(ORG_OPENDAYLIGHT_FEATURETEST_FEATUREVERSION_PROP).value(System.getProperty(ORG_OPENDAYLIGHT_FEATURETEST_FEATUREVERSION_PROP)), }; }
private ExamSystem createExamSystem() throws IOException { systemType = cm.getProperty(EXAM_SYSTEM_KEY, EXAM_SYSTEM_TEST); String timeout = cm.getProperty(EXAM_SERVICE_TIMEOUT_KEY, EXAM_SERVICE_TIMEOUT_DEFAULT); Option timeoutOption = new SystemPropertyOption(EXAM_SERVICE_TIMEOUT_KEY).value(timeout); if (EXAM_SYSTEM_DEFAULT.equals(systemType)) { system = DefaultExamSystem.create(new Option[] { timeoutOption }); } else if (EXAM_SYSTEM_JAVAEE.equals(systemType)) { WarProbeOption warProbe = new WarProbeOption().classPathDefaultExcludes(); system = DefaultExamSystem.create(new Option[] { warProbe }); } else { system = PaxExamRuntime.createTestSystem(timeoutOption); } return system; }
/** * 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")); }
public static Option logbackBundles() { LOG.info("Console Enabled {}", consoleEnabled); return composite( when(consoleEnabled).useOptions(systemProperty("osgi.console").value("6666"), systemProperty("osgi.console.enable.builtin").value("true")), when(consoleEnabled && isFelix()).useOptions( mavenBundle("org.apache.felix", "org.apache.felix.gogo.command", "0.14.0"), mavenBundle("org.apache.felix", "org.apache.felix.gogo.runtime", "0.12.1"), mavenBundle("org.apache.felix", "org.apache.felix.gogo.shell", "0.10.0")), systemProperty("logback.configurationFile").value( "file:" + PathUtils.getBaseDir() + "/src/test/resources/logback.xml"), linkBundle("slf4j.api"), linkBundle("jcl.over.slf4j"), linkBundle("ch.qos.logback.core"), linkBundle("ch.qos.logback.classic")); }
/** * 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")); }
/** * If custom Maven local repositories are used PAX URL needs to know about it. * * This method will return a composit option with the settings required for PAX EXAM to find * the custom Maven local repo. */ public static Option localRepoForPAXUrl() throws Exception { String localRepo = System.getProperty("localRepository"); if (localRepo == null) { return null; } return composite(systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo), editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", localRepo)); } }
/** * Return the options required by this container implementation. * * @return local options */ private Option[] localOptions() { return new Option[] { // remote bundle context bundle mavenBundle().groupId( "org.ops4j.pax.exam" ).artifactId( "pax-exam-container-rbc" ).version( Info.getPaxExamVersion() ).update( Info.isPaxExamSnapshotVersion() ).startLevel( START_LEVEL_SYSTEM_BUNDLES ), // rmi communication port systemProperty( Constants.RMI_PORT_PROPERTY ).value( m_remoteBundleContextClient.getRmiPort().toString() ), // boot delegation for sun.*. This seems only necessary in Knopflerfish version > 2.0.0 bootDelegationPackage( "sun.*" ) }; }
@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(), }; }
@Configuration public Option[] configuration() throws IOException, URISyntaxException { return CoreOptions.options( junitBundles(), mavenBundle("org.apache.felix", "org.apache.felix.scr", "2.0.12"), mavenBundle("org.osgi", "org.osgi.dto", "1.0.0"), mavenBundle( "org.apache.felix", "org.apache.felix.configadmin", "1.8.16" ), mavenBundle( "org.apache.felix", "org.apache.felix.fileinstall", "3.2.6" ), mavenBundle( "org.ops4j.pax.logging", "pax-logging-api", "1.7.2" ), frameworkProperty("repository.home").value("target"), systemProperties(new SystemPropertyOption("felix.fileinstall.dir").value(getConfigDir())), jarBundles(), jpmsOptions()); }