cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin" <sergey.beryoz...@iona.com>
Subject Re: Patch with fix for Distributed OSGi code in sandbox/dosgi
Date Wed, 10 Sep 2008 14:55:28 GMT
Hi David

This patch is in the sandbox now...

thanks, Sergey


----- Original Message ----- 
From: "David Bosschaert" <davidb@iona.com>
To: <dev@cxf.apache.org>
Sent: Wednesday, September 10, 2008 3:42 PM
Subject: Patch with fix for Distributed OSGi code in sandbox/dosgi


Hi all,

Attached is a fix for the D-OSGi sandbox project.
It fixes the case where service distribution is triggered purely from
OSGi Service Registration properties (not from the remote-services.xml
file), previously this would only work if a remote-services.xml file was
present on the server side.

A new unit test file is included (OsgiUtilsTest.java) that tests the change.
The patch also contains a new profile (dosgi_bundles.txt) that can be
run in Felix if you want to install all the necessary D-OSGi bundles,
but not the samples. The existing profiles always included the samples too.

I created the patch with Tortoise 1.5 so it also includes the new files.

Best regards,

David Bosschaert

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland



--------------------------------------------------------------------------------


> Index: dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java
> ===================================================================
> --- dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java (revision 693756)
> +++ dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/OsgiUtils.java (working copy)
> @@ -72,12 +72,12 @@
>         if (names == null || names.length == 0) {
>             return null;
>         }
> +
>         Map<String, Object> userProperties = new HashMap<String, Object>();
>         for (String key : sref.getPropertyKeys()) {
>             // we're after remote properties only
> -            Object property = sref.getProperty(key);
> -            if (property.toString().startsWith(Constants.REMOTE_PROPERTY_PREFIX)) {
> -                userProperties.put(key, property);
> +            if (key.startsWith(Constants.REMOTE_PROPERTY_PREFIX)) {
> +                userProperties.put(key, sref.getProperty(key));
>             }
>         }
>         List<ServiceDescription> srefs = getRemoteReferences(sref.getBundle(),
> Index: dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java
> ===================================================================
> --- dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java (revision 0)
> +++ dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/OsgiUtilsTest.java (revision 0)
> @@ -0,0 +1,42 @@
> +package org.apache.cxf.dosgi.dsw;
> +
> +import java.util.HashMap;
> +import java.util.Map;
> +
> +import junit.framework.TestCase;
> +
> +import org.easymock.EasyMock;
> +import org.easymock.IAnswer;
> +import org.osgi.framework.Bundle;
> +import org.osgi.framework.ServiceReference;
> +import org.osgi.service.discovery.ServiceDescription;
> +
> +public class OsgiUtilsTest extends TestCase {
> +    public void testGetRemoteReferencesFromRegistrationProperties() {
> +        final Map<String, Object> props = new HashMap<String, Object>();
> +        props.put(org.osgi.framework.Constants.OBJECTCLASS, new String [] {"myClass"});
> +        props.put(Constants.PUBLISH_PROPERTY, "*");
> +
> +        Bundle b = EasyMock.createNiceMock(Bundle.class);
> +        EasyMock.replay(b);
> +
> +        ServiceReference sr = EasyMock.createMock(ServiceReference.class);
> +        // set behaviour for getPropertyKeys() and getProperty() based on the map above.
> +        EasyMock.expect(sr.getPropertyKeys()).
> +            andReturn(props.keySet().toArray(new String [] {})).anyTimes();
> +        EasyMock.expect(sr.getProperty((String) EasyMock.anyObject())).
> +            andAnswer(new IAnswer<Object>() {
> +                public Object answer() throws Throwable {
> +                    return props.get(EasyMock.getCurrentArguments()[0]);
> +                }
> +            }).anyTimes();
> +        EasyMock.expect(sr.getBundle()).andReturn(b).anyTimes();
> +        EasyMock.replay(sr);
> +
> +        // Actual test starts here
> +        ServiceDescription sd = OsgiUtils.getRemoteReference(sr, true);
> +        assertEquals("*", sd.getProperties().get(Constants.PUBLISH_PROPERTY));
> +
> +        EasyMock.verify(sr);
> +    }
> +}
>
> Property changes on: dsw\cxf-dsw\src\test\java\org\apache\cxf\dosgi\dsw\OsgiUtilsTest.java
> ___________________________________________________________________
> Added: svn:keywords
>   + Rev Date
> Added: svn:eol-style
>   + native
>
> Index: felix/profiles/src/main/resources/dosgi_bundles.txt
> ===================================================================
> --- felix/profiles/src/main/resources/dosgi_bundles.txt (revision 0)
> +++ felix/profiles/src/main/resources/dosgi_bundles.txt (revision 0)
> @@ -0,0 +1,64 @@
> +start 
> file:${maven.repo.local}/org/apache/geronimo/specs/geronimo-annotation_1.0_spec/1.1.1/geronimo-annotation_1.0_spec-1.1.1.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/geronimo/specs/geronimo-activation_1.1_spec/1.0.2/geronimo-activation_1.1_spec-1.0.2.jar
> +
> +start file:${maven.repo.local}/org/apache/geronimo/specs/geronimo-javamail_1.4_spec/1.2/geronimo-javamail_1.4_spec-1.2.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/geronimo/specs/geronimo-ws-metadata_2.0_spec/1.1.2/geronimo-ws-metadata_2.0_spec-1.1.2.jar
> +
> +start file:${maven.repo.local}/org/apache/geronimo/specs/geronimo-servlet_2.5_spec/1.1.2/geronimo-servlet_2.5_spec-1.1.2.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/commons/com.springsource.org.apache.commons.logging/1.1.1/com.springsource.org.apache.commons.logging-1.1.1.jar
> +
> +start file:${maven.repo.local}/org/jdom/com.springsource.org.jdom/1.0.0/com.springsource.org.jdom-1.0.0.jar
> +
> +start file:${maven.repo.local}/org/springframework/spring-core/${spring.version}/spring-core-${spring.version}.jar
> +
> +start file:${maven.repo.local}/org/springframework/spring-beans/${spring.version}/spring-beans-${spring.version}.jar
> +
> +start file:${maven.repo.local}/org/springframework/spring-context/${spring.version}/spring-context-${spring.version}.jar
> +
> +start file:${maven.repo.local}/org/aopalliance/com.springsource.org.aopalliance/1.0.0/com.springsource.org.aopalliance-1.0.0.jar
> +
> +start file:${maven.repo.local}/org/springframework/spring-aop/${spring.version}/spring-aop-${spring.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/springframework/osgi/spring-osgi-io/${spring.osgi.version}/spring-osgi-io-${spring.osgi.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/springframework/osgi/spring-osgi-core/${spring.osgi.version}/spring-osgi-core-${spring.osgi.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/springframework/osgi/spring-osgi-extender/${spring.osgi.version}/spring-osgi-extender-${spring.osgi.version}.jar
> +
> +start file:${maven.repo.local}/org/mortbay/jetty/jetty-util/${jetty.version}/jetty-util-${jetty.version}.jar
> +
> +start file:${maven.repo.local}/org/mortbay/jetty/jetty/${jetty.version}/jetty-${jetty.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/servicemix/specs/org.apache.servicemix.specs.locator/${servicemix.specs.version}/org.apache.servicemix.specs.locator-${servicemix.specs.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/servicemix/specs/org.apache.servicemix.specs.saaj-api-1.3/${servicemix.specs.version}/org.apache.servicemix.specs.saaj-api-1.3-${servicemix.specs.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/servicemix/specs/org.apache.servicemix.specs.stax-api-1.0/${servicemix.specs.version}/org.apache.servicemix.specs.stax-api-1.0-${servicemix.specs.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/servicemix/specs/org.apache.servicemix.specs.jaxb-api-2.0/${servicemix.specs.version}/org.apache.servicemix.specs.jaxb-api-2.0-${servicemix.specs.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/servicemix/specs/org.apache.servicemix.specs.jaxws-api-2.0/${servicemix.specs.version}/org.apache.servicemix.specs.jaxws-api-2.0-${servicemix.specs.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/servicemix/bundles/org.apache.servicemix.bundles.jaxb-impl-2.0.3/${servicemix.feature.version}/org.apache.servicemix.bundles.jaxb-impl-2.0.3-${servicemix.feature.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/servicemix/bundles/org.apache.servicemix.bundles.wsdl4j-1.6.1/${servicemix.feature.version}/org.apache.servicemix.bundles.wsdl4j-1.6.1-${servicemix.feature.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/servicemix/bundles/org.apache.servicemix.bundles.xmlschema-1.3.2/${servicemix.feature.version}/org.apache.servicemix.bundles.xmlschema-1.3.2-${servicemix.feature.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/servicemix/bundles/org.apache.servicemix.bundles.asm-2.2.3/${servicemix.kernel.version}/org.apache.servicemix.bundles.asm-2.2.3-${servicemix.kernel.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/servicemix/bundles/org.apache.servicemix.bundles.xmlresolver-1.2/${servicemix.feature.version}/org.apache.servicemix.bundles.xmlresolver-1.2-${servicemix.feature.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/servicemix/bundles/org.apache.servicemix.bundles.neethi-2.0.2/${servicemix.feature.version}/org.apache.servicemix.bundles.neethi-2.0.2-${servicemix.feature.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/servicemix/bundles/org.apache.servicemix.bundles.woodstox/${woodstox.bundle.version}/org.apache.servicemix.bundles.woodstox-${woodstox.bundle.version}.jar
> +
> +start file:${maven.repo.local}/org/apache/cxf/cxf-bundle-minimal/${cxf.version}/cxf-bundle-minimal-${cxf.version}.jar
> +
> +start 
> file:${maven.repo.local}/org/apache/cxf/cxf-dosgi-ri-discovery-local/${project.version}/cxf-dosgi-ri-discovery-local-${project.version}.jar
> +
> +start file:${maven.repo.local}/org/apache/cxf/cxf-dosgi-ri-dsw-cxf/${project.version}/cxf-dosgi-ri-dsw-cxf-${project.version}.jar
> +
>
> Property changes on: felix\profiles\src\main\resources\dosgi_bundles.txt
> ___________________________________________________________________
> Added: svn:mime-type
>   + text/plain
> Added: svn:eol-style
>   + native
>
> 

----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Mime
View raw message