Repository: cxf-dosgi Updated Branches: refs/heads/master b77a90308 -> c1b1598d2
[DOSGI-241] Remove systest2.common Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/c1b1598d Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/c1b1598d Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/c1b1598d Branch: refs/heads/master Commit: c1b1598d2ac34108226ce699b891953b859e614f Parents: b77a903 Author: Christian Schneider <[email protected]> Authored: Fri Jul 1 10:37:24 2016 +0200 Committer: Christian Schneider <[email protected]> Committed: Fri Jul 1 10:37:24 2016 +0200 ---------------------------------------------------------------------- decorator/pom.xml | 17 +-- parent/pom.xml | 5 + systests2/common/pom.xml | 112 ------------------- .../systests2/common/test1/GreeterDataImpl.java | 39 ------- .../systests2/common/test1/MyActivator.java | 45 -------- .../common/test1/MyServiceTracker.java | 76 ------------- .../common/test1/StartServiceTracker.java | 41 ------- .../systests2/common/test2/Test2Service.java | 23 ---- .../common/test2/client/ClientActivator.java | 37 ------ .../test2/client/Test2ServiceTracker.java | 70 ------------ .../common/test2/server/ServerActivator.java | 53 --------- .../common/test2/server/Test2ServiceImpl.java | 36 ------ .../common/src/main/resources/rs-test1.xml | 28 ----- systests2/multi-bundle/pom.xml | 47 ++++---- .../systests2/common/test1/GreeterDataImpl.java | 39 +++++++ .../systests2/common/test1/MyActivator.java | 45 ++++++++ .../common/test1/MyServiceTracker.java | 76 +++++++++++++ .../common/test1/StartServiceTracker.java | 41 +++++++ .../systests2/multi/AbstractDosgiTest.java | 29 +++-- .../dosgi/systests2/multi/TestCustomIntent.java | 6 +- .../systests2/multi/TestDiscoveryExport.java | 35 ++---- .../systests2/multi/TestExportRestService.java | 14 +-- .../systests2/multi/TestExportService.java | 16 +-- .../systests2/multi/TestImportService.java | 6 +- .../src/test/resources/rs-test1.xml | 28 +++++ systests2/pom.xml | 1 - 26 files changed, 298 insertions(+), 667 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/decorator/pom.xml ---------------------------------------------------------------------- diff --git a/decorator/pom.xml b/decorator/pom.xml index e86e5bb..af14af3 100644 --- a/decorator/pom.xml +++ b/decorator/pom.xml @@ -88,12 +88,6 @@ </dependency> <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-servlet_${servlet.version}_spec</artifactId> - <version>1.0</version> - </dependency> - - <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> @@ -116,6 +110,7 @@ <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> + <version>0.9.1</version> <executions> <execution> <goals> @@ -138,16 +133,6 @@ </instructions> </configuration> </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <excludes> - <exclude>**/TestUtils*</exclude> - </excludes> - </configuration> - </plugin> </plugins> </build> </project> http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/parent/pom.xml ---------------------------------------------------------------------- diff --git a/parent/pom.xml b/parent/pom.xml index 70933a8..e30dc89 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -123,6 +123,11 @@ </dependency> <dependency> <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-cm</artifactId> + <version>${exam.version}</version> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> <artifactId>pax-exam-container-forked</artifactId> <version>${exam.version}</version> </dependency> http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/common/pom.xml ---------------------------------------------------------------------- diff --git a/systests2/common/pom.xml b/systests2/common/pom.xml deleted file mode 100644 index b3aacb3..0000000 --- a/systests2/common/pom.xml +++ /dev/null @@ -1,112 +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>1.9-SNAPSHOT</version> - <relativePath>../../parent/pom.xml</relativePath> - </parent> - - <properties> - <topDirectoryLocation>../..</topDirectoryLocation> - </properties> - - <groupId>org.apache.cxf.dosgi.systests</groupId> - <artifactId>cxf-dosgi-ri-systests2-common</artifactId> - <packaging>bundle</packaging> - - <name>Distributed OSGi System Tests Common Classes</name> - - <dependencies> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.core</artifactId> - </dependency> - <dependency> - <groupId>org.osgi</groupId> - <artifactId>org.osgi.compendium</artifactId> - </dependency> - - <dependency> - <groupId>org.ops4j.pax.tinybundles</groupId> - <artifactId>tinybundles</artifactId> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-core</artifactId> - <version>${cxf.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-rt-frontend-jaxws</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.cxf.dosgi.samples</groupId> - <artifactId>cxf-dosgi-ri-samples-greeter-impl</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.cxf.dosgi.samples</groupId> - <artifactId>cxf-dosgi-ri-samples-greeter-interface</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>provided</scope> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <excludeDependencies>true</excludeDependencies> - <instructions> - <Bundle-Name>Bundle containing common code for the CXF DOSGi system tests</Bundle-Name> - <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> - <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor> - <!-- The TinyBundles are only used during the 'configure' stage and are therefore not - needed at runtime. - Other imports marked as optional as not all tests have the same dependencies. --> - <Import-Package> - !org.ops4j.pax.swissbox.tinybundles.*, - *;resolution:=optional - </Import-Package> - <Export-Package>*</Export-Package> - </instructions> - </configuration> - </plugin> - </plugins> - </build> -</project> http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/GreeterDataImpl.java ---------------------------------------------------------------------- diff --git a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/GreeterDataImpl.java b/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/GreeterDataImpl.java deleted file mode 100644 index 31f2988..0000000 --- a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/GreeterDataImpl.java +++ /dev/null @@ -1,39 +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.common.test1; - -import org.apache.cxf.dosgi.samples.greeter.GreeterData; - -public class GreeterDataImpl implements GreeterData { - - public int getAge() { - // TODO Auto-generated method stub - return 0; - } - - public String getName() { - // TODO Auto-generated method stub - return null; - } - - public boolean isException() { - // TODO Auto-generated method stub - return false; - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyActivator.java ---------------------------------------------------------------------- diff --git a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyActivator.java b/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyActivator.java deleted file mode 100644 index 6740725..0000000 --- a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyActivator.java +++ /dev/null @@ -1,45 +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.common.test1; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Filter; -import org.osgi.util.tracker.ServiceTracker; - -public class MyActivator implements BundleActivator { - - private ServiceTracker startTracker; - private ServiceTracker tracker; - - public void start(final BundleContext bc) throws Exception { - Filter filter = bc.createFilter("(&(objectClass=java.lang.Object)(testName=test1))"); - tracker = new MyServiceTracker(bc); - - // The start tracker waits until a service from the test class is set before the - // 'MyServiceTracker' is activated. - startTracker = new StartServiceTracker(bc, filter, tracker); - startTracker.open(); - } - - public void stop(BundleContext bc) throws Exception { - startTracker.close(); - tracker.close(); - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java ---------------------------------------------------------------------- diff --git a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java b/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java deleted file mode 100644 index 2886ce8..0000000 --- a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java +++ /dev/null @@ -1,76 +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.common.test1; - -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Map; - -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.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.osgi.util.tracker.ServiceTracker; - -public class MyServiceTracker extends ServiceTracker<GreeterService, GreeterService> { - - private static StringBuffer invocationResult = new StringBuffer(); - - public MyServiceTracker(BundleContext context) { - super(context, GreeterService.class, null); - } - - @Override - public GreeterService addingService(ServiceReference<GreeterService> reference) { - GreeterService service = super.addingService(reference); - System.out.println("[client] Got a GreeterService..."); - invokeGreeter(service); - return service; - } - - public static String getResult() { - return invocationResult.toString(); - } - - private void invokeGreeter(GreeterService svc) { - try { - Map<GreetingPhrase, String> result = svc.greetMe("OSGi"); - for (Map.Entry<GreetingPhrase, String> e : result.entrySet()) { - GreetingPhrase key = e.getKey(); - invocationResult.append(key.getPhrase()); - invocationResult.append(e.getValue()); - } - try { - svc.greetMe(new GreeterDataImpl()); - } catch (GreeterException ex) { - invocationResult.append(";exception"); - } - Dictionary<String, Object> props = new Hashtable<String, Object>(); - props.put("result", invocationResult.toString()); - props.put("testResult", "test1"); - - System.out.println("[client] Successfully invoked remote service. Registering test response service..."); - context.registerService(String.class.getName(), "test1", props); - } catch (Exception x) { - System.err.println("[client] Error during remote service invocation:"); - x.printStackTrace(System.err); - } - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/StartServiceTracker.java ---------------------------------------------------------------------- diff --git a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/StartServiceTracker.java b/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/StartServiceTracker.java deleted file mode 100644 index 40319ec..0000000 --- a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test1/StartServiceTracker.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.common.test1; - -import org.osgi.framework.BundleContext; -import org.osgi.framework.Filter; -import org.osgi.framework.ServiceReference; -import org.osgi.util.tracker.ServiceTracker; - -public class StartServiceTracker extends ServiceTracker { - - private ServiceTracker tracker; - - public StartServiceTracker(BundleContext context, Filter filter, ServiceTracker tracker) { - super(context, filter, null); - this.tracker = tracker; - } - - @Override - public Object addingService(ServiceReference reference) { - System.out.println("Test object available, so starting the service client tracker..."); - tracker.open(); - return super.addingService(reference); - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/Test2Service.java ---------------------------------------------------------------------- diff --git a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/Test2Service.java b/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/Test2Service.java deleted file mode 100644 index 806cdc9..0000000 --- a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/Test2Service.java +++ /dev/null @@ -1,23 +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.common.test2; - -public interface Test2Service { - String getRemoteStackTrace(); -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/ClientActivator.java ---------------------------------------------------------------------- diff --git a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/ClientActivator.java b/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/ClientActivator.java deleted file mode 100644 index 0efd943..0000000 --- a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/ClientActivator.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.common.test2.client; - -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.util.tracker.ServiceTracker; - -public class ClientActivator implements BundleActivator { - - private ServiceTracker tracker; - - public void start(final BundleContext bc) throws Exception { - tracker = new Test2ServiceTracker(bc); - tracker.open(); - } - - public void stop(BundleContext bc) throws Exception { - tracker.close(); - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/Test2ServiceTracker.java ---------------------------------------------------------------------- diff --git a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/Test2ServiceTracker.java b/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/Test2ServiceTracker.java deleted file mode 100644 index 9996eb4..0000000 --- a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/client/Test2ServiceTracker.java +++ /dev/null @@ -1,70 +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.common.test2.client; - -import java.util.Dictionary; -import java.util.Hashtable; - -import org.apache.cxf.dosgi.systests2.common.test2.Test2Service; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Filter; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; -import org.osgi.util.tracker.ServiceTracker; - -public class Test2ServiceTracker extends ServiceTracker<Test2Service, Test2Service> { - - public Test2ServiceTracker(BundleContext context) { - super(context, getFilter(context), null); - } - - private static Filter getFilter(BundleContext context) { - Filter f = null; - try { - // It's very important that the service.imported condition is there too - // otherwise the tracker will make a local 'direct' invocation on the service. - // The service.imported forces a proxy lookup. - f = context.createFilter("(&(objectClass=" + Test2Service.class.getName() + ")(service.imported=*))"); - } catch (InvalidSyntaxException e) { - e.printStackTrace(); - } - return f; - } - - @Override - public Test2Service addingService(ServiceReference<Test2Service> reference) { - Test2Service service = super.addingService(reference); - System.out.println("*** Ref: " + reference); - for (String key : reference.getPropertyKeys()) { - System.out.println(" " + key + "-" + reference.getProperty(key)); - } - - invokeRemoteTestService(context, service); - return service; - } - - private void invokeRemoteTestService(BundleContext bc, Test2Service service) { - String res = service.getRemoteStackTrace(); - - Dictionary<String, Object> props = new Hashtable<String, Object>(); - props.put("result", res); - props.put("testResult", "test2"); - bc.registerService(String.class.getName(), "test2", props); - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/ServerActivator.java ---------------------------------------------------------------------- diff --git a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/ServerActivator.java b/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/ServerActivator.java deleted file mode 100644 index 315b250..0000000 --- a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/ServerActivator.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.common.test2.server; - -import java.net.ServerSocket; -import java.util.Dictionary; -import java.util.Hashtable; - -import org.apache.cxf.dosgi.systests2.common.test2.Test2Service; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; - -public class ServerActivator implements BundleActivator { - - private ServiceRegistration reg; - - public void start(BundleContext bc) throws Exception { - Test2Service svc = new Test2ServiceImpl(); - - // Dynamically assign a free port - int freePort = new ServerSocket(0).getLocalPort(); - String url = "http://localhost:" + freePort + "/test2"; - System.out.println("*** Server using URL: " + url); - - Dictionary<String, Object> props = new Hashtable<String, Object>(); - props.put("service.exported.interfaces", "*"); - props.put("service.exported.configs", "org.apache.cxf.ws"); - props.put("endpoint.id", url); - - reg = bc.registerService(Test2Service.class.getName(), svc, props); - } - - public void stop(BundleContext bc) throws Exception { - reg.unregister(); - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/Test2ServiceImpl.java ---------------------------------------------------------------------- diff --git a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/Test2ServiceImpl.java b/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/Test2ServiceImpl.java deleted file mode 100644 index c03f572..0000000 --- a/systests2/common/src/main/java/org/apache/cxf/dosgi/systests2/common/test2/server/Test2ServiceImpl.java +++ /dev/null @@ -1,36 +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.common.test2.server; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import org.apache.cxf.dosgi.systests2.common.test2.Test2Service; - -public class Test2ServiceImpl implements Test2Service { - - public String getRemoteStackTrace() { - Throwable th = new Throwable("Throwable created on the server"); - StringWriter sw = new StringWriter(); - PrintWriter pw = new PrintWriter(sw); - th.printStackTrace(pw); - - return sw.toString(); - } -} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/common/src/main/resources/rs-test1.xml ---------------------------------------------------------------------- diff --git a/systests2/common/src/main/resources/rs-test1.xml b/systests2/common/src/main/resources/rs-test1.xml deleted file mode 100644 index 7392d24..0000000 --- a/systests2/common/src/main/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/c1b1598d/systests2/multi-bundle/pom.xml ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/pom.xml b/systests2/multi-bundle/pom.xml index 6ee3186..34d6ecc 100644 --- a/systests2/multi-bundle/pom.xml +++ b/systests2/multi-bundle/pom.xml @@ -45,6 +45,12 @@ <dependencies> <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + </dependency> + + <!-- Pax Exam --> + <dependency> <groupId>org.apache.geronimo.specs</groupId> <artifactId>geronimo-atinject_1.0_spec</artifactId> <scope>test</scope> @@ -59,6 +65,11 @@ </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> @@ -73,6 +84,7 @@ <version>2.4.5</version> </dependency> + <dependency> <groupId>org.eclipse.tycho</groupId> <artifactId>org.eclipse.osgi</artifactId> @@ -85,13 +97,7 @@ </dependency> --> - <dependency> - <groupId>org.apache.cxf.dosgi.systests</groupId> - <artifactId>cxf-dosgi-ri-systests2-common</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - + <!-- CXF --> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-core</artifactId> @@ -118,6 +124,12 @@ <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> @@ -132,6 +144,8 @@ </exclusion> </exclusions> </dependency> + + <!-- Samples --> <dependency> <groupId>org.apache.cxf.dosgi.samples</groupId> <artifactId>cxf-dosgi-ri-samples-greeter-impl</artifactId> @@ -162,25 +176,6 @@ <artifactId>junit</artifactId> <scope>test</scope> </dependency> - - <dependency> - <groupId>org.apache.cxf.services.xkms</groupId> - <artifactId>cxf-services-xkms-features</artifactId> - <version>${cxf.version}</version> - <type>xml</type> - </dependency> - <dependency> - <groupId>org.apache.cxf.services.xkms</groupId> - <artifactId>cxf-services-xkms-common</artifactId> - <version>${cxf.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.cxf.services.xkms</groupId> - <artifactId>cxf-services-xkms-client</artifactId> - <version>${cxf.version}</version> - <scope>test</scope> - </dependency> </dependencies> <build> http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/GreeterDataImpl.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/GreeterDataImpl.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/GreeterDataImpl.java new file mode 100644 index 0000000..31f2988 --- /dev/null +++ b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/GreeterDataImpl.java @@ -0,0 +1,39 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.dosgi.systests2.common.test1; + +import org.apache.cxf.dosgi.samples.greeter.GreeterData; + +public class GreeterDataImpl implements GreeterData { + + public int getAge() { + // TODO Auto-generated method stub + return 0; + } + + public String getName() { + // TODO Auto-generated method stub + return null; + } + + public boolean isException() { + // TODO Auto-generated method stub + return false; + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/MyActivator.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/MyActivator.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/MyActivator.java new file mode 100644 index 0000000..6740725 --- /dev/null +++ b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/MyActivator.java @@ -0,0 +1,45 @@ +/** + * 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.common.test1; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Filter; +import org.osgi.util.tracker.ServiceTracker; + +public class MyActivator implements BundleActivator { + + private ServiceTracker startTracker; + private ServiceTracker tracker; + + public void start(final BundleContext bc) throws Exception { + Filter filter = bc.createFilter("(&(objectClass=java.lang.Object)(testName=test1))"); + tracker = new MyServiceTracker(bc); + + // The start tracker waits until a service from the test class is set before the + // 'MyServiceTracker' is activated. + startTracker = new StartServiceTracker(bc, filter, tracker); + startTracker.open(); + } + + public void stop(BundleContext bc) throws Exception { + startTracker.close(); + tracker.close(); + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java new file mode 100644 index 0000000..2886ce8 --- /dev/null +++ b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/MyServiceTracker.java @@ -0,0 +1,76 @@ +/** + * 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.common.test1; + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.Map; + +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.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.util.tracker.ServiceTracker; + +public class MyServiceTracker extends ServiceTracker<GreeterService, GreeterService> { + + private static StringBuffer invocationResult = new StringBuffer(); + + public MyServiceTracker(BundleContext context) { + super(context, GreeterService.class, null); + } + + @Override + public GreeterService addingService(ServiceReference<GreeterService> reference) { + GreeterService service = super.addingService(reference); + System.out.println("[client] Got a GreeterService..."); + invokeGreeter(service); + return service; + } + + public static String getResult() { + return invocationResult.toString(); + } + + private void invokeGreeter(GreeterService svc) { + try { + Map<GreetingPhrase, String> result = svc.greetMe("OSGi"); + for (Map.Entry<GreetingPhrase, String> e : result.entrySet()) { + GreetingPhrase key = e.getKey(); + invocationResult.append(key.getPhrase()); + invocationResult.append(e.getValue()); + } + try { + svc.greetMe(new GreeterDataImpl()); + } catch (GreeterException ex) { + invocationResult.append(";exception"); + } + Dictionary<String, Object> props = new Hashtable<String, Object>(); + props.put("result", invocationResult.toString()); + props.put("testResult", "test1"); + + System.out.println("[client] Successfully invoked remote service. Registering test response service..."); + context.registerService(String.class.getName(), "test1", props); + } catch (Exception x) { + System.err.println("[client] Error during remote service invocation:"); + x.printStackTrace(System.err); + } + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/StartServiceTracker.java ---------------------------------------------------------------------- diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/StartServiceTracker.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/StartServiceTracker.java new file mode 100644 index 0000000..40319ec --- /dev/null +++ b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/common/test1/StartServiceTracker.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.common.test1; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Filter; +import org.osgi.framework.ServiceReference; +import org.osgi.util.tracker.ServiceTracker; + +public class StartServiceTracker extends ServiceTracker { + + private ServiceTracker tracker; + + public StartServiceTracker(BundleContext context, Filter filter, ServiceTracker tracker) { + super(context, filter, null); + this.tracker = tracker; + } + + @Override + public Object addingService(ServiceReference reference) { + System.out.println("Test object available, so starting the service client tracker..."); + tracker.open(); + return super.addingService(reference); + } +} http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/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 index b7ae6f3..98579d2 100644 --- 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 @@ -18,6 +18,8 @@ */ package org.apache.cxf.dosgi.systests2.multi; +import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration; + import java.io.IOException; import java.net.ConnectException; import java.net.HttpURLConnection; @@ -31,18 +33,21 @@ import java.util.concurrent.TimeoutException; import javax.inject.Inject; +import org.ops4j.pax.exam.Option; 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; - + + + /** * 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. @@ -112,14 +117,13 @@ public class AbstractDosgiTest { return null; } - protected int getFreePort() throws IOException { - ServerSocket socket = new ServerSocket(); - try { + 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(); - } finally { - socket.close(); + } catch (Exception e) { + throw new RuntimeException(e.getMessage(), e); } } @@ -162,4 +166,15 @@ public class AbstractDosgiTest { } } } + + 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(); + } + } http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/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 index 769f118..e7c4b4a 100644 --- 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 @@ -41,6 +41,7 @@ import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.CoreOptions; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.tinybundles.core.TinyBundles; @@ -75,13 +76,10 @@ public class TestCustomIntent extends AbstractDosgiTest { public static Option[] configure() throws Exception { return new Option[] { MultiBundleTools.getDistro(), + CoreOptions.junitBundles(), systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"), - mavenBundle().groupId("org.apache.servicemix.bundles") - .artifactId("org.apache.servicemix.bundles.junit").version("4.9_2"), mavenBundle().groupId("org.apache.cxf.dosgi.samples") .artifactId("cxf-dosgi-ri-samples-greeter-interface").versionAsInProject(), - mavenBundle().groupId("org.apache.cxf.dosgi.systests") - .artifactId("cxf-dosgi-ri-systests2-common").versionAsInProject(), streamBundle(getCustomIntentBundle()).noStart(), provision(getServiceBundle()), frameworkStartLevel(100) }; http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/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 index f3e3f41..51db7f9 100644 --- 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 @@ -18,9 +18,9 @@ */ package org.apache.cxf.dosgi.systests2.multi; -import java.io.IOException; -import java.util.Dictionary; -import java.util.Hashtable; +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 javax.inject.Inject; @@ -35,10 +35,6 @@ import org.ops4j.pax.exam.junit.PaxExam; import org.osgi.framework.BundleContext; import org.osgi.service.cm.ConfigurationAdmin; -import static org.ops4j.pax.exam.CoreOptions.frameworkStartLevel; -import static org.ops4j.pax.exam.CoreOptions.mavenBundle; -import static org.ops4j.pax.exam.CoreOptions.systemProperty; - @RunWith(PaxExam.class) public class TestDiscoveryExport extends AbstractDosgiTest { @@ -50,20 +46,20 @@ public class TestDiscoveryExport extends AbstractDosgiTest { @Inject ConfigurationAdmin configAdmin; - + @Configuration public static Option[] configure() throws Exception { return new Option[] { MultiBundleTools.getDistro(), systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"), + configZKServer(), + configZKConsumer(), mavenBundle().groupId("org.apache.servicemix.bundles") .artifactId("org.apache.servicemix.bundles.junit").version("4.9_2"), mavenBundle().groupId("org.apache.cxf.dosgi.samples") .artifactId("cxf-dosgi-ri-samples-greeter-interface").versionAsInProject(), mavenBundle().groupId("org.apache.cxf.dosgi.samples") .artifactId("cxf-dosgi-ri-samples-greeter-impl").versionAsInProject(), - mavenBundle().groupId("org.apache.cxf.dosgi.systests") - .artifactId("cxf-dosgi-ri-systests2-common").versionAsInProject(), frameworkStartLevel(100), //CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005") }; @@ -71,11 +67,7 @@ public class TestDiscoveryExport extends AbstractDosgiTest { @Test public void testDiscoveryExport() throws Exception { - final int zkPort = getFreePort(); - System.out.println("*** Port for ZooKeeper Server: " + zkPort); - updateZkServerConfig(zkPort, configAdmin); - updateZkClientConfig(zkPort, configAdmin); - ZooKeeper zk = new ZooKeeper("localhost:" + zkPort, 1000, null); + ZooKeeper zk = new ZooKeeper("localhost:" + ZK_PORT, 1000, null); assertNodeExists(zk, GREETER_ZOOKEEPER_NODE, 14000); zk.close(); } @@ -93,17 +85,6 @@ public class TestDiscoveryExport extends AbstractDosgiTest { } Assert.assertNotNull("ZooKeeper node " + zNode + " was not found", stat); } + - protected void updateZkClientConfig(final int zkPort, ConfigurationAdmin cadmin) throws IOException { - Dictionary<String, Object> cliProps = new Hashtable<String, Object>(); - cliProps.put("zookeeper.host", "127.0.0.1"); - cliProps.put("zookeeper.port", "" + zkPort); - cadmin.getConfiguration("org.apache.aries.rsa.discovery.zookeeper", null).update(cliProps); - } - - protected void updateZkServerConfig(final int zkPort, ConfigurationAdmin cadmin) throws IOException { - Dictionary<String, Object> svrProps = new Hashtable<String, Object>(); - svrProps.put("clientPort", zkPort); - cadmin.getConfiguration("org.apache.aries.rsa.discovery.zookeeper.server", null).update(svrProps); - } } http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/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 index 26c1640..6eeb4b7 100644 --- 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 @@ -20,6 +20,11 @@ package org.apache.cxf.dosgi.systests2.multi; +import static org.ops4j.pax.exam.CoreOptions.frameworkStartLevel; +import static org.ops4j.pax.exam.CoreOptions.mavenBundle; +import static org.ops4j.pax.exam.CoreOptions.provision; +import static org.ops4j.pax.exam.CoreOptions.systemProperty; + import java.io.InputStream; import javax.inject.Inject; @@ -39,12 +44,6 @@ import org.ops4j.pax.tinybundles.core.TinyBundles; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; - -import static org.ops4j.pax.exam.CoreOptions.frameworkStartLevel; -import static org.ops4j.pax.exam.CoreOptions.mavenBundle; -import static org.ops4j.pax.exam.CoreOptions.provision; -import static org.ops4j.pax.exam.CoreOptions.systemProperty; - @RunWith(PaxExam.class) public class TestExportRestService extends AbstractDosgiTest { @@ -78,9 +77,6 @@ public class TestExportRestService extends AbstractDosgiTest { .build(TinyBundles.withBnd()); } - /** - * FIXME This test fails.. - */ @Test public void testEndpointAvailable() throws Exception { waitWebPage("http://localhost:" + webPort + "/cxf/translate"); http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/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 index 3c3861b..97d791e 100644 --- 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 @@ -33,15 +33,14 @@ 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.apache.cxf.frontend.ClientProxyFactoryBean; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.CoreOptions; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.PaxExam; -import static org.ops4j.pax.exam.CoreOptions.frameworkStartLevel; import static org.ops4j.pax.exam.CoreOptions.mavenBundle; import static org.ops4j.pax.exam.CoreOptions.systemProperty; @@ -52,13 +51,12 @@ public class TestExportService extends AbstractDosgiTest { public static Option[] configure() throws Exception { return new Option[] { MultiBundleTools.getDistro(), + CoreOptions.junitBundles(), systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"), mavenBundle().groupId("org.apache.cxf.dosgi.samples") .artifactId("cxf-dosgi-ri-samples-greeter-interface").versionAsInProject(), mavenBundle().groupId("org.apache.cxf.dosgi.samples") .artifactId("cxf-dosgi-ri-samples-greeter-impl").versionAsInProject(), - mavenBundle().groupId("org.apache.cxf.dosgi.systests") - .artifactId("cxf-dosgi-ri-systests2-common").versionAsInProject(), frameworkStartLevel(100), //CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005") }; } @@ -67,16 +65,8 @@ public class TestExportService extends AbstractDosgiTest { public void testAccessEndpoint() throws Exception { assertBundlesStarted(); waitPort(9090); - checkWsdl(new URL("http://localhost:9090/greeter?wsdl")); - - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - Thread.currentThread().setContextClassLoader(ClientProxyFactoryBean.class.getClassLoader()); - try { - checkServiceCall("http://localhost:9090/greeter"); - } finally { - Thread.currentThread().setContextClassLoader(cl); - } + checkServiceCall("http://localhost:9090/greeter"); } private void checkServiceCall(String serviceUri) { http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/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 index f7775d9..8c1a816 100644 --- 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 @@ -41,6 +41,7 @@ import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.CoreOptions; import org.ops4j.pax.exam.Option; import org.ops4j.pax.exam.junit.PaxExam; import org.ops4j.pax.tinybundles.core.TinyBundles; @@ -63,13 +64,10 @@ public class TestImportService extends AbstractDosgiTest { public static Option[] configure() throws Exception { return new Option[] { MultiBundleTools.getDistro(), + CoreOptions.junitBundles(), systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"), mavenBundle().groupId("org.apache.cxf.dosgi.samples") .artifactId("cxf-dosgi-ri-samples-greeter-interface").versionAsInProject(), - mavenBundle().groupId("org.apache.servicemix.bundles") - .artifactId("org.apache.servicemix.bundles.junit").version("4.9_2"), - mavenBundle().groupId("org.apache.cxf.dosgi.systests") - .artifactId("cxf-dosgi-ri-systests2-common").versionAsInProject(), provision(createServiceConsumerBundle()), // increase for debugging systemProperty("org.apache.cxf.dosgi.test.serviceWaitTimeout").value( http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/c1b1598d/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 new file mode 100644 index 0000000..7392d24 --- /dev/null +++ b/systests2/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/c1b1598d/systests2/pom.xml ---------------------------------------------------------------------- diff --git a/systests2/pom.xml b/systests2/pom.xml index 85f26e5..15b871c 100644 --- a/systests2/pom.xml +++ b/systests2/pom.xml @@ -36,7 +36,6 @@ <name>Distributed OSGi System Tests</name> <modules> - <module>common</module> <module>multi-bundle</module> </modules> </project>
