cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r898744 [3/3] - in /cxf/dosgi/trunk: discovery/distributed/cxf-discovery/src/main/java/org/apache/cxf/dosgi/discovery/zookeeper/ discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/ dsw/cxf-dsw/ dsw/cxf-dsw/src/main/java/org/...
Date Wed, 13 Jan 2010 13:28:39 GMT
Modified: cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
Wed Jan 13 13:28:38 2010
@@ -18,8 +18,11 @@
   */
 package org.apache.cxf.dosgi.dsw.service;
 
+import java.util.Dictionary;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 
 import org.apache.cxf.dosgi.dsw.handlers.ConfigurationTypeHandler;
 import org.easymock.IMocksControl;
@@ -33,7 +36,11 @@
 import org.osgi.service.remoteserviceadmin.RemoteConstants;
 
 import org.junit.Test;
-import static org.junit.Assert.*;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 public class RemoteServiceAdminCoreTest {
 
@@ -44,8 +51,12 @@
         Bundle b = c.createMock(Bundle.class);
         BundleContext bc = c.createMock(BundleContext.class);
         
+        
         EasyMock.expect(bc.getBundle()).andReturn(b).anyTimes();
         
+        Dictionary d = new Properties();
+        EasyMock.expect(b.getHeaders()).andReturn(d).anyTimes();
+        
         ServiceReference sref = c.createMock(ServiceReference.class);
         EasyMock.expect(sref.getBundle()).andReturn(b).anyTimes();
         
@@ -74,6 +85,9 @@
         Bundle b = c.createMock(Bundle.class);
         BundleContext bc = c.createMock(BundleContext.class);
         
+        Dictionary d = new Properties();
+        EasyMock.expect(b.getHeaders()).andReturn(d).anyTimes();
+        
         EasyMock.expect(bc.getBundle()).andReturn(b).anyTimes();
         EasyMock.expect(b.getSymbolicName()).andReturn("BundleName").anyTimes();
         
@@ -138,4 +152,58 @@
         
         
     }
+    
+    @Test
+    public void testDefaultConfigurationType(){
+        
+        IMocksControl c = EasyMock.createNiceControl();
+        Bundle b = c.createMock(Bundle.class);
+        BundleContext bc = c.createMock(BundleContext.class);
+        
+        c.replay();
+        
+        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc);
+        
+        Properties serviceProperties = new Properties();
+        
+        List<String> types  = rsaCore.determineConfigurationTypes(serviceProperties);
+        
+        c.verify();
+        
+        assertNotNull(types);
+        assertEquals(types.size(),rsaCore.supportedConfigurationTypes.size());
+        
+        for (String type : types) {
+            assertTrue(rsaCore.supportedConfigurationTypes.contains(type));
+        }
+    }
+    
+    
+    @Test
+    public void testSpecificConfigurationType(){
+        
+        IMocksControl c = EasyMock.createNiceControl();
+        Bundle b = c.createMock(Bundle.class);
+        BundleContext bc = c.createMock(BundleContext.class);
+        
+        c.replay();
+        
+        RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc);
+        
+        
+        
+        Properties serviceProperties = new Properties();
+        
+        serviceProperties.setProperty(RemoteConstants.SERVICE_EXPORTED_CONFIGS, org.apache.cxf.dosgi.dsw.Constants.WS_CONFIG_TYPE);
+        
+        List<String> types  = rsaCore.determineConfigurationTypes(serviceProperties);
+        
+        c.verify();
+        
+        assertNotNull(types);
+        assertEquals(1,types.size());
+        
+        assertTrue(types.contains(org.apache.cxf.dosgi.dsw.Constants.WS_CONFIG_TYPE));
+    }
+    
 }

Modified: cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointDescription.java
Wed Jan 13 13:28:38 2010
@@ -65,9 +65,9 @@
 public class EndpointDescription {
 	private final Map<String, Object>	properties;
 	private final List<String>			interfaces;
-	private final long					remoteServiceID;
-	private final String				remoteFrameworkUUID;
-	private final String				remoteID;
+	private final long					serviceId;
+	private final String				frameworkUUID;
+	private final String				id;
 
 	/**
 	 * Create an Endpoint Description from a Map.
@@ -110,10 +110,10 @@
 		this.properties = Collections.unmodifiableMap(props);
 		/* properties must be initialized before calling the following methods */
 		interfaces = verifyObjectClassProperty();
-		remoteServiceID = verifyLongProperty(ENDPOINT_SERVICE_ID);
-		remoteFrameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
-		remoteID = verifyStringProperty(ENDPOINT_ID);
-		if (remoteID == null) {
+		serviceId = verifyLongProperty(ENDPOINT_SERVICE_ID);
+		frameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
+		id = verifyStringProperty(ENDPOINT_ID);
+		if (id == null) {
 			throw new IllegalArgumentException(ENDPOINT_ID
 					+ " property must be set");
 		}
@@ -204,10 +204,10 @@
 		this.properties = Collections.unmodifiableMap(props);
 		/* properties must be initialized before calling the following methods */
 		interfaces = verifyObjectClassProperty();
-		remoteServiceID = verifyLongProperty(ENDPOINT_SERVICE_ID);
-		remoteFrameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
-		remoteID = verifyStringProperty(ENDPOINT_ID);
-		if (remoteID == null) {
+		serviceId = verifyLongProperty(ENDPOINT_SERVICE_ID);
+		frameworkUUID = verifyStringProperty(ENDPOINT_FRAMEWORK_UUID);
+		id = verifyStringProperty(ENDPOINT_ID);
+		if (id == null) {
 			throw new IllegalArgumentException(ENDPOINT_ID
 					+ " property must be set");
 		}
@@ -312,8 +312,8 @@
 	 * 
 	 * @return The id of the endpoint, never <code>null</code>.
 	 */
-	public String getRemoteID() {
-		return remoteID;
+	public String getId() {
+		return id;
 	}
 
 	/**
@@ -382,8 +382,8 @@
 	 *         not relate to an OSGi service.
 	 * 
 	 */
-	public long getRemoteServiceID() {
-		return remoteServiceID;
+	public long getServiceId() {
+		return serviceId;
 	}
 
 	/**
@@ -477,8 +477,8 @@
 	 * @return Remote Framework UUID, or null if this endpoint is not associated
 	 *         with an OSGi framework having a framework uuid.
 	 */
-	public String getRemoteFrameworkUUID() {
-		return remoteFrameworkUUID;
+	public String getFrameworkUUID() {
+		return frameworkUUID;
 	}
 
 	/**
@@ -507,13 +507,13 @@
 			return true;
 		}
 
-		if (this.getRemoteFrameworkUUID() == null) {
+		if (this.getFrameworkUUID() == null) {
 			return false;
 		}
 
-		return (this.getRemoteServiceID() == other.getRemoteServiceID())
-				&& this.getRemoteFrameworkUUID().equals(
-						other.getRemoteFrameworkUUID());
+		return (this.getServiceId() == other.getServiceId())
+				&& this.getFrameworkUUID().equals(
+						other.getFrameworkUUID());
 	}
 
 	/**
@@ -522,7 +522,7 @@
 	 * @return An integer which is a hash code value for this object.
 	 */
 	public int hashCode() {
-		return getRemoteID().hashCode();
+		return getId().hashCode();
 	}
 
 	/**
@@ -544,8 +544,8 @@
 		if (!(other instanceof EndpointDescription)) {
 			return false;
 		}
-		return getRemoteID().equals(
-				((EndpointDescription) other).getRemoteID());
+		return getId().equals(
+				((EndpointDescription) other).getId());
 	}
 
 	/**

Modified: cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/EndpointPermission.java
Wed Jan 13 13:28:38 2010
@@ -165,11 +165,11 @@
 		setTransients(null, parseActions(actions));
 		Map<String, Object> props;
 		if ((localFrameworkUUID != null)
-				&& localFrameworkUUID.equals(endpoint.getRemoteFrameworkUUID())) {
+				&& localFrameworkUUID.equals(endpoint.getFrameworkUUID())) {
 			props = new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
 			props.putAll(endpoint.getProperties());
 			props.put(ENDPOINT_FRAMEWORK_UUID, new String[] {
-					endpoint.getRemoteFrameworkUUID(), "<<LOCAL>>"});
+					endpoint.getFrameworkUUID(), "<<LOCAL>>"});
 		}
 		else {
 			props = endpoint.getProperties();
@@ -190,7 +190,7 @@
 			throw new IllegalArgumentException("invalid endpoint: null");
 		}
 		StringBuffer sb = new StringBuffer("(" + ENDPOINT_ID + "=");
-		sb.append(endpoint.getRemoteID());
+		sb.append(endpoint.getId());
 		sb.append(")");
 		return sb.toString();
 	}

Modified: cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdmin.java
Wed Jan 13 13:28:38 2010
@@ -43,8 +43,6 @@
 	 * exported because the endpoint could not be implemented by this Remote
 	 * Service Admin.
 	 * 
-	 * TODO Peter to update for case insensitive properties
-	 * 
 	 * The properties on a Service Reference are case insensitive while the
 	 * properties on a <code>properties</code> are case sensitive. A value in
 	 * the <code>properties</code> must therefore override any case variant in
@@ -67,11 +65,8 @@
 	 *        insensitive). This parameter can be <code>null</code>, this should
 	 *        be treated as an empty map.
 	 * 
-	 *        TODO Peter The return description does not mesh with returning a
-	 *        list! Why a list and not just one?
 	 * @return An Export Registration that combines the Endpoint Description and
-	 *         the Service Reference or <code>null</code> if the service could
-	 *         not be exported.
+	 *         the Service Reference.
 	 * @throws IllegalArgumentException If any of the properties has a value
 	 *         that is not syntactically correct or if the service properties
 	 *         and the overlaid properties do not contain a

Modified: cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-osgi-remote-service-admin-interfaces/src/main/java/org/osgi/service/remoteserviceadmin/RemoteServiceAdminListener.java
Wed Jan 13 13:28:38 2010
@@ -17,7 +17,7 @@
 package org.osgi.service.remoteserviceadmin;
 
 /**
- * A {@link RemoteServiceAdminEvent} listener is notified asynchronously of any
+ * A {@link RemoteServiceAdminEvent} listener is notified synchronously of any
  * export or import registrations and unregistrations.
  * 
  * <p>

Modified: cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/TopologyManagerImport.java
URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/TopologyManagerImport.java?rev=898744&r1=898743&r2=898744&view=diff
==============================================================================
--- cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/TopologyManagerImport.java
(original)
+++ cxf/dosgi/trunk/dsw/cxf-topology-manager/src/main/java/org/apache/cxf/dosgi/topologymanager/TopologyManagerImport.java
Wed Jan 13 13:28:38 2010
@@ -1,21 +1,21 @@
 /** 
-  * 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. 
-  */
+ * 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.topologymanager;
 
 import java.util.ArrayList;
@@ -49,9 +49,8 @@
 
     /**
      * If set to false only one service is imported for each import interest even it multiple
services are
-     * available. If set to true, all available services are imported.
-     * 
-     * TODO: Make this available as a configuration option
+     * available. If set to true, all available services are imported. TODO: Make this available
as a
+     * configuration option
      */
     private boolean importAllAvailable = true;
 
@@ -138,9 +137,11 @@
                     endpointListener.reduceScope(exFilter);
                     importInterests.remove(exFilter);
                     List<ImportRegistration> irs = importedServices.remove(exFilter);
-                    for (ImportRegistration ir : irs) {
-                        if (ir != null) {
-                            ir.close();
+                    if (irs != null) {
+                        for (ImportRegistration ir : irs) {
+                            if (ir != null) {
+                                ir.close();
+                            }
                         }
                     }
                 }



Mime
View raw message