Rename systests2 to itests to make it more similar to other projects
Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/052cccc7 Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/052cccc7 Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/052cccc7 Branch: refs/heads/master Commit: 052cccc7f678f53b936272039c3bed6f3bc85c74 Parents: 1fef305 Author: Christian Schneider <[email protected]> Authored: Wed Jul 6 11:59:37 2016 +0200 Committer: Christian Schneider <[email protected]> Committed: Wed Jul 6 11:59:37 2016 +0200 ---------------------------------------------------------------------- itests/multi-bundle/pom.xml | 230 +++++++++++++++++ .../systests2/multi/AbstractDosgiTest.java | 248 +++++++++++++++++++ .../multi/GreeterServiceProxyFactory.java | 44 ++++ .../dosgi/systests2/multi/MultiBundleTools.java | 102 ++++++++ .../dosgi/systests2/multi/TestCustomIntent.java | 91 +++++++ .../systests2/multi/TestDiscoveryExport.java | 53 ++++ .../systests2/multi/TestExportRestService.java | 77 ++++++ .../systests2/multi/TestExportService.java | 117 +++++++++ .../systests2/multi/TestImportService.java | 104 ++++++++ .../AddGreetingPhraseInterceptor.java | 44 ++++ .../multi/customintent/CustomFeature.java | 33 +++ .../customintent/CustomIntentActivator.java | 37 +++ .../service/EmptyGreeterService.java | 41 +++ ...GreeterServiceWithCustomIntentActivator.java | 42 ++++ .../multi/importservice/SimpleGreeter.java | 41 +++ .../systests2/multi/rest/RestTranslate.java | 34 +++ .../systests2/multi/rest/RestTranslateImpl.java | 41 +++ .../multi/rest/TranslateActivator.java | 40 +++ .../resources/cfg/org.ops4j.pax.logging.cfg | 7 + .../src/test/resources/log4j.properties | 9 + .../src/test/resources/rs-test1.xml | 28 +++ itests/pom.xml | 41 +++ pom.xml | 2 +- systests2/multi-bundle/pom.xml | 230 ----------------- .../systests2/multi/AbstractDosgiTest.java | 248 ------------------- .../multi/GreeterServiceProxyFactory.java | 44 ---- .../dosgi/systests2/multi/MultiBundleTools.java | 102 -------- .../dosgi/systests2/multi/TestCustomIntent.java | 91 ------- .../systests2/multi/TestDiscoveryExport.java | 53 ---- .../systests2/multi/TestExportRestService.java | 77 ------ .../systests2/multi/TestExportService.java | 117 --------- .../systests2/multi/TestImportService.java | 104 -------- .../AddGreetingPhraseInterceptor.java | 44 ---- .../multi/customintent/CustomFeature.java | 33 --- .../customintent/CustomIntentActivator.java | 37 --- .../service/EmptyGreeterService.java | 41 --- ...GreeterServiceWithCustomIntentActivator.java | 42 ---- .../multi/importservice/SimpleGreeter.java | 41 --- .../systests2/multi/rest/RestTranslate.java | 34 --- .../systests2/multi/rest/RestTranslateImpl.java | 41 --- .../multi/rest/TranslateActivator.java | 40 --- .../resources/cfg/org.ops4j.pax.logging.cfg | 7 - .../src/test/resources/log4j.properties | 9 - .../src/test/resources/rs-test1.xml | 28 --- systests2/pom.xml | 41 --- 45 files changed, 1505 insertions(+), 1505 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/pom.xml b/itests/multi-bundle/pom.xml new file mode 100644 index 0000000..71be6a5 --- /dev/null +++ b/itests/multi-bundle/pom.xml @@ -0,0 +1,230 @@ +<?xml version='1.0' encoding='UTF-8' ?> +<!-- + 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.cxf.dosgi</groupId> + <artifactId>cxf-dosgi-ri-parent</artifactId> + <version>2.0-SNAPSHOT</version> + <relativePath>../../parent/pom.xml</relativePath> + </parent> + + <groupId>org.apache.cxf.dosgi.systests</groupId> + <artifactId>cxf-dosgi-ri-itests-multibundle</artifactId> + <packaging>jar</packaging> + <name>Distributed OSGi System Tests Multi-Bundle</name> + + <properties> + <topDirectoryLocation>../..</topDirectoryLocation> + </properties> + + <!-- + When changing code make sure to run the distro before testing + or you will be testing the old code. + + --> + + <dependencies> + <!-- Pax Exam --> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-atinject_1.0_spec</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-junit4</artifactId> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-inject</artifactId> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-cm</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-container-forked</artifactId> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-link-mvn</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.ops4j.pax.url</groupId> + <artifactId>pax-url-aether</artifactId> + <version>2.4.5</version> + </dependency> + + + <dependency> + <groupId>org.eclipse.tycho</groupId> + <artifactId>org.eclipse.osgi</artifactId> + </dependency> + <!-- + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.framework</artifactId> + <scope>test</scope> + </dependency> + --> + + <!-- CXF --> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-core</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-bindings-soap</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-transports-http-jetty</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-frontend-jaxrs</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-client</artifactId> + <version>${cxf.version}</version> + </dependency> + <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-databinding-aegis</artifactId> + <version>${cxf.version}</version> + </dependency> + + <dependency> + <groupId>org.apache.zookeeper</groupId> + <artifactId>zookeeper</artifactId> + <version>${zookeeper.version}</version> + <exclusions> + <exclusion> + <groupId>com.sun.jdmk</groupId> + <artifactId>jmxtools</artifactId> + </exclusion> + <exclusion> + <groupId>com.sun.jmx</groupId> + <artifactId>jmxri</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- Samples --> + <dependency> + <groupId>org.apache.cxf.dosgi.samples</groupId> + <artifactId>cxf-dosgi-ri-samples-greeter-impl</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.cxf.dosgi.samples</groupId> + <artifactId>cxf-dosgi-ri-samples-greeter-interface</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.cxf.dosgi.samples</groupId> + <artifactId>cxf-dosgi-ri-samples-greeter-rest-impl</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.cxf.dosgi.samples</groupId> + <artifactId>cxf-dosgi-ri-samples-greeter-rest-interface</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>unpack</id> + <phase>generate-resources</phase> + <goals> + <goal>unpack</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>org.apache.cxf.dosgi</groupId> + <artifactId>cxf-dosgi-ri-multibundle-distribution</artifactId> + <version>${project.version}</version> + <type>zip</type> + <classifier>dir</classifier> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.servicemix.tooling</groupId> + <artifactId>depends-maven-plugin</artifactId> + <version>1.3.1</version> + <executions> + <execution> + <id>generate-depends-file</id> + <goals> + <goal>generate-depends-file</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <systemPropertyVariables> + <!-- <org.apache.cxf.dosgi.test.debug.port>5005</org.apache.cxf.dosgi.test.debug.port> + <org.apache.cxf.dosgi.test.serviceWaitTimeout>180</org.apache.cxf.dosgi.test.serviceWaitTimeout> --> + <java.util.logging.config.file>${project.build.directory}/test-classes/logging.properties</java.util.logging.config.file> + </systemPropertyVariables> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java new file mode 100644 index 0000000..383d7e9 --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java @@ -0,0 +1,248 @@ +/** + * 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.cxf.dosgi.systests2.multi; + +import static org.ops4j.pax.exam.CoreOptions.composite; +import static org.ops4j.pax.exam.CoreOptions.frameworkStartLevel; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; +import static org.ops4j.pax.exam.CoreOptions.systemProperty; +import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration; + +import java.io.File; +import java.io.IOException; +import java.net.ConnectException; +import java.net.HttpURLConnection; +import java.net.InetSocketAddress; +import java.net.MalformedURLException; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.URL; +import java.util.Collection; +import java.util.concurrent.TimeoutException; + +import javax.inject.Inject; + +import org.apache.zookeeper.ZooKeeper; +import org.apache.zookeeper.data.Stat; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.ops4j.pax.exam.CoreOptions; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.cm.ConfigurationAdminOptions; +import org.ops4j.pax.exam.options.MavenArtifactProvisionOption; +import org.ops4j.pax.exam.options.extra.VMOption; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.BundleException; +import org.osgi.framework.ServiceReference; + +public class AbstractDosgiTest { + static final int ZK_PORT = 35101; + private static final int TIMEOUT = 20; + + @Inject + BundleContext bundleContext; + + @BeforeClass + public static void log() { + System.out.println("-----------------------------------------------------------------"); + } + + + /** + * Sleeps for a short interval, throwing an exception if timeout has been reached. Used to facilitate a + * retry interval with timeout when used in a loop. + * + * @param startTime the start time of the entire operation in milliseconds + * @param timeout the timeout duration for the entire operation in seconds + * @param message the error message to use when timeout occurs + * @throws InterruptedException if interrupted while sleeping + */ + private static void sleepOrTimeout(long startTime, long timeout, String message) + throws InterruptedException, TimeoutException { + timeout *= 1000; // seconds to millis + long elapsed = System.currentTimeMillis() - startTime; + long remaining = timeout - elapsed; + if (remaining <= 0) { + throw new TimeoutException(message); + } + long interval = Math.min(remaining, 1000); + Thread.sleep(interval); + } + + @SuppressWarnings({ + "rawtypes", "unchecked" + }) + protected ServiceReference waitService(BundleContext bc, Class cls, String filter, int timeout) + throws Exception { + System.out.println("Waiting for service: " + cls + " " + filter); + long startTime = System.currentTimeMillis(); + while (true) { + Collection refs = bc.getServiceReferences(cls, filter); + if (refs != null && refs.size() > 0) { + return (ServiceReference)refs.iterator().next(); + } + sleepOrTimeout(startTime, timeout, "Service not found: " + cls + " " + filter); + } + } + + protected void waitPort(int port) throws Exception { + System.out.println("Waiting for server to appear on port: " + port); + long startTime = System.currentTimeMillis(); + while (true) { + Socket s = null; + try { + s = new Socket((String)null, port); + // yep, its available + return; + } catch (IOException e) { + sleepOrTimeout(startTime, TIMEOUT, "Timeout waiting for port " + port); + } finally { + if (s != null) { + try { + s.close(); + } catch (IOException e) { + // ignore + } + } + } + } + } + + protected Bundle getBundleByName(BundleContext bc, String name) { + for (Bundle bundle : bc.getBundles()) { + if (bundle.getSymbolicName().equals(name)) { + return bundle; + } + } + return null; + } + + protected static int getFreePort() { + try (ServerSocket socket = new ServerSocket()) { + socket.setReuseAddress(true); // enables quickly reopening socket on same port + socket.bind(new InetSocketAddress(0)); // zero finds a free port + return socket.getLocalPort(); + } catch (Exception e) { + throw new RuntimeException(e.getMessage(), e); + } + } + + protected void waitWebPage(String urlSt) throws InterruptedException, TimeoutException { + System.out.println("Waiting for url " + urlSt); + HttpURLConnection con = null; + long startTime = System.currentTimeMillis(); + while (true) { + try { + URL url = new URL(urlSt); + con = (HttpURLConnection)url.openConnection(); + int status = con.getResponseCode(); + if (status == 200) { + return; + } + } catch (ConnectException e) { + // Ignore connection refused + } catch (MalformedURLException e) { + throw new RuntimeException(e.getMessage(), e); + } catch (IOException e) { + throw new RuntimeException(e.getMessage(), e); + } finally { + if (con != null) { + con.disconnect(); + } + } + sleepOrTimeout(startTime, TIMEOUT, "Timeout waiting for web page " + urlSt); + } + } + + protected void assertBundlesStarted() { + for (Bundle bundle : bundleContext.getBundles()) { + System.out + .println(bundle.getSymbolicName() + ":" + bundle.getVersion() + ": " + bundle.getState()); + if (bundle.getState() != Bundle.ACTIVE) { + try { + bundle.start(); + } catch (BundleException e) { + e.printStackTrace(); + } + } + } + } + + protected ZooKeeper createZookeeperClient() throws IOException { + return new ZooKeeper("localhost:" + ZK_PORT, 1000, null); + } + + protected void assertNodeExists(ZooKeeper zk, String zNode, int timeout) { + long endTime = System.currentTimeMillis() + timeout; + Stat stat = null; + while (stat == null && System.currentTimeMillis() < endTime) { + try { + stat = zk.exists(zNode, null); + Thread.sleep(200); + } catch (Exception e) { + // Ignore + } + } + Assert.assertNotNull("ZooKeeper node " + zNode + " was not found", stat); + } + + protected static Option configZKConsumer() { + return newConfiguration("org.apache.aries.rsa.discovery.zookeeper") // + .put("zookeeper.host", "127.0.0.1") // + .put("zookeeper.port", "" + ZK_PORT).asOption(); + } + + protected static Option configZKServer() { + return newConfiguration("org.apache.aries.rsa.discovery.zookeeper.server") + .put("clientPort", "" + ZK_PORT) // + .asOption(); + } + + protected static Option configLogging() { + return ConfigurationAdminOptions.configurationFolder(new File("src/test/resources/cfg")); + } + + + protected static MavenArtifactProvisionOption greeterImpl() { + return mavenBundle().groupId("org.apache.cxf.dosgi.samples") + .artifactId("cxf-dosgi-ri-samples-greeter-impl").versionAsInProject(); + } + + protected static MavenArtifactProvisionOption greeterInterface() { + return mavenBundle().groupId("org.apache.cxf.dosgi.samples") + .artifactId("cxf-dosgi-ri-samples-greeter-interface").versionAsInProject(); + } + + protected static Option basicTestOptions() throws Exception { + return composite(MultiBundleTools.getDistro(), // + CoreOptions.junitBundles(), // + systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"), // + systemProperty("pax.exam.osgi.unresolved.fail").value("true"), // + configLogging(), + frameworkStartLevel(100) + ); + } + + + protected static VMOption debug() { + return CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"); + } + +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/GreeterServiceProxyFactory.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/GreeterServiceProxyFactory.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/GreeterServiceProxyFactory.java new file mode 100644 index 0000000..074a6f1 --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/GreeterServiceProxyFactory.java @@ -0,0 +1,44 @@ +/** + * 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.cxf.dosgi.systests2.multi; + +import org.apache.cxf.aegis.databinding.AegisDatabinding; +import org.apache.cxf.dosgi.samples.greeter.GreeterService; +import org.apache.cxf.frontend.ClientProxyFactoryBean; + +public final class GreeterServiceProxyFactory { + + private GreeterServiceProxyFactory() { + } + + protected static GreeterService createGreeterServiceProxy(String serviceUri) { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(ClientProxyFactoryBean.class.getClassLoader()); + try { + ClientProxyFactoryBean factory = new ClientProxyFactoryBean(); + factory.setServiceClass(GreeterService.class); + factory.setAddress(serviceUri); + factory.getServiceFactory().setDataBinding(new AegisDatabinding()); + return (GreeterService)factory.create(); + } finally { + Thread.currentThread().setContextClassLoader(cl); + } + } + +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java new file mode 100644 index 0000000..70e4816 --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java @@ -0,0 +1,102 @@ +/** + * 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.cxf.dosgi.systests2.multi; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.TreeMap; + +import org.ops4j.pax.exam.CoreOptions; +import org.ops4j.pax.exam.Option; + +public final class MultiBundleTools { + + private MultiBundleTools() { + } + + private static Properties getProps(File distroDir) throws FileNotFoundException, IOException { + Properties p = new Properties(); + File confFile = new File(distroDir, "conf/felix.config.properties.append"); + p.load(new FileInputStream(confFile)); + return p; + } + + private static int getDistroBundles(File distroDir, + Properties props, + Map<Integer, String> bundles) throws Exception { + int startLevel = Integer.parseInt(props.getProperty("org.osgi.framework.startlevel.beginning")); + for (int i = 0; i <= startLevel; i++) { + String val = props.getProperty("felix.auto.start." + i); + if (val != null) { + if (val.startsWith("file:")) { + File fullDir = new File(distroDir, val.substring("file:".length())); + bundles.put(i, fullDir.toURI().toASCIIString()); + } else { + if (!val.contains("org.osgi.compendium")) { + // We're skipping that one as it's pulled in explicitly in the test + bundles.put(i, val); + } + } + } + } + return startLevel + 1; // Add 1 to start level to be on the safe side + } + + private static File getRootDirectory() { + String resourceName = "/" + MultiBundleTools.class.getName().replace('.', '/') + ".class"; + URL curURL = MultiBundleTools.class.getResource(resourceName); + File curFile = new File(curURL.getFile()); + String curString = curFile.getAbsolutePath(); + File curBase = new File(curString.substring(0, curString.length() - resourceName.length())); + return curBase.getParentFile().getParentFile(); + } + + private static Option[] getDistroBundleOptions() throws Exception { + Map<Integer, String> bundles = new TreeMap<Integer, String>(); + File root = getRootDirectory(); + File depRoot = new File(root, "target/dependency"); + File distroDir = depRoot.listFiles()[0]; + Properties props = getProps(distroDir); + getDistroBundles(distroDir, props, bundles); + List<Option> opts = new ArrayList<Option>(); + + /* + String sysPackagesValue = props.getProperty("org.osgi.framework.system.packages"); + opts.add(CoreOptions.frameworkProperty("org.osgi.framework.system.packages") + .value(sysPackagesValue)); + */ + + for (Map.Entry<Integer, String> entry : bundles.entrySet()) { + String bundleUri = entry.getValue(); + opts.add(CoreOptions.bundle(bundleUri)); + } + return opts.toArray(new Option[opts.size()]); + } + + public static Option getDistro() throws Exception { + return CoreOptions.composite(getDistroBundleOptions()); + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestCustomIntent.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestCustomIntent.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestCustomIntent.java new file mode 100644 index 0000000..9928db0 --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestCustomIntent.java @@ -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.cxf.dosgi.systests2.multi; + +import static org.apache.cxf.dosgi.systests2.multi.GreeterServiceProxyFactory.createGreeterServiceProxy; +import static org.ops4j.pax.exam.CoreOptions.provision; +import static org.ops4j.pax.exam.CoreOptions.streamBundle; + +import java.io.InputStream; +import java.util.Map; + +import org.apache.cxf.dosgi.samples.greeter.GreeterService; +import org.apache.cxf.dosgi.samples.greeter.GreetingPhrase; +import org.apache.cxf.dosgi.systests2.multi.customintent.AddGreetingPhraseInterceptor; +import org.apache.cxf.dosgi.systests2.multi.customintent.CustomFeature; +import org.apache.cxf.dosgi.systests2.multi.customintent.CustomIntentActivator; +import org.apache.cxf.dosgi.systests2.multi.customintent.service.EmptyGreeterService; +import org.apache.cxf.dosgi.systests2.multi.customintent.service.GreeterServiceWithCustomIntentActivator; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.tinybundles.core.TinyBundles; +import org.osgi.framework.Constants; + +@RunWith(PaxExam.class) +public class TestCustomIntent extends AbstractDosgiTest { + + @Configuration + public static Option[] configure() throws Exception { + return new Option[] // + { + basicTestOptions(), // + greeterInterface(), // + streamBundle(getCustomIntentBundle()).noStart(), // + provision(getServiceBundle()), + //debug() + }; + } + + @Test + public void testCustomIntent() throws Exception { + // There should be warnings of unsatisfied intent myIntent in the log at debug level + //Thread.sleep(2000); + getBundleByName(bundleContext, "CustomIntent").start(); + waitPort(9090); + + GreeterService greeterService = createGreeterServiceProxy("http://localhost:9090/greeter"); + Map<GreetingPhrase, String> result = greeterService.greetMe("Chris"); + Assert.assertEquals(1, result.size()); + GreetingPhrase phrase = result.keySet().iterator().next(); + Assert.assertEquals("Hi from custom intent", phrase.getPhrase()); + } + + private static InputStream getCustomIntentBundle() { + return TinyBundles.bundle() // + .add(CustomIntentActivator.class) // + .add(CustomFeature.class) // + .add(AddGreetingPhraseInterceptor.class) // + .set(Constants.BUNDLE_SYMBOLICNAME, "CustomIntent") // + .set(Constants.BUNDLE_ACTIVATOR, CustomIntentActivator.class.getName()) + .build(TinyBundles.withBnd()); + } + + private static InputStream getServiceBundle() { + return TinyBundles.bundle() // + .add(GreeterServiceWithCustomIntentActivator.class) // + .add(EmptyGreeterService.class) // + .set(Constants.BUNDLE_SYMBOLICNAME, "EmptyGreeterService") // + .set(Constants.BUNDLE_ACTIVATOR, GreeterServiceWithCustomIntentActivator.class.getName()) + .build(TinyBundles.withBnd()); + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryExport.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryExport.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryExport.java new file mode 100644 index 0000000..b0113fd --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryExport.java @@ -0,0 +1,53 @@ +/** + * 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.cxf.dosgi.systests2.multi; + +import org.apache.zookeeper.ZooKeeper; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; + +@RunWith(PaxExam.class) +public class TestDiscoveryExport extends AbstractDosgiTest { + + private static final String GREETER_ZOOKEEPER_NODE = // + "/osgi/service_registry/org/apache/cxf/dosgi/samples/greeter/GreeterService/localhost#9090##greeter"; + + @Configuration + public static Option[] configure() throws Exception { + return new Option[] // + { + basicTestOptions(), // + configZKServer(), // + configZKConsumer(), // + greeterInterface(), // + greeterImpl(), + }; + } + + @Test + public void testDiscoveryExport() throws Exception { + ZooKeeper zk = createZookeeperClient(); + assertNodeExists(zk, GREETER_ZOOKEEPER_NODE, 5000); + zk.close(); + } + +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java new file mode 100644 index 0000000..0ed885a --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java @@ -0,0 +1,77 @@ +/** + * 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.cxf.dosgi.systests2.multi; + +import static org.ops4j.pax.exam.CoreOptions.provision; +import static org.ops4j.pax.exam.CoreOptions.systemProperty; + +import java.io.InputStream; + +import org.apache.cxf.dosgi.systests2.multi.rest.RestTranslate; +import org.apache.cxf.dosgi.systests2.multi.rest.RestTranslateImpl; +import org.apache.cxf.dosgi.systests2.multi.rest.TranslateActivator; +import org.apache.cxf.jaxrs.client.WebClient; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.tinybundles.core.TinyBundles; +import org.osgi.framework.Constants; + +@RunWith(PaxExam.class) +public class TestExportRestService extends AbstractDosgiTest { + String webPort = "9091"; + + @Configuration + public Option[] configure() throws Exception { + return new Option[] // + {// + basicTestOptions(), // + systemProperty("org.osgi.service.http.port").value(webPort), // + provision(getServiceBundle()), + //debug() + }; + } + + @Test + public void testCallService() throws Exception { + waitWebPage("http://localhost:" + webPort + "/cxf/translate"); + try { + WebClient client = WebClient.create("http://localhost:" + webPort + "/cxf/translate/hello"); + String result = client.get(String.class); + Assert.assertEquals("hallo", result); + } catch (Exception e) { + // Avoid serialization problems when just letting the exception fly + e.printStackTrace(); + throw new RuntimeException(e.getMessage()); + } + } + + private InputStream getServiceBundle() { + return TinyBundles.bundle() // + .add(RestTranslate.class) // + .add(RestTranslateImpl.class) // + .add(TranslateActivator.class) // + .set(Constants.BUNDLE_SYMBOLICNAME, "RestTranslate") // + .set(Constants.BUNDLE_ACTIVATOR, TranslateActivator.class.getName()) // + .build(TinyBundles.withBnd()); + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java new file mode 100644 index 0000000..27cc989 --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java @@ -0,0 +1,117 @@ +/** + * 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.cxf.dosgi.systests2.multi; + +import java.io.IOException; +import java.net.URL; +import java.util.Map; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.cxf.dosgi.samples.greeter.GreeterData; +import org.apache.cxf.dosgi.samples.greeter.GreeterException; +import org.apache.cxf.dosgi.samples.greeter.GreeterService; +import org.apache.cxf.dosgi.samples.greeter.GreetingPhrase; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.xml.sax.SAXException; + +@RunWith(PaxExam.class) +public class TestExportService extends AbstractDosgiTest { + + @Configuration + public static Option[] configure() throws Exception { + return new Option[] // + {// + basicTestOptions(), // + greeterInterface(), // + greeterImpl(), // + //debug(), + }; + } + + @Test + public void testAccessEndpoint() throws Exception { + waitPort(9090); + checkWsdl(new URL("http://localhost:9090/greeter?wsdl")); + checkServiceCall("http://localhost:9090/greeter"); + } + + private void checkServiceCall(String serviceUri) { + GreeterService client = GreeterServiceProxyFactory.createGreeterServiceProxy(serviceUri); + + Map<GreetingPhrase, String> greetings = client.greetMe("Fred"); + Assert.assertEquals("Fred", greetings.get(new GreetingPhrase("Hello"))); + System.out.println("Invocation result: " + greetings); + + try { + GreeterData gd = new GreeterDataImpl("Stranger", 11, true); + client.greetMe(gd); + Assert.fail("GreeterException has to be thrown"); + } catch (GreeterException ex) { + Assert.assertEquals("Wrong exception message", "GreeterService can not greet Stranger", + ex.toString()); + } + } + + private void checkWsdl(URL wsdlURL) throws ParserConfigurationException, SAXException, IOException { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setNamespaceAware(true); + dbf.setValidating(false); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document doc = db.parse(wsdlURL.openStream()); + Element el = doc.getDocumentElement(); + Assert.assertEquals("definitions", el.getLocalName()); + Assert.assertEquals("http://schemas.xmlsoap.org/wsdl/", el.getNamespaceURI()); + Assert.assertEquals("GreeterService", el.getAttribute("name")); + } + + class GreeterDataImpl implements GreeterData { + + private String name; + private int age; + private boolean exception; + + GreeterDataImpl(String n, int a, boolean ex) { + name = n; + age = a; + exception = ex; + } + + public String getName() { + return name; + } + + public int getAge() { + return age; + } + + public boolean isException() { + return exception; + } + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java new file mode 100644 index 0000000..9e435a8 --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java @@ -0,0 +1,104 @@ +/** + * 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.cxf.dosgi.systests2.multi; + +import static org.ops4j.pax.exam.CoreOptions.provision; +import static org.ops4j.pax.exam.CoreOptions.systemProperty; + +import java.io.InputStream; +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cxf.aegis.databinding.AegisDatabinding; +import org.apache.cxf.dosgi.samples.greeter.GreeterService; +import org.apache.cxf.dosgi.samples.greeter.GreetingPhrase; +import org.apache.cxf.dosgi.systests2.multi.importservice.SimpleGreeter; +import org.apache.cxf.endpoint.Server; +import org.apache.cxf.frontend.ServerFactoryBean; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.tinybundles.core.TinyBundles; +import org.osgi.framework.Constants; + +@RunWith(PaxExam.class) +public class TestImportService extends AbstractDosgiTest { + @Inject + GreeterService greeterService; + private Server server; + + @Configuration + public static Option[] configure() throws Exception { + return new Option[] // + {// + basicTestOptions(), // + greeterInterface(), // + provision(createServiceConsumerBundle()), // + // increase for debugging + systemProperty("org.apache.cxf.dosgi.test.serviceWaitTimeout") + .value(System.getProperty("org.apache.cxf.dosgi.test.serviceWaitTimeout", "200")), + }; + } + + protected static InputStream createServiceConsumerBundle() { + return TinyBundles.bundle() // + .add("OSGI-INF/remote-service/remote-services.xml", + TestImportService.class.getResource("/rs-test1.xml")) // + .set(Constants.BUNDLE_SYMBOLICNAME, "importConfig") // + .build(TinyBundles.withBnd()); + } + + @Before + public void createCXFService() { + server = publishTestGreeter(); + } + + @Test + public void testClientConsumer() throws Exception { + Map<GreetingPhrase, String> result = greeterService.greetMe("OSGi"); + GreetingPhrase phrase = result.keySet().iterator().next(); + Assert.assertEquals("Hi", phrase.getPhrase()); + } + + @After + public void stopCXFService() { + server.stop(); + } + + private Server publishTestGreeter() { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + try { + Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader()); + ServerFactoryBean factory = new ServerFactoryBean(); + factory.setServiceClass(GreeterService.class); + factory.setAddress("http://localhost:9191/grrr"); + factory.getServiceFactory().setDataBinding(new AegisDatabinding()); + factory.setServiceBean(new SimpleGreeter()); + return factory.create(); + } finally { + Thread.currentThread().setContextClassLoader(cl); + } + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/AddGreetingPhraseInterceptor.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/AddGreetingPhraseInterceptor.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/AddGreetingPhraseInterceptor.java new file mode 100644 index 0000000..a3a19be --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/AddGreetingPhraseInterceptor.java @@ -0,0 +1,44 @@ +/** + * 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.cxf.dosgi.systests2.multi.customintent; + +import java.util.List; +import java.util.Map; + +import org.apache.cxf.dosgi.samples.greeter.GreetingPhrase; +import org.apache.cxf.helpers.CastUtils; +import org.apache.cxf.interceptor.Fault; +import org.apache.cxf.message.Message; +import org.apache.cxf.message.MessageContentsList; +import org.apache.cxf.phase.AbstractPhaseInterceptor; + +public final class AddGreetingPhraseInterceptor extends AbstractPhaseInterceptor<Message> { + + AddGreetingPhraseInterceptor(String phase) { + super(phase); + } + + public void handleMessage(Message message) throws Fault { + MessageContentsList contents = (MessageContentsList) message.getContent(List.class); + Map<GreetingPhrase, String> result = CastUtils.cast((Map<?, ?>)contents.get(0)); + result.put(new GreetingPhrase("Hi from custom intent"), "customintent"); + //Object content1 = contents.iterator().next(); + System.out.println(message); + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomFeature.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomFeature.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomFeature.java new file mode 100644 index 0000000..abac14f --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomFeature.java @@ -0,0 +1,33 @@ +/** + * 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.cxf.dosgi.systests2.multi.customintent; + +import org.apache.cxf.Bus; +import org.apache.cxf.feature.AbstractFeature; +import org.apache.cxf.interceptor.InterceptorProvider; +import org.apache.cxf.phase.Phase; + +public final class CustomFeature extends AbstractFeature { + + @Override + protected void initializeProvider(InterceptorProvider provider, Bus bus) { + provider.getOutInterceptors().add(0, new AddGreetingPhraseInterceptor(Phase.USER_LOGICAL)); + super.initializeProvider(provider, bus); + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomIntentActivator.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomIntentActivator.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomIntentActivator.java new file mode 100644 index 0000000..ca4efda --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomIntentActivator.java @@ -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.cxf.dosgi.systests2.multi.customintent; + +import java.util.Dictionary; +import java.util.Hashtable; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class CustomIntentActivator implements BundleActivator { + + public void start(BundleContext context) throws Exception { + Dictionary<String, String> props = new Hashtable<String, String>(); + props.put("org.apache.cxf.dosgi.IntentName", "myIntent"); + context.registerService(Object.class.getName(), new CustomFeature(), props); + } + + public void stop(BundleContext context) throws Exception { + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/EmptyGreeterService.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/EmptyGreeterService.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/EmptyGreeterService.java new file mode 100644 index 0000000..2c0108d --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/EmptyGreeterService.java @@ -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.cxf.dosgi.systests2.multi.customintent.service; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.cxf.dosgi.samples.greeter.GreeterData; +import org.apache.cxf.dosgi.samples.greeter.GreeterException; +import org.apache.cxf.dosgi.samples.greeter.GreeterService; +import org.apache.cxf.dosgi.samples.greeter.GreetingPhrase; + +public final class EmptyGreeterService implements GreeterService { + + /** + * Return an empty array. Our custom intent should add a GreetingPhrase + */ + public GreetingPhrase[] greetMe(GreeterData name) throws GreeterException { + return new GreetingPhrase[]{}; + } + + public Map<GreetingPhrase, String> greetMe(String name) { + return new HashMap<GreetingPhrase, String>(); + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/GreeterServiceWithCustomIntentActivator.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/GreeterServiceWithCustomIntentActivator.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/GreeterServiceWithCustomIntentActivator.java new file mode 100644 index 0000000..bcf6016 --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/GreeterServiceWithCustomIntentActivator.java @@ -0,0 +1,42 @@ +/** + * 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.cxf.dosgi.systests2.multi.customintent.service; + +import java.util.Dictionary; +import java.util.Hashtable; + +import org.apache.cxf.dosgi.samples.greeter.GreeterService; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.service.remoteserviceadmin.RemoteConstants; + +public class GreeterServiceWithCustomIntentActivator implements BundleActivator { + + public void start(BundleContext context) throws Exception { + Dictionary<String, String> props = new Hashtable<String, String>(); + props.put(RemoteConstants.SERVICE_EXPORTED_INTERFACES, "*"); + props.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, "org.apache.cxf.ws"); + props.put("org.apache.cxf.ws.address", "http://localhost:9090/greeter"); + props.put(RemoteConstants.SERVICE_EXPORTED_INTENTS, "myIntent"); + context.registerService(GreeterService.class.getName(), new EmptyGreeterService(), props); + } + + public void stop(BundleContext context) throws Exception { + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/importservice/SimpleGreeter.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/importservice/SimpleGreeter.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/importservice/SimpleGreeter.java new file mode 100644 index 0000000..e39c315 --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/importservice/SimpleGreeter.java @@ -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.cxf.dosgi.systests2.multi.importservice; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.cxf.dosgi.samples.greeter.GreeterData; +import org.apache.cxf.dosgi.samples.greeter.GreeterException; +import org.apache.cxf.dosgi.samples.greeter.GreeterService; +import org.apache.cxf.dosgi.samples.greeter.GreetingPhrase; + +public class SimpleGreeter implements GreeterService { + + public Map<GreetingPhrase, String> greetMe(String name) { + Map<GreetingPhrase, String> m = new HashMap<GreetingPhrase, String>(); + GreetingPhrase gp = new GreetingPhrase("Hi"); + m.put(gp, name); + return m; + } + + public GreetingPhrase[] greetMe(GreeterData gd) throws GreeterException { + throw new GreeterException("TestGreeter"); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslate.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslate.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslate.java new file mode 100644 index 0000000..3a55c0e --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslate.java @@ -0,0 +1,34 @@ +/** + * 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.cxf.dosgi.systests2.multi.rest; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; + +public interface RestTranslate { + + @GET + String englishWords(); + + @GET + @Path("/{word}") + String getTranslation(@PathParam("word") String word); + +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslateImpl.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslateImpl.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslateImpl.java new file mode 100644 index 0000000..640b0c9 --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslateImpl.java @@ -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.cxf.dosgi.systests2.multi.rest; + +import java.util.HashMap; +import java.util.Map; + +public class RestTranslateImpl implements RestTranslate { + Map<String, String> translation; + + public RestTranslateImpl() { + translation = new HashMap<String, String>(); + translation.put("hello", "hallo"); + } + + @Override + public String englishWords() { + return translation.keySet().toString(); + } + + @Override + public String getTranslation(String word) { + return translation.get(word); + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/TranslateActivator.java ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/TranslateActivator.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/TranslateActivator.java new file mode 100644 index 0000000..a6b1892 --- /dev/null +++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/TranslateActivator.java @@ -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.cxf.dosgi.systests2.multi.rest; + +import java.util.Dictionary; +import java.util.Hashtable; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.service.remoteserviceadmin.RemoteConstants; + +public class TranslateActivator implements BundleActivator { + + public void start(BundleContext context) throws Exception { + Dictionary<String, String> props = new Hashtable<String, String>(); + props.put(RemoteConstants.SERVICE_EXPORTED_INTERFACES, "*"); + props.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, "org.apache.cxf.rs"); + props.put("org.apache.cxf.rs.address", "/translate"); + context.registerService(RestTranslate.class, new RestTranslateImpl(), props); + } + + public void stop(BundleContext context) throws Exception { + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/resources/cfg/org.ops4j.pax.logging.cfg ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/resources/cfg/org.ops4j.pax.logging.cfg b/itests/multi-bundle/src/test/resources/cfg/org.ops4j.pax.logging.cfg new file mode 100644 index 0000000..b081a42 --- /dev/null +++ b/itests/multi-bundle/src/test/resources/cfg/org.ops4j.pax.logging.cfg @@ -0,0 +1,7 @@ +log4j.rootLogger=INFO, stdout +log4j.logger.org.apache.cxf.bus.blueprint=ERROR +log4j.logger.org.apache.cxf.bus.osgi.CXFActivator=WARN + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %40.40c | %m%n http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/resources/log4j.properties b/itests/multi-bundle/src/test/resources/log4j.properties new file mode 100644 index 0000000..37ce342 --- /dev/null +++ b/itests/multi-bundle/src/test/resources/log4j.properties @@ -0,0 +1,9 @@ +log4j.rootLogger=INFO, stdout + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %40.40c | %m%n + +log4j.logger.org.ops4j.pax.scanner=WARN +log4j.logger.org.ops4j.pax.runner=WARN +log4j.logger.org.ops4j.pax.url=WARN http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/multi-bundle/src/test/resources/rs-test1.xml ---------------------------------------------------------------------- diff --git a/itests/multi-bundle/src/test/resources/rs-test1.xml b/itests/multi-bundle/src/test/resources/rs-test1.xml new file mode 100644 index 0000000..7392d24 --- /dev/null +++ b/itests/multi-bundle/src/test/resources/rs-test1.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> + <!-- + 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. + --> +<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0" + xmlns:other="http://www.acme.org/xmlns/other/v1.0.0"> + <endpoint-description> + <property name="objectClass"> + <array> + <value>org.apache.cxf.dosgi.samples.greeter.GreeterService</value> + </array> + </property> + <property name="endpoint.id">http://localhost:9191/grrr</property> + <property name="service.imported.configs">org.apache.cxf.ws</property> + </endpoint-description> +</endpoint-descriptions> + http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/itests/pom.xml ---------------------------------------------------------------------- diff --git a/itests/pom.xml b/itests/pom.xml new file mode 100644 index 0000000..6482ba7 --- /dev/null +++ b/itests/pom.xml @@ -0,0 +1,41 @@ +<?xml version='1.0' encoding='UTF-8' ?> +<!-- + 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. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.cxf.dosgi</groupId> + <artifactId>cxf-dosgi-ri-parent</artifactId> + <version>2.0-SNAPSHOT</version> + <relativePath>../parent/pom.xml</relativePath> + </parent> + + <groupId>org.apache.cxf.dosgi.systests</groupId> + <artifactId>cxf-dosgi-ri-itests</artifactId> + <version>2.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>Distributed OSGi System Tests</name> + + <modules> + <module>multi-bundle</module> + </modules> +</project> http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index b07da5c..ea1f430 100644 --- a/pom.xml +++ b/pom.xml @@ -108,7 +108,7 @@ <module>provider-rs</module> <module>samples</module> <module>distribution</module> - <module>systests2</module> + <module>itests</module> </modules> <profiles> http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/systests2/multi-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/pom.xml b/systests2/multi-bundle/pom.xml deleted file mode 100644 index 4fb0947..0000000 --- a/systests2/multi-bundle/pom.xml +++ /dev/null @@ -1,230 +0,0 @@ -<?xml version='1.0' encoding='UTF-8' ?> -<!-- - 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. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.apache.cxf.dosgi</groupId> - <artifactId>cxf-dosgi-ri-parent</artifactId> - <version>2.0-SNAPSHOT</version> - <relativePath>../../parent/pom.xml</relativePath> - </parent> - - <groupId>org.apache.cxf.dosgi.systests</groupId> - <artifactId>cxf-dosgi-ri-systests2-multibundle</artifactId> - <packaging>jar</packaging> - <name>Distributed OSGi System Tests Multi-Bundle</name> - - <properties> - <topDirectoryLocation>../..</topDirectoryLocation> - </properties> - - <!-- - When changing code make sure to run the distro before testing - or you will be testing the old code. - - --> - - <dependencies> - <!-- Pax Exam --> - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-atinject_1.0_spec</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.ops4j.pax.exam</groupId> - <artifactId>pax-exam-junit4</artifactId> - </dependency> - <dependency> - <groupId>org.ops4j.pax.exam</groupId> - <artifactId>pax-exam-inject</artifactId> - </dependency> - <dependency> - <groupId>org.ops4j.pax.exam</groupId> - <artifactId>pax-exam-cm</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.ops4j.pax.exam</groupId> - <artifactId>pax-exam-container-forked</artifactId> - </dependency> - <dependency> - <groupId>org.ops4j.pax.exam</groupId> - <artifactId>pax-exam-link-mvn</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.ops4j.pax.url</groupId> - <artifactId>pax-url-aether</artifactId> - <version>2.4.5</version> - </dependency> - - - <dependency> - <groupId>org.eclipse.tycho</groupId> - <artifactId>org.eclipse.osgi</artifactId> - </dependency> - <!-- - <dependency> - <groupId>org.apache.felix</groupId> - <artifactId>org.apache.felix.framework</artifactId> - <scope>test</scope> - </dependency> - --> - - <!-- CXF --> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-core</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-bindings-soap</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-transports-http-jetty</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-frontend-jaxrs</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-rs-client</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-databinding-aegis</artifactId> - <version>${cxf.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.zookeeper</groupId> - <artifactId>zookeeper</artifactId> - <version>${zookeeper.version}</version> - <exclusions> - <exclusion> - <groupId>com.sun.jdmk</groupId> - <artifactId>jmxtools</artifactId> - </exclusion> - <exclusion> - <groupId>com.sun.jmx</groupId> - <artifactId>jmxri</artifactId> - </exclusion> - </exclusions> - </dependency> - - <!-- Samples --> - <dependency> - <groupId>org.apache.cxf.dosgi.samples</groupId> - <artifactId>cxf-dosgi-ri-samples-greeter-impl</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.cxf.dosgi.samples</groupId> - <artifactId>cxf-dosgi-ri-samples-greeter-interface</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.cxf.dosgi.samples</groupId> - <artifactId>cxf-dosgi-ri-samples-greeter-rest-impl</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.cxf.dosgi.samples</groupId> - <artifactId>cxf-dosgi-ri-samples-greeter-rest-interface</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>unpack</id> - <phase>generate-resources</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.apache.cxf.dosgi</groupId> - <artifactId>cxf-dosgi-ri-multibundle-distribution</artifactId> - <version>${project.version}</version> - <type>zip</type> - <classifier>dir</classifier> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.servicemix.tooling</groupId> - <artifactId>depends-maven-plugin</artifactId> - <version>1.3.1</version> - <executions> - <execution> - <id>generate-depends-file</id> - <goals> - <goal>generate-depends-file</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <systemPropertyVariables> - <!-- <org.apache.cxf.dosgi.test.debug.port>5005</org.apache.cxf.dosgi.test.debug.port> - <org.apache.cxf.dosgi.test.serviceWaitTimeout>180</org.apache.cxf.dosgi.test.serviceWaitTimeout> --> - <java.util.logging.config.file>${project.build.directory}/test-classes/logging.properties</java.util.logging.config.file> - </systemPropertyVariables> - </configuration> - </plugin> - </plugins> - </build> -</project>
