servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r672120 - in /servicemix/components/bindings/servicemix-cxf-bc/trunk: ./ src/main/java/org/apache/servicemix/cxfbc/ src/test/java/org/apache/servicemix/cxfbc/ src/test/java/org/apache/servicemix/cxfbc/ws/rm/ src/test/resources/org/apache/se...
Date Fri, 27 Jun 2008 05:55:27 GMT
Author: ffang
Date: Thu Jun 26 22:55:26 2008
New Revision: 672120

URL: http://svn.apache.org/viewvc?rev=672120&view=rev
Log:
[SM-1424]several tests failed for cxf bc after the new components project introduced

Added:
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/ListServiceHandler.java
  (with props)
Modified:
    servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcComponentTest.java
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderConsumerTest.java
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBcRMSequenceTest.java
    servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/interceptors/quote.wsdl

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml?rev=672120&r1=672119&r2=672120&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml (original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/pom.xml Thu Jun 26 22:55:26 2008
@@ -46,16 +46,15 @@
   <properties>
     <previous.releases>3.1.2,3.2,3.2.1</previous.releases>
     <servicemix-version>3.2.1</servicemix-version>
-    <servicemix-shared-version>4.0-SNAPSHOT</servicemix-shared-version>
-
+    <servicemix-components-version>4.0-SNAPSHOT</servicemix-components-version>
     <cxf-version>2.1.1-SNAPSHOT</cxf-version>
     <jetty-version>6.1.6</jetty-version>
     <spring-version>2.0.6</spring-version>
     <derby-version>10.2.2.0</derby-version>
     <surefire.fork.mode>pertest</surefire.fork.mode>
     <jaxb.version>2.1</jaxb.version>
-    <jaxb.impl.version>2.1.4</jaxb.impl.version>
-    <jaxb.xjc.version>2.1.4</jaxb.xjc.version>
+    <jaxb.impl.version>2.1.6</jaxb.impl.version>
+    <jaxb.xjc.version>2.1.6</jaxb.xjc.version>
   </properties>
 
   <dependencies>
@@ -80,7 +79,7 @@
     <dependency>
       <groupId>org.apache.servicemix</groupId>
       <artifactId>servicemix-shared</artifactId>
-      <version>${servicemix-shared-version}</version>
+      <version>${servicemix-components-version}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.cxf</groupId>
@@ -179,7 +178,7 @@
     <dependency>
       <groupId>org.apache.servicemix</groupId>
       <artifactId>servicemix-cxf-se</artifactId>
-      <version>${servicemix-version}</version>
+      <version>${servicemix-components-version}</version>
       <scope>test</scope>
     </dependency>
 
@@ -372,6 +371,30 @@
         </exclusion>
       </exclusions>
     </dependency>
+    <dependency>
+        <groupId>commons-httpclient</groupId>
+        <artifactId>commons-httpclient</artifactId>
+        <scope>test</scope>
+        <version>3.0</version>
+        <exclusions>
+            <exclusion>
+                <groupId>commons-codec</groupId>
+                <artifactId>commons-codec</artifactId>
+            </exclusion>
+        </exclusions>
+    </dependency>
+    <dependency>
+        <groupId>commons-codec</groupId>
+        <artifactId>commons-codec</artifactId>
+        <scope>test</scope>
+        <exclusions>
+            <exclusion>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+            </exclusion>
+        </exclusions>
+        <version>1.3</version>
+    </dependency>
   </dependencies>
   
   <build>
@@ -403,6 +426,7 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
+          <forkMode>${surefire.fork.mode}</forkMode>
           <systemProperties>
             <property>
               <name>derby.system.home</name>

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=672120&r1=672119&r2=672120&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
(original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
Thu Jun 26 22:55:26 2008
@@ -61,6 +61,7 @@
 import org.apache.cxf.endpoint.EndpointImpl;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.endpoint.ServerImpl;
+import org.apache.cxf.endpoint.ServerRegistry;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.interceptor.AttachmentInInterceptor;
 import org.apache.cxf.interceptor.AttachmentOutInterceptor;
@@ -83,6 +84,8 @@
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.ChainInitiationObserver;
+import org.apache.cxf.transport.http_jetty.JettyHTTPDestination;
+import org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine;
 import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.rm.Servant;
 import org.apache.cxf.wsdl.WSDLManager;
@@ -96,6 +99,7 @@
 import org.apache.servicemix.cxfbc.interceptors.MtomCheckInterceptor;
 import org.apache.servicemix.jbi.jaxp.SourceTransformer;
 import org.apache.servicemix.soap.util.DomUtil;
+import org.mortbay.jetty.Handler;
 import org.springframework.core.io.Resource;
 
 
@@ -203,9 +207,24 @@
     @Override
     public void start() throws Exception {
         super.start();
+        registerListServiceHandler();
         server.start();
     }
 
+    private void registerListServiceHandler() {
+        if (server.getDestination() instanceof JettyHTTPDestination) {
+            JettyHTTPDestination jettyDest = (JettyHTTPDestination) server.getDestination();
+            JettyHTTPServerEngine jettyEng = (JettyHTTPServerEngine) jettyDest.getEngine();
+            List<Handler> handlers = jettyEng.getHandlers();
+            if (handlers == null) {
+                handlers = new ArrayList<Handler>();
+                jettyEng.setHandlers(handlers);
+            }
+            handlers.add(new ListServiceHandler(getBus().getExtension(ServerRegistry.class)));
+                
+        }
+    }
+
     @Override
     public void stop() throws Exception {
         server.stop();

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java?rev=672120&r1=672119&r2=672120&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
(original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/CxfBcProvider.java
Thu Jun 26 22:55:26 2008
@@ -70,6 +70,7 @@
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.Conduit;
@@ -373,6 +374,10 @@
                     }
                 }
                 serInfo.setProperty(WSDLServiceBuilder.WSDL_DEFINITION, null);
+                serInfo.getInterface().setProperty(WSDLServiceBuilder.WSDL_PORTTYPE, null);
+                for (OperationInfo opInfo : serInfo.getInterface().getOperations()) {
+                    opInfo.setProperty(WSDLServiceBuilder.WSDL_OPERATION, null);
+                }
                 description = WSDLFactory.newInstance().newWSDLWriter()
                         .getDocument(swBuilder.build());
 

Added: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/ListServiceHandler.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/ListServiceHandler.java?rev=672120&view=auto
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/ListServiceHandler.java
(added)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/ListServiceHandler.java
Thu Jun 26 22:55:26 2008
@@ -0,0 +1,101 @@
+/*
+ * 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.cxfbc;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.endpoint.ServerRegistry;
+import org.apache.cxf.transport.http_jetty.JettyHTTPDestination;
+import org.mortbay.jetty.HttpConnection;
+import org.mortbay.jetty.HttpMethods;
+import org.mortbay.jetty.MimeTypes;
+import org.mortbay.jetty.handler.AbstractHandler;
+import org.mortbay.util.ByteArrayISO8859Writer;
+import org.mortbay.util.StringUtil;
+
+public class ListServiceHandler extends AbstractHandler {
+
+
+    private ServerRegistry serverRegistry;
+    
+    public ListServiceHandler(ServerRegistry serRegistry) {
+        this.serverRegistry = serRegistry;
+    }
+    
+    public void handle(String target, HttpServletRequest request,
+            HttpServletResponse response, int dispatch) throws IOException,
+            ServletException {
+        if (response.isCommitted()
+                || HttpConnection.getCurrentConnection().getRequest()
+                        .isHandled()) {
+            return;
+        }
+
+        String method = request.getMethod();
+
+        if (!method.equals(HttpMethods.GET)
+                || !request.getRequestURI().equals("/")) {
+            return;
+        }
+
+        response.setStatus(404);
+        response.setContentType(MimeTypes.TEXT_HTML);
+
+        ByteArrayISO8859Writer writer = new ByteArrayISO8859Writer(1500);
+
+        String uri = request.getRequestURI();
+        uri = StringUtil.replace(uri, "<", "&lt;");
+        uri = StringUtil.replace(uri, ">", "&gt;");
+
+        writer.write("<HTML>\n<HEAD>\n<TITLE>Error 404 - Not Found");
+        writer.write("</TITLE>\n<BODY>\n<H2>Error 404 - Not Found.</H2>\n");
+        writer.write("No service matched or handled this request.<BR>");
+        writer.write("Known services on cxf bc component are: <ul>");
+
+        List<Server> servers = serverRegistry.getServers();
+        for (Iterator iter = servers.iterator(); iter.hasNext();) {
+            Server server = (Server) iter.next();
+            JettyHTTPDestination jhd = (JettyHTTPDestination)server.getDestination();
+            String address = jhd.getAddress().getAddress().getValue();
+            writer.write("<li><a href=\"");
+            writer.write(address);
+            writer.write("?wsdl\">");
+            writer.write(address);
+            writer.write("</a></li>\n");
+        }
+        
+        for (int i = 0; i < 10; i++) {
+            writer.write("\n<!-- Padding for IE                  -->");
+        }
+
+        writer.write("\n</BODY>\n</HTML>\n");
+        writer.flush();
+        response.setContentLength(writer.size());
+        OutputStream out = response.getOutputStream();
+        writer.writeTo(out);
+        out.close();
+    }
+
+}

Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/ListServiceHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/main/java/org/apache/servicemix/cxfbc/ListServiceHandler.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcComponentTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcComponentTest.java?rev=672120&r1=672119&r2=672120&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcComponentTest.java
(original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcComponentTest.java
Thu Jun 26 22:55:26 2008
@@ -27,6 +27,8 @@
 
 import junit.framework.TestCase;
 
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.frontend.ClientProxy;
@@ -99,6 +101,30 @@
 
         Thread.sleep(100);
     }
+    
+    public void testListService() throws Exception {
+        CxfBcComponent comp = new CxfBcComponent();
+        CxfBcConsumer ep = new CxfBcConsumer();
+        ep.setWsdl(new ClassPathResource("HelloWorld-DOC.wsdl"));
+        ep.setTargetService(new QName("urn:test", "target"));
+        comp.setEndpoints(new CxfBcEndpointType[] {ep});
+        jbi.activateComponent(comp, "servicemix-cxfbc");
+
+        MockServiceComponent echo = new MockServiceComponent();
+        echo.setService(new QName("urn:test", "target"));
+        echo.setEndpoint("endpoint");
+        echo.setResponseXml("<jbi:message xmlns:jbi='http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper'><jbi:part>"

+                + "<ns2:HelloResponse xmlns:ns2='uri:HelloWorld'><text>helloffang</text></ns2:HelloResponse></jbi:part></jbi:message>");
+        jbi.activateComponent(echo, "echo");
+        URL wsdl = getClass().getResource("/HelloWorld-DOC.wsdl");
+        assertNotNull(wsdl);
+        GetMethod getMethod = new GetMethod("http://localhost:8080");
+        HttpClient httpClient = new HttpClient();
+        httpClient.executeMethod(getMethod);
+        String response = getMethod.getResponseBodyAsString();
+        assertTrue(response.indexOf("Known services on cxf bc component are:") >= 0);
+        assertTrue(response.indexOf("http://localhost:8080/hello") >= 0);
+    }
 
     public void testEndpointDOCWithExternalConsumer() throws Exception {
         CxfBcComponent comp = new CxfBcComponent();

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderConsumerTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderConsumerTest.java?rev=672120&r1=672119&r2=672120&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderConsumerTest.java
(original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcProviderConsumerTest.java
Thu Jun 26 22:55:26 2008
@@ -66,8 +66,6 @@
 
     }
 
-    
-    
     @Override
     protected AbstractXmlApplicationContext createBeanFactory() {
         return new ClassPathXmlApplicationContext(

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBcRMSequenceTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBcRMSequenceTest.java?rev=672120&r1=672119&r2=672120&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBcRMSequenceTest.java
(original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/ws/rm/CxfBcRMSequenceTest.java
Thu Jun 26 22:55:26 2008
@@ -73,7 +73,7 @@
     private static final QName GREETER_SERVICE = new QName("http://cxf.apache.org/greeter_control",
"GreeterService");
 
 
-    private static int decoupledEndpointPort = 10000;
+    private static int decoupledEndpointPort = 11000;
     private static String decoupledEndpoint;
 
 

Modified: servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/interceptors/quote.wsdl
URL: http://svn.apache.org/viewvc/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/interceptors/quote.wsdl?rev=672120&r1=672119&r2=672120&view=diff
==============================================================================
--- servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/interceptors/quote.wsdl
(original)
+++ servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/interceptors/quote.wsdl
Thu Jun 26 22:55:26 2008
@@ -1,4 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  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.
+
+-->
+
 <wsdl:definitions name="java_first"
 	targetNamespace="http://servicemix.apache.org/cxfbc/interceptors" 
 	          xmlns:tns="http://servicemix.apache.org/cxfbc/interceptors" 



Mime
View raw message