Add support for karaf.debug and karaf.keep.unpack 83/26983/2
authorStephen Kitt <skitt@redhat.com>
Tue, 15 Sep 2015 13:43:29 +0000 (15:43 +0200)
committerFlavio Fernandes <ffernand@redhat.com>
Tue, 15 Sep 2015 20:55:49 +0000 (16:55 -0400)
This is the basic version, a better approach would be to use either
AbstractMdsalTestBase or AbstractConfigTestBase (but the impact is
greater).

Patch set 2: use constants instead of bare strings

Change-Id: I8c54da0892c8e969c838edb20902ba123065782c
Signed-off-by: Stephen Kitt <skitt@redhat.com>
integration/test/src/test/java/org/opendaylight/neutron/e2etest/ITNeutronE2E.java

index dd4ac606398a03633b9f38f31651780830e78581..eae9e06c5a3eb0f864172b3352a0ed95358b6db4 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.neutron.e2etest;
 
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.CoreOptions.vmOption;
+import static org.ops4j.pax.exam.CoreOptions.when;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.debugConfiguration;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
@@ -34,12 +35,17 @@ import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.junit.PaxExam;
 
+import org.ops4j.pax.exam.karaf.options.KarafDistributionOption;
 import org.osgi.framework.BundleContext;
 import org.osgi.service.cm.ConfigurationAdmin;
 
 @RunWith(PaxExam.class)
 public class ITNeutronE2E {
 
+    private static final String KARAF_DEBUG_PORT = "5005";
+    private static final String KARAF_DEBUG_PROP = "karaf.debug";
+    private static final String KEEP_UNPACK_DIRECTORY_PROP = "karaf.keep.unpack";
+
     @Inject
     private BundleContext bundleContext;
 
@@ -52,6 +58,8 @@ public class ITNeutronE2E {
             // Provision and launch a container based on a distribution of Karaf (Apache ServiceMix).
             // FIXME: need to *NOT* hardcode the version here - it breaks on
             // version bumps
+            when(Boolean.getBoolean(KARAF_DEBUG_PROP))
+                    .useOptions(KarafDistributionOption.debugConfiguration(KARAF_DEBUG_PORT, true)),
             karafDistributionConfiguration()
                 .frameworkUrl(
                     maven()
@@ -66,7 +74,7 @@ public class ITNeutronE2E {
        // It is really nice if the container sticks around after the test so you can check the contents
        // of the data directory when things go wrong.
             vmOption("-javaagent:../jars/org.jacoco.agent.jar=destfile=jacoco-it.exec"),
-            keepRuntimeFolder(),
+            when(Boolean.getBoolean(KEEP_UNPACK_DIRECTORY_PROP)).useOptions(keepRuntimeFolder()),
        // 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.