You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by pi...@apache.org on 2010/12/30 07:58:32 UTC

svn commit: r1053811 - /karaf/branches/karaf-2.1.x/tooling/testing/src/main/java/org/apache/karaf/testing/Helper.java

Author: pieber
Date: Thu Dec 30 06:58:32 2010
New Revision: 1053811

URL: http://svn.apache.org/viewvc?rev=1053811&view=rev
Log:
[KARAF-329] added util methods

Modified:
    karaf/branches/karaf-2.1.x/tooling/testing/src/main/java/org/apache/karaf/testing/Helper.java

Modified: karaf/branches/karaf-2.1.x/tooling/testing/src/main/java/org/apache/karaf/testing/Helper.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.1.x/tooling/testing/src/main/java/org/apache/karaf/testing/Helper.java?rev=1053811&r1=1053810&r2=1053811&view=diff
==============================================================================
--- karaf/branches/karaf-2.1.x/tooling/testing/src/main/java/org/apache/karaf/testing/Helper.java (original)
+++ karaf/branches/karaf-2.1.x/tooling/testing/src/main/java/org/apache/karaf/testing/Helper.java Thu Dec 30 06:58:32 2010
@@ -33,14 +33,17 @@ import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.options.JUnitBundlesOption;
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
+import org.ops4j.pax.exam.container.def.options.FeaturesScannerProvisionOption;
 import org.ops4j.pax.exam.options.SystemPropertyOption;
 
 import static org.ops4j.pax.exam.CoreOptions.bootClasspathLibrary;
 import static org.ops4j.pax.exam.CoreOptions.bootDelegationPackages;
 import static org.ops4j.pax.exam.CoreOptions.frameworkStartLevel;
 import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
 import static org.ops4j.pax.exam.OptionUtils.combine;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.scanFeatures;
 import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption;
 
 /**
@@ -301,6 +304,39 @@ public final class Helper {
     }
 
     /**
+     * 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);
+    }
+
+    /**
+     * Method to directly register Karaf features.
+     *
+     * @param features a list of features which should be loaded from the Karaf feature file.
+     * @return a pax-exam option
+     */
+    public static FeaturesScannerProvisionOption loadKarafFeatures(String... features) {
+        return scanFeatures(
+            maven().groupId("org.apache.karaf").artifactId("apache-karaf").type("xml").classifier("features")
+                .versionAsInProject(), features);
+    }
+
+    /**
+     * Returns the vmOption to configure pax exam with debugging support.
+     *
+     * @param debuggingPort the port where the remote debugger should be allowed to be attached
+     * @return the option to enable debugging
+     */
+    public static Option activateDebugging(String debuggingPort) {
+        return vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=" + debuggingPort);
+    }
+
+    /**
      * Retrieve the pax-exam option for provisioning the given maven bundle.
      *
      * @param options the list of pax-exam options