org.ops4j.pax.exam.karaf.options.LogLevelOption Java Examples

The following examples show how to use org.ops4j.pax.exam.karaf.options.LogLevelOption. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ArtemisFeatureTest.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
public static Option[] configure(String... features) {

      ArrayList<String> f = new ArrayList<>();
      f.addAll(Arrays.asList(features));

      Option[] options = new Option[]{karafDistributionConfiguration().frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("tar.gz").versionAsInProject()).unpackDirectory(new File("target/paxexam/unpack/")),

         KarafDistributionOption.keepRuntimeFolder(), logLevel(LogLevelOption.LogLevel.INFO), editConfigurationFilePut("etc/config.properties", "karaf.startlevel.bundle", "50"),
         // [KARAF-6600] Use https URL for Maven Central
         editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg", "org.ops4j.pax.url.mvn.repositories", "https://repo1.maven.org/maven2@id=central, https://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases, https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases"),
         // uncomment this to debug it.
         // debugConfiguration("5005", true),
         features(getArtemisMQKarafFeatureUrl(), f.toArray(new String[f.size()]))};

      return options;
   }
 
Example #2
Source File: PaxExamIT.java    From camelinaction2 with Apache License 2.0 5 votes vote down vote up
@Configuration
public Option[] config() {
    return new Option[]{
            // setup which karaf server we are using
            karafDistributionConfiguration()
                    .frameworkUrl(maven().groupId("org.apache.karaf").artifactId("apache-karaf").version("4.1.2").type("tar.gz"))
                    .karafVersion("4.1.3")
                    .name("Apache Karaf")
                    .useDeployFolder(false)
                    .unpackDirectory(new File("target/karaf")),

            // keep the folder so we can look inside when something fails, eg check the data/logs directory
            keepRuntimeFolder(),

            // Disable the SSH port
            configureConsole().ignoreRemoteShell(),

            // Configure Logging to not be verbose, if you set to DEBUG you see a lot of details
            logLevel(LogLevelOption.LogLevel.WARN),

            // Install JUnit
            junitBundles(),

            // Install base camel features
            features(getCamelKarafFeatureUrl(), "camel", "camel-test"),

            // and use camel-http for testing
            features(getCamelKarafFeatureUrl(), "camel-http4"),

            // install our example feature
            features(maven().groupId("com.camelinaction").artifactId("chapter9-pax-exam").version("2.0.0").classifier("features").type("xml"), "camel-quote")
    };
}
 
Example #3
Source File: AbstractIgniteKarafTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * 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"))
    );
}
 
Example #4
Source File: SouthboundIT.java    From ovsdb with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Option getLoggingOption() {
    return composite(
            editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
                    "log4j.logger.org.opendaylight.ovsdb",
                    LogLevelOption.LogLevel.TRACE.name()),
            super.getLoggingOption());
}
 
Example #5
Source File: CamelWorkitemIntegrationTest.java    From jbpm-work-items with Apache License 2.0 4 votes vote down vote up
@Configuration
public static Option[] configure() {
    return new Option[]{
            // Install Karaf Container
            getKarafDistributionOption(),

            // Don't bother with local console output as it just ends up cluttering the logs
            configureConsole().ignoreLocalConsole(),
            // Force the log level to INFO so we have more details during the test.  It defaults to WARN.
            logLevel(LogLevelOption.LogLevel.DEBUG),

            // Option to be used to do remote debugging
            // debugConfiguration("5005", true),

            loadKieFeatures("jbpm",
                            "drools-module",
                            "jbpm-workitems-camel",
                            "kie-spring"),
            features(getFeaturesUrl("org.apache.karaf.features",
                                    "spring-legacy",
                                    getKarafVersion()),
                     "aries-blueprint-spring"),
            wrappedBundle(mavenBundle().groupId("commons-io").artifactId("commons-io").versionAsInProject()),
            wrappedBundle(mavenBundle().groupId("junit").artifactId("junit").versionAsInProject()),

            // wrap and install junit bundle - the DRL imports a class from it
            // (simulates for instance a bundle with domain classes used in rules)
            wrappedBundle(mavenBundle().groupId("junit").artifactId("junit").versionAsInProject()),

            // Create a bundle with META-INF/spring/kie-beans.xml - this should be processed automatically by Spring
            streamBundle(bundle()
                                 .set(Constants.BUNDLE_MANIFESTVERSION,
                                      "2")
                                 .add("META-INF/spring/workitem-camel-service.xml",
                                      CamelWorkitemIntegrationTest.class.getResource(SPRING_XML_LOCATION))
                                 .add(PROCESS_LOCATION.substring(1),
                                      CamelWorkitemIntegrationTest.class.getResource(PROCESS_LOCATION))
                                 .add(CWD_LOCATION.substring(1),
                                      CamelWorkitemIntegrationTest.class.getResource(CWD_LOCATION))
                                 .set(Constants.IMPORT_PACKAGE,
                                      "org.kie.osgi.spring," +
                                              "org.kie.api," +
                                              "org.kie.api.runtime," +
                                              "org.kie.api.runtime.manager," +
                                              "org.kie.api.runtime.process," +
                                              "org.kie.api.task," +
                                              "org.jbpm.persistence.processinstance," +
                                              "org.jbpm.runtime.manager.impl," +
                                              "org.jbpm.process.instance.impl," +
                                              "org.jbpm.services.task.identity," +
                                              "org.jbpm.services.task.impl.model," +
                                              "org.kie.internal.runtime.manager.context," +
                                              "javax.transaction," +
                                              "javax.persistence," +
                                              "*")
                                 .set(Constants.DYNAMICIMPORT_PACKAGE,
                                      "*")
                                 .set(Constants.BUNDLE_SYMBOLICNAME,
                                      "Test-Kie-Spring-Bundle")
                                 // alternative for enumerating org.kie.aries.blueprint packages in Import-Package:
                                 //.set(Constants.DYNAMICIMPORT_PACKAGE, "*")
                                 .build()).start()
    };
}
 
Example #6
Source File: ServiceTest.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Configuration
public Option[] config() throws URISyntaxException, MalformedURLException {
    MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").versionAsInProject().type("tar.gz");
    if (JavaVersionUtil.getMajorVersion() >= 9) { 
        return new Option[]{
                            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
                            configureSecurity().disableKarafMBeanServerBuilder(),
                            features(getFeaturesFile().toURI().toString(), "scr", "openshift-client"),
                            editConfigurationFileExtend(
                                "etc/org.ops4j.pax.url.mvn.cfg",
                                "org.ops4j.pax.url.mvn.repositories",
                              "https://repo1.maven.org/maven2/"),
                            keepRuntimeFolder(),
                            logLevel(LogLevelOption.LogLevel.INFO),
                            new VMOption("--add-exports=java.base/"
                                + "org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
                            new VMOption("--patch-module"),
                            new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" 
                            + System.getProperty("karaf.version", "4.2.2-SNAPSHOT") + ".jar"),
                            new VMOption("--patch-module"),
                            new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" 
                            + System.getProperty("karaf.version", "4.2.2-SNAPSHOT") + ".jar"),
                            new VMOption("--add-opens"),
                            new VMOption("java.base/java.security=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.base/java.net=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.base/java.lang=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.base/java.util=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
                            new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
                            new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
                            new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
                            new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
                            new VMOption("-classpath"),
                            new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
                        };
    } else {
        return new Option[]{
            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
            configureSecurity().disableKarafMBeanServerBuilder(),
            features(getFeaturesFile().toURI().toString(), "scr", "openshift-client"),
            editConfigurationFileExtend(
                "etc/org.ops4j.pax.url.mvn.cfg",
                "org.ops4j.pax.url.mvn.repositories",
              "https://repo1.maven.org/maven2/"),
            keepRuntimeFolder(),
            logLevel(LogLevelOption.LogLevel.INFO)
        };
    }
}
 
Example #7
Source File: FeatureInstallationTest.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Configuration
public Option[] config() {
    MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").versionAsInProject().type("tar.gz");
    if (JavaVersionUtil.getMajorVersion() >= 9) {
        return new Option[]{
                            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
                            configureSecurity().disableKarafMBeanServerBuilder(),
                            keepRuntimeFolder(),
                            editConfigurationFilePut("etc/system.properties", "features.xml", System.getProperty("features.xml")),
                            editConfigurationFileExtend(
                                "etc/org.ops4j.pax.url.mvn.cfg",
                                "org.ops4j.pax.url.mvn.repositories",
                              "https://repo1.maven.org/maven2/"),
                            logLevel(LogLevelOption.LogLevel.INFO),new VMOption("--add-reads=java.xml=java.logging"),
                            new VMOption("--add-exports=java.base/"
                                + "org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
                            new VMOption("--patch-module"),
                            new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" 
                            + System.getProperty("karaf.version", "4.2.2-SNAPSHOT") + ".jar"),
                            new VMOption("--patch-module"),
                            new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" 
                            + System.getProperty("karaf.version", "4.2.2-SNAPSHOT") + ".jar"),
                            new VMOption("--add-opens"),
                            new VMOption("java.base/java.security=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.base/java.net=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.base/java.lang=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.base/java.util=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
                            new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
                            new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
                            new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
                            new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
                            new VMOption("-classpath"),
                            new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
                        };
    } else {
        return new Option[]{
            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
            configureSecurity().disableKarafMBeanServerBuilder(),
            keepRuntimeFolder(),
            editConfigurationFilePut("etc/system.properties", "features.xml", System.getProperty("features.xml")),
            editConfigurationFileExtend(
                "etc/org.ops4j.pax.url.mvn.cfg",
                "org.ops4j.pax.url.mvn.repositories",
              "https://repo1.maven.org/maven2/"),
            logLevel(LogLevelOption.LogLevel.INFO),
        };
    }
}
 
Example #8
Source File: PropertiesOverrideTest.java    From kubernetes-client with Apache License 2.0 4 votes vote down vote up
@Configuration
public Option[] config() throws URISyntaxException, MalformedURLException {
    MavenArtifactUrlReference karafUrl = maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal").versionAsInProject().type("tar.gz");
    if (JavaVersionUtil.getMajorVersion() >= 9) {
        return new Option[]{
                            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
                            configureSecurity().disableKarafMBeanServerBuilder(),
                            features(getFeaturesFile().toURI().toURL().toString(), "scr", "openshift-client"),
                            editConfigurationFileExtend(
                                "etc/org.ops4j.pax.url.mvn.cfg",
                                "org.ops4j.pax.url.mvn.repositories",
                              "https://repo1.maven.org/maven2/"),
                            keepRuntimeFolder(),
                            systemProperty("kubernetes.namespace").value("my-namespace"),
                            systemProperty("kubernetes.master").value("http://my.kube.master:8443"),
                            systemProperty("kubernetes.auth.tryKubeConfig").value("false"),
                            logLevel(LogLevelOption.LogLevel.DEBUG),
                            new VMOption("--add-exports=java.base/"
                                + "org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
                            new VMOption("--patch-module"),
                            new VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" 
                            + System.getProperty("karaf.version", "4.2.2-SNAPSHOT") + ".jar"),
                            new VMOption("--patch-module"),
                            new VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" 
                            + System.getProperty("karaf.version", "4.2.2-SNAPSHOT") + ".jar"),
                            new VMOption("--add-opens"),
                            new VMOption("java.base/java.security=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.base/java.net=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.base/java.lang=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.base/java.util=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.naming/javax.naming.spi=ALL-UNNAMED"),
                            new VMOption("--add-opens"),
                            new VMOption("java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"),
                            new VMOption("--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED"),
                            new VMOption("--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED"),
                            new VMOption("--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED"),
                            new VMOption("--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED"),
                            new VMOption("-classpath"),
                            new VMOption("lib/jdk9plus/*" + File.pathSeparator + "lib/boot/*")
        };
        
    } else {
        return new Option[]{
            karafDistributionConfiguration().frameworkUrl(karafUrl).name("Apache Karaf").unpackDirectory(new File("target/exam")),
            configureSecurity().disableKarafMBeanServerBuilder(),
            features(getFeaturesFile().toURI().toURL().toString(), "scr", "openshift-client"),
            editConfigurationFileExtend(
                "etc/org.ops4j.pax.url.mvn.cfg",
                "org.ops4j.pax.url.mvn.repositories",
              "https://repo1.maven.org/maven2/"),
            keepRuntimeFolder(),
            systemProperty("kubernetes.namespace").value("my-namespace"),
            systemProperty("kubernetes.master").value("http://my.kube.master:8443"),
            systemProperty("kubernetes.auth.tryKubeConfig").value("false"),
            logLevel(LogLevelOption.LogLevel.DEBUG),
        };
    }
}