You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by am...@apache.org on 2017/02/10 09:06:21 UTC
[1/3] cxf-dosgi git commit: [DOSGI-257] Add ability to set bus
properties via service properties of the form cxf.bus.prop.=
Repository: cxf-dosgi
Updated Branches:
refs/heads/master 628a128b6 -> bec022021
[DOSGI-257] Add ability to set bus properties via service properties of the form cxf.bus.prop.<key>=<value>
Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/d785e345
Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/d785e345
Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/d785e345
Branch: refs/heads/master
Commit: d785e345d39d91d89e9be57eea8799d4d54d691e
Parents: 628a128
Author: Amichai Rothman <am...@apache.org>
Authored: Thu Feb 9 16:09:24 2017 +0200
Committer: Amichai Rothman <am...@apache.org>
Committed: Fri Feb 10 11:02:25 2017 +0200
----------------------------------------------------------------------
.../cxf/dosgi/dsw/handlers/rest/RsProvider.java | 21 +++++++++++++++-----
.../cxf/dosgi/dsw/handlers/ws/WsProvider.java | 12 ++++++++---
2 files changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/d785e345/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
index 5ef58d2..1c5e2f9 100644
--- a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
+++ b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
@@ -138,10 +138,7 @@ public class RsProvider implements DistributionProvider {
final Long sid = (Long) endpointProps.get(RemoteConstants.ENDPOINT_SERVICE_ID);
Set<String> intentNames = intentManager.getExported(endpointProps);
List<Object> intents = intentManager.getRequiredIntents(intentNames);
- Bus bus = BusFactory.newInstance().createBus();
- if (contextRoot != null) {
- httpServiceManager.registerServlet(bus, contextRoot, callingContext, sid);
- }
+ Bus bus = createBus(sid, callingContext, contextRoot, endpointProps);
LOG.info("Creating JAXRS endpoint for " + iClass.getName() + " with address " + address);
JAXRSServerFactoryBean factory = createServerFactory(callingContext, endpointProps,
@@ -154,7 +151,21 @@ public class RsProvider implements DistributionProvider {
intentNames);
return createServerFromFactory(factory, epd);
}
-
+
+ protected Bus createBus(Long sid, BundleContext callingContext, String contextRoot,
+ Map<String, Object> endpointProps) {
+ Bus bus = BusFactory.newInstance().createBus();
+ for (Map.Entry<String, Object> prop : endpointProps.entrySet()) {
+ if (prop.getKey().startsWith("cxf.bus.prop.")) {
+ bus.setProperty(prop.getKey().substring("cxf.bus.prop.".length()), prop.getValue());
+ }
+ }
+ if (contextRoot != null) {
+ httpServiceManager.registerServlet(bus, contextRoot, callingContext, sid);
+ }
+ return bus;
+ }
+
private void applyIntents(List<Object> intents, AbstractJAXRSFactoryBean factory) {
List<Feature> features = intentManager.getIntents(Feature.class, intents);
factory.setFeatures(features);
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/d785e345/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
----------------------------------------------------------------------
diff --git a/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java b/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
index 27fe72b..c13c93d 100644
--- a/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
+++ b/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
@@ -169,7 +169,7 @@ public class WsProvider implements DistributionProvider {
final Long sid = (Long) endpointProps.get(RemoteConstants.ENDPOINT_SERVICE_ID);
Set<String> intentNames = intentManager.getExported(endpointProps);
List<Object> intents = intentManager.getRequiredIntents(intentNames);
- Bus bus = createBus(sid, serviceContext, contextRoot);
+ Bus bus = createBus(sid, serviceContext, contextRoot, endpointProps);
factory.setDataBinding(getDataBinding(endpointProps, iClass));
factory.setBindingConfig(new SoapBindingConfiguration());
factory.setBus(bus);
@@ -247,9 +247,15 @@ public class WsProvider implements DistributionProvider {
String address = getClientAddress(sd);
return address == null ? httpServiceManager.getDefaultAddress(iClass) : address;
}
-
- protected Bus createBus(Long sid, BundleContext callingContext, String contextRoot) {
+
+ protected Bus createBus(Long sid, BundleContext callingContext, String contextRoot,
+ Map<String, Object> endpointProps) {
Bus bus = BusFactory.newInstance().createBus();
+ for (Map.Entry<String, Object> prop : endpointProps.entrySet()) {
+ if (prop.getKey().startsWith("cxf.bus.prop.")) {
+ bus.setProperty(prop.getKey().substring("cxf.bus.prop.".length()), prop.getValue());
+ }
+ }
if (contextRoot != null) {
httpServiceManager.registerServlet(bus, contextRoot, callingContext, sid);
}
[3/3] cxf-dosgi git commit: Extract duplicate handler functionality
into BaseDistributionProvider base class
Posted by am...@apache.org.
Extract duplicate handler functionality into BaseDistributionProvider base class
Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/bec02202
Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/bec02202
Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/bec02202
Branch: refs/heads/master
Commit: bec02202129f3bcb740c2f9762592f0cc79d7cc3
Parents: 776238e
Author: Amichai Rothman <am...@apache.org>
Authored: Thu Feb 9 17:03:24 2017 +0200
Committer: Amichai Rothman <am...@apache.org>
Committed: Fri Feb 10 11:05:00 2017 +0200
----------------------------------------------------------------------
common/bnd.bnd | 5 +-
.../handlers/BaseDistributionProvider.java | 79 ++++++++++++++++++++
.../cxf/dosgi/dsw/handlers/rest/RsProvider.java | 49 ++----------
.../cxf/dosgi/dsw/handlers/ws/WsProvider.java | 50 ++-----------
4 files changed, 95 insertions(+), 88 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/bec02202/common/bnd.bnd
----------------------------------------------------------------------
diff --git a/common/bnd.bnd b/common/bnd.bnd
index a8b330b..88689ec 100644
--- a/common/bnd.bnd
+++ b/common/bnd.bnd
@@ -1,8 +1,9 @@
Import-Package: javax.servlet;version='[2,4)', javax.servlet.http;version='[2,4)', *
Export-Package: \
+ org.apache.cxf.dosgi.common.endpoint,\
+ org.apache.cxf.dosgi.common.handlers,\
org.apache.cxf.dosgi.common.httpservice,\
- org.apache.cxf.dosgi.common.util,\
org.apache.cxf.dosgi.common.intent,\
org.apache.cxf.dosgi.common.proxy,\
- org.apache.cxf.dosgi.common.endpoint
+ org.apache.cxf.dosgi.common.util
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/bec02202/common/src/main/java/org/apache/cxf/dosgi/common/handlers/BaseDistributionProvider.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/handlers/BaseDistributionProvider.java b/common/src/main/java/org/apache/cxf/dosgi/common/handlers/BaseDistributionProvider.java
new file mode 100644
index 0000000..0325543
--- /dev/null
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/handlers/BaseDistributionProvider.java
@@ -0,0 +1,79 @@
+/**
+ * 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.common.handlers;
+
+import static org.apache.cxf.dosgi.common.util.PropertyHelper.getMultiValueProperty;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.aries.rsa.spi.DistributionProvider;
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
+import org.apache.cxf.dosgi.common.intent.IntentManager;
+import org.apache.cxf.endpoint.AbstractEndpointFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.remoteserviceadmin.EndpointDescription;
+import org.osgi.service.remoteserviceadmin.RemoteConstants;
+
+public abstract class BaseDistributionProvider implements DistributionProvider {
+
+ protected IntentManager intentManager;
+ protected HttpServiceManager httpServiceManager;
+
+ protected boolean configTypeSupported(Map<String, Object> endpointProps, String configType) {
+ Collection<String> configs = getMultiValueProperty(endpointProps.get(RemoteConstants.SERVICE_EXPORTED_CONFIGS));
+ return configs == null || configs.isEmpty() || configs.contains(configType);
+ }
+
+ protected EndpointDescription createEndpointDesc(Map<String, Object> props,
+ String[] importedConfigs,
+ String addressPropName,
+ String address,
+ Collection<String> intents) {
+ props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, importedConfigs);
+ props.put(addressPropName, address);
+ props.put(RemoteConstants.SERVICE_INTENTS, intents);
+ props.put(RemoteConstants.ENDPOINT_ID, address);
+ return new EndpointDescription(props);
+ }
+
+ protected Bus createBus(Long sid, BundleContext callingContext, String contextRoot,
+ Map<String, Object> endpointProps) {
+ Bus bus = BusFactory.newInstance().createBus();
+ for (Map.Entry<String, Object> prop : endpointProps.entrySet()) {
+ if (prop.getKey().startsWith("cxf.bus.prop.")) {
+ bus.setProperty(prop.getKey().substring("cxf.bus.prop.".length()), prop.getValue());
+ }
+ }
+ if (contextRoot != null) {
+ httpServiceManager.registerServlet(bus, contextRoot, callingContext, sid);
+ }
+ return bus;
+ }
+
+ protected void addContextProperties(AbstractEndpointFactory factory, Map<String, Object> sd, String propName) {
+ @SuppressWarnings("unchecked")
+ Map<String, Object> props = (Map<String, Object>)sd.get(propName);
+ if (props != null) {
+ factory.getProperties(true).putAll(props);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/bec02202/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
index 1c5e2f9..4f32c5a 100644
--- a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
+++ b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
@@ -18,7 +18,6 @@
*/
package org.apache.cxf.dosgi.dsw.handlers.rest;
-import static org.apache.cxf.dosgi.common.util.PropertyHelper.getMultiValueProperty;
import static org.osgi.service.remoteserviceadmin.RemoteConstants.REMOTE_CONFIGS_SUPPORTED;
import static org.osgi.service.remoteserviceadmin.RemoteConstants.REMOTE_INTENTS_SUPPORTED;
@@ -38,15 +37,14 @@ import org.apache.aries.rsa.spi.DistributionProvider;
import org.apache.aries.rsa.spi.Endpoint;
import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
import org.apache.cxf.binding.BindingConfiguration;
import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.dosgi.common.endpoint.ServerEndpoint;
+import org.apache.cxf.dosgi.common.handlers.BaseDistributionProvider;
import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
import org.apache.cxf.dosgi.common.intent.IntentManager;
import org.apache.cxf.dosgi.common.proxy.ProxyFactory;
import org.apache.cxf.dosgi.common.util.PropertyHelper;
-import org.apache.cxf.endpoint.AbstractEndpointFactory;
import org.apache.cxf.endpoint.Server;
import org.apache.cxf.feature.Feature;
import org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean;
@@ -66,12 +64,10 @@ import org.slf4j.LoggerFactory;
REMOTE_CONFIGS_SUPPORTED + "=" + RsConstants.RS_CONFIG_TYPE,
REMOTE_INTENTS_SUPPORTED + "="
})
-public class RsProvider implements DistributionProvider {
+public class RsProvider extends BaseDistributionProvider implements DistributionProvider {
private static final Logger LOG = LoggerFactory.getLogger(RsProvider.class);
- private IntentManager intentManager;
- private HttpServiceManager httpServiceManager;
-
+
@Reference
public void setHttpServiceManager(HttpServiceManager httpServiceManager) {
this.httpServiceManager = httpServiceManager;
@@ -152,20 +148,6 @@ public class RsProvider implements DistributionProvider {
return createServerFromFactory(factory, epd);
}
- protected Bus createBus(Long sid, BundleContext callingContext, String contextRoot,
- Map<String, Object> endpointProps) {
- Bus bus = BusFactory.newInstance().createBus();
- for (Map.Entry<String, Object> prop : endpointProps.entrySet()) {
- if (prop.getKey().startsWith("cxf.bus.prop.")) {
- bus.setProperty(prop.getKey().substring("cxf.bus.prop.".length()), prop.getValue());
- }
- }
- if (contextRoot != null) {
- httpServiceManager.registerServlet(bus, contextRoot, callingContext, sid);
- }
- return bus;
- }
-
private void applyIntents(List<Object> intents, AbstractJAXRSFactoryBean factory) {
List<Feature> features = intentManager.getIntents(Feature.class, intents);
factory.setFeatures(features);
@@ -194,11 +176,6 @@ public class RsProvider implements DistributionProvider {
|| (intent instanceof ContextResolver);
}
- private boolean configTypeSupported(Map<String, Object> endpointProps, String configType) {
- Collection<String> configs = getMultiValueProperty(endpointProps.get(RemoteConstants.SERVICE_EXPORTED_CONFIGS));
- return configs == null || configs.isEmpty() || configs.contains(configType);
- }
-
private Endpoint createServerFromFactory(JAXRSServerFactoryBean factory,
EndpointDescription epd) {
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
@@ -238,22 +215,8 @@ public class RsProvider implements DistributionProvider {
}
}
- private EndpointDescription createEndpointDesc(Map<String, Object> props,
- String[] importedConfigs,
- String address,
- Set<String> intents) {
- props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, importedConfigs);
- props.put(RsConstants.RS_ADDRESS_PROPERTY, address);
- props.put(RemoteConstants.SERVICE_INTENTS, intents);
- props.put(RemoteConstants.ENDPOINT_ID, address);
- return new EndpointDescription(props);
- }
-
- private static void addContextProperties(AbstractEndpointFactory factory, Map<String, Object> sd, String propName) {
- @SuppressWarnings("unchecked")
- Map<String, Object> props = (Map<String, Object>)sd.get(propName);
- if (props != null) {
- factory.getProperties(true).putAll(props);
- }
+ protected EndpointDescription createEndpointDesc(Map<String, Object> props, String[] importedConfigs,
+ String address, Collection<String> intents) {
+ return super.createEndpointDesc(props, importedConfigs, RsConstants.RS_ADDRESS_PROPERTY, address, intents);
}
}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/bec02202/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
----------------------------------------------------------------------
diff --git a/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java b/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
index c13c93d..99e64d4 100644
--- a/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
+++ b/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
@@ -18,7 +18,6 @@
*/
package org.apache.cxf.dosgi.dsw.handlers.ws;
-import static org.apache.cxf.dosgi.common.util.PropertyHelper.getMultiValueProperty;
import static org.osgi.service.remoteserviceadmin.RemoteConstants.REMOTE_CONFIGS_SUPPORTED;
import static org.osgi.service.remoteserviceadmin.RemoteConstants.REMOTE_INTENTS_SUPPORTED;
@@ -33,12 +32,12 @@ import org.apache.aries.rsa.spi.DistributionProvider;
import org.apache.aries.rsa.spi.Endpoint;
import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
import org.apache.cxf.aegis.databinding.AegisDatabinding;
import org.apache.cxf.binding.BindingConfiguration;
import org.apache.cxf.binding.soap.SoapBindingConfiguration;
import org.apache.cxf.databinding.DataBinding;
import org.apache.cxf.dosgi.common.endpoint.ServerEndpoint;
+import org.apache.cxf.dosgi.common.handlers.BaseDistributionProvider;
import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
import org.apache.cxf.dosgi.common.intent.IntentManager;
import org.apache.cxf.dosgi.common.proxy.ProxyFactory;
@@ -65,12 +64,11 @@ import org.slf4j.LoggerFactory;
REMOTE_CONFIGS_SUPPORTED + "=" + WsConstants.WS_CONFIG_TYPE,
REMOTE_INTENTS_SUPPORTED + "="
})
-public class WsProvider implements DistributionProvider {
+public class WsProvider extends BaseDistributionProvider implements DistributionProvider {
+
private static final Logger LOG = LoggerFactory.getLogger(WsProvider.class);
protected BundleContext bundleContext;
- protected IntentManager intentManager;
- protected HttpServiceManager httpServiceManager;
-
+
@Reference
public void setHttpServiceManager(HttpServiceManager httpServiceManager) {
this.httpServiceManager = httpServiceManager;
@@ -203,21 +201,10 @@ public class WsProvider implements DistributionProvider {
factory.setBindingConfig(binding);
}
}
-
- private boolean configTypeSupported(Map<String, Object> endpointProps, String configType) {
- Collection<String> configs = getMultiValueProperty(endpointProps.get(RemoteConstants.SERVICE_EXPORTED_CONFIGS));
- return configs == null || configs.isEmpty() || configs.contains(configType);
- }
- protected EndpointDescription createEndpointDesc(Map<String, Object> props,
- String[] importedConfigs,
- String address,
- Collection<String> intents) {
- props.put(RemoteConstants.SERVICE_IMPORTED_CONFIGS, importedConfigs);
- props.put(WsConstants.WS_ADDRESS_PROPERTY, address);
- props.put(RemoteConstants.SERVICE_INTENTS, intents);
- props.put(RemoteConstants.ENDPOINT_ID, address);
- return new EndpointDescription(props);
+ protected EndpointDescription createEndpointDesc(Map<String, Object> props, String[] importedConfigs,
+ String address, Collection<String> intents) {
+ return super.createEndpointDesc(props, importedConfigs, WsConstants.WS_ADDRESS_PROPERTY, address, intents);
}
private String getPojoAddress(Map<String, Object> sd, Class<?> iClass) {
@@ -248,34 +235,11 @@ public class WsProvider implements DistributionProvider {
return address == null ? httpServiceManager.getDefaultAddress(iClass) : address;
}
- protected Bus createBus(Long sid, BundleContext callingContext, String contextRoot,
- Map<String, Object> endpointProps) {
- Bus bus = BusFactory.newInstance().createBus();
- for (Map.Entry<String, Object> prop : endpointProps.entrySet()) {
- if (prop.getKey().startsWith("cxf.bus.prop.")) {
- bus.setProperty(prop.getKey().substring("cxf.bus.prop.".length()), prop.getValue());
- }
- }
- if (contextRoot != null) {
- httpServiceManager.registerServlet(bus, contextRoot, callingContext, sid);
- }
- return bus;
- }
-
protected Endpoint createServerFromFactory(ServerFactoryBean factory, EndpointDescription epd) {
Server server = factory.create();
return new ServerEndpoint(epd, server);
}
- protected static void addContextProperties(AbstractEndpointFactory factory,
- Map<String, Object> sd, String propName) {
- @SuppressWarnings("unchecked")
- Map<String, Object> props = (Map<String, Object>)sd.get(propName);
- if (props != null) {
- factory.getProperties(true).putAll(props);
- }
- }
-
private DataBinding getDataBinding(Map<String, Object> sd, Class<?> iClass) {
return isJAXWS(sd, iClass) ? new JAXBDataBinding() : new AegisDatabinding();
}
[2/3] cxf-dosgi git commit: [DOSGI-258] Made itests HTTP port
configurable via constant, and changed default to port 8989
Posted by am...@apache.org.
[DOSGI-258] Made itests HTTP port configurable via constant, and changed default to port 8989
Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/776238eb
Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/776238eb
Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/776238eb
Branch: refs/heads/master
Commit: 776238eb3ac65300797a926586879cd5b6b9c3f1
Parents: d785e34
Author: Amichai Rothman <am...@apache.org>
Authored: Thu Feb 9 22:17:22 2017 +0200
Committer: Amichai Rothman <am...@apache.org>
Committed: Fri Feb 10 11:02:55 2017 +0200
----------------------------------------------------------------------
.../apache/cxf/dosgi/itests/multi/AbstractDosgiTest.java | 11 +++++++++++
.../apache/cxf/dosgi/itests/multi/TestCustomIntent.java | 3 ++-
.../apache/cxf/dosgi/itests/multi/TestExportService.java | 4 ++--
3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/776238eb/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/AbstractDosgiTest.java
----------------------------------------------------------------------
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/AbstractDosgiTest.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/AbstractDosgiTest.java
index 0887cb6..01975bf 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/AbstractDosgiTest.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/AbstractDosgiTest.java
@@ -55,6 +55,9 @@ import org.osgi.framework.ServiceReference;
public class AbstractDosgiTest {
static final int ZK_PORT = 35101;
+ static final int HTTP_PORT = 8989;
+ static final String HTTP_HOST = "localhost"; // can specify specific bound IP
+ static final String HTTP_BASE_URI = "http://" + HTTP_HOST + ":" + HTTP_PORT;
private static final int TIMEOUT = 20;
@Inject
@@ -236,6 +239,13 @@ public class AbstractDosgiTest {
Assert.assertNotNull("ZooKeeper node " + zNode + " was not found", stat);
}
+ protected static Option configHttpService(String host, int port) {
+ return newConfiguration("org.ops4j.pax.web")
+ .put("org.osgi.service.http.port", "" + port)
+ .put("org.ops4j.pax.web.listening.addresses", host)
+ .asOption();
+ }
+
protected static Option configZKConsumer() {
return newConfiguration("org.apache.aries.rsa.discovery.zookeeper") //
.put("zookeeper.host", "127.0.0.1") //
@@ -290,6 +300,7 @@ public class AbstractDosgiTest {
systemProperty("pax.exam.osgi.unresolved.fail").value("true"), //
systemProperty("org.apache.cxf.stax.allowInsecureParser").value("true"), //
systemProperty("rsa.export.policy.filter").value("(name=cxf)"), //
+ configHttpService(HTTP_HOST, HTTP_PORT),
configLogging(),
frameworkStartLevel(100)
);
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/776238eb/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java
----------------------------------------------------------------------
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java
index b722255..618aedb 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestCustomIntent.java
@@ -53,7 +53,8 @@ public class TestCustomIntent extends AbstractDosgiTest {
@Test
public void testCustomIntent() throws Exception {
- final TaskService greeterService = TaskServiceProxyFactory.create("http://localhost:8080/cxf/taskservice");
+ String serviceUri = HTTP_BASE_URI + "/cxf/taskservice";
+ final TaskService greeterService = TaskServiceProxyFactory.create(serviceUri);
Task task = tryTo("Call TaskService", new Callable<Task>() {
public Task call() throws Exception {
return greeterService.get(1);
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/776238eb/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportService.java
----------------------------------------------------------------------
diff --git a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportService.java b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportService.java
index c8c619a..a4bc5a1 100644
--- a/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportService.java
+++ b/itests/multi-bundle/src/test/java/org/apache/cxf/dosgi/itests/multi/TestExportService.java
@@ -48,8 +48,8 @@ import org.w3c.dom.Element;
@ExamReactorStrategy(PerClass.class)
public class TestExportService extends AbstractDosgiTest {
- private static final String SERVICE_URI = "http://localhost:8080/cxf/taskservice";
- private static final String REST_SERVICE_URI = "http://localhost:8080/cxf/tasks";
+ private static final String SERVICE_URI = HTTP_BASE_URI + "/cxf/taskservice";
+ private static final String REST_SERVICE_URI = HTTP_BASE_URI + "/cxf/tasks";
private static final String GREETER_ZOOKEEPER_NODE = //
"/osgi/service_registry/org/apache/cxf/dosgi/samples/soap/TaskService/localhost#8181##cxf#taskservice";