Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 65770 invoked from network); 13 Jan 2010 13:29:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Jan 2010 13:29:01 -0000 Received: (qmail 39216 invoked by uid 500); 13 Jan 2010 13:29:01 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 39118 invoked by uid 500); 13 Jan 2010 13:29:01 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 39105 invoked by uid 99); 13 Jan 2010 13:29:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jan 2010 13:29:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jan 2010 13:28:59 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id C69502388A40; Wed, 13 Jan 2010 13:28:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@cxf.apache.org From: davidb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100113132839.C69502388A40@eris.apache.org> 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 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 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 properties; private final List 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 null. */ - 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 props; if ((localFrameworkUUID != null) - && localFrameworkUUID.equals(endpoint.getRemoteFrameworkUUID())) { + && localFrameworkUUID.equals(endpoint.getFrameworkUUID())) { props = new TreeMap(String.CASE_INSENSITIVE_ORDER); props.putAll(endpoint.getProperties()); props.put(ENDPOINT_FRAMEWORK_UUID, new String[] { - endpoint.getRemoteFrameworkUUID(), "<>"}); + endpoint.getFrameworkUUID(), "<>"}); } 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 properties are case sensitive. A value in * the properties must therefore override any case variant in @@ -67,11 +65,8 @@ * insensitive). This parameter can be null, 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 null 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. * *

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 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(); + } } } }