Author: ffang
Date: Mon Jun 29 14:04:00 2009
New Revision: 789332

URL: http://svn.apache.org/viewvc?rev=789332&view=rev
Log:
[SMX4-310]JAX-WS consumer can not access the JAX-WS service deployed into the 
nmr

Added:
    
servicemix/smx4/features/trunk/examples/itests/tests/src/test/java/org/apache/servicemix/examples/CXFNMRIntegrationTest.java
Modified:
    
servicemix/smx4/features/trunk/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java
    
servicemix/smx4/features/trunk/examples/itests/cxf-nmr-osgi/src/main/resources/META-INF/spring/beans.xml

Modified: 
servicemix/smx4/features/trunk/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java?rev=789332&r1=789331&r2=789332&view=diff
==============================================================================
--- 
servicemix/smx4/features/trunk/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java
 (original)
+++ 
servicemix/smx4/features/trunk/cxf/cxf-transport-nmr/src/main/java/org/apache/servicemix/cxf/transport/nmr/NMRDestination.java
 Mon Jun 29 14:04:00 2009
@@ -64,8 +64,8 @@
             this.properties.put(Endpoint.NAME, info.getName().toString());
         }
         
-        this.properties.put(Endpoint.SERVICE_NAME, 
info.getService().getName().toString());
-        this.properties.put(Endpoint.INTERFACE_NAME, 
info.getInterface().getName().toString());
+        this.properties.put(Endpoint.SERVICE_NAME, 
info.getService().getName());
+        this.properties.put(Endpoint.INTERFACE_NAME, 
info.getInterface().getName());
     }
 
     public void setChannel(Channel dc) {

Modified: 
servicemix/smx4/features/trunk/examples/itests/cxf-nmr-osgi/src/main/resources/META-INF/spring/beans.xml
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/itests/cxf-nmr-osgi/src/main/resources/META-INF/spring/beans.xml?rev=789332&r1=789331&r2=789332&view=diff
==============================================================================
--- 
servicemix/smx4/features/trunk/examples/itests/cxf-nmr-osgi/src/main/resources/META-INF/spring/beans.xml
 (original)
+++ 
servicemix/smx4/features/trunk/examples/itests/cxf-nmr-osgi/src/main/resources/META-INF/spring/beans.xml
 Mon Jun 29 14:04:00 2009
@@ -33,10 +33,10 @@
 
        <jaxws:endpoint id="NMREndpoint"
            implementor="org.apache.servicemix.examples.cxf.HelloWorldImpl"
-           wsdlLocation="wsdl/hello_world.wsdl"
-           endpointName="e:HelloWorldImplPort"
+            endpointName="e:HelloWorldImplPort"
            serviceName="s:HelloWorldImplService"
            xmlns:e="http://cxf.examples.servicemix.apache.org/";
+            address="nmr:HelloWorld"
         xmlns:s="http://cxf.examples.servicemix.apache.org/";>
             <jaxws:features>
                 <bean class="org.apache.cxf.feature.LoggingFeature"/>
@@ -46,11 +46,11 @@
 
     <jaxws:client id="client" 
        serviceClass="org.apache.servicemix.examples.cxf.HelloWorld"    
-           endpointName="e:HelloWorldImplPort"
-           serviceName="s:HelloWorldImplService"
            xmlns:e="http://cxf.examples.servicemix.apache.org/";
         xmlns:s="http://cxf.examples.servicemix.apache.org/";
-       wsdlLocation="wsdl/hello_world.wsdl"
+        endpointName="e:HelloWorldImplPort"     
+            serviceName="s:HelloWorldImplService"
+        address="nmr:HelloWorld"
        >   
         <jaxws:features>
            <bean class="org.apache.cxf.feature.LoggingFeature"/>

Added: 
servicemix/smx4/features/trunk/examples/itests/tests/src/test/java/org/apache/servicemix/examples/CXFNMRIntegrationTest.java
URL: 
http://svn.apache.org/viewvc/servicemix/smx4/features/trunk/examples/itests/tests/src/test/java/org/apache/servicemix/examples/CXFNMRIntegrationTest.java?rev=789332&view=auto
==============================================================================
--- 
servicemix/smx4/features/trunk/examples/itests/tests/src/test/java/org/apache/servicemix/examples/CXFNMRIntegrationTest.java
 (added)
+++ 
servicemix/smx4/features/trunk/examples/itests/tests/src/test/java/org/apache/servicemix/examples/CXFNMRIntegrationTest.java
 Mon Jun 29 14:04:00 2009
@@ -0,0 +1,168 @@
+/*
+ * 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.servicemix.examples;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.util.jar.Manifest;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.List;
+
+import javax.xml.transform.Source;
+
+import org.apache.cxf.Bus;
+import org.apache.servicemix.examples.cxf.HelloWorld;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.kernel.testing.support.AbstractIntegrationTest;
+import org.apache.servicemix.nmr.api.Channel;
+import org.apache.servicemix.nmr.api.Endpoint;
+import org.apache.servicemix.nmr.api.Exchange;
+import org.apache.servicemix.nmr.api.NMR;
+import org.apache.servicemix.nmr.api.Pattern;
+import org.apache.servicemix.nmr.api.Status;
+import org.springframework.osgi.test.platform.OsgiPlatform;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+public class CXFNMRIntegrationTest extends AbstractIntegrationTest {
+
+    private Properties dependencies;
+
+    /**
+        * The manifest to use for the "virtual bundle" created
+        * out of the test classes and resources in this project
+        *
+        * This is actually the boilerplate manifest with one additional
+        * import-package added. We should provide a simpler customization
+        * point for such use cases that doesn't require duplication
+        * of the entire manifest...
+        */
+       protected String getManifestLocation() {
+               return "classpath:org/apache/servicemix/MANIFEST.MF";
+       }
+
+    /**
+        * The location of the packaged OSGi bundles to be installed
+        * for this test. Values are Spring resource paths. The bundles
+        * we want to use are part of the same multi-project maven
+        * build as this project is. Hence we use the localMavenArtifact
+        * helper method to find the bundles produced by the package
+        * phase of the maven build (these tests will run after the
+        * packaging phase, in the integration-test phase).
+        *
+        * JUnit, commons-logging, spring-core and the spring OSGi
+        * test bundle are automatically included so do not need
+        * to be specified here.
+        */
+       protected String[] getTestBundlesNames() {
+        return new String[] {
+            getBundle("org.apache.felix", "org.apache.felix.prefs"),
+            getBundle("org.apache.servicemix.specs", 
"org.apache.servicemix.specs.activation-api-1.1"),
+            getBundle("org.apache.geronimo.specs", 
"geronimo-annotation_1.0_spec"),
+            getBundle("org.apache.servicemix.specs", 
"org.apache.servicemix.specs.javamail-api-1.4"),
+            getBundle("org.apache.geronimo.specs", 
"geronimo-servlet_2.5_spec"),
+            getBundle("org.apache.geronimo.specs", 
"geronimo-ws-metadata_2.0_spec"),
+            getBundle("org.apache.geronimo.specs", 
"geronimo-j2ee-connector_1.5_spec"),
+            getBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec"),
+                       
+         
+            getBundle("org.apache.servicemix.specs", 
"org.apache.servicemix.specs.jbi-api-1.0"),            
+            getBundle("org.apache.servicemix.specs", 
"org.apache.servicemix.specs.stax-api-1.0"),
+            getBundle("org.apache.servicemix.specs", 
"org.apache.servicemix.specs.saaj-api-1.3"),
+            getBundle("org.apache.servicemix.specs", 
"org.apache.servicemix.specs.jaxb-api-2.1"),
+            getBundle("org.apache.servicemix.specs", 
"org.apache.servicemix.specs.jaxws-api-2.1"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.asm"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.cglib"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.jaxb-impl"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.neethi"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.saaj-impl"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.woodstox"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.wsdl4j"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.xmlschema"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.xmlsec"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.xmlresolver"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.jetty-bundle"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.commons-codec"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.abdera"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.jettison"),
+            getBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.xmlbeans"),
+            getBundle("org.apache.servicemix.specs", 
"org.apache.servicemix.specs.jsr311-api-1.0"),
+            getBundle("org.ops4j.pax.web", "pax-web-bundle"),
+            getBundle("org.ops4j.pax.web-extender", "pax-web-ex-whiteboard"),
+            getBundle("org.apache.servicemix", "servicemix-utils"),
+            getBundle("org.apache.cxf", "cxf-bundle"),
+           
+            getBundle("org.apache.servicemix.cxf", 
"org.apache.servicemix.cxf.transport.nmr"),
+            getBundle("org.apache.servicemix.nmr", 
"org.apache.servicemix.nmr.api"),
+            getBundle("org.apache.servicemix.nmr", 
"org.apache.servicemix.nmr.core"),
+            getBundle("org.apache.servicemix.nmr", 
"org.apache.servicemix.nmr.spring"),
+            getBundle("org.apache.servicemix.nmr", 
"org.apache.servicemix.nmr.osgi"),
+            getBundle("org.apache.servicemix.document", 
"org.apache.servicemix.document"),
+            getBundle("org.apache.servicemix.examples", 
"org.apache.servicemix.examples.itests.cxf-nmr-osgi"),
+        };
+       }
+
+    
+    
+    public void testNMROsgi() throws Exception {
+        Thread.sleep(5000);
+        
waitOnContextCreation("org.apache.servicemix.examples.itests.cxf-nmr-osgi");
+        Thread.sleep(5000);
+        NMR nmr = getOsgiService(NMR.class);
+        assertNotNull(nmr);
+        
+        
+        ServiceReference ref = 
bundleContext.getServiceReference(HelloWorld.class.getName());
+        assertNotNull("Service Reference is null", ref);
+        org.apache.servicemix.examples.cxf.HelloWorld helloWorld = null;
+
+        helloWorld = (org.apache.servicemix.examples.cxf.HelloWorld) 
bundleContext.getService(ref);
+        assertNotNull("Cannot find the service", helloWorld);
+
+        assertEquals("Hello Bonjour", helloWorld.sayHi("Bonjour"));
+ 
+    
+    }
+
+    protected Manifest getManifest() {
+        Manifest mf = super.getManifest();
+        String importP = 
mf.getMainAttributes().getValue(Constants.IMPORT_PACKAGE);
+        mf.getMainAttributes().putValue(Constants.IMPORT_PACKAGE,
+            importP + ",META-INF.cxf, org.apache.servicemix.jbi.jaxp");
+        String exportP = 
mf.getMainAttributes().getValue(Constants.EXPORT_PACKAGE);
+        mf.getMainAttributes().putValue(Constants.EXPORT_PACKAGE,
+                                      exportP + ",org.apache.handlers, "
+                                      + "org.apache.springcfg.handlers, "
+                                      + 
"org.apache.handlers.types,org.apache.servicemix.examples.cxf,"
+                                      + 
"org.apache.servicemix.examples.cxf.soaphandler,"
+                                      + 
"org.apache.servicemix.examples.cxf.springcfghandler,"
+                                      + 
"org.apache.servicemix.examples.cxf.wsaddressing,"
+                                      + "org.apache.hello_world_soap_http,"
+                                      + "org.apache.cxf,"
+                                      + "org.apache.cxf.bus,"
+                                      + "org.apache.cxf.interceptor"
+                                      );
+        return mf;
+    }
+
+   
+}


Reply via email to