felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r907997 - in /felix/trunk/karaf: assembly/src/main/filtered-resources/etc/ itests/src/test/java/org/apache/felix/karaf/shell/itests/ tooling/testing/src/main/java/org/apache/felix/karaf/testing/
Date Tue, 09 Feb 2010 10:50:30 GMT
Author: gnodet
Date: Tue Feb  9 10:50:29 2010
New Revision: 907997

URL: http://svn.apache.org/viewvc?rev=907997&view=rev
Log:
FELIX-2049: extend org.apache.felix.karaf.testing.Helper to emit a karaf-specific execution
environmnent file for pax-runner

Modified:
    felix/trunk/karaf/assembly/src/main/filtered-resources/etc/config.properties
    felix/trunk/karaf/itests/src/test/java/org/apache/felix/karaf/shell/itests/CoreTest.java
    felix/trunk/karaf/itests/src/test/java/org/apache/felix/karaf/shell/itests/FeaturesTest.java
    felix/trunk/karaf/tooling/testing/src/main/java/org/apache/felix/karaf/testing/Helper.java

Modified: felix/trunk/karaf/assembly/src/main/filtered-resources/etc/config.properties
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/assembly/src/main/filtered-resources/etc/config.properties?rev=907997&r1=907996&r2=907997&view=diff
==============================================================================
--- felix/trunk/karaf/assembly/src/main/filtered-resources/etc/config.properties (original)
+++ felix/trunk/karaf/assembly/src/main/filtered-resources/etc/config.properties Tue Feb 
9 10:50:29 2010
@@ -204,10 +204,7 @@
 #   - javax.transaction* is exported with a mandatory attribute 
 jre-1.6=, \
  javax.accessibility, \
- javax.activation, \
  javax.activity, \
- javax.annotation, \
- javax.annotation.processing, \
  javax.crypto, \
  javax.crypto.interfaces, \
  javax.crypto.spec, \
@@ -218,8 +215,6 @@
  javax.imageio.plugins.jpeg, \
  javax.imageio.spi, \
  javax.imageio.stream, \
- javax.jws, \
- javax.jws.soap, \
  javax.lang.model, \
  javax.lang.model.element, \
  javax.lang.model.type, \
@@ -284,12 +279,6 @@
  javax.tools, \
  javax.transaction; javax.transaction.xa; partial=true; mandatory:=partial, \
  javax.xml, \
- javax.xml.bind, \
- javax.xml.bind.annotation, \
- javax.xml.bind.annotation.adapters, \
- javax.xml.bind.attachment, \
- javax.xml.bind.helpers, \
- javax.xml.bind.util, \
  javax.xml.crypto, \
  javax.xml.crypto.dom, \
  javax.xml.crypto.dsig, \
@@ -299,22 +288,12 @@
  javax.xml.datatype, \
  javax.xml.namespace, \
  javax.xml.parsers, \
- javax.xml.soap, \
- javax.xml.stream, \
- javax.xml.stream.events, \
- javax.xml.stream.util, \
  javax.xml.transform, \
  javax.xml.transform.dom, \
  javax.xml.transform.sax, \
  javax.xml.transform.stax, \
  javax.xml.transform.stream, \
  javax.xml.validation, \
- javax.xml.ws, \
- javax.xml.ws.handler, \
- javax.xml.ws.handler.soap, \
- javax.xml.ws.http, \
- javax.xml.ws.soap, \
- javax.xml.ws.spi, \
  javax.xml.xpath, \
  org.ietf.jgss, \
  org.omg.CORBA, \

Modified: felix/trunk/karaf/itests/src/test/java/org/apache/felix/karaf/shell/itests/CoreTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/itests/src/test/java/org/apache/felix/karaf/shell/itests/CoreTest.java?rev=907997&r1=907996&r2=907997&view=diff
==============================================================================
--- felix/trunk/karaf/itests/src/test/java/org/apache/felix/karaf/shell/itests/CoreTest.java
(original)
+++ felix/trunk/karaf/itests/src/test/java/org/apache/felix/karaf/shell/itests/CoreTest.java
Tue Feb  9 10:50:29 2010
@@ -34,6 +34,8 @@
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 import static org.ops4j.pax.exam.OptionUtils.combine;
 
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.workingDirectory;
+
 @RunWith(JUnit4TestRunner.class)
 public class CoreTest extends AbstractIntegrationTest {
 
@@ -109,9 +111,12 @@
     public static Option[] configuration() throws Exception {
         Option[] options = combine(
             // Default karaf environment
-            Helper.getDefaultOptions(),
-            // this is how you set the default log level when using pax logging (logProfile)
-            systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
+            Helper.getDefaultOptions(
+                // this is how you set the default log level when using pax logging (logProfile)
+                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG")),
+
+            workingDirectory("target/paxrunner/core/"),
+
             // Test on both equinox and felix
             equinox(), felix()
         );

Modified: felix/trunk/karaf/itests/src/test/java/org/apache/felix/karaf/shell/itests/FeaturesTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/itests/src/test/java/org/apache/felix/karaf/shell/itests/FeaturesTest.java?rev=907997&r1=907996&r2=907997&view=diff
==============================================================================
--- felix/trunk/karaf/itests/src/test/java/org/apache/felix/karaf/shell/itests/FeaturesTest.java
(original)
+++ felix/trunk/karaf/itests/src/test/java/org/apache/felix/karaf/shell/itests/FeaturesTest.java
Tue Feb  9 10:50:29 2010
@@ -35,6 +35,8 @@
 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.workingDirectory;
+
 @RunWith(JUnit4TestRunner.class)
 public class FeaturesTest extends AbstractIntegrationTest {
 
@@ -55,14 +57,18 @@
     public static Option[] configuration() throws Exception{
         return combine(
             // Default karaf environment
-            Helper.getDefaultOptions(),
-            // this is how you set the default log level when using pax logging (logProfile)
-            systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
+            Helper.getDefaultOptions(
+                // this is how you set the default log level when using pax logging (logProfile)
+                systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG")),
+
             // add two features
             scanFeatures(
                     maven().groupId("org.apache.felix.karaf").artifactId("apache-felix-karaf").type("xml").classifier("features").versionAsInProject(),
                     "obr", "wrapper"
             ),
+
+            workingDirectory("target/paxrunner/features/"),
+            
             // Test on both equinox and felix
             equinox(), felix()
         );

Modified: felix/trunk/karaf/tooling/testing/src/main/java/org/apache/felix/karaf/testing/Helper.java
URL: http://svn.apache.org/viewvc/felix/trunk/karaf/tooling/testing/src/main/java/org/apache/felix/karaf/testing/Helper.java?rev=907997&r1=907996&r2=907997&view=diff
==============================================================================
--- felix/trunk/karaf/tooling/testing/src/main/java/org/apache/felix/karaf/testing/Helper.java
(original)
+++ felix/trunk/karaf/tooling/testing/src/main/java/org/apache/felix/karaf/testing/Helper.java
Tue Feb  9 10:50:29 2010
@@ -32,10 +32,12 @@
 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.wrappedBundle;
 import static org.ops4j.pax.exam.OptionUtils.combine;
+import static org.ops4j.pax.exam.container.def.PaxRunnerOptions.rawPaxRunnerOption;
 
 /**
  * Helper class for setting up a pax-exam test environment for karaf.
@@ -105,11 +107,13 @@
      * Return an array of pax-exam options to correctly configure the osgi
      * framework for karaf.
      *
+     * @param sysOptions test-specific system property options
      * @return default pax-exam options for karaf osgi framework
      */
-    public static Option[] getDefaultConfigOptions() {
+    public static Option[] getDefaultConfigOptions(SystemPropertyOption... sysOptions) {
         return getDefaultConfigOptions(getDefaultSystemOptions(),
-                                       getResource("/org/apache/felix/karaf/testing/config.properties"));
+                                       getResource("/org/apache/felix/karaf/testing/config.properties"),
+                                       sysOptions);
     }
 
     /**
@@ -119,11 +123,13 @@
      *
      * @param sysProps karaf system properties
      * @param configProperties the URL to load the osgi framework properties from
+     * @param sysOptions test-specific system property options
      * @return pax-exam options for karaf osgi framework
      */
-    public static Option[] getDefaultConfigOptions(Properties sysProps, URL configProperties)
{
+    public static Option[] getDefaultConfigOptions(Properties sysProps, URL configProperties,
SystemPropertyOption... sysOptions) {
         // Load props
         Properties configProps = loadProperties(configProperties);
+
         // Set system props
         for (Enumeration e = sysProps.propertyNames(); e.hasMoreElements();) {
             String key = (String) e.nextElement();
@@ -134,17 +140,36 @@
             String name = (String) e.nextElement();
             configProps.setProperty(name, substVars(configProps.getProperty(name), name,
null, configProps));
         }
-        // Transform to sys props options
+        // Transform system properties to VM options
         List<Option> options = new ArrayList<Option>();
+        String vmOptions = "-Dorg.ops4j.pax.exam.rbc.rmi.port=1099";
         for (Enumeration e = configProps.propertyNames(); e.hasMoreElements();) {
             String name = (String) e.nextElement();
             String value = configProps.getProperty(name);
-            value = value.replaceAll("\r", "").replaceAll("\n", "").replaceAll(" ", "");
-            options.add(new SystemPropertyOption(name).value(value));
+            value = align(value);
+            if ("org.osgi.framework.system.packages".equals(name)) {
+                String extra = align(configProps.getProperty("org.osgi.framework.system.packages.extra"));
+                vmOptions = vmOptions + " -D" + name + "=" + value + "," + extra;
+            } else if ("org.osgi.framework.bootdelegation".equals(name)) {
+                options.add(bootDelegationPackages(value));
+            } else {
+                vmOptions = vmOptions + " -D" + name + "=" + value;
+            }
         }
+
+        // add test-specific system properties
+        if (sysOptions != null) {
+            for (SystemPropertyOption sysOption : sysOptions) {
+                vmOptions = vmOptions + " -D" + sysOption.getKey() + "=" + sysOption.getValue();
+            }
+        }
+
         if (configProps.getProperty("org.osgi.framework.startlevel.beginning") != null) {
             options.add(frameworkStartLevel(Integer.parseInt(configProps.getProperty("org.osgi.framework.startlevel.beginning"))));
         }
+
+        options.add(rawPaxRunnerOption("--vmOptions", vmOptions));
+ 
         return options.toArray(new Option[options.size()]);
     }
 
@@ -188,6 +213,7 @@
             options.add(opt);
         }
         options.add(mavenBundle("org.apache.felix.karaf.tooling", "org.apache.felix.karaf.tooling.testing"));
+        options.add(wrappedBundle(maven("org.ops4j.pax.exam", "pax-exam-container-default")));
         // 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
@@ -203,7 +229,17 @@
      * @return an array of pax-exam options
      */
     public static Option[] getDefaultOptions() {
-        return combine(getDefaultConfigOptions(), getDefaultProvisioningOptions());
+        return getDefaultOptions(null);
+    }
+
+    /**
+     * Return an array of options for setting up a pax-exam test environment for karaf.
+     *
+     * @param sysOptions test-specific system property options
+     * @return an array of pax-exam options
+     */
+    public static Option[] getDefaultOptions(SystemPropertyOption... sysOptions) {
+        return combine(getDefaultConfigOptions(sysOptions), getDefaultProvisioningOptions());
     }
 
     /**
@@ -395,4 +431,9 @@
         }
     }
 
+
+    private static String align(String value) {
+        return value != null ? value.replaceAll("\r", "").replaceAll("\n", "").replaceAll("
", "") : "";
+    }
+
 }
\ No newline at end of file



Mime
View raw message