Repository: cxf-dosgi Updated Branches: refs/heads/master 1fef30511 -> 7f75cc067
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/052cccc7/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java deleted file mode 100644 index 383d7e9..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java +++ /dev/null @@ -1,248 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/GreeterServiceProxyFactory.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/GreeterServiceProxyFactory.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/GreeterServiceProxyFactory.java deleted file mode 100644 index 074a6f1..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/GreeterServiceProxyFactory.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java deleted file mode 100644 index 70e4816..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestCustomIntent.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestCustomIntent.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestCustomIntent.java deleted file mode 100644 index 9928db0..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestCustomIntent.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryExport.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryExport.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryExport.java deleted file mode 100644 index b0113fd..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryExport.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java deleted file mode 100644 index 0ed885a..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java +++ /dev/null @@ -1,77 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java deleted file mode 100644 index 27cc989..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportService.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java deleted file mode 100644 index 9e435a8..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestImportService.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/AddGreetingPhraseInterceptor.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/AddGreetingPhraseInterceptor.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/AddGreetingPhraseInterceptor.java deleted file mode 100644 index a3a19be..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/AddGreetingPhraseInterceptor.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomFeature.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomFeature.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomFeature.java deleted file mode 100644 index abac14f..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomFeature.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomIntentActivator.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomIntentActivator.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomIntentActivator.java deleted file mode 100644 index ca4efda..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/CustomIntentActivator.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/EmptyGreeterService.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/EmptyGreeterService.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/EmptyGreeterService.java deleted file mode 100644 index 2c0108d..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/EmptyGreeterService.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/GreeterServiceWithCustomIntentActivator.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/GreeterServiceWithCustomIntentActivator.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/GreeterServiceWithCustomIntentActivator.java deleted file mode 100644 index bcf6016..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/customintent/service/GreeterServiceWithCustomIntentActivator.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/importservice/SimpleGreeter.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/importservice/SimpleGreeter.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/importservice/SimpleGreeter.java deleted file mode 100644 index e39c315..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/importservice/SimpleGreeter.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslate.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslate.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslate.java deleted file mode 100644 index 3a55c0e..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslate.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslateImpl.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslateImpl.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslateImpl.java deleted file mode 100644 index 640b0c9..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/RestTranslateImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/TranslateActivator.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/TranslateActivator.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/TranslateActivator.java deleted file mode 100644 index a6b1892..0000000 --- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/rest/TranslateActivator.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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/systests2/multi-bundle/src/test/resources/cfg/org.ops4j.pax.logging.cfg ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/resources/cfg/org.ops4j.pax.logging.cfg b/systests2/multi-bundle/src/test/resources/cfg/org.ops4j.pax.logging.cfg deleted file mode 100644 index b081a42..0000000 --- a/systests2/multi-bundle/src/test/resources/cfg/org.ops4j.pax.logging.cfg +++ /dev/null @@ -1,7 +0,0 @@ -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/systests2/multi-bundle/src/test/resources/log4j.properties ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/resources/log4j.properties b/systests2/multi-bundle/src/test/resources/log4j.properties deleted file mode 100644 index 37ce342..0000000 --- a/systests2/multi-bundle/src/test/resources/log4j.properties +++ /dev/null @@ -1,9 +0,0 @@ -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/systests2/multi-bundle/src/test/resources/rs-test1.xml ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/resources/rs-test1.xml b/systests2/multi-bundle/src/test/resources/rs-test1.xml deleted file mode 100644 index 7392d24..0000000 --- a/systests2/multi-bundle/src/test/resources/rs-test1.xml +++ /dev/null @@ -1,28 +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. - --> -<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/systests2/pom.xml ---------------------------------------------------------------------- diff --git a/systests2/pom.xml b/systests2/pom.xml deleted file mode 100644 index 423b338..0000000 --- a/systests2/pom.xml +++ /dev/null @@ -1,41 +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</artifactId> - <version>2.0-SNAPSHOT</version> - <packaging>pom</packaging> - - <name>Distributed OSGi System Tests</name> - - <modules> - <module>multi-bundle</module> - </modules> -</project>
