You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by cs...@apache.org on 2016/07/02 22:25:19 UTC
[1/2] cxf-dosgi git commit: [DOSGI-243] Update to OSGi spec 5.0.0
Repository: cxf-dosgi
Updated Branches:
refs/heads/master d2a3c75f3 -> 951f7c8db
[DOSGI-243] Update to OSGi spec 5.0.0
Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/a738fce6
Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/a738fce6
Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/a738fce6
Branch: refs/heads/master
Commit: a738fce695403ba8a1adca2448976a6097d1278d
Parents: d2a3c75
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Sun Jul 3 00:15:49 2016 +0200
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Sun Jul 3 00:15:49 2016 +0200
----------------------------------------------------------------------
parent/pom.xml | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a738fce6/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 82bb30a..f9d71c5 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -28,8 +28,8 @@
<!-- portable text resource processing -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <osgi.version>4.3.1</osgi.version>
- <osgi.compendium.version>4.3.1</osgi.compendium.version>
+ <osgi.version>5.0.0</osgi.version>
+ <osgi.compendium.version>5.0.0</osgi.compendium.version>
<aries.rsa.version>1.8.0</aries.rsa.version>
<cxf.version>3.1.6</cxf.version>
<felix.version>5.4.0</felix.version>
@@ -186,12 +186,6 @@
<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>
[2/2] cxf-dosgi git commit: [DOSGI-242] Switch IntentManager to DS
Posted by cs...@apache.org.
[DOSGI-242] Switch IntentManager to DS
Project: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/commit/951f7c8d
Tree: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/tree/951f7c8d
Diff: http://git-wip-us.apache.org/repos/asf/cxf-dosgi/diff/951f7c8d
Branch: refs/heads/master
Commit: 951f7c8dbb47e078c0c452197a3b18e97e6c233b
Parents: a738fce
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Sun Jul 3 00:25:06 2016 +0200
Committer: Christian Schneider <ch...@die-schneider.net>
Committed: Sun Jul 3 00:25:06 2016 +0200
----------------------------------------------------------------------
common/bnd.bnd | 2 +-
.../common/httpservice/HttpServiceManager.java | 11 +-
.../common/intent/DefaultIntentMapFactory.java | 52 ----------
.../dosgi/common/intent/IntentManagerImpl.java | 100 ++++++++++++-------
.../cxf/dosgi/common/intent/IntentTracker.java | 61 -----------
.../dosgi/common/qos/IntentManagerImplTest.java | 5 +-
.../cxf/dosgi/common/qos/IntentTrackerTest.java | 82 ---------------
cxf-dsw/bnd.bnd | 1 +
.../dsw/handlers/CXFDistributionProvider.java | 1 -
.../handlers/CXFDistributionProviderTest.java | 9 +-
samples/ds/client/pom.xml | 2 +-
samples/ds/impl/pom.xml | 2 +-
samples/ds/interface/pom.xml | 2 +-
samples/ds/pom.xml | 2 +-
systests2/multi-bundle/pom.xml | 5 -
.../systests2/multi/AbstractDosgiTest.java | 17 +++-
.../resources/cfg/org.ops4j.pax.logging.cfg | 7 ++
.../src/test/resources/log4j.properties | 12 +--
18 files changed, 107 insertions(+), 266 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/common/bnd.bnd
----------------------------------------------------------------------
diff --git a/common/bnd.bnd b/common/bnd.bnd
index 9fc9a8c..b5ec91c 100644
--- a/common/bnd.bnd
+++ b/common/bnd.bnd
@@ -3,4 +3,4 @@ Export-Package: \
org.apache.cxf.dosgi.common.httpservice,\
org.apache.cxf.dosgi.common.util,\
org.apache.cxf.dosgi.common.intent
-Private-Package: org.apache.cxf.dosgi.common.osgi
+
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java b/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java
index b129514..e5015c9 100644
--- a/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/httpservice/HttpServiceManager.java
@@ -66,24 +66,23 @@ public class HttpServiceManager {
private HttpService httpService;
private BundleContext context;
- @SuppressWarnings("unchecked")
@Activate
public void activate(ComponentContext compContext) {
- Dictionary<String, String> config = compContext.getProperties();
+ Dictionary<String, Object> config = compContext.getProperties();
initFromConfig(config);
this.context = compContext.getBundleContext();
}
- void initFromConfig(Dictionary<String, String> config) {
+ void initFromConfig(Dictionary<String, Object> config) {
if (config == null) {
- config = new Hashtable<String, String>();
+ config = new Hashtable<String, Object>();
}
this.httpBase = getWithDefault(config.get(KEY_HTTP_BASE), "http://" + LocalHostUtil.getLocalIp() + ":8181");
this.cxfServletAlias = getWithDefault(config.get(KEY_CXF_SERVLET_ALIAS), "/cxf");
}
- private String getWithDefault(String value, String defaultValue) {
- return value == null ? defaultValue : value;
+ private String getWithDefault(Object value, String defaultValue) {
+ return value == null ? defaultValue : value.toString();
}
public Bus registerServlet(Bus bus, String contextRoot, BundleContext callingContext, Long sid) {
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/common/src/main/java/org/apache/cxf/dosgi/common/intent/DefaultIntentMapFactory.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/intent/DefaultIntentMapFactory.java b/common/src/main/java/org/apache/cxf/dosgi/common/intent/DefaultIntentMapFactory.java
deleted file mode 100644
index 395fe46..0000000
--- a/common/src/main/java/org/apache/cxf/dosgi/common/intent/DefaultIntentMapFactory.java
+++ /dev/null
@@ -1,52 +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.common.intent;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.cxf.binding.soap.Soap11;
-import org.apache.cxf.binding.soap.Soap12;
-import org.apache.cxf.binding.soap.SoapBindingConfiguration;
-import org.apache.cxf.binding.soap.SoapVersion;
-import org.apache.cxf.feature.LoggingFeature;
-
-public class DefaultIntentMapFactory {
-
- public Map<String, Object> create() {
- Map<String, Object> intentMap = new HashMap<String, Object>();
- intentMap.put("logging", getLoggingFeature());
- Object soap11 = getSoapBinding(Soap11.getInstance());
- intentMap.put("SOAP", soap11);
- intentMap.put("SOAP.1_1", soap11);
- intentMap.put("SOAP.1_2", getSoapBinding(Soap12.getInstance()));
- intentMap.put("HTTP", "PROVIDED");
- return intentMap;
- }
-
- private Object getLoggingFeature() {
- return new LoggingFeature();
- }
-
- private Object getSoapBinding(SoapVersion soapVersion) {
- SoapBindingConfiguration soapBindingConfig = new SoapBindingConfiguration();
- soapBindingConfig.setVersion(soapVersion);
- return soapBindingConfig;
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManagerImpl.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManagerImpl.java b/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManagerImpl.java
index 2775086..3bbfaab 100644
--- a/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManagerImpl.java
+++ b/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentManagerImpl.java
@@ -18,10 +18,13 @@
*/
package org.apache.cxf.dosgi.common.intent;
+import static org.osgi.service.component.annotations.ReferenceCardinality.MULTIPLE;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -29,13 +32,18 @@ import java.util.Set;
import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
import org.apache.cxf.binding.BindingConfiguration;
+import org.apache.cxf.binding.soap.Soap11;
+import org.apache.cxf.binding.soap.Soap12;
+import org.apache.cxf.binding.soap.SoapBindingConfiguration;
+import org.apache.cxf.binding.soap.SoapVersion;
import org.apache.cxf.dosgi.common.util.OsgiUtils;
import org.apache.cxf.endpoint.AbstractEndpointFactory;
import org.apache.cxf.feature.Feature;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.annotations.Activate;
+import org.apache.cxf.feature.LoggingFeature;
import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferencePolicy;
+import org.osgi.service.component.annotations.ReferencePolicyOption;
import org.osgi.service.remoteserviceadmin.RemoteConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,41 +56,58 @@ public class IntentManagerImpl implements IntentManager {
private static final int DEFAULT_INTENT_TIMEOUT = 30000;
private final IntentMap intentMap;
- private final long maxIntentWaitTime;
- private IntentTracker tracker;
+ private final long maxIntentWaitTime = DEFAULT_INTENT_TIMEOUT;
public IntentManagerImpl() {
- this(DEFAULT_INTENT_TIMEOUT);
+ this(new IntentMap(create()));
}
- public IntentManagerImpl(int maxIntentWaitTime) {
- this(new IntentMap(new DefaultIntentMapFactory().create()), maxIntentWaitTime);
+ public IntentManagerImpl(IntentMap intentMap) {
+ this.intentMap = intentMap;
}
- public IntentManagerImpl(IntentMap intentMap) {
- this(intentMap, DEFAULT_INTENT_TIMEOUT);
+ public static Map<String, Object> create() {
+ Map<String, Object> defaults = new HashMap<String, Object>();
+ defaults.put("logging", getLoggingFeature());
+ Object soap11 = getSoapBinding(Soap11.getInstance());
+ defaults.put("SOAP", soap11);
+ defaults.put("SOAP.1_1", soap11);
+ defaults.put("SOAP.1_2", getSoapBinding(Soap12.getInstance()));
+ defaults.put("HTTP", "PROVIDED");
+ return defaults;
}
- // For test
- public IntentManagerImpl(IntentMap intentMap, int maxIntentWaitTime) {
- this.maxIntentWaitTime = maxIntentWaitTime;
- this.intentMap = intentMap;
+ private static Object getLoggingFeature() {
+ return new LoggingFeature();
}
-
- @Activate
- public void activate(BundleContext context) {
- tracker = new IntentTracker(context, this.intentMap);
- tracker.open();
+ private static Object getSoapBinding(SoapVersion soapVersion) {
+ SoapBindingConfiguration soapBindingConfig = new SoapBindingConfiguration();
+ soapBindingConfig.setVersion(soapVersion);
+ return soapBindingConfig;
}
-
- @Deactivate
- public void deactivate() {
- tracker.close();
+
+ @Reference //
+ (//
+ cardinality = MULTIPLE, //
+ policy = ReferencePolicy.DYNAMIC, //
+ target = "(" + IntentManager.INTENT_NAME_PROP + "=*)", //
+ policyOption = ReferencePolicyOption.GREEDY
+ )
+ public void addIntent(Object intent, Map<String, ?> props) {
+ String intentName = (String)props.get(INTENT_NAME_PROP);
+ LOG.info("Adding custom intent " + intentName);
+ intentMap.put(intentName, intent);
+ }
+
+ public void removeIntent(Object intent, Map<String, ?> props) {
+ String intentName = (String)props.get(INTENT_NAME_PROP);
+ intentMap.remove(intentName);
}
public String[] applyIntents(List<Feature> features, AbstractEndpointFactory factory,
- Map<String, Object> props) throws IntentUnsatisfiedException {
+ Map<String, Object> props)
+ throws IntentUnsatisfiedException {
Set<String> requestedIntents = IntentManagerImpl.getRequestedIntents(props);
Set<String> appliedIntents = new HashSet<String>();
appliedIntents.addAll(reverseLookup(intentMap, PROVIDED_INTENT_VALUE));
@@ -99,13 +124,15 @@ public class IntentManagerImpl implements IntentManager {
appliedIntents.addAll(addSynonymIntents(appliedIntents, intentMap));
return appliedIntents.toArray(new String[appliedIntents.size()]);
}
-
+
private static Set<String> getRequestedIntents(Map<String, Object> sd) {
- Collection<String> intents = OsgiUtils.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
- Collection<String> intents2
- = OsgiUtils.getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA));
+ Collection<String> intents = OsgiUtils
+ .getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS));
+ Collection<String> intents2 = OsgiUtils
+ .getMultiValueProperty(sd.get(RemoteConstants.SERVICE_EXPORTED_INTENTS_EXTRA));
@SuppressWarnings("deprecation")
- Collection<String> oldIntents = OsgiUtils.getMultiValueProperty(sd.get(IntentManager.EXPORTED_INTENTS_OLD));
+ Collection<String> oldIntents = OsgiUtils
+ .getMultiValueProperty(sd.get(IntentManager.EXPORTED_INTENTS_OLD));
Set<String> allIntents = new HashSet<String>();
if (intents != null) {
allIntents.addAll(parseIntents(intents));
@@ -128,10 +155,11 @@ public class IntentManagerImpl implements IntentManager {
return parsed;
}
- private boolean processIntent(List<Feature> features, AbstractEndpointFactory factory,
- String intentName, Object intent) throws IntentUnsatisfiedException {
+ private boolean processIntent(List<Feature> features, AbstractEndpointFactory factory, String intentName,
+ Object intent)
+ throws IntentUnsatisfiedException {
if (intent instanceof String) {
- if (PROVIDED_INTENT_VALUE.equalsIgnoreCase((String) intent)) {
+ if (PROVIDED_INTENT_VALUE.equalsIgnoreCase((String)intent)) {
return false;
}
} else if (intent instanceof BindingConfiguration) {
@@ -140,7 +168,7 @@ public class IntentManagerImpl implements IntentManager {
factory.setBindingConfig(bindingCfg);
return true;
} else if (intent instanceof Feature) {
- Feature feature = (Feature) intent;
+ Feature feature = (Feature)intent;
LOG.info("Applying intent: " + intentName + " via feature: " + feature);
features.add(feature);
return false;
@@ -151,8 +179,7 @@ public class IntentManagerImpl implements IntentManager {
return false;
}
- private static Collection<String> addSynonymIntents(Collection<String> appliedIntents,
- IntentMap map) {
+ private static Collection<String> addSynonymIntents(Collection<String> appliedIntents, IntentMap map) {
// E.g. SOAP and SOAP.1_1 are synonyms
List<Object> values = new ArrayList<Object>();
for (String key : appliedIntents) {
@@ -195,7 +222,8 @@ public class IntentManagerImpl implements IntentManager {
}
long remainingSeconds = (endTime - System.currentTimeMillis()) / 1000;
if (!unsupportedIntents.isEmpty() && remainingSeconds > 0) {
- LOG.debug("Waiting for custom intents " + unsupportedIntents + " timeout in " + remainingSeconds);
+ LOG.debug("Waiting for custom intents " + unsupportedIntents + " timeout in "
+ + remainingSeconds);
try {
synchronized (intentMap) {
intentMap.wait(1000);
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentTracker.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentTracker.java b/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentTracker.java
deleted file mode 100644
index 678e9e5..0000000
--- a/common/src/main/java/org/apache/cxf/dosgi/common/intent/IntentTracker.java
+++ /dev/null
@@ -1,61 +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.common.intent;
-
-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;
-
-@SuppressWarnings({"rawtypes", "unchecked"})
-public class IntentTracker extends ServiceTracker {
-
- private final IntentMap intentMap;
-
-
- public IntentTracker(BundleContext context, IntentMap intentMap) {
- super(context, getFilter(context), null);
- this.intentMap = intentMap;
- }
-
- static Filter getFilter(BundleContext context) {
- try {
- return context.createFilter("(" + IntentManager.INTENT_NAME_PROP + "=*)");
- } catch (InvalidSyntaxException e) {
- throw new RuntimeException(e.getMessage(), e);
- }
- }
-
- @Override
- public Object addingService(ServiceReference reference) {
- String intentName = (String) reference.getProperty(IntentManager.INTENT_NAME_PROP);
- Object intent = super.addingService(reference);
- IntentManagerImpl.LOG.info("Adding custom intent " + intentName);
- intentMap.put(intentName, intent);
- return intent;
- }
-
- @Override
- public void removedService(ServiceReference reference, Object service) {
- String intentName = (String) reference.getProperty(IntentManager.INTENT_NAME_PROP);
- intentMap.remove(intentName);
- super.removedService(reference, service);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/common/src/test/java/org/apache/cxf/dosgi/common/qos/IntentManagerImplTest.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/cxf/dosgi/common/qos/IntentManagerImplTest.java b/common/src/test/java/org/apache/cxf/dosgi/common/qos/IntentManagerImplTest.java
index 63a2fef..15fe952 100644
--- a/common/src/test/java/org/apache/cxf/dosgi/common/qos/IntentManagerImplTest.java
+++ b/common/src/test/java/org/apache/cxf/dosgi/common/qos/IntentManagerImplTest.java
@@ -28,7 +28,6 @@ import java.util.Set;
import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
import org.apache.cxf.binding.BindingConfiguration;
-import org.apache.cxf.dosgi.common.intent.DefaultIntentMapFactory;
import org.apache.cxf.dosgi.common.intent.IntentManager;
import org.apache.cxf.dosgi.common.intent.IntentManagerImpl;
import org.apache.cxf.dosgi.common.intent.IntentMap;
@@ -54,7 +53,7 @@ public class IntentManagerImplTest extends Assert {
AbstractEndpointFactory factory = control.createMock(AbstractEndpointFactory.class);
control.replay();
- IntentManager intentManager = new IntentManagerImpl(intentMap, 10000);
+ IntentManager intentManager = new IntentManagerImpl(intentMap);
Map<String, Object> props = new HashMap<String, Object>();
props.put("osgi.remote.requires.intents", "A");
@@ -65,7 +64,7 @@ public class IntentManagerImplTest extends Assert {
@Test
public void testMultiIntents() {
- final IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
+ final IntentMap intentMap = new IntentMap(IntentManagerImpl.create());
intentMap.put("confidentiality.message", new TestFeature("confidentiality.message"));
intentMap.put("transactionality", new TestFeature("transactionality"));
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/common/src/test/java/org/apache/cxf/dosgi/common/qos/IntentTrackerTest.java
----------------------------------------------------------------------
diff --git a/common/src/test/java/org/apache/cxf/dosgi/common/qos/IntentTrackerTest.java b/common/src/test/java/org/apache/cxf/dosgi/common/qos/IntentTrackerTest.java
deleted file mode 100644
index b1efd62..0000000
--- a/common/src/test/java/org/apache/cxf/dosgi/common/qos/IntentTrackerTest.java
+++ /dev/null
@@ -1,82 +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.common.qos;
-
-import static org.easymock.EasyMock.expect;
-
-import org.apache.cxf.dosgi.common.intent.IntentManager;
-import org.apache.cxf.dosgi.common.intent.IntentMap;
-import org.apache.cxf.dosgi.common.intent.IntentTracker;
-import org.apache.cxf.feature.AbstractFeature;
-import org.easymock.Capture;
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Filter;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-
-public class IntentTrackerTest {
-
- private static final String MY_INTENT_NAME = "myIntent";
-
- @Test
- public void testIntentAsService() throws InvalidSyntaxException {
- IMocksControl c = EasyMock.createControl();
- BundleContext bc = c.createMock(BundleContext.class);
- Filter filter = c.createMock(Filter.class);
- expect(bc.createFilter(EasyMock.<String>anyObject())).andReturn(filter);
- final Capture<ServiceListener> capturedListener = EasyMock.newCapture();
- bc.addServiceListener(EasyMock.capture(capturedListener), EasyMock.<String>anyObject());
- EasyMock.expectLastCall().atLeastOnce();
- expect(bc.getServiceReferences(EasyMock.<String>anyObject(),
- EasyMock.<String>anyObject())).andReturn(new ServiceReference[]{});
- IntentMap intentMap = new IntentMap();
-
- // Create a custom intent
- @SuppressWarnings("unchecked")
- ServiceReference<AbstractFeature> reference = c.createMock(ServiceReference.class);
- expect(reference.getProperty(IntentManager.INTENT_NAME_PROP)).andReturn(MY_INTENT_NAME);
- AbstractFeature testIntent = new AbstractFeature() {
- };
- expect(bc.getService(reference)).andReturn(testIntent).atLeastOnce();
-
- c.replay();
-
- IntentTracker tracker = new IntentTracker(bc, intentMap);
- tracker.open();
-
- Assert.assertFalse("IntentMap should not contain " + MY_INTENT_NAME, intentMap.containsKey(MY_INTENT_NAME));
- ServiceListener listener = capturedListener.getValue();
-
- // Simulate adding custom intent service
- ServiceEvent event = new ServiceEvent(ServiceEvent.REGISTERED, reference);
- listener.serviceChanged(event);
-
- // our custom intent should now be available
- Assert.assertTrue("IntentMap should contain " + MY_INTENT_NAME, intentMap.containsKey(MY_INTENT_NAME));
- Assert.assertEquals(testIntent, intentMap.get(MY_INTENT_NAME));
-
- c.verify();
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/cxf-dsw/bnd.bnd
----------------------------------------------------------------------
diff --git a/cxf-dsw/bnd.bnd b/cxf-dsw/bnd.bnd
index 017457a..99f067a 100644
--- a/cxf-dsw/bnd.bnd
+++ b/cxf-dsw/bnd.bnd
@@ -1,2 +1,3 @@
Import-Package: javax.servlet;version='[2,4)', javax.servlet.http;version='[2,4)', *
+Private-Package: org.apache.cxf.dosgi.dsw.*
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
index 49ee272..287c4f1 100644
--- a/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
+++ b/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProvider.java
@@ -93,7 +93,6 @@ public class CXFDistributionProvider implements DistributionProvider {
this.intentManager = intentManager;
}
- @SuppressWarnings("unchecked")
@Activate
public synchronized void activate(ComponentContext compContext) {
Dictionary<String, Object> config = compContext.getProperties();
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
----------------------------------------------------------------------
diff --git a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
index 38db72d..d161b2d 100644
--- a/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
+++ b/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
@@ -18,16 +18,16 @@
*/
package org.apache.cxf.dosgi.dsw.handlers;
+import static org.junit.Assert.assertTrue;
+
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.aries.rsa.spi.DistributionProvider;
import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
-import org.apache.cxf.dosgi.common.intent.DefaultIntentMapFactory;
import org.apache.cxf.dosgi.common.intent.IntentManager;
import org.apache.cxf.dosgi.common.intent.IntentManagerImpl;
-import org.apache.cxf.dosgi.common.intent.IntentMap;
import org.apache.cxf.dosgi.dsw.handlers.pojo.PojoConfigurationTypeHandler;
import org.apache.cxf.dosgi.dsw.handlers.pojo.WsdlConfigurationTypeHandler;
import org.apache.cxf.dosgi.dsw.handlers.rest.JaxRSPojoConfigurationTypeHandler;
@@ -38,8 +38,6 @@ import org.junit.Test;
import org.osgi.framework.BundleContext;
import org.osgi.service.remoteserviceadmin.RemoteConstants;
-import static org.junit.Assert.assertTrue;
-
public class CXFDistributionProviderTest {
@Test
@@ -98,8 +96,7 @@ public class CXFDistributionProviderTest {
Map<String, Object> serviceProps = new HashMap<String, Object>();
serviceProps.put(RemoteConstants.SERVICE_EXPORTED_CONFIGS, configType);
serviceProps.put(RemoteConstants.SERVICE_EXPORTED_INTENTS, intents);
- IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
- IntentManager intentManager = new IntentManagerImpl(intentMap);
+ IntentManager intentManager = new IntentManagerImpl();
HttpServiceManager httpServiceManager = new HttpServiceManager();
httpServiceManager.setContext(bc);
CXFDistributionProvider provider = new CXFDistributionProvider();
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/samples/ds/client/pom.xml
----------------------------------------------------------------------
diff --git a/samples/ds/client/pom.xml b/samples/ds/client/pom.xml
index 7c5f1df..3e833d5 100644
--- a/samples/ds/client/pom.xml
+++ b/samples/ds/client/pom.xml
@@ -13,7 +13,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>cxf-dosgi-ri-samples-ds-client</artifactId>
<packaging>bundle</packaging>
- <name>Distributed OSGI Declarative Services Sample Client</name>
+ <name>Distributed OSGI DS Client</name>
<parent>
<groupId>org.apache.cxf.dosgi.samples</groupId>
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/samples/ds/impl/pom.xml
----------------------------------------------------------------------
diff --git a/samples/ds/impl/pom.xml b/samples/ds/impl/pom.xml
index 80c1744..11bcdcb 100644
--- a/samples/ds/impl/pom.xml
+++ b/samples/ds/impl/pom.xml
@@ -40,5 +40,5 @@
</dependency>
</dependencies>
- <name>Distributed OSGI Declarative Services Sample Impl</name>
+ <name>Distributed OSGI DS Sample Impl</name>
</project>
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/samples/ds/interface/pom.xml
----------------------------------------------------------------------
diff --git a/samples/ds/interface/pom.xml b/samples/ds/interface/pom.xml
index 1952f06..3db2187 100644
--- a/samples/ds/interface/pom.xml
+++ b/samples/ds/interface/pom.xml
@@ -22,7 +22,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>cxf-dosgi-ri-samples-ds-interface</artifactId>
<packaging>bundle</packaging>
- <name>Distributed OSGI Declarative Services Sample Interface</name>
+ <name>Distributed OSGI DS Sample Interface</name>
<parent>
<groupId>org.apache.cxf.dosgi.samples</groupId>
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/samples/ds/pom.xml
----------------------------------------------------------------------
diff --git a/samples/ds/pom.xml b/samples/ds/pom.xml
index 3987c69..bd42e92 100644
--- a/samples/ds/pom.xml
+++ b/samples/ds/pom.xml
@@ -15,7 +15,7 @@
<groupId>org.apache.cxf.dosgi.samples</groupId>
<artifactId>cxf-dosgi-ri-samples-ds-parent</artifactId>
<packaging>pom</packaging>
- <name>Distributed OSGI Declarative Services Sample</name>
+ <name>Distributed OSGI DS Sample</name>
<version>1.9-SNAPSHOT</version>
<parent>
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/systests2/multi-bundle/pom.xml
----------------------------------------------------------------------
diff --git a/systests2/multi-bundle/pom.xml b/systests2/multi-bundle/pom.xml
index 34d6ecc..cb8b205 100644
--- a/systests2/multi-bundle/pom.xml
+++ b/systests2/multi-bundle/pom.xml
@@ -44,11 +44,6 @@
-->
<dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
-
<!-- Pax Exam -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java
----------------------------------------------------------------------
diff --git a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java
index 7fc4c6a..2e727fe 100644
--- a/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java
+++ b/systests2/multi-bundle/src/test/java/org/apache/cxf/dosgi/systests2/multi/AbstractDosgiTest.java
@@ -24,6 +24,7 @@ import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
+import java.io.File;
import java.io.IOException;
import java.net.ConnectException;
import java.net.HttpURLConnection;
@@ -40,8 +41,10 @@ import javax.inject.Inject;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.Stat;
import org.junit.Assert;
+import org.junit.BeforeClass;
import org.ops4j.pax.exam.CoreOptions;
import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.cm.ConfigurationAdminOptions;
import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -51,9 +54,15 @@ import org.osgi.framework.ServiceReference;
public class AbstractDosgiTest {
static final int ZK_PORT = 35101;
private static final int TIMEOUT = 20;
-
+
@Inject
BundleContext bundleContext;
+
+ @BeforeClass
+ public static void log() {
+ System.out.println("-----------------------------------------------------------------");
+ }
+
/**
* Sleeps for a short interval, throwing an exception if timeout has been reached. Used to facilitate a
@@ -204,6 +213,11 @@ public class AbstractDosgiTest {
.put("clientPort", "" + ZK_PORT) //
.asOption();
}
+
+ protected static Option configLogging() {
+ return ConfigurationAdminOptions.configurationFolder(new File("src/test/resources/cfg"));
+ }
+
protected static MavenArtifactProvisionOption greeterImpl() {
return mavenBundle().groupId("org.apache.cxf.dosgi.samples")
@@ -220,6 +234,7 @@ public class AbstractDosgiTest {
CoreOptions.junitBundles(), //
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"), //
systemProperty("pax.exam.osgi.unresolved.fail").value("true"), //
+ configLogging(),
frameworkStartLevel(100)
// CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005") //
);
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/systests2/multi-bundle/src/test/resources/cfg/org.ops4j.pax.logging.cfg
----------------------------------------------------------------------
diff --git a/systests2/multi-bundle/src/test/resources/cfg/org.ops4j.pax.logging.cfg b/systests2/multi-bundle/src/test/resources/cfg/org.ops4j.pax.logging.cfg
new file mode 100644
index 0000000..b081a42
--- /dev/null
+++ b/systests2/multi-bundle/src/test/resources/cfg/org.ops4j.pax.logging.cfg
@@ -0,0 +1,7 @@
+log4j.rootLogger=INFO, stdout
+log4j.logger.org.apache.cxf.bus.blueprint=ERROR
+log4j.logger.org.apache.cxf.bus.osgi.CXFActivator=WARN
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %40.40c | %m%n
http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/951f7c8d/systests2/multi-bundle/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/systests2/multi-bundle/src/test/resources/log4j.properties b/systests2/multi-bundle/src/test/resources/log4j.properties
index 2f206d5..37ce342 100644
--- a/systests2/multi-bundle/src/test/resources/log4j.properties
+++ b/systests2/multi-bundle/src/test/resources/log4j.properties
@@ -1,12 +1,8 @@
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, A1
+log4j.rootLogger=INFO, stdout
-# A1 is set to be a ConsoleAppender.
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# A1 uses PatternLayout.
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} | %-5.5p | %40.40c | %m%n
log4j.logger.org.ops4j.pax.scanner=WARN
log4j.logger.org.ops4j.pax.runner=WARN