You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2012/09/06 16:55:33 UTC
svn commit: r1381632 [2/3] - in /karaf/branches/karaf-2.3.x: ./ itests/
itests/dependencies/ itests/kittests/
itests/kittests/src/test/java/org/apache/karaf/kittests/ itests/tests/
itests/tests/src/test/java/org/apache/karaf/shell/itests/ itests/tests/...
Added: karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/BaseScriptRunner.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/BaseScriptRunner.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/BaseScriptRunner.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/BaseScriptRunner.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.container.internal.runner;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Abstract implementation of the script runner containing the entire self repeating code.
+ */
+public abstract class BaseScriptRunner implements Runner {
+
+ protected InternalRunner runner;
+ protected List<String> makeExec = new ArrayList<String>();
+ protected String exec;
+
+ public BaseScriptRunner(List<String> makeExec, String exec) {
+ this.makeExec = makeExec;
+ this.exec = exec;
+ runner = new InternalRunner();
+ }
+
+ @Override
+ public void exec(final String[] environment, final File karafBase, String javaHome, String[] javaOpts,
+ String[] javaEndorsedDirs, String[] javaExtDirs, String karafHome,
+ String karafData, String[] karafOpts, String[] opts, String[] classPath, String main, String options) {
+ makeEnvironmentExecutable(karafBase);
+ startSystem(environment, karafBase);
+ }
+
+ private void startSystem(final String[] environment, final File karafBase) {
+ new Thread("KarafJavaRunner") {
+ @Override
+ public void run() {
+ CommandLineBuilder commandLine = createCommandLine(environment, karafBase);
+ runner.exec(commandLine, karafBase, environment);
+ }
+ }.start();
+ }
+
+ protected abstract CommandLineBuilder createCommandLine(final String[] environment, final File karafBase);
+
+ private void makeEnvironmentExecutable(final File karafBase) {
+ new File(karafBase, exec).setExecutable(true);
+ for (String execEntry : makeExec) {
+ new File(karafBase, execEntry).setExecutable(true);
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ runner.shutdown();
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/CommandLineBuilder.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/CommandLineBuilder.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/CommandLineBuilder.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/CommandLineBuilder.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.container.internal.runner;
+
+public class CommandLineBuilder {
+
+ /**
+ * The command line array.
+ */
+ private String[] m_commandLine;
+
+ /**
+ * Creates a new command line builder.
+ */
+ public CommandLineBuilder() {
+ m_commandLine = new String[0];
+ }
+
+ /**
+ * Appends an array of strings to command line.
+ *
+ * @param segments array to append
+ *
+ * @return CommandLineBuilder for fluent api
+ */
+ public CommandLineBuilder append(final String[] segments) {
+ if (segments != null && segments.length > 0) {
+ final String[] command = new String[m_commandLine.length + segments.length];
+ System.arraycopy(m_commandLine, 0, command, 0, m_commandLine.length);
+ System.arraycopy(segments, 0, command, m_commandLine.length, segments.length);
+ m_commandLine = command;
+ }
+ return this;
+ }
+
+ /**
+ * Appends a string to command line.
+ *
+ * @param segment string to append
+ *
+ * @return CommandLineBuilder for fluent api
+ */
+ public CommandLineBuilder append(final String segment) {
+ if (segment != null && !segment.isEmpty()) {
+ return append(new String[]{ segment });
+ }
+ return this;
+ }
+
+ /**
+ * Returns the command line.
+ *
+ * @return command line
+ */
+ public String[] toArray() {
+ return m_commandLine;
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/InternalRunner.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/InternalRunner.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/InternalRunner.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/InternalRunner.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.container.internal.runner;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.ops4j.io.Pipe;
+
+public class InternalRunner {
+
+ private Process m_frameworkProcess;
+ private Thread m_shutdownHook;
+
+ public synchronized void exec(CommandLineBuilder commandLine, final File workingDirectory,
+ final String[] envOptions) {
+ if (m_frameworkProcess != null) {
+ throw new IllegalStateException("Platform already started");
+ }
+
+ try {
+ m_frameworkProcess =
+ Runtime.getRuntime().exec(commandLine.toArray(), createEnvironmentVars(envOptions),
+ workingDirectory);
+ } catch (IOException e) {
+ throw new IllegalStateException("Could not start up the process", e);
+ }
+
+ m_shutdownHook = createShutdownHook(m_frameworkProcess);
+ Runtime.getRuntime().addShutdownHook(m_shutdownHook);
+
+ waitForExit();
+ }
+
+ private String[] createEnvironmentVars(String[] envOptions) {
+ List<String> env = new ArrayList<String>();
+ Map<String, String> getenv = System.getenv();
+ for (String key : getenv.keySet()) {
+ env.add(key + "=" + getenv.get(key));
+ }
+ if (envOptions != null) {
+ Collections.addAll(env, envOptions);
+ }
+ return env.toArray(new String[env.size()]);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void shutdown() {
+ try {
+ if (m_shutdownHook != null) {
+ synchronized (m_shutdownHook) {
+ if (m_shutdownHook != null) {
+ Runtime.getRuntime().removeShutdownHook(m_shutdownHook);
+ m_frameworkProcess = null;
+ m_shutdownHook.run();
+ m_shutdownHook = null;
+ }
+ }
+ }
+ } catch (IllegalStateException ignore) {
+ // ignore
+ }
+ }
+
+ /**
+ * Wait till the framework process exits.
+ */
+ public void waitForExit() {
+ synchronized (m_frameworkProcess) {
+ try
+ {
+ m_frameworkProcess.waitFor();
+ shutdown();
+ } catch (Throwable e)
+ {
+ shutdown();
+ }
+ }
+ }
+
+ /**
+ * Create helper thread to safely shutdown the external framework process
+ *
+ * @param process framework process
+ *
+ * @return stream handler
+ */
+ private Thread createShutdownHook(final Process process) {
+ final Pipe errPipe = new Pipe(process.getErrorStream(), System.err).start("Error pipe");
+ final Pipe outPipe = new Pipe(process.getInputStream(), System.out).start("Out pipe");
+ final Pipe inPipe = new Pipe(process.getOutputStream(), System.in).start("In pipe");
+
+ return new Thread(
+ new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ inPipe.stop();
+ outPipe.stop();
+ errPipe.stop();
+
+ try
+ {
+ process.destroy();
+ }
+ catch (Exception e)
+ {
+ // ignore if already shutting down
+ }
+ }
+ },
+ "Pax-Runner shutdown hook");
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/KarafJavaRunner.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/KarafJavaRunner.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/KarafJavaRunner.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/KarafJavaRunner.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.container.internal.runner;
+
+import java.io.File;
+
+/**
+ * Very simple asynchronous implementation of Java Runner. Exec is being invoked in a fresh Thread.
+ */
+public class KarafJavaRunner implements Runner {
+
+ private InternalRunner runner;
+
+ public KarafJavaRunner() {
+ runner = new InternalRunner();
+ }
+
+ @Override
+ public synchronized void
+ exec(final String[] environment, final File karafBase, final String javaHome, final String[] javaOpts,
+ final String[] javaEndorsedDirs,
+ final String[] javaExtDirs, final String karafHome, final String karafData, final String[] karafOpts,
+ final String[] opts, final String[] classPath, final String main, final String options) {
+ new Thread("KarafJavaRunner") {
+ @Override
+ public void run() {
+ String cp = buildCmdSeparatedString(classPath);
+ String endDirs = buildCmdSeparatedString(javaEndorsedDirs);
+ String extDirs = buildCmdSeparatedString(javaExtDirs);
+ final CommandLineBuilder commandLine = new CommandLineBuilder()
+ .append(getJavaExecutable(javaHome))
+ .append(javaOpts)
+ .append("-Djava.endorsed.dirs=" + endDirs)
+ .append("-Djava.ext.dirs=" + extDirs)
+ .append("-Dkaraf.instances=" + karafHome + "/instances")
+ .append("-Dkaraf.home=" + karafHome)
+ .append("-Dkaraf.base=" + karafBase)
+ .append("-Dkaraf.data=" + karafData)
+ .append("-Djava.util.logging.config.file=" + karafBase + "/etc/java.util.logging.properties")
+ .append(karafOpts)
+ .append(opts)
+ .append("-cp")
+ .append(cp)
+ .append(main)
+ .append(options);
+ runner.exec(commandLine, karafBase, environment);
+ }
+
+ private String buildCmdSeparatedString(final String[] splitted) {
+ final StringBuilder together = new StringBuilder();
+ for (String path : splitted)
+ {
+ if (together.length() != 0)
+ {
+ together.append(File.pathSeparator);
+ }
+ together.append(path);
+ }
+ return together.toString();
+ }
+
+ private String getJavaExecutable(final String javaHome)
+ {
+ if (javaHome == null)
+ {
+ throw new IllegalStateException("JAVA_HOME is not set.");
+ }
+ return javaHome + "/bin/java";
+ }
+ }.start();
+ }
+
+ @Override
+ public synchronized void shutdown() {
+ runner.shutdown();
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/NixRunner.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/NixRunner.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/NixRunner.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/NixRunner.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.container.internal.runner;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * Runner implementation starting Karaf based distributions no unix based systems like linux, mac, ...
+ */
+public class NixRunner extends BaseScriptRunner {
+
+ public NixRunner(List<String> makeExec, String exec) {
+ super(makeExec, exec);
+ }
+
+ @Override
+ protected CommandLineBuilder createCommandLine(String[] environment, File karafBase) {
+ CommandLineBuilder commandLine = new CommandLineBuilder()
+ .append("/bin/sh")
+ .append(new File(karafBase, exec).getAbsolutePath());
+ return commandLine;
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/Runner.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/Runner.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/Runner.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/Runner.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.container.internal.runner;
+
+import java.io.File;
+
+/**
+ * Abstracts the runner to be able to add different runners easier.
+ */
+public interface Runner {
+
+ /**
+ * Starts the environment in the specific environment.
+ */
+ public abstract void
+ exec(final String[] environment, final File karafBase, final String javaHome, final String[] javaOpts,
+ final String[] javaEndorsedDirs,
+ final String[] javaExtDirs, final String karafHome, final String karafData, final String[] karafOpts,
+ final String[] opts, final String[] classPath, final String main, final String options);
+
+ /**
+ * Shutdown the runner again.
+ */
+ public abstract void shutdown();
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/WindowsRunner.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/WindowsRunner.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/WindowsRunner.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/container/src/main/java/org/apache/karaf/tooling/exam/container/internal/runner/WindowsRunner.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.container.internal.runner;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * Runner to start the Karaf platform on microsoft windows systems.
+ */
+public class WindowsRunner extends BaseScriptRunner {
+
+ public WindowsRunner(List<String> makeExec, String exec) {
+ super(makeExec, exec);
+ }
+
+ @Override
+ protected CommandLineBuilder createCommandLine(String[] environment, File karafBase) {
+ CommandLineBuilder commandLine = new CommandLineBuilder()
+ .append("cmd.exe")
+ .append("/c")
+ .append(new File(karafBase, exec).getAbsolutePath());
+ return commandLine;
+ }
+
+}
Copied: karaf/branches/karaf-2.3.x/tooling/exam/options/NOTICE (from r1380213, karaf/branches/karaf-2.3.x/itests/NOTICE)
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/NOTICE?p2=karaf/branches/karaf-2.3.x/tooling/exam/options/NOTICE&p1=karaf/branches/karaf-2.3.x/itests/NOTICE&r1=1380213&r2=1381632&rev=1381632&view=diff
==============================================================================
(empty)
Copied: karaf/branches/karaf-2.3.x/tooling/exam/options/pom.xml (from r1380213, karaf/branches/karaf-2.3.x/itests/dependencies/pom.xml)
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/pom.xml?p2=karaf/branches/karaf-2.3.x/tooling/exam/options/pom.xml&p1=karaf/branches/karaf-2.3.x/itests/dependencies/pom.xml&r1=1380213&r2=1381632&rev=1381632&view=diff
==============================================================================
--- karaf/branches/karaf-2.3.x/itests/dependencies/pom.xml (original)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/pom.xml Thu Sep 6 14:55:30 2012
@@ -22,27 +22,38 @@
<modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.karaf.itests</groupId>
- <artifactId>itests</artifactId>
+ <groupId>org.apache.karaf.tooling.exam</groupId>
+ <artifactId>exam</artifactId>
<version>2.3.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
- <artifactId>dependencies</artifactId>
- <packaging>pom</packaging>
- <name>Apache Karaf :: Integration Tests :: Dependencies</name>
+ <groupId>org.apache.karaf.tooling.exam</groupId>
+ <artifactId>org.apache.karaf.tooling.exam.options</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Karaf :: Tooling :: Exam Testing Framework :: Options</name>
<dependencies>
<dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.main</artifactId>
- <version>4.0.2</version>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-default</artifactId>
- <version>${pax.exam.version}</version>
+ <groupId>org.ops4j.pax.exam</groupId>
+ <artifactId>pax-exam</artifactId>
</dependency>
</dependencies>
-</project>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Version>${project.version}</Bundle-Version>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/ConfigurationPointer.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/ConfigurationPointer.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/ConfigurationPointer.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/ConfigurationPointer.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+/**
+ * Bundled configuration for making it easily static accessible via classes.
+ */
+public class ConfigurationPointer {
+
+ private String configurationFilePath;
+ private String key;
+
+ public ConfigurationPointer(String configurationFilePath, String key) {
+ this.configurationFilePath = configurationFilePath;
+ this.key = key;
+ }
+
+ public String getConfigurationFilePath() {
+ return configurationFilePath;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/DoNotModifyLogOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/DoNotModifyLogOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/DoNotModifyLogOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/DoNotModifyLogOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+import org.ops4j.pax.exam.Option;
+
+/**
+ * The Karaf pax-logging configuration is typically not a file manipulated very often. Therefore we take the freedom
+ * of adding a console logger and changing the log level directly. If you want to configure the file manually (or had
+ * so in your distribution) add this option to avoid any automatic modifications to this file.
+ */
+public class DoNotModifyLogOption implements Option {
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/ExamBundlesStartLevel.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/ExamBundlesStartLevel.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/ExamBundlesStartLevel.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/ExamBundlesStartLevel.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+import org.ops4j.pax.exam.Option;
+
+/**
+ * This option allows to configure the start level of the bundles in the exam features descriptor.
+ */
+public class ExamBundlesStartLevel implements Option {
+
+ private final int startLevel;
+
+ /**
+ * Sets the start level of the bundles in the generated exam features descriptor.
+ * @param startLevel
+ */
+ public ExamBundlesStartLevel(int startLevel) {
+ this.startLevel = startLevel;
+ }
+
+ public int getStartLevel() {
+ return startLevel;
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionBaseConfigurationOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionBaseConfigurationOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionBaseConfigurationOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionBaseConfigurationOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+
+import java.io.File;
+
+public class KarafDistributionBaseConfigurationOption implements Option {
+
+ protected String frameworkUrl;
+ protected MavenUrlReference frameworkUrlReference;
+ protected String name;
+ protected String karafVersion;
+ protected File unpackDirectory;
+ protected boolean useDeployFolder = true;
+
+ public KarafDistributionBaseConfigurationOption() {
+ frameworkUrl = null;
+ frameworkUrlReference = null;
+ name = null;
+ karafVersion = null;
+ }
+
+ public KarafDistributionBaseConfigurationOption(String frameworkUrl, String name, String karafVersion) {
+ this.frameworkUrl = frameworkUrl;
+ frameworkUrlReference = null;
+ this.name = name;
+ this.karafVersion = karafVersion;
+ }
+
+ public KarafDistributionBaseConfigurationOption(MavenUrlReference frameworkUrlReference, String name, String karafVersion) {
+ frameworkUrl = null;
+ this.frameworkUrlReference = frameworkUrlReference;
+ this.name = name;
+ this.karafVersion = karafVersion;
+ }
+
+ public KarafDistributionBaseConfigurationOption(MavenUrlReference frameworkUrlReference) {
+ frameworkUrl = null;
+ this.frameworkUrlReference = frameworkUrlReference;
+ }
+
+ /**
+ * Simply clone the inserted {@link KarafDistributionBaseConfigurationOption}
+ *
+ * @param base the <code>KarafDistributionBaseConfigurationOption</code> to clone.
+ */
+ public KarafDistributionBaseConfigurationOption(KarafDistributionBaseConfigurationOption base) {
+ frameworkUrl = base.frameworkUrl;
+ frameworkUrlReference = base.frameworkUrlReference;
+ name = base.name;
+ karafVersion = base.karafVersion;
+ unpackDirectory = base.unpackDirectory;
+ useDeployFolder = base.useDeployFolder;
+ }
+
+ /**
+ * Set the URL of the framework as a String (for example a file).
+ *
+ * @param frameworkUrl the framework URL.
+ * @return the updated <code>KarafDistributionBaseConfigurationOption</code>.
+ */
+ public KarafDistributionBaseConfigurationOption frameworkUrl(String frameworkUrl) {
+ this.frameworkUrl = frameworkUrl;
+ return this;
+ }
+
+ /**
+ * Set the URL of the framework as a Maven URL reference.
+ *
+ * @param frameworkUrlReference the framework Maven URL.
+ * @return the updated <code>KarafDistributionBaseConfigurationOption</code>.
+ */
+ public KarafDistributionBaseConfigurationOption frameworkUrl(MavenUrlReference frameworkUrlReference) {
+ this.frameworkUrlReference = frameworkUrlReference;
+ return this;
+ }
+
+ /**
+ * Set the name of the framework. This is only used for logging.
+ *
+ * @param name the framework name.
+ * @return the updated <code>KarafDistributionBaseConfigurationOption</code>.
+ */
+ public KarafDistributionBaseConfigurationOption name(String name) {
+ this.name = name;
+ return this;
+ }
+
+ /**
+ * The version of Karaf used by the framework. That one is required since there is the high possibility that
+ * configuration is different between various Karaf versions.
+ *
+ * @param karafVersion the Karaf version to use.
+ * @return the updated <code>KarafDistributionBaseConfigurationOption</code>.
+ */
+ public KarafDistributionBaseConfigurationOption karafVersion(String karafVersion) {
+ this.karafVersion = karafVersion;
+ return this;
+ }
+
+ /**
+ * Define the unpack directory for the Karaf distribution. In this directory a UUID named directory will be
+ * created for each environment.
+ *
+ * @param unpackDirectory the unpack directory location.
+ * @return the updated <code>KarafDistributionBaseConfigurationOption</code>.
+ */
+ public KarafDistributionBaseConfigurationOption unpackDirectory(File unpackDirectory) {
+ this.unpackDirectory = unpackDirectory;
+ return this;
+ }
+
+ /**
+ * By default, the framework simply copies all referenced artifacts (via PaxExam DistributionOption) to the
+ * deploy folder of the Karaf (based) distribution. If you don't have such a folder (for any reason) you can set
+ * this option to false. PaxExam Karaf will then try to add those deployment URLs directly to a feature XML instead
+ * of copying those files to the deploy folder.
+ *
+ * @param useDeployFolder flag defining if we have to use the deploy folder (true) or not (false).
+ * @return the updated <code>KarafDistributionBaseConfigurationOption</code>.
+ */
+ public KarafDistributionBaseConfigurationOption useDeployFolder(boolean useDeployFolder) {
+ this.useDeployFolder = useDeployFolder;
+ return this;
+ }
+
+ public String getFrameworkUrl() {
+ if (frameworkUrl == null && frameworkUrlReference == null) {
+ throw new IllegalStateException("Either frameworkUrl or frameworkUrlReference have to be set.");
+ }
+ return frameworkUrl != null ? frameworkUrl : frameworkUrlReference.getURL();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getKarafVersion() {
+ return karafVersion;
+ }
+
+ public File getUnpackDirectory() {
+ return unpackDirectory;
+ }
+
+ public boolean isUseDeployFolder() {
+ return useDeployFolder;
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationConsoleOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationConsoleOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationConsoleOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationConsoleOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+import org.ops4j.pax.exam.Option;
+
+/**
+ * Option to configure the Karaf <code>-Dkaraf.startLocalConsole</code> and <code>-Dkaraf.startRemoteShell</code>
+ * options. By default, both are started automatically. If you want to change this behavior, simply add this option
+ * to your container configuration.
+ */
+public class KarafDistributionConfigurationConsoleOption implements Option {
+
+ private Boolean startLocalConsole;
+ private Boolean startRemoteShell;
+
+ public KarafDistributionConfigurationConsoleOption(Boolean startLocalConsole, Boolean startRemoteShell) {
+ this.startLocalConsole = startLocalConsole;
+ this.startRemoteShell = startRemoteShell;
+ }
+
+ /**
+ * Set the <code>-Dkaraf.startLocalConsole</code> to true.
+ *
+ * @return the updated <code>KarafDistributionConfigurationConsoleOption</code>.
+ */
+ public KarafDistributionConfigurationConsoleOption startLocalConsole() {
+ startLocalConsole = true;
+ return this;
+ }
+
+ /**
+ * Set the <code>-Dkaraf.startLocalConsole</code> to false.
+ *
+ * @return the updated <code>KarafDistributionConfigurationConsoleOption</code>.
+ */
+ public KarafDistributionConfigurationConsoleOption ignoreLocalConsole() {
+ startLocalConsole = false;
+ return this;
+ }
+
+ /**
+ * Set the <code>-Dkaraf.startRemoteShell</code> to true.
+ *
+ * @return the updated <code>KarafDistributionConfigurationConsoleOption</code>.
+ */
+ public KarafDistributionConfigurationConsoleOption startRemoteShell() {
+ startRemoteShell = true;
+ return this;
+ }
+
+ /**
+ * Set the <code>-Dkaraf.startRemoteShell</code> to false.
+ *
+ * @return the updated <code>KarafDistributionConfigurationConsoleOption</code>.
+ */
+ public KarafDistributionConfigurationConsoleOption ignoreRemoteShell() {
+ startRemoteShell = false;
+ return this;
+ }
+
+ public Boolean getStartLocalConsole() {
+ return startLocalConsole;
+ }
+
+ public Boolean getStartRemoteShell() {
+ return startRemoteShell;
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFileExtendOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFileExtendOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFileExtendOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFileExtendOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+/**
+ * This option allows to extend configurations in each configuration file based on the <code>karaf.home</code> location.
+ * The value extends the current value (e.g. a=b to a=a,b) instead of replacing it. If there is no current value it is
+ * added.
+ *
+ * If you want to have add or replace functionality please use the
+ * {@link KarafDistributionConfigurationFilePutOption} instead.
+ */
+public class KarafDistributionConfigurationFileExtendOption extends KarafDistributionConfigurationFileOption {
+
+ public KarafDistributionConfigurationFileExtendOption(String configurationFilePath, String key, String value) {
+ super(configurationFilePath, key, value);
+ }
+
+ public KarafDistributionConfigurationFileExtendOption(ConfigurationPointer pointer, String value) {
+ super(pointer, value);
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFileOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFileOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFileOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFileOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+import org.ops4j.pax.exam.Option;
+
+/**
+ * Abstract configuration file option. This one should not used directly but rather via
+ * {@link KarafDistributionConfigurationFileExtendOption} or {@link KarafDistributionConfigurationFilePutOption}.
+ */
+public abstract class KarafDistributionConfigurationFileOption implements Option {
+
+ private String configurationFilePath;
+ private String key;
+ private String value;
+
+ public KarafDistributionConfigurationFileOption(ConfigurationPointer pointer, String value) {
+ this(pointer.getConfigurationFilePath(), pointer.getKey(), value);
+ }
+
+ public KarafDistributionConfigurationFileOption(String configurationFilePath, String key, String value) {
+ this.configurationFilePath = configurationFilePath;
+ this.key = key;
+ this.value = value;
+ }
+
+ public KarafDistributionConfigurationFileOption(String configurationFilePath) {
+ this.configurationFilePath = configurationFilePath;
+ }
+
+ public String getConfigurationFilePath() {
+ return configurationFilePath;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFilePutOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFilePutOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFilePutOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFilePutOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+/**
+ * This option allows to configure each configuration file based on the <code>karaf.home</code> location.
+ * The value is "put", which means it is either replaced or added.
+ *
+ * If you want to extend a value (e.g. make a=b to a=b,c) please use the
+ * {@link KarafDistributionConfigurationFileExtendOption}.
+ */
+public class KarafDistributionConfigurationFilePutOption extends KarafDistributionConfigurationFileOption {
+
+ public KarafDistributionConfigurationFilePutOption(String configurationFilePath, String key, String value) {
+ super(configurationFilePath, key, value);
+ }
+
+ public KarafDistributionConfigurationFilePutOption(ConfigurationPointer pointer, String value) {
+ super(pointer, value);
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFileReplacementOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFileReplacementOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFileReplacementOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationFileReplacementOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+import java.io.File;
+
+/**
+ * If you don't want to replace (or extend) values in a file, but rather simply replace a configuration file
+ * "brute force", this option is the one to use. It removes the original file and replaces it with the one
+ * configured here.
+ */
+public class KarafDistributionConfigurationFileReplacementOption extends KarafDistributionConfigurationFileOption {
+
+ private File source;
+
+ public KarafDistributionConfigurationFileReplacementOption(String configurationFilePath, File source) {
+ super(configurationFilePath);
+ this.source = source;
+ }
+
+ public File getSource() {
+ return source;
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionConfigurationOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+import org.ops4j.pax.exam.options.MavenUrlReference;
+
+/**
+ * Option describing the Karaf distribution to use. Without this option, no Karaf based distribution can be used in
+ * exam tests.
+ */
+public class KarafDistributionConfigurationOption extends KarafDistributionBaseConfigurationOption {
+
+ public KarafDistributionConfigurationOption() {
+ super();
+ }
+
+ public KarafDistributionConfigurationOption(KarafDistributionBaseConfigurationOption base) {
+ super(base);
+ }
+
+ public KarafDistributionConfigurationOption(MavenUrlReference frameworkUrlReference, String name, String karafVersion) {
+ super(frameworkUrlReference, name, karafVersion);
+ }
+
+ public KarafDistributionConfigurationOption(String frameworkUrl, String name, String karafVersion) {
+ super(frameworkUrl, name, karafVersion);
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionKitConfigurationOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionKitConfigurationOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionKitConfigurationOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionKitConfigurationOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+import org.ops4j.pax.exam.options.MavenUrlReference;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Option describing the Karaf distribution to use. This option uses the specified scripts to run the environment
+ * depending on the platform. If a platform is defined and run on another platform, it is ignored.
+ */
+public class KarafDistributionKitConfigurationOption extends KarafDistributionBaseConfigurationOption {
+
+ public enum Platform {
+ WINDOWS, NIX
+ }
+
+ private Platform platform;
+ private List<String> makeExec = new ArrayList<String>();
+ private String exec;
+
+ public KarafDistributionKitConfigurationOption(KarafDistributionBaseConfigurationOption base, Platform platform) {
+ super(base);
+ setPlatform(platform);
+ }
+
+ public KarafDistributionKitConfigurationOption(MavenUrlReference frameworkUrlReference, String name, String karafVersion, Platform platform) {
+ super(frameworkUrlReference, name, karafVersion);
+ setPlatform(platform);
+ }
+
+ public KarafDistributionKitConfigurationOption(MavenUrlReference frameworkUrlReference, Platform platform) {
+ super(frameworkUrlReference);
+ setPlatform(platform);
+ }
+
+ public KarafDistributionKitConfigurationOption(String frameworkUrl, String name, String karafVersion, Platform platform) {
+ super(frameworkUrl, name, karafVersion);
+ setPlatform(platform);
+ }
+
+ private void setPlatform(Platform platform) {
+ this.platform = platform;
+ if (platform.equals(Platform.WINDOWS)) {
+ exec = "bin\\karaf.bat";
+ } else {
+ exec = "bin/karaf";
+ }
+ }
+
+ public KarafDistributionKitConfigurationOption filesToMakeExecutable(String... platformRelativeFilePath) {
+ for (String platformRelativePath : platformRelativeFilePath) {
+ makeExec.add(platformRelativePath);
+ }
+ return this;
+ }
+
+ public KarafDistributionKitConfigurationOption executable(String platformRelativeFilePath) {
+ exec = platformRelativeFilePath;
+ return this;
+ }
+
+ public Platform getPlatform() {
+ return platform;
+ }
+
+ public List<String> getMakeExec() {
+ return makeExec;
+ }
+
+ public String getExec() {
+ return exec;
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafDistributionOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,289 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+import static java.lang.String.format;
+
+import org.apache.karaf.tooling.exam.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.options.extra.VMOption;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * Final class to provide an easy and intuitive way to configure the specific Karaf distribution options.
+ */
+public final class KarafDistributionOption {
+
+ /**
+ * By default, the folder pax-exam is deleting the test directories after a test is over. If you want to keep those
+ * directories (for later evaluation) simply set this option.
+ *
+ * @return the exam option.
+ */
+ public static Option keepRuntimeFolder() {
+ return new KeepRuntimeFolderOption();
+ }
+
+ /**
+ * Provides an option to configure the internals of the PaxExamKaraf subsystem runner.
+ *
+ * @param invoker the invoker to use.
+ * @return the exam option.
+ */
+ public static Option useOwnKarafExamSystemConfiguration(String invoker) {
+ return new KarafExamSystemConfigurationOption(invoker);
+ }
+
+ /**
+ * The Karaf pax-logging configuration is typically not a file manipulated very often. Therefore we take a freedom
+ * of adding a console logger and changing the log level directly. If you want to configure the file manually (or
+ * add your own file in your distribution), use this option.
+ *
+ * @return the exam option.
+ */
+ public static Option doNotModifyLogConfiguration() {
+ return new DoNotModifyLogOption();
+ }
+
+ /**
+ * This option allows to configure the start level of the bundles in the exam features descriptor.
+ *
+ * @param startLevel set the start level.
+ * @return the exam option.
+ */
+ public static Option useOwnExamBundlesStartLevel(int startLevel) {
+ return new ExamBundlesStartLevel(startLevel);
+ }
+
+ /**
+ * Return an option object which can be used to configure the <code>-Dkaraf.startLocalConsole</code> and
+ * <code>-Dkaraf.startRemoteShell</code> options. By default, both are true.
+ *
+ * @return the exam option.
+ */
+ public static KarafDistributionConfigurationConsoleOption configureConsole() {
+ return new KarafDistributionConfigurationConsoleOption(null, null);
+ }
+
+ /**
+ * Configure the distribution options to use. Relevant are the frameworkUrl, the frameworkName and the Karaf
+ * version, since all of those parameters are relevant to decide which wrapper configurations to use.
+ *
+ * @return the exam option.
+ */
+ public static KarafDistributionBaseConfigurationOption karafDistributionConfiguration(String frameworkUrl, String name, String karafVersion) {
+ return new KarafDistributionBaseConfigurationOption(frameworkUrl, name, karafVersion);
+ }
+
+ /**
+ * Configure the distribution options to use. Relevant are the frameworkUrl, the frameworkName and the Karaf
+ * version, since all of those parameters are relevant to decide which wrapper configurations to use.
+ *
+ * @return the exam option.
+ */
+ public static KarafDistributionBaseConfigurationOption karafDistributionConfiguration() {
+ return new KarafDistributionBaseConfigurationOption();
+ }
+
+ /**
+ * This option allows to configure each configuration file based on the <code>karaf.home</code> location.
+ * The value is "put", which means it is either replaced or added.
+ *
+ * If you want to extend a value (e.g. make a=b to a=b,c), please use the {@link KarafDistributionConfigurationFileExtendOption}
+ *
+ * @param configurationFilePath the configuration file path.
+ * @param key the key in the configuration file.
+ * @param value the value in the configuration file.
+ * @return the exam option.
+ */
+ public static Option editConfigurationFilePut(String configurationFilePath, String key, String value) {
+ return new KarafDistributionConfigurationFilePutOption(configurationFilePath, key, value);
+ }
+
+ /**
+ * This option allows to configure each configuration file based on the <code>karaf.home</code> location.
+ * The value is "put", which means it is either replaced or added.
+ *
+ * If you want to extend a value (e.g. make a=b to a=b,c), please use the {@link KarafDistributionConfigurationFileExtendOption}
+ *
+ * @param pointer the configuration pointer.
+ * @param value the value in the configuration file.
+ * @return the exam option.
+ */
+ public static Option editConfigurationFilePut(ConfigurationPointer pointer, String value) {
+ return new KarafDistributionConfigurationFilePutOption(pointer, value);
+ }
+
+ /**
+ * This option allows to configure each configuration file based on <code>karaf.home</code> location. The value is "put"
+ * which means it is either replaced or added. For simple configuration, you can add a file source. If you want to
+ * put all values from this file, do not configure any keysToUseFromSource; otherwise define them to use only those
+ * specific values.
+ *
+ * @param configurationFilePath the configuration file path.
+ * @param source the source file.
+ * @param keysToUseFromSource the keys to use in the source file.
+ * @return the exam option.
+ */
+ public static Option[] editConfigurationFilePut(final String configurationFilePath, File source, String... keysToUseFromSource) {
+ return createOptionListFromFile(source, new FileOptionFactory() {
+ @Override
+ public Option createOption(String key, String value) {
+ return new KarafDistributionConfigurationFilePutOption(configurationFilePath, key, value);
+ }
+ }, keysToUseFromSource);
+ }
+
+ private static interface FileOptionFactory {
+ Option createOption(String key, String value);
+ }
+
+ private static Option[] createOptionListFromFile(File source, FileOptionFactory optionFactory, String... keysToUseFromSource) {
+ Properties props = new Properties();
+ try {
+ props.load(new FileInputStream(source));
+ } catch (FileNotFoundException e) {
+ throw new IllegalStateException(e);
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
+ List<Option> options = new ArrayList<Option>();
+ if (keysToUseFromSource == null || keysToUseFromSource.length == 0) {
+ Set<Object> keySet = props.keySet();
+ for (Object key : keySet) {
+ Object value = props.get(key);
+ options.add(optionFactory.createOption((String) key, (String) value));
+ }
+ } else {
+ for (String key : keysToUseFromSource) {
+ Object value = props.get(key);
+ options.add(optionFactory.createOption(key, (String) value));
+ }
+ }
+ return options.toArray(new Option[]{ });
+ }
+
+ /**
+ * This option allows to extend configurations in each configuration file based on <code>karaf.home</code> location.
+ * The value extends the current value (e.g. a=b to a=a,b) instead of replacing it. If there is no current value
+ * it is added.
+ *
+ * If you want to add or replace functionality, please use the {@link KarafDistributionConfigurationFilePutOption}
+ * option.
+ *
+ * @param configurationFilePath the configuration file path.
+ * @param key the key in the configuration file.
+ * @param value the value in the configuration file.
+ * @return the exam option.
+ */
+ public static Option editConfigurationFileExtend(String configurationFilePath, String key, String value) {
+ return new KarafDistributionConfigurationFileExtendOption(configurationFilePath, key, value);
+ }
+
+ /**
+ * This option allows to extend configurations in each configuration file based on <code>karaf.home</code> location.
+ * The value extends the current value (e.g. a=b to a=a,b) instead of replacing it. If there is no current value
+ * it is added.
+ *
+ * If you want to add or replace functionality, please use the {@link KarafDistributionConfigurationFilePutOption}
+ * option.
+ *
+ * @param pointer the configuration pointer to use.
+ * @param value the value in the configuration file.
+ * @return the exam option.
+ */
+ public static Option editConfigurationFileExtend(ConfigurationPointer pointer, String value) {
+ return new KarafDistributionConfigurationFileExtendOption(pointer, value);
+ }
+
+ /**
+ * This option allows to configure each configuration file based on the <code>karaf.home</code> location. The value
+ * is "extend", which means it is either replaced or added. For simpler configuration you can add a source file.
+ *
+ * @param configurationFilePath the configuration file path.
+ * @param source the file source.
+ * @param keysToUseFromSource the keys to use from source.
+ * @return the exam options.
+ */
+ public static Option[] editConfigurationFileExtend(final String configurationFilePath, File source, String... keysToUseFromSource) {
+ return createOptionListFromFile(source, new FileOptionFactory() {
+ @Override
+ public Option createOption(String key, String value) {
+ return new KarafDistributionConfigurationFileExtendOption(configurationFilePath, key, value);
+ }
+ }, keysToUseFromSource);
+ }
+
+ /**
+ * This option allows to replace a whole configuration file with your own one. Simply point to the configuration
+ * file you want to replace and define the source file.
+ *
+ * @param configurationFilePath the configuration file path.
+ * @param source the source file.
+ * @return the exam option.
+ */
+ public static Option replaceConfigurationFile(String configurationFilePath, File source) {
+ return new KarafDistributionConfigurationFileReplacementOption(configurationFilePath, source);
+ }
+
+ /**
+ * Activate debugging on the embedded Karaf container using the standard 5005 and hold the JVM till you've
+ * attached the debugger.
+ *
+ * @return the exam option.
+ */
+ public static Option debugConfiguration() {
+ return debugConfiguration("5005", true);
+ }
+
+ /**
+ * A very simple and convenient method to set a specific log level without the need of configure the specific
+ * option itself.
+ *
+ * @param logLevel the new log level.
+ * @return the exam option.
+ */
+ public static Option logLevel(LogLevel logLevel) {
+ return new LogLevelOption(logLevel);
+ }
+
+
+ /**
+ * A very simple and convinient method to set a specific log level without the need of configure the specific option
+ * itself.
+ */
+ public static LogLevelOption logLevel() {
+ return new LogLevelOption();
+ }
+
+ /**
+ * Returns an easy option to activate and configure remote debugging for the Karaf container.
+ */
+ public static Option debugConfiguration(String port, boolean hold) {
+ return new VMOption(format("-Xrunjdwp:transport=dt_socket,server=y,suspend=%s,address=%s", hold ? "y" : "n",
+ port));
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafExamSystemConfigurationOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafExamSystemConfigurationOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafExamSystemConfigurationOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KarafExamSystemConfigurationOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+import org.ops4j.pax.exam.Option;
+
+/**
+ * Option to configure the internal invoker for integration tests to be used.
+ */
+public class KarafExamSystemConfigurationOption implements Option {
+
+ private String invoker;
+
+ /**
+ * Define the pax.exam.invoker property as system property in the environment during creating the subproject.
+ *
+ * @param invoker invoker name.
+ */
+ public KarafExamSystemConfigurationOption(String invoker) {
+ this.invoker = invoker;
+ }
+
+ public String getInvoker() {
+ return invoker;
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KeepRuntimeFolderOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KeepRuntimeFolderOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KeepRuntimeFolderOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/KeepRuntimeFolderOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+import org.ops4j.pax.exam.Option;
+
+/**
+ * By default, pax-exam deletes the test directories after a test is over. If you want to keep those
+ * directories (for later evaluation) simply set this option.
+ */
+public class KeepRuntimeFolderOption implements Option {
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/LogLevelOption.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/LogLevelOption.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/LogLevelOption.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/LogLevelOption.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options;
+
+import org.ops4j.pax.exam.Option;
+
+/**
+ * While the log-level could also be configured using the config options in the configuration files we also provide
+ * a more easy option here.
+ */
+public class LogLevelOption implements Option {
+
+ public static enum LogLevel {
+ TRACE, DEBUG, INFO, WARN, ERROR
+ }
+
+ private LogLevel logLevel;
+
+ public LogLevelOption() {
+
+ }
+
+ public LogLevelOption(LogLevel logLevel) {
+ this.logLevel = logLevel;
+ }
+
+ public LogLevelOption logLevel(LogLevel logLevel) {
+ this.logLevel = logLevel;
+ return this;
+ }
+
+ public LogLevel getLogLevel() {
+ return logLevel;
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/CustomProperties.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/CustomProperties.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/CustomProperties.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/CustomProperties.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options.configs;
+
+import org.apache.karaf.tooling.exam.options.ConfigurationPointer;
+
+/**
+ * Pre-configured property file pointers to the most commonly used properties in /etc/config.properties and
+ * /etc/custom.properties
+ */
+public interface CustomProperties {
+
+ static final String FILE_PATH = "etc/config.properties";
+
+ /**
+ * Possible values here are felix or equinox
+ */
+ static final ConfigurationPointer KARAF_FRAMEWORK = new CustomPropertiesPointer("karaf.framework");
+
+ static final ConfigurationPointer SYSTEM_PACKAGES_EXTRA = new CustomPropertiesPointer("org.osgi.framework.system.packages.extra");
+
+ static final ConfigurationPointer BOOTDELEGATION = new CustomPropertiesPointer("org.osgi.framework.bootdelegation");
+
+ static class CustomPropertiesPointer extends ConfigurationPointer {
+
+ public CustomPropertiesPointer(String key) {
+ super(FILE_PATH, key);
+ }
+
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/FeaturesCfg.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/FeaturesCfg.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/FeaturesCfg.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/FeaturesCfg.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options.configs;
+
+import org.apache.karaf.tooling.exam.options.ConfigurationPointer;
+
+/**
+ * Pre-configured property file pointers to the most commonly used properties in /etc/config.properties and
+ * /etc/org.apache.karaf.features.cfg.
+ */
+public interface FeaturesCfg {
+
+ static final String FILE_PATH = "etc/org.apache.karaf.features.cfg";
+
+ static final ConfigurationPointer REPOSITORIES = new CustomPropertiesPointer("featuresRepositories");
+ static final ConfigurationPointer BOOT = new CustomPropertiesPointer("featuresBoot");
+
+ static class CustomPropertiesPointer extends ConfigurationPointer {
+
+ public CustomPropertiesPointer(String key) {
+ super(FILE_PATH, key);
+ }
+
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/JreProperties.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/JreProperties.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/JreProperties.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/JreProperties.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options.configs;
+
+import org.apache.karaf.tooling.exam.options.ConfigurationPointer;
+
+/**
+ * Pre-configured property file pointers to the most commonly used properties in /etc/config.properties and
+ * /etc/jre.properties.
+ */
+public interface JreProperties {
+
+ static final String FILE_PATH = "etc/jre.properties";
+
+ static final ConfigurationPointer JRE15 = new CustomPropertiesPointer("jre-1.5");
+ static final ConfigurationPointer JRE16 = new CustomPropertiesPointer("jre-1.6");
+ static final ConfigurationPointer JRE17 = new CustomPropertiesPointer("jre-1.7");
+
+ static class CustomPropertiesPointer extends ConfigurationPointer {
+
+ public CustomPropertiesPointer(String key) {
+ super(FILE_PATH, key);
+ }
+
+ }
+
+}
Added: karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/LoggingCfg.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/LoggingCfg.java?rev=1381632&view=auto
==============================================================================
--- karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/LoggingCfg.java (added)
+++ karaf/branches/karaf-2.3.x/tooling/exam/options/src/main/java/org/apache/karaf/tooling/exam/options/configs/LoggingCfg.java Thu Sep 6 14:55:30 2012
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.tooling.exam.options.configs;
+
+import org.apache.karaf.tooling.exam.options.ConfigurationPointer;
+
+/**
+ * Pre-configured property file pointers to the most commonly used properties in /etc/config.properties and
+ * /etc/org.ops4j.pax.logging.cfg.
+ */
+public interface LoggingCfg {
+
+ static final String FILE_PATH = "etc/org.ops4j.pax.logging.cfg";
+
+ static final ConfigurationPointer ROOT_LOGGER = new CustomPropertiesPointer("log4j.rootLogger");
+
+ static class CustomPropertiesPointer extends ConfigurationPointer {
+
+ public CustomPropertiesPointer(String key) {
+ super(FILE_PATH, key);
+ }
+
+ }
+
+}