diff --git a/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/KarafTestContainer.java b/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/KarafTestContainer.java
index ba1b6091a..96d80a84d 100644
--- a/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/KarafTestContainer.java
+++ b/containers/pax-exam-container-karaf/src/main/java/org/ops4j/pax/exam/karaf/container/internal/KarafTestContainer.java
@@ -96,6 +96,14 @@
public class KarafTestContainer implements TestContainer {
+ private static final String[] configs = {
+ "config.properties",
+ "system.properties",
+ "org.apache.karaf.features.cfg",
+ "org.apache.karaf.management.cfg",
+ "org.ops4j.pax.logging.cfg"
+ };
+
private static final Logger LOGGER = LoggerFactory.getLogger(KarafTestContainer.class);
private static final String KARAF_TEST_CONTAINER = "KarafTestContainer.start";
@@ -222,11 +230,10 @@ public synchronized TestContainer start() {
private void backupConfigFiles() {
try {
- File karafEtc = new File(karafBase, framework.getKarafEtc());
- FileUtils.copyFile(new File(karafEtc, "config.properties"), new File(karafEtc, "config.properties.paxexam"));
- FileUtils.copyFile(new File(karafEtc, "system.properties"), new File(karafEtc, "system.properties.paxexam"));
- FileUtils.copyFile(new File(karafEtc, "org.apache.karaf.features.cfg"), new File(karafEtc, "org.apache.karaf.features.cfg.paxexam"));
- FileUtils.copyFile(new File(karafEtc, "org.ops4j.pax.logging.cfg"), new File(karafEtc, "org.ops4j.pax.logging.cfg.paxexam"));
+ final File karafEtc = new File(karafBase, framework.getKarafEtc());
+ for (final String config : configs) {
+ FileUtils.copyFile(new File(karafEtc, config), new File(karafEtc, config.concat(".paxexam")));
+ }
} catch (Exception e) {
LOGGER.warn("Can't backup config files", e);
}
@@ -234,11 +241,10 @@ private void backupConfigFiles() {
private void restoreConfigFiles() {
try {
- File karafEtc = new File(karafBase, framework.getKarafEtc());
- FileUtils.copyFile(new File(karafEtc, "config.properties.paxexam"), new File(karafEtc, "config.properties"));
- FileUtils.copyFile(new File(karafEtc, "system.properties.paxexam"), new File(karafEtc, "system.properties"));
- FileUtils.copyFile(new File(karafEtc, "org.apache.karaf.features.cfg.paxexam"), new File(karafEtc, "org.apache.karaf.features.cfg"));
- FileUtils.copyFile(new File(karafEtc, "org.ops4j.pax.logging.cfg.paxexam"), new File(karafEtc, "org.ops4j.pax.logging.cfg"));
+ final File karafEtc = new File(karafBase, framework.getKarafEtc());
+ for (final String config : configs) {
+ FileUtils.copyFile(new File(karafEtc, config.concat(".paxexam")), new File(karafEtc, config));
+ }
} catch (Exception e) {
LOGGER.warn("Can't restore config files", e);
}
@@ -303,8 +309,7 @@ private void startKaraf(ExamSystem subsystem, File karafBase, File karafHome) {
+ subsystem.getTimeout());
if (subsystem.getOptions(ServerModeOption.class).length == 0) {
- waitForState(org.ops4j.pax.exam.karaf.container.internal.Constants.SYSTEM_BUNDLE,
- Bundle.ACTIVE, subsystem.getTimeout());
+ waitForState(Constants.SYSTEM_BUNDLE, Bundle.ACTIVE, subsystem.getTimeout());
}
else {
LOGGER
diff --git a/containers/pax-exam-container-karaf/src/test/java/org/ops4j/pax/exam/karaf/container/AbstractKarafTestContainerIT.java b/containers/pax-exam-container-karaf/src/test/java/org/ops4j/pax/exam/karaf/container/AbstractKarafTestContainerIT.java
index 4b47888fc..4d70b5dff 100644
--- a/containers/pax-exam-container-karaf/src/test/java/org/ops4j/pax/exam/karaf/container/AbstractKarafTestContainerIT.java
+++ b/containers/pax-exam-container-karaf/src/test/java/org/ops4j/pax/exam/karaf/container/AbstractKarafTestContainerIT.java
@@ -14,17 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.ops4j.pax.exam.karaf.container;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.Assert.assertThat;
-import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
-
import java.io.File;
import javax.inject.Inject;
@@ -41,49 +32,67 @@
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
+
@RunWith(PaxExam.class)
public abstract class AbstractKarafTestContainerIT {
- private final MavenArtifactUrlReference KARAF_URL = maven("org.apache.karaf", "apache-karaf").type("zip");
+ protected static final File UNPACK_DIRECTORY = new File("target/paxexam/unpack/");
+
+ protected static final MavenArtifactUrlReference KARAF_URL = maven("org.apache.karaf", "apache-karaf").type("zip");
@Inject
- private BundleContext bc;
+ private BundleContext bundleContext;
@Configuration
public Option[] config() {
- String karafVersion = karafVersion();
- return new Option[] {
- karafDistributionConfiguration().frameworkUrl(KARAF_URL.version(karafVersion))
- .karafVersion(karafVersion).useDeployFolder(false).unpackDirectory(new File("target/paxexam/unpack/")),
- configureConsole().startLocalConsole().ignoreRemoteShell(), logLevel(LogLevel.INFO)
- };
+ final String karafVersion = karafVersion();
+ return options(
+ karafDistributionConfiguration().
+ frameworkUrl(KARAF_URL.version(karafVersion)).
+ karafVersion(karafVersion).
+ useDeployFolder(false).
+ unpackDirectory(UNPACK_DIRECTORY),
+ configureConsole().
+ startLocalConsole().
+ ignoreRemoteShell(),
+ logLevel(LogLevel.DEBUG),
+ keepRuntimeFolder()
+ );
}
public String karafVersion() {
- ConfigurationManager cm = new ConfigurationManager();
- String karafVersion = cm.getProperty("pax.exam.karaf.version", getDefaultKarafVersion());
- return karafVersion;
+ final ConfigurationManager cm = new ConfigurationManager();
+ return cm.getProperty("pax.exam.karaf.version", getDefaultKarafVersion());
}
- protected abstract String getDefaultKarafVersion();
+ protected String getDefaultKarafVersion() {
+ return "4.4.3";
+ }
@Test
- public void checkKarafSystemService() throws Exception {
- assertThat(bc, is(notNullValue()));
- ServiceReference> serviceRef = bc
- .getServiceReference("org.apache.karaf.system.SystemService");
- Object service = bc.getService(serviceRef);
+ public void checkKarafSystemService() {
+ assertThat(bundleContext, is(notNullValue()));
+ final ServiceReference> serviceRef = bundleContext.getServiceReference("org.apache.karaf.system.SystemService");
+ final Object service = bundleContext.getService(serviceRef);
assertThat(service, is(notNullValue()));
}
-
- public Bundle findBundle(String symbolicName) {
- Bundle[] bundles = bc.getBundles();
- for (Bundle bundle : bundles) {
+
+ public Bundle findBundle(final String symbolicName) {
+ final Bundle[] bundles = bundleContext.getBundles();
+ for (final Bundle bundle : bundles) {
if (bundle.getSymbolicName().equals(symbolicName)) {
return bundle;
}
}
-
return null;
}
diff --git a/containers/pax-exam-container-karaf/src/test/java/org/ops4j/pax/exam/karaf/container/Karaf4EmbeddedTestContainerIT.java b/containers/pax-exam-container-karaf/src/test/java/org/ops4j/pax/exam/karaf/container/Karaf4EmbeddedTestContainerIT.java
index 5b9336832..f517d74c6 100644
--- a/containers/pax-exam-container-karaf/src/test/java/org/ops4j/pax/exam/karaf/container/Karaf4EmbeddedTestContainerIT.java
+++ b/containers/pax-exam-container-karaf/src/test/java/org/ops4j/pax/exam/karaf/container/Karaf4EmbeddedTestContainerIT.java
@@ -18,32 +18,32 @@
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption;
-import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
-import java.io.File;
-
-import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.*;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureConsole;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.logLevel;
public class Karaf4EmbeddedTestContainerIT extends AbstractKarafTestContainerIT {
- private final MavenArtifactUrlReference KARAF_URL = maven("org.apache.karaf", "apache-karaf").type("zip");
-
- @Override
- protected String getDefaultKarafVersion() {
- return "4.2.8";
- }
-
@Configuration
public Option[] config() {
String karafVersion = karafVersion();
- return new Option[] {
- karafDistributionConfiguration().runEmbedded(true).frameworkUrl(KARAF_URL.version(karafVersion))
- .karafVersion(karafVersion).useDeployFolder(false).unpackDirectory(new File("target/paxexam/unpack/")),
- configureConsole().startLocalConsole().ignoreRemoteShell(), logLevel(LogLevelOption.LogLevel.INFO)
- };
+ return options(
+ karafDistributionConfiguration().
+ runEmbedded(true).
+ frameworkUrl(KARAF_URL.version(karafVersion)).
+ karafVersion(karafVersion).
+ useDeployFolder(false).
+ unpackDirectory(UNPACK_DIRECTORY),
+ configureConsole().
+ startLocalConsole().
+ ignoreRemoteShell(),
+ logLevel(LogLevel.DEBUG),
+ keepRuntimeFolder()
+ );
}
}
diff --git a/containers/pax-exam-container-karaf/src/test/java/org/ops4j/pax/exam/karaf/container/Karaf4TestContainerIT.java b/containers/pax-exam-container-karaf/src/test/java/org/ops4j/pax/exam/karaf/container/Karaf4TestContainerIT.java
index 460172217..7db8002f4 100644
--- a/containers/pax-exam-container-karaf/src/test/java/org/ops4j/pax/exam/karaf/container/Karaf4TestContainerIT.java
+++ b/containers/pax-exam-container-karaf/src/test/java/org/ops4j/pax/exam/karaf/container/Karaf4TestContainerIT.java
@@ -14,13 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.ops4j.pax.exam.karaf.container;
public class Karaf4TestContainerIT extends AbstractKarafTestContainerIT {
- @Override
- protected String getDefaultKarafVersion() {
- return "4.2.8";
- }
}
diff --git a/pom/pom.xml b/pom/pom.xml
index 7d986805c..a99d1b0dc 100644
--- a/pom/pom.xml
+++ b/pom/pom.xml
@@ -33,7 +33,7 @@
1.5.1
4.1.1
4.5.13
- 4.2.8
+ 4.4.3
1.2.3