cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject [1/2] cxf-dosgi git commit: [DOSGI-229] Make CXF handlers only depend on API
Date Fri, 04 Mar 2016 10:56:07 GMT
Repository: cxf-dosgi
Updated Branches:
  refs/heads/master b5f02ff5a -> f54fb69b9


http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/f54fb69b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java
deleted file mode 100644
index 83347b5..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/util/Utils.java
+++ /dev/null
@@ -1,101 +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.dsw.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public final class Utils {
-
-    private static final Logger LOG = LoggerFactory.getLogger(Utils.class);
-
-    private Utils() {
-        // never constructed
-    }
-
-    @SuppressWarnings("rawtypes")
-    public static String[] normalizeStringPlus(Object object) {
-        if (object instanceof String) {
-            String s = (String)object;
-            String[] values = s.split(",");
-            List<String> list = new ArrayList<String>();
-            for (String val : values) {
-                String actualValue = val.trim();
-                if (!actualValue.isEmpty()) {
-                    list.add(actualValue);
-                }
-            }
-            return list.toArray(new String[list.size()]);
-        }
-
-        if (object instanceof String[]) {
-            return (String[])object;
-        }
-        
-        if (object instanceof Collection) {
-            Collection col = (Collection)object;
-            List<String> ar = new ArrayList<String>(col.size());
-            for (Object o : col) {
-                if (o instanceof String) {
-                    String s = (String)o;
-                    ar.add(s);
-                } else {
-                    LOG.warn("stringPlus contained non string element in list! Element was
skipped");
-                }
-            }
-            return ar.toArray(new String[ar.size()]);
-        }
-
-        return null;
-    }
-
-    /**
-     * Converts the given Dictionary to a Map.
-     *
-     * @param dict a dictionary
-     * @param <K> the key type
-     * @param <V> the value type
-     * @return the converted map, or an empty map if the given dictionary is null
-     */
-    public static <K, V> Map<K, V> toMap(Dictionary<K, V> dict) {
-        Map<K, V> map = new HashMap<K, V>();
-        if (dict != null) {
-            Enumeration<K> keys = dict.keys();
-            while (keys.hasMoreElements()) {
-                K key = keys.nextElement();
-                map.put(key, dict.get(key));
-            }
-        }
-        return map;
-    }
-
-    public static <K, V> void setIfNotNull(Map<K, V> map, K key, V val) {
-        if (val != null) {
-            map.put(key, val);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/f54fb69b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
index 62007c7..98e2cfc 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
@@ -44,6 +44,9 @@ public class ActivatorTest extends TestCase {
         return bc;
     }
 
+    @SuppressWarnings({
+     "rawtypes", "unchecked"
+    })
     public void testCreateAndShutdownRemoteServiceAdminService() throws Exception {
         IMocksControl control = EasyMock.createNiceControl();
         BundleContext bc = getMockBundleContext(control);

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/f54fb69b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
new file mode 100644
index 0000000..1144ae0
--- /dev/null
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/CXFDistributionProviderTest.java
@@ -0,0 +1,118 @@
+/**
+ * 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.handlers;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cxf.dosgi.dsw.Constants;
+import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
+import org.apache.cxf.dosgi.dsw.qos.DefaultIntentMapFactory;
+import org.apache.cxf.dosgi.dsw.qos.IntentManager;
+import org.apache.cxf.dosgi.dsw.qos.IntentManagerImpl;
+import org.apache.cxf.dosgi.dsw.qos.IntentMap;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+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
+    public void testGetDefaultHandlerNoIntents() {
+        DistributionProvider handler = getHandlerWith(null, null);
+        assertTrue(handler instanceof PojoConfigurationTypeHandler);
+    }
+
+    @Test
+    public void testGetJaxrsHandlerNoIntents() {
+        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, null);
+        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
+    }
+
+    @Test
+    public void testGetJaxrsHandlerHttpIntents() {
+        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, "HTTP");
+        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
+    }
+
+    @Test
+    public void testJaxrsPropertyIgnored() {
+        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, "SOAP HTTP");
+        assertTrue(handler instanceof PojoConfigurationTypeHandler);
+        assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
+    }
+
+    @Test
+    public void testJaxrsPropertyIgnored2() {
+        DistributionProvider handler = getHandlerWith2(Constants.RS_CONFIG_TYPE, new String[]
{"HTTP", "SOAP"});
+        assertTrue(handler instanceof PojoConfigurationTypeHandler);
+        assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
+    }
+
+    @Test
+    public void testGetPojoHandler() {
+        DistributionProvider handler = getHandlerWith(Constants.WS_CONFIG_TYPE, null);
+        assertTrue(handler instanceof PojoConfigurationTypeHandler);
+    }
+
+    @Test
+    public void testGetWSDLHandler() {
+        DistributionProvider handler = getHandlerWith(Constants.WSDL_CONFIG_TYPE, null);
+        assertTrue(handler instanceof WsdlConfigurationTypeHandler);
+    }
+
+    @Test
+    public void testUnsupportedConfiguration() {
+        DistributionProvider handler = getHandlerWith("notSupportedConfig", null);
+        Assert.assertNull(handler);
+    }
+
+    private DistributionProvider getHandlerWith(String configType, String intents) {
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bc);
+        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);
+        HttpServiceManager httpServiceManager = new HttpServiceManager(bc, null, null);
+        CXFDistributionProvider f = new CXFDistributionProvider(bc, intentManager, httpServiceManager);
+        List<String> configurationTypes = f.determineConfigurationTypes(serviceProps);
+        return f.getHandler(configurationTypes, serviceProps);
+    }
+
+    private DistributionProvider getHandlerWith2(String configType, String[] intents) {
+        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
+        EasyMock.replay(bc);
+        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);
+        HttpServiceManager httpServiceManager = new HttpServiceManager(bc, null, null);
+        CXFDistributionProvider f = new CXFDistributionProvider(bc, intentManager, httpServiceManager);
+        List<String> configurationTypes = f.determineConfigurationTypes(serviceProps);
+        return f.getHandler(configurationTypes, serviceProps);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/f54fb69b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java
b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java
index bdbb93d..afc45d1 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ClientServiceFactoryTest.java
@@ -31,7 +31,6 @@ import org.easymock.IMocksControl;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.remoteserviceadmin.EndpointDescription;
 import org.osgi.service.remoteserviceadmin.RemoteConstants;
@@ -59,14 +58,10 @@ public class ClientServiceFactoryTest extends TestCase {
         Bundle requestingBundle = control.createMock(Bundle.class);
         EasyMock.expect(requestingBundle.loadClass(String.class.getName())).andReturn((Class)String.class);
         EasyMock.expect(requestingBundle.getBundleContext()).andReturn(requestingContext);
-
-        ServiceReference sref = control.createMock(ServiceReference.class);
-        EasyMock.expect(sref.getBundle()).andReturn(requestingBundle);
         ServiceRegistration sreg = control.createMock(ServiceRegistration.class);
-        EasyMock.expect(sreg.getReference()).andReturn(sref);
 
         DistributionProvider handler = control.createMock(DistributionProvider.class);
-        handler.createProxy(sref, String.class, endpoint);
+        handler.importEndpoint(requestingContext, String.class, endpoint);
         EasyMock.expectLastCall().andReturn(myTestProxyObject);
         control.replay();
 

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/f54fb69b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
deleted file mode 100644
index c96874e..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/ConfigTypeHandlerFactoryTest.java
+++ /dev/null
@@ -1,116 +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.dsw.handlers;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.cxf.dosgi.dsw.Constants;
-import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
-import org.apache.cxf.dosgi.dsw.qos.DefaultIntentMapFactory;
-import org.apache.cxf.dosgi.dsw.qos.IntentManager;
-import org.apache.cxf.dosgi.dsw.qos.IntentManagerImpl;
-import org.apache.cxf.dosgi.dsw.qos.IntentMap;
-import org.apache.cxf.dosgi.dsw.service.ConfigTypeHandlerFinder;
-import org.easymock.EasyMock;
-import org.junit.Assert;
-import org.junit.Test;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.remoteserviceadmin.RemoteConstants;
-
-import static org.junit.Assert.assertTrue;
-
-public class ConfigTypeHandlerFactoryTest {
-
-    @Test
-    public void testGetDefaultHandlerNoIntents() {
-        DistributionProvider handler = getHandlerWith(null, null);
-        assertTrue(handler instanceof PojoConfigurationTypeHandler);
-    }
-
-    @Test
-    public void testGetJaxrsHandlerNoIntents() {
-        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, null);
-        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
-    }
-
-    @Test
-    public void testGetJaxrsHandlerHttpIntents() {
-        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, "HTTP");
-        assertTrue(handler instanceof JaxRSPojoConfigurationTypeHandler);
-    }
-
-    @Test
-    public void testJaxrsPropertyIgnored() {
-        DistributionProvider handler = getHandlerWith(Constants.RS_CONFIG_TYPE, "SOAP HTTP");
-        assertTrue(handler instanceof PojoConfigurationTypeHandler);
-        assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
-    }
-
-    @Test
-    public void testJaxrsPropertyIgnored2() {
-        DistributionProvider handler = getHandlerWith2(Constants.RS_CONFIG_TYPE, new String[]
{"HTTP", "SOAP"});
-        assertTrue(handler instanceof PojoConfigurationTypeHandler);
-        assertTrue(!(handler instanceof JaxRSPojoConfigurationTypeHandler));
-    }
-
-    @Test
-    public void testGetPojoHandler() {
-        DistributionProvider handler = getHandlerWith(Constants.WS_CONFIG_TYPE, null);
-        assertTrue(handler instanceof PojoConfigurationTypeHandler);
-    }
-
-    @Test
-    public void testGetWSDLHandler() {
-        DistributionProvider handler = getHandlerWith(Constants.WSDL_CONFIG_TYPE, null);
-        assertTrue(handler instanceof WsdlConfigurationTypeHandler);
-    }
-
-    @Test
-    public void testUnsupportedConfiguration() {
-        DistributionProvider handler = getHandlerWith("notSupportedConfig", null);
-        Assert.assertNull(handler);
-    }
-
-    private DistributionProvider getHandlerWith(String configType, String intents) {
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.replay(bc);
-        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);
-        HttpServiceManager httpServiceManager = new HttpServiceManager(bc, null, null);
-        ConfigTypeHandlerFinder f = new ConfigTypeHandlerFactory(bc, intentManager, httpServiceManager);
-        return f.getHandler(bc, serviceProps);
-    }
-
-    private DistributionProvider getHandlerWith2(String configType, String[] intents) {
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.replay(bc);
-        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);
-        HttpServiceManager httpServiceManager = new HttpServiceManager(bc, null, null);
-        ConfigTypeHandlerFinder f = new ConfigTypeHandlerFactory(bc, intentManager, httpServiceManager);
-        return f.getHandler(bc, serviceProps);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/f54fb69b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
index 69f194d..8e9d64d 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/handlers/PojoConfigurationTypeHandlerTest.java
@@ -22,6 +22,7 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 import javax.xml.namespace.QName;
 
@@ -110,13 +111,8 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
     public void testCreateProxy() {
         IMocksControl c = EasyMock.createNiceControl();
         BundleContext bc1 = c.createMock(BundleContext.class);
-
         
-        ServiceReference<?> sref = c.createMock(ServiceReference.class);
-        Bundle requestingBundle = c.createMock(Bundle.class);
         BundleContext requestingContext = c.createMock(BundleContext.class);
-        EasyMock.expect(requestingBundle.getBundleContext()).andReturn(requestingContext);
-        EasyMock.expect(sref.getBundle()).andReturn(requestingBundle);
 
         final ClientProxyFactoryBean cpfb = c.createMock(ClientProxyFactoryBean.class);
         ReflectionServiceFactoryBean sf = c.createMock(ReflectionServiceFactoryBean.class);
@@ -152,7 +148,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
         EasyMock.expectLastCall().atLeastOnce();
 
         c.replay();
-        Object proxy = p.createProxy(sref, CharSequence.class, endpoint);
+        Object proxy = p.importEndpoint(requestingContext, CharSequence.class, endpoint);
         assertNotNull(proxy);
         assertTrue("Proxy is not of the requested type! ", proxy instanceof CharSequence);
         c.verify();
@@ -195,7 +191,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
         Map<String, Object> props = new HashMap<String, Object>();
         props.put(Constants.WS_ADDRESS_PROPERTY, "http://alternate_host:80/myString");
 
-        Endpoint exportResult = p.createServer(sref, props, String.class.getName());
+        Endpoint exportResult = p.exportService(sref, props, String.class.getName());
         Map<String, Object> edProps = exportResult.description().getProperties();
 
         assertNotNull(edProps.get(RemoteConstants.SERVICE_IMPORTED_CONFIGS));
@@ -226,6 +222,8 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
 
     private void runAddressingTest(Map<String, Object> properties, String expectedAddress)
throws Exception {
         BundleContext dswContext = EasyMock.createNiceMock(BundleContext.class);
+        String expectedUUID = UUID.randomUUID().toString();
+        EasyMock.expect(dswContext.getProperty(org.osgi.framework.Constants.FRAMEWORK_UUID)).andReturn(expectedUUID);
         EasyMock.replay(dswContext);
 
         IntentManager intentManager = EasyMock.createNiceMock(IntentManager.class);
@@ -247,6 +245,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
         ServiceReference sref = EasyMock.createNiceMock(ServiceReference.class);
         BundleContext bundleContext = EasyMock.createNiceMock(BundleContext.class);
         EasyMock.expect(bundleContext.getService(sref)).andReturn(myService);
+        
         EasyMock.replay(bundleContext);
         Bundle bundle = EasyMock.createNiceMock(Bundle.class);
         EasyMock.expect(bundle.getBundleContext()).andReturn(bundleContext);
@@ -256,13 +255,13 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
         EasyMock.replay(sref);
 
 
-        Endpoint result = handler.createServer(sref, properties, Runnable.class.getName());
+        Endpoint result = handler.exportService(sref, properties, Runnable.class.getName());
         Map<String, Object> props = result.description().getProperties();
         assertEquals(expectedAddress, props.get("org.apache.cxf.ws.address"));
         assertEquals("Version of java. package is always 0", "0.0.0", props.get("endpoint.package.version.java.lang"));
         assertTrue(Arrays.equals(new String[] {"org.apache.cxf.ws"}, (String[]) props.get("service.imported.configs")));
         assertTrue(Arrays.equals(new String[] {"java.lang.Runnable"}, (String[]) props.get("objectClass")));
-        assertNotNull(props.get("endpoint.framework.uuid"));
+        assertEquals(expectedUUID, props.get("endpoint.framework.uuid"));
     }
 
     public void t2estCreateServerException() {
@@ -290,7 +289,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
         Runnable myService = EasyMock.createMock(Runnable.class);
         EasyMock.replay(myService);
         try {
-            handler.createServer(sref, props, Runnable.class.getName());
+            handler.exportService(sref, props, Runnable.class.getName());
             fail("Expected TestException");
         } catch (TestException e) {
             // Expected
@@ -390,7 +389,8 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
         sd.put(Constants.WS_ADDRESS_PROPERTY, "/somewhere");
 
         c.replay();
-        ServerWrapper serverWrapper = (ServerWrapper)handler.createServer(sref, sd, MyJaxWsEchoService.class.getName());
+        ServerWrapper serverWrapper = (ServerWrapper)handler.exportService(sref, sd, 
+                                                                           MyJaxWsEchoService.class.getName());
         c.verify();
 
         org.apache.cxf.endpoint.Endpoint ep = serverWrapper.getServer().getEndpoint();
@@ -412,7 +412,7 @@ public class PojoConfigurationTypeHandlerTest extends TestCase {
         sd.put(Constants.WS_ADDRESS_PROPERTY, "/somewhere_else");
 
         c.replay();
-        ServerWrapper serverWrapper = (ServerWrapper)handler.createServer(sref, sd, 
+        ServerWrapper serverWrapper = (ServerWrapper)handler.exportService(sref, sd, 
                                                                           MySimpleEchoService.class.getName());
         c.verify();
 

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/f54fb69b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java
index 92c157a..f7fe844 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/qos/IntentUtilsTest.java
@@ -50,6 +50,7 @@ public class IntentUtilsTest {
                 new HashSet<String>(Arrays.asList(IntentUtils.mergeArrays(sa3, sa4))));
     }
 
+    @SuppressWarnings("deprecation")
     @Test
     public void testRequestedIntents() {
         Map<String, Object> props = new HashMap<String, Object>();

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/f54fb69b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
index 21d76cd..23902a5 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
@@ -60,6 +60,7 @@ public class ImportRegistrationImplTest {
         assertEquals(endpoint, i.getImportedEndpointDescription());
     }
 
+    @SuppressWarnings("rawtypes")
     @Test
     public void testCloneAndClose() {
         IMocksControl c = EasyMock.createControl();

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/f54fb69b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
index 2900ce6..285885a 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
@@ -29,7 +29,7 @@ import java.util.Map;
 
 import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
 import org.apache.cxf.dosgi.dsw.api.Endpoint;
-import org.apache.cxf.dosgi.dsw.handlers.ConfigTypeHandlerFactory;
+import org.apache.cxf.dosgi.dsw.handlers.CXFDistributionProvider;
 import org.apache.cxf.dosgi.dsw.handlers.HttpServiceManager;
 import org.apache.cxf.dosgi.dsw.handlers.ServerWrapper;
 import org.apache.cxf.dosgi.dsw.qos.DefaultIntentMapFactory;
@@ -83,13 +83,14 @@ public class RemoteServiceAdminCoreTest {
         EasyMock.expect(sref.getPropertyKeys())
             .andReturn(new String[]{"objectClass", "service.exported.interfaces"}).anyTimes();
         EasyMock.expect(sref.getProperty("objectClass")).andReturn(new String[] {"a.b.C"}).anyTimes();
+        EasyMock.expect(sref.getProperty(RemoteConstants.SERVICE_IMPORTED)).andReturn(true).anyTimes();
         EasyMock.expect(sref.getProperty("service.exported.interfaces")).andReturn("*").anyTimes();
 
-        ConfigTypeHandlerFinder configTypeHandlerFactory = c.createMock(ConfigTypeHandlerFactory.class);
+        DistributionProvider provider = c.createMock(DistributionProvider.class);
 
         c.replay();
 
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, configTypeHandlerFactory);
+        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, provider);
 
         // must return an empty List as sref if from the same bundle
         List<ExportRegistration> exRefs = rsaCore.exportService(sref, null);
@@ -125,12 +126,10 @@ public class RemoteServiceAdminCoreTest {
         IntentMap intentMap = new IntentMap(new DefaultIntentMapFactory().create());
         IntentManager intentManager = new IntentManagerImpl(intentMap, 10000);
         HttpServiceManager httpServiceManager = c.createMock(HttpServiceManager.class);
-        ConfigTypeHandlerFinder configTypeHandlerFactory
-            = new ConfigTypeHandlerFactory(bc, intentManager, httpServiceManager);
-
+        CXFDistributionProvider provider = new CXFDistributionProvider(bc, intentManager,
httpServiceManager);
         c.replay();
 
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, configTypeHandlerFactory)
{
+        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, provider) {
             @Override
             protected ImportRegistrationImpl exposeServiceFactory(String interfaceName, 
                                                                       EndpointDescription
epd,
@@ -212,14 +211,10 @@ public class RemoteServiceAdminCoreTest {
         Endpoint er = new ServerWrapper(new EndpointDescription(eProps), null);
 
         DistributionProvider handler = EasyMock.createNiceMock(DistributionProvider.class);
-        EasyMock.expect(handler.createServer(sref, sProps, Runnable.class.getName())).andReturn(er).once();
+        EasyMock.expect(handler.exportService(sref, sProps, Runnable.class.getName())).andReturn(er).once();
         EasyMock.replay(handler);
 
-        ConfigTypeHandlerFinder handlerFactory = EasyMock.createNiceMock(ConfigTypeHandlerFactory.class);
-        EasyMock.expect(handlerFactory.getHandler(bc, sProps))
-            .andReturn(handler).once(); // Second time shouldn't get there because it should
simply copy
-        EasyMock.replay(handlerFactory);
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, handlerFactory);
+        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, handler);
 
         // Export the service for the first time
         List<ExportRegistration> ereg = rsaCore.exportService(sref, null);
@@ -306,13 +301,10 @@ public class RemoteServiceAdminCoreTest {
         eProps.put("service.imported.configs", new String[] {"org.apache.cxf.ws"});
 
         DistributionProvider handler = EasyMock.createMock(DistributionProvider.class);
-        EasyMock.expect(handler.createServer(sref, sProps, Runnable.class.getName())).andThrow(new
TestException());
+        EasyMock.expect(handler.exportService(sref, sProps, Runnable.class.getName())).andThrow(new
TestException());
         EasyMock.replay(handler);
 
-        ConfigTypeHandlerFinder handlerFactory = EasyMock.createMock(ConfigTypeHandlerFactory.class);
-        EasyMock.expect(handlerFactory.getHandler(bc, sProps)).andReturn(handler).anyTimes();
-        EasyMock.replay(handlerFactory);
-        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, handlerFactory);
+        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, handler);
 
         List<ExportRegistration> ereg = rsaCore.exportService(sref, sProps);
         assertEquals(1, ereg.size());
@@ -356,4 +348,35 @@ public class RemoteServiceAdminCoreTest {
     @SuppressWarnings("serial")
     private static class TestException extends RuntimeException {
     }
+    
+    public void testOverlayProperties() {
+        Map<String, Object> sProps = new HashMap<String, Object>();
+        Map<String, Object> aProps = new HashMap<String, Object>();
+
+        RemoteServiceAdminCore.overlayProperties(sProps, aProps);
+        assertEquals(0, sProps.size());
+
+        sProps.put("aaa", "aval");
+        sProps.put("bbb", "bval");
+        sProps.put(Constants.OBJECTCLASS, new String[] {"X"});
+        sProps.put(Constants.SERVICE_ID, 17L);
+
+        aProps.put("AAA", "achanged");
+        aProps.put("CCC", "CVAL");
+        aProps.put(Constants.OBJECTCLASS, new String[] {"Y"});
+        aProps.put(Constants.SERVICE_ID.toUpperCase(), 51L);
+
+        Map<String, Object> aPropsOrg = new HashMap<String, Object>(aProps);
+        RemoteServiceAdminCore.overlayProperties(sProps, aProps);
+        assertEquals("The additional properties should not be modified", aPropsOrg, aProps);
+
+        assertEquals(5, sProps.size());
+        assertEquals("achanged", sProps.get("aaa"));
+        assertEquals("bval", sProps.get("bbb"));
+        assertEquals("CVAL", sProps.get("CCC"));
+        assertTrue("Should not be possible to override the objectClass property",
+                Arrays.equals(new String[] {"X"}, (Object[]) sProps.get(Constants.OBJECTCLASS)));
+        assertEquals("Should not be possible to override the service.id property",
+                17L, sProps.get(Constants.SERVICE_ID));
+    }
 }

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/f54fb69b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java
index 1ceebe8..29e177f 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/UtilsTest.java
@@ -23,8 +23,7 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.cxf.dosgi.dsw.util.OsgiUtils;
-import org.apache.cxf.dosgi.dsw.util.Utils;
+import org.apache.cxf.dosgi.dsw.util.StringPlus;
 import org.junit.Test;
 import org.osgi.framework.Constants;
 
@@ -36,7 +35,7 @@ public class UtilsTest {
 
     @Test
     public void testSplitString() {
-        String[] values = Utils.normalizeStringPlus("1, 2");
+        String[] values = StringPlus.normalize("1, 2");
         assertEquals(2, values.length);
         assertEquals(values[0], "1");
         assertEquals(values[1], "2");
@@ -58,12 +57,12 @@ public class UtilsTest {
         sl.add(s3);
         sl.add(new Object()); // must be skipped
 
-        assertArrayEquals(null, Utils.normalizeStringPlus(new Object()));
+        assertArrayEquals(null, StringPlus.normalize(new Object()));
         assertArrayEquals(new String[] {
             s1
-        }, Utils.normalizeStringPlus(s1));
-        assertArrayEquals(sa, Utils.normalizeStringPlus(sa));
-        assertArrayEquals(sa, Utils.normalizeStringPlus(sl));
+        }, StringPlus.normalize(s1));
+        assertArrayEquals(sa, StringPlus.normalize(sa));
+        assertArrayEquals(sa, StringPlus.normalize(sl));
     }
 
     @Test
@@ -78,7 +77,7 @@ public class UtilsTest {
 
         // nothing should change here
         Map<String, Object> overload = new HashMap<String, Object>();
-        OsgiUtils.overlayProperties(copy, overload);
+        RemoteServiceAdminCore.overlayProperties(copy, overload);
 
         assertEquals(original.size(), copy.size());
         for (Object key : original.keySet()) {
@@ -92,7 +91,7 @@ public class UtilsTest {
         overload = new HashMap<String, Object>();
         overload.put("new", "prop");
 
-        OsgiUtils.overlayProperties(copy, overload);
+        RemoteServiceAdminCore.overlayProperties(copy, overload);
 
         assertEquals(original.size() + 1, copy.size());
         for (Object key : original.keySet()) {
@@ -109,7 +108,7 @@ public class UtilsTest {
         overload.put("new", "prop");
         overload.put("NEW", "prop");
 
-        OsgiUtils.overlayProperties(copy, overload);
+        RemoteServiceAdminCore.overlayProperties(copy, overload);
 
         assertEquals(original.size() + 1, copy.size());
         for (Object key : original.keySet()) {
@@ -125,7 +124,7 @@ public class UtilsTest {
         overload = new HashMap<String, Object>();
         overload.put(Constants.OBJECTCLASS, "assd");
         overload.put(Constants.SERVICE_ID, "asasdasd");
-        OsgiUtils.overlayProperties(copy, overload);
+        RemoteServiceAdminCore.overlayProperties(copy, overload);
 
         assertEquals(original.size(), copy.size());
         for (Object key : original.keySet()) {
@@ -138,7 +137,7 @@ public class UtilsTest {
         // overwrite own prop
         overload = new HashMap<String, Object>();
         overload.put("MyProp", "newValue");
-        OsgiUtils.overlayProperties(copy, overload);
+        RemoteServiceAdminCore.overlayProperties(copy, overload);
 
         assertEquals(original.size(), copy.size());
         for (Object key : original.keySet()) {
@@ -154,7 +153,7 @@ public class UtilsTest {
         // overwrite own prop in different case
         overload = new HashMap<String, Object>();
         overload.put("MYPROP", "newValue");
-        OsgiUtils.overlayProperties(copy, overload);
+        RemoteServiceAdminCore.overlayProperties(copy, overload);
 
         assertEquals(original.size(), copy.size());
         for (Object key : original.keySet()) {

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/f54fb69b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java
index 96ffd82..a21ada5 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/ClassUtilsTest.java
@@ -28,6 +28,7 @@ import java.util.Map;
 
 import junit.framework.TestCase;
 
+import org.apache.cxf.dosgi.dsw.handlers.ClassUtils;
 import org.easymock.EasyMock;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/f54fb69b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
----------------------------------------------------------------------
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
index c45f7b2..cc15ea6 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/util/OsgiUtilsTest.java
@@ -31,7 +31,6 @@ import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.Version;
 import org.osgi.service.packageadmin.ExportedPackage;
@@ -64,18 +63,6 @@ public class OsgiUtilsTest extends TestCase {
         assertNull(OsgiUtils.getMultiValueProperty(null));
     }
 
-    public void testGetUUID() {
-        BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-        EasyMock.expect(bc.getProperty(EasyMock.eq("org.osgi.framework.uuid"))).andReturn(null).atLeastOnce();
-        EasyMock.replay(bc);
-        String uuid = OsgiUtils.getUUID(bc);
-        assertNotNull(uuid);
-
-        assertEquals(System.getProperty("org.osgi.framework.uuid"), uuid);
-
-        EasyMock.verify(bc);
-    }
-
     @SuppressWarnings({
      "rawtypes", "unchecked"
     })
@@ -114,37 +101,6 @@ public class OsgiUtilsTest extends TestCase {
         c.verify();
     }
 
-    public void testOverlayProperties() {
-        Map<String, Object> sProps = new HashMap<String, Object>();
-        Map<String, Object> aProps = new HashMap<String, Object>();
-
-        OsgiUtils.overlayProperties(sProps, aProps);
-        assertEquals(0, sProps.size());
-
-        sProps.put("aaa", "aval");
-        sProps.put("bbb", "bval");
-        sProps.put(Constants.OBJECTCLASS, new String[] {"X"});
-        sProps.put(Constants.SERVICE_ID, 17L);
-
-        aProps.put("AAA", "achanged");
-        aProps.put("CCC", "CVAL");
-        aProps.put(Constants.OBJECTCLASS, new String[] {"Y"});
-        aProps.put(Constants.SERVICE_ID.toUpperCase(), 51L);
-
-        Map<String, Object> aPropsOrg = new HashMap<String, Object>(aProps);
-        OsgiUtils.overlayProperties(sProps, aProps);
-        assertEquals("The additional properties should not be modified", aPropsOrg, aProps);
-
-        assertEquals(5, sProps.size());
-        assertEquals("achanged", sProps.get("aaa"));
-        assertEquals("bval", sProps.get("bbb"));
-        assertEquals("CVAL", sProps.get("CCC"));
-        assertTrue("Should not be possible to override the objectClass property",
-                Arrays.equals(new String[] {"X"}, (Object[]) sProps.get(Constants.OBJECTCLASS)));
-        assertEquals("Should not be possible to override the service.id property",
-                17L, sProps.get(Constants.SERVICE_ID));
-    }
-
     private static class MyExportedPackage implements ExportedPackage {
 
         Package package1;


Mime
View raw message