You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2016/03/11 20:43:22 UTC
[23/50] [abbrv] aries-rsa git commit: Switch project setup to Aries
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/samples/spring_dm/interface/src/main/java/org/apache/cxf/dosgi/samples/springdm/Restaurant.java
----------------------------------------------------------------------
diff --git a/samples/spring_dm/interface/src/main/java/org/apache/cxf/dosgi/samples/springdm/Restaurant.java b/samples/spring_dm/interface/src/main/java/org/apache/cxf/dosgi/samples/springdm/Restaurant.java
deleted file mode 100644
index f6f06b1..0000000
--- a/samples/spring_dm/interface/src/main/java/org/apache/cxf/dosgi/samples/springdm/Restaurant.java
+++ /dev/null
@@ -1,59 +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.samples.springdm;
-
-public class Restaurant {
-
- private String name;
- private String address;
- private int rating;
-
- public Restaurant() {
- }
-
- public Restaurant(String name, String address, int rating) {
- this.name = name;
- this.address = address;
- this.rating = rating;
- }
-
- public String getAddress() {
- return address;
- }
-
- public String getName() {
- return name;
- }
-
- public int getRating() {
- return rating;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- public void setRating(int rating) {
- this.rating = rating;
- }
-}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/samples/spring_dm/pom.xml
----------------------------------------------------------------------
diff --git a/samples/spring_dm/pom.xml b/samples/spring_dm/pom.xml
deleted file mode 100644
index 97d9bac..0000000
--- a/samples/spring_dm/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>
- <groupId>org.apache.cxf.dosgi.samples</groupId>
- <artifactId>cxf-dosgi-ri-samples-spring-dm-parent</artifactId>
- <packaging>pom</packaging>
- <name>Distributed OSGI Spring-DM Sample</name>
- <version>1.8-SNAPSHOT</version>
-
- <parent>
- <groupId>org.apache.cxf.dosgi</groupId>
- <artifactId>cxf-dosgi-ri-parent</artifactId>
- <version>1.8-SNAPSHOT</version>
- <relativePath>../../parent/pom.xml</relativePath>
- </parent>
-
- <modules>
- <module>interface</module>
- <module>impl</module>
- <module>client</module>
- </modules>
-</project>
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/spi/pom.xml
----------------------------------------------------------------------
diff --git a/spi/pom.xml b/spi/pom.xml
new file mode 100644
index 0000000..427383b
--- /dev/null
+++ b/spi/pom.xml
@@ -0,0 +1,67 @@
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.aries.rsa</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.8-SNAPSHOT</version>
+ <relativePath>../parent/pom.xml</relativePath>
+ </parent>
+ <artifactId>spi</artifactId>
+ <packaging>bundle</packaging>
+ <name>Aries Remote Service Admin Service Provider Interface</name>
+
+ <properties>
+ <topDirectoryLocation>../..</topDirectoryLocation>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <version>1.7.14</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java
----------------------------------------------------------------------
diff --git a/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java b/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java
new file mode 100644
index 0000000..d7c648b
--- /dev/null
+++ b/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java
@@ -0,0 +1,56 @@
+/**
+ * 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.dsw.api;
+
+import java.util.Map;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+
+@SuppressWarnings("rawtypes")
+public interface DistributionProvider {
+
+ String[] getSupportedTypes();
+
+ /**
+ * @param serviceO service instance to be exported
+ * @param serviceContext bundle context of the bundle exporting the sevice
+ * @param effectiveProperties combined properties of the service and additional properties from rsa
+ * @param exportedInterfaces name of the interface to be exported
+ * @return Endpoint that represents the service that is exposed to the outside world
+ */
+ Endpoint exportService(Object serviceO,
+ BundleContext serviceContext,
+ Map<String, Object> effectiveProperties,
+ Class[] exportedInterfaces);
+
+ /**
+ * @param cl classloader of the consumer bundle
+ * @param consumerContext bundle context of the consumer bundle
+ * @param interfaces interfaces of the service to proxy
+ * @param endpoint description of the remote endpoint
+ * @return service proxy to be given to the requesting bundle
+ * @throws IntentUnsatisfiedException
+ */
+ Object importEndpoint(ClassLoader cl,
+ BundleContext consumerContext,
+ Class[] interfaces,
+ EndpointDescription endpoint)
+ throws IntentUnsatisfiedException;
+}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java
----------------------------------------------------------------------
diff --git a/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java b/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java
new file mode 100644
index 0000000..f45b562
--- /dev/null
+++ b/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.api;
+
+import java.io.Closeable;
+
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+
+public interface Endpoint extends Closeable {
+ EndpointDescription description();
+}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/EndpointHelper.java
----------------------------------------------------------------------
diff --git a/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/EndpointHelper.java b/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/EndpointHelper.java
new file mode 100644
index 0000000..cdc66ad
--- /dev/null
+++ b/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/EndpointHelper.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.dsw.api;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public final class EndpointHelper {
+
+ private EndpointHelper() {
+ }
+
+ public static void addObjectClass(Map<String, Object> props, Class<?>[] interfaces) {
+ props.put(org.osgi.framework.Constants.OBJECTCLASS, getClassNames(interfaces));
+ }
+
+ public static String[] getClassNames(Class<?>[] ifaces) {
+ List<String> ifaceNames = new ArrayList<String>();
+ for (Class<?> iface : ifaces) {
+ ifaceNames.add(iface.getName());
+ }
+ return ifaceNames.toArray(new String[]{});
+ }
+}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportPolicy.java
----------------------------------------------------------------------
diff --git a/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportPolicy.java b/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportPolicy.java
new file mode 100644
index 0000000..9e82c04
--- /dev/null
+++ b/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/ExportPolicy.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.api;
+
+import java.util.Map;
+
+import org.osgi.framework.ServiceReference;
+
+
+/**
+ * SPI for TopologyManagerExport. Allows to export services that are
+ * not marked for export as well customize the way services are exported.
+ *
+ * Use cases:
+ * - Mandate SSL and basic authoriziation by adding the respective intents and configs
+ * - Add logging interceptor as intent
+ * - Remove exported interfaces to filter out services
+ */
+public interface ExportPolicy {
+ /**
+ * Allows to supply additional properties for a service that are then
+ * given to RemoteServiceAdmin. The service will be exported
+ * if the original service or the additional properties contain the
+ * non empty property service.exported.interfaces.
+ *
+ * @param service to export
+ * @return additional properties for exported Service (must not be null)
+ */
+ Map<String, ?> additionalParameters(ServiceReference<?> sref);
+}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java
----------------------------------------------------------------------
diff --git a/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java b/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java
new file mode 100644
index 0000000..4e27938
--- /dev/null
+++ b/spi/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java
@@ -0,0 +1,35 @@
+/**
+ * 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.dsw.api;
+
+public class IntentUnsatisfiedException extends RuntimeException {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String intent;
+
+ public IntentUnsatisfiedException(String intent) {
+ super(intent);
+ this.intent = intent;
+ }
+
+ public String getIntent() {
+ return intent;
+ }
+}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/systests2/common/pom.xml
----------------------------------------------------------------------
diff --git a/systests2/common/pom.xml b/systests2/common/pom.xml
deleted file mode 100644
index 700468a..0000000
--- a/systests2/common/pom.xml
+++ /dev/null
@@ -1,108 +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.8-SNAPSHOT</version>
- <relativePath>../../parent/pom.xml</relativePath>
- </parent>
-
- <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/aries-rsa/blob/d73a3a7f/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/aries-rsa/blob/d73a3a7f/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/aries-rsa/blob/d73a3a7f/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/aries-rsa/blob/d73a3a7f/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/aries-rsa/blob/d73a3a7f/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/aries-rsa/blob/d73a3a7f/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/aries-rsa/blob/d73a3a7f/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/aries-rsa/blob/d73a3a7f/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/aries-rsa/blob/d73a3a7f/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/aries-rsa/blob/d73a3a7f/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/aries-rsa/blob/d73a3a7f/systests2/multi-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/systests2/multi-bundle/pom.xml b/systests2/multi-bundle/pom.xml
deleted file mode 100644
index baa9d01..0000000
--- a/systests2/multi-bundle/pom.xml
+++ /dev/null
@@ -1,243 +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.8-SNAPSHOT</version>
- <relativePath>../../parent/pom.xml</relativePath>
- </parent>
-
- <groupId>org.apache.cxf.dosgi.systests</groupId>
- <artifactId>cxf-dosgi-ri-systests2-multibundle</artifactId>
- <packaging>jar</packaging>
-
- <name>Distributed OSGi System Tests Multi-Bundle</name>
-
- <!--
- When changing code make sure to run the distro before testing
- or you will be testing the old code.
-
- -->
-
- <dependencies>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-atinject_1.0_spec</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-junit4</artifactId>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-inject</artifactId>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-container-forked</artifactId>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.exam</groupId>
- <artifactId>pax-exam-link-mvn</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.ops4j.pax.url</groupId>
- <artifactId>pax-url-aether</artifactId>
- <version>2.4.5</version>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- </dependency>
- <!--
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.framework</artifactId>
- <scope>test</scope>
- </dependency>
- -->
-
- <dependency>
- <groupId>org.apache.cxf.dosgi.systests</groupId>
- <artifactId>cxf-dosgi-ri-systests2-common</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </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-bindings-soap</artifactId>
- <version>${cxf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-transports-http-jetty</artifactId>
- <version>${cxf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-frontend-jaxrs</artifactId>
- <version>${cxf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-client</artifactId>
- <version>${cxf.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>${zookeeper.version}</version>
- <exclusions>
- <exclusion>
- <groupId>com.sun.jdmk</groupId>
- <artifactId>jmxtools</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.sun.jmx</groupId>
- <artifactId>jmxri</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.dosgi</groupId>
- <artifactId>cxf-dosgi-ri-discovery-distributed-zookeeper-server</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.dosgi.samples</groupId>
- <artifactId>cxf-dosgi-ri-samples-greeter-impl</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.dosgi.samples</groupId>
- <artifactId>cxf-dosgi-ri-samples-greeter-interface</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.dosgi.samples</groupId>
- <artifactId>cxf-dosgi-ri-samples-greeter-rest-impl</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cxf.dosgi.samples</groupId>
- <artifactId>cxf-dosgi-ri-samples-greeter-rest-interface</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <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>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.cxf.dosgi</groupId>
- <artifactId>cxf-dosgi-ri-multibundle-distribution</artifactId>
- <version>${project.version}</version>
- <type>zip</type>
- <classifier>dir</classifier>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.servicemix.tooling</groupId>
- <artifactId>depends-maven-plugin</artifactId>
- <version>1.3.1</version>
- <executions>
- <execution>
- <id>generate-depends-file</id>
- <goals>
- <goal>generate-depends-file</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <systemPropertyVariables>
- <!-- <org.apache.cxf.dosgi.test.debug.port>5005</org.apache.cxf.dosgi.test.debug.port>
- <org.apache.cxf.dosgi.test.serviceWaitTimeout>180</org.apache.cxf.dosgi.test.serviceWaitTimeout> -->
- <java.util.logging.config.file>${project.build.directory}/test-classes/logging.properties</java.util.logging.config.file>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/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 09e3ba5..0000000
--- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java
+++ /dev/null
@@ -1,176 +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.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.cxf.aegis.databinding.AegisDatabinding;
-import org.apache.cxf.dosgi.samples.greeter.GreeterService;
-import org.apache.cxf.frontend.ClientProxyFactoryBean;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-
-public class AbstractDosgiTest {
-
- 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.
- *
- * @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 GreeterService createGreeterServiceProxy(String serviceUri) {
- ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
- factory.setServiceClass(GreeterService.class);
- factory.setAddress(serviceUri);
- factory.getServiceFactory().setDataBinding(new AegisDatabinding());
- return (GreeterService)factory.create();
- }
-
- protected Bundle getBundleByName(BundleContext bc, String name) {
- for (Bundle bundle : bc.getBundles()) {
- if (bundle.getSymbolicName().equals(name)) {
- return bundle;
- }
- }
- return null;
- }
-
- protected int getFreePort() throws IOException {
- ServerSocket socket = new ServerSocket();
- try {
- 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();
- }
- }
-
- 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();
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/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 1e4bf39..0000000
--- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/MultiBundleTools.java
+++ /dev/null
@@ -1,106 +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 getDistroWithDiscovery() throws Exception {
- return getDistro();
- }
-
- public static Option getDistro() throws Exception {
- return CoreOptions.composite(getDistroBundleOptions());
- }
-}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/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 04ddcdc..0000000
--- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestCustomIntent.java
+++ /dev/null
@@ -1,109 +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.InputStream;
-import java.util.Map;
-
-import javax.inject.Inject;
-
-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.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.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-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.streamBundle;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
-@RunWith(PaxExam.class)
-public class TestCustomIntent extends AbstractDosgiTest {
-
- @Inject
- BundleContext bundleContext;
-
- protected 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());
- }
-
- protected 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());
- }
-
- @Configuration
- public static Option[] configure() throws Exception {
- return new Option[] {
- MultiBundleTools.getDistro(),
- 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) };
- }
-
- @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);
-
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(ClientProxyFactoryBean.class.getClassLoader());
- try {
- 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());
- } finally {
- Thread.currentThread().setContextClassLoader(cl);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/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 ab8dae8..0000000
--- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestDiscoveryExport.java
+++ /dev/null
@@ -1,109 +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.util.Dictionary;
-import java.util.Hashtable;
-
-import javax.inject.Inject;
-
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.data.Stat;
-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.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 {
-
- private static final String GREETER_ZOOKEEPER_NODE
- = "/osgi/service_registry/org/apache/cxf/dosgi/samples/greeter/GreeterService/localhost#9090##greeter";
-
- @Inject
- BundleContext bundleContext;
-
- @Inject
- ConfigurationAdmin configAdmin;
-
- @Configuration
- public static Option[] configure() throws Exception {
- return new Option[] {
- MultiBundleTools.getDistroWithDiscovery(),
- 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.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")
- };
- }
-
- @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);
- assertNodeExists(zk, GREETER_ZOOKEEPER_NODE, 14000);
- zk.close();
- }
-
- private 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 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.cxf.dosgi.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.cxf.dosgi.discovery.zookeeper.server", null).update(svrProps);
- }
-}
http://git-wip-us.apache.org/repos/asf/aries-rsa/blob/d73a3a7f/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 ad601b5..0000000
--- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/TestExportRestService.java
+++ /dev/null
@@ -1,96 +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.InputStream;
-
-import javax.inject.Inject;
-
-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.CoreOptions;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-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 {
-
- @Inject
- BundleContext bundleContext;
-
- String webPort = "9091";
-
- @Configuration
- public Option[] configure() throws Exception {
- return new Option[] {
- MultiBundleTools.getDistroWithDiscovery(),
- systemProperty("org.osgi.service.http.port").value(webPort),
- systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
- mavenBundle().groupId("org.apache.cxf.dosgi.samples")
- .artifactId("cxf-dosgi-ri-samples-greeter-interface").versionAsInProject(),
- CoreOptions.junitBundles(),
- provision(getServiceBundle()),
- frameworkStartLevel(100),
- //CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")
- };
- }
-
- 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());
- }
-
- /**
- * FIXME This test fails..
- */
- @Test
- public void testEndpointAvailable() 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) {
- e.printStackTrace();
- throw new RuntimeException(e.getMessage());
- }
- }
-}