when( debug ).useOptions( debugConfiguration( "5005", true ) ), karafDistributionConfiguration() .frameworkUrl( paxExamEnvironment.getProperty( "org.ops4j.pax.exam.container.karaf.distroUrl" ) ) ), configureConsole().ignoreLocalConsole().ignoreRemoteShell(), when( debug ).useOptions( keepRuntimeFolder() ), logLevel( LogLevelOption.LogLevel.INFO ),
/** * Allows custom logging by passing in the `custom.logging` property with the value being in the * format of `[package]=[logLevel];[anotherPackage]=[anotherLogLevel] * * @return */ public static Option enableCustomLogging() { return when(System.getProperty(CUSTOM_LOGGING) != null) .useOptions(customLogging(System.getProperty(CUSTOM_LOGGING))); }
private Option getKeepRuntimeFolderOptions() { return when(Boolean.getBoolean("keepRuntimeFolder")).useOptions(keepRuntimeFolder()); } }
private Option getDebugOptions() { return when(Boolean.getBoolean(DEBUG_ENABLED_PROPERTY)).useOptions(debugConfiguration()); }
/** * Prevents the deletion of the distribution used during testing. * * @return */ public static Option keepRuntimeFolder() { String keepRuntimeFolder = System.getProperty(KEEP_RUNTIME_FOLDER_FLAG, "true"); recordConfiguration(KEEP_RUNTIME_FOLDER_FLAG, keepRuntimeFolder); return when(Boolean.valueOf(keepRuntimeFolder)) .useOptions(org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder()); }
/** * Top level option combinator that adds platform fixes as needed * @param params * @return */ public static Option[] testOptions(Object ... params) { // We need to add pax-exam-junit here when running with the ibm // jdk to avoid the following exception during the test run: // ClassNotFoundException: org.ops4j.pax.exam.junit.Configuration // We also need to pass through local repository properties return combine(flatOptions(params), when(System.getProperty("maven.repo.local") != null).useOptions(vmOption("-Dorg.ops4j.pax.url.mvn.localRepository=" + System.getProperty("maven.repo.local"))), when(System.getProperty("org.ops4j.pax.url.mvn.localRepository") != null).useOptions(vmOption("-Dorg.ops4j.pax.url.mvn.localRepository=" + System.getProperty("org.ops4j.pax.url.mvn.localRepository"))), when("IBM Corporation".equals(System.getProperty("java.vendor"))) .useOptions(wrappedBundle(mavenBundle("org.ops4j.pax.exam", "pax-exam-junit"))), mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit") ); }
private Option getMavenRepositoryOptions() { return composite( editConfigurationFilePut( "etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.repositories", "http://repo1.maven.org/maven2@id=central," + "http://oss.sonatype.org/content/repositories/snapshots@snapshots@noreleases@id=sonatype-snapshot," + "http://oss.sonatype.org/content/repositories/ops4j-snapshots@snapshots@noreleases@id=ops4j-snapshot," + "http://repository.apache.org/content/groups/snapshots-group@snapshots@noreleases@id=apache," + "http://svn.apache.org/repos/asf/servicemix/m2-repo@id=servicemix," + "http://repository.springsource.com/maven/bundles/release@id=springsource," + "http://repository.springsource.com/maven/bundles/external@id=springsourceext," + "http://oss.sonatype.org/content/repositories/releases/@id=sonatype"), when(System.getProperty("maven.repo.local") != null) .useOptions( editConfigurationFilePut( "etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.localRepository", System.getProperty("maven.repo.local")))); }
when(useFragmentBundle).useOptions(url(String.format("file:%s/%s-%s-fragment-bundle.jar", projectBuildDirectory, projectBaseBundleJarName, projectVersion)).noStart()), systemPackages(
public static Option paxCdiWithWeldBundles() { Properties props = new Properties(); try { props.load(TestConfiguration.class.getResourceAsStream("/systemPackages.properties")); } catch (IOException exc) { throw new Ops4jException(exc); } return composite( // do not treat javax.annotation as system package when(isEquinox()).useOptions( frameworkProperty("org.osgi.framework.system.packages").value( props.get("org.osgi.framework.system.packages"))), linkBundle("org.ops4j.pax.cdi.weld"), // there is a classloader conflict when adding this dep to the POM mavenBundle("org.ops4j.pax.cdi", "pax-cdi-undertow-weld", PAX_CDI_VERSION), mavenBundle("com.google.guava", "guava", "13.0.1"), mavenBundle("org.jboss.weld", "weld-osgi-bundle", "2.2.8.Final")); }
@Configuration public Option[] config() { Option[] options = new Option[] { when(Boolean.getBoolean(KARAF_DEBUG_PROP)) .useOptions(KarafDistributionOption.debugConfiguration(KARAF_DEBUG_PORT, true)), karafDistributionConfiguration().frameworkUrl(getKarafDistro()) .unpackDirectory(new File(PAX_EXAM_UNPACK_DIRECTORY)) .useDeployFolder(false), when(Boolean.getBoolean(KEEP_UNPACK_DIRECTORY_PROP)).useOptions(keepRuntimeFolder()), features(getFeatureRepo(), getFeatureName()), getLoggingOption(), mvnLocalRepoOption(), editConfigurationFilePut(ETC_ORG_OPS4J_PAX_LOGGING_CFG, "log4j.rootLogger", "INFO, stdout, osgi:*")}; return OptionUtils.combine(options, getAdditionalOptions()); }
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")); }
public static Option paxCdiWithOwbBundles() { Properties props = new Properties(); try { props.load(TestConfiguration.class.getResourceAsStream("/systemPackages.properties")); } catch (IOException exc) { throw new Ops4jException(exc); } return composite( // do not treat javax.annotation as system package when(isEquinox()).useOptions( frameworkProperty("org.osgi.framework.system.packages").value( props.get("org.osgi.framework.system.packages"))), linkBundle("org.ops4j.pax.cdi.openwebbeans"), // there is a classloader conflict when adding this dep to the POM mavenBundle("org.ops4j.pax.cdi", "pax-cdi-undertow-openwebbeans", PAX_CDI_VERSION), mavenBundle("org.apache.openwebbeans", "openwebbeans-impl", "1.5.0"), mavenBundle("org.apache.openwebbeans", "openwebbeans-spi", "1.5.0"), mavenBundle("org.apache.openwebbeans", "openwebbeans-web", "1.5.0"), mavenBundle("org.apache.openwebbeans", "openwebbeans-el22", "1.5.0"), // needed by pax-cdi-web-openwebbeans mavenBundle("org.apache.geronimo.specs", "geronimo-jsp_2.2_spec", "1.2"), mavenBundle("org.apache.xbean", "xbean-asm6-shaded", "4.6"), // mavenBundle("org.apache.xbean", "xbean-finder-shaded", "4.6"), // //mavenBundle("org.slf4j", "jul-to-slf4j").versionAsInProject(), mavenBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec", "1.1.1"), mavenBundle("javax.validation", "validation-api", "1.1.0.Final"), mavenBundle("javax.interceptor", "javax.interceptor-api", "1.2"), mavenBundle("javax.el", "javax.el-api", "3.0.0")); }
new VMOption("-XX:HeapDumpPath=" + heapDumpPath), when(System.getProperty("os.name").toLowerCase().startsWith("linux")).useOptions( when(Boolean.getBoolean(PROFILE_PROP)).useOptions( new VMOption("-XX:+UnlockCommercialFeatures"), new VMOption("-XX:+FlightRecorder"), ), getKarafDistroOption(), when(Boolean.getBoolean(KEEP_UNPACK_DIRECTORY_PROP)).useOptions(keepRuntimeFolder()), configureConsole().ignoreLocalConsole(), logLevel(LogLevel.INFO),
@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(), }; }
when(localRepo.length() > 0).useOptions(systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo))
when(localRepo.length() > 0).useOptions(systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo))
@Configuration public Option[] config() { Option[] options = new Option[] { when(Boolean.getBoolean(KARAF_DEBUG_PROP)) .useOptions(KarafDistributionOption.debugConfiguration(KARAF_DEBUG_PORT, true)), karafDistributionConfiguration().frameworkUrl(getKarafDistro()) .unpackDirectory(new File(PAX_EXAM_UNPACK_DIRECTORY)).useDeployFolder(false), when(Boolean.getBoolean(KEEP_UNPACK_DIRECTORY_PROP)).useOptions(keepRuntimeFolder()), features(getFeatureRepo(), getFeatureName()),
private static Option[] defaultTestSystemOptions() { ConfigurationManager cm = new ConfigurationManager(); String logging = cm.getProperty(Constants.EXAM_LOGGING_KEY, Constants.EXAM_LOGGING_PAX_LOGGING); return new Option[] { bootDelegationPackage("sun.*"), frameworkStartLevel(Constants.START_LEVEL_TEST_BUNDLE), url("link:classpath:META-INF/links/org.ops4j.pax.exam.link").startLevel( START_LEVEL_SYSTEM_BUNDLES), url("link:classpath:META-INF/links/org.ops4j.pax.extender.service.link").startLevel( START_LEVEL_SYSTEM_BUNDLES), when(logging.equals(Constants.EXAM_LOGGING_PAX_LOGGING)).useOptions( url("link:classpath:META-INF/links/org.ops4j.pax.logging.api.link").startLevel( START_LEVEL_SYSTEM_BUNDLES)), url("link:classpath:META-INF/links/org.ops4j.base.link").startLevel( START_LEVEL_SYSTEM_BUNDLES), url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.core.link").startLevel( START_LEVEL_SYSTEM_BUNDLES), url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.extender.link").startLevel( START_LEVEL_SYSTEM_BUNDLES), url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.framework.link").startLevel( START_LEVEL_SYSTEM_BUNDLES), url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.lifecycle.link").startLevel( START_LEVEL_SYSTEM_BUNDLES), url("link:classpath:META-INF/links/org.ops4j.pax.swissbox.tracker.link").startLevel( START_LEVEL_SYSTEM_BUNDLES), url("link:classpath:META-INF/links/org.apache.geronimo.specs.atinject.link") .startLevel(START_LEVEL_SYSTEM_BUNDLES) }; }