cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r598106 - in /incubator/cxf/trunk/rt/javascript/src: main/java/org/apache/cxf/javascript/ main/java/org/apache/cxf/javascript/service/ main/resources/META-INF/cxf/ test/java/org/apache/cxf/javascript/ test/java/org/apache/cxf/javascript/for...
Date Mon, 26 Nov 2007 01:55:12 GMT
Author: bimargulies
Date: Sun Nov 25 17:55:11 2007
New Revision: 598106

URL: http://svn.apache.org/viewvc?rev=598106&view=rev
Log:
Get the query handler working.

Added:
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/QueryHandlerTest.java
    incubator/cxf/trunk/rt/javascript/src/test/resources/HelloWorldDocLitBeans.xml
Modified:
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandlerRegistry.java
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/Messages.properties
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
    incubator/cxf/trunk/rt/javascript/src/main/resources/META-INF/cxf/cxf-extension-javascript-client.xml
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandlerRegistry.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandlerRegistry.java?rev=598106&r1=598105&r2=598106&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandlerRegistry.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptQueryHandlerRegistry.java
Sun Nov 25 17:55:11 2007
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.javascript;
 
-import javax.annotation.PostConstruct;
 import org.apache.cxf.Bus;
 import org.apache.cxf.transports.http.QueryHandlerRegistry;
 
@@ -32,12 +31,12 @@
     
     public JavascriptQueryHandlerRegistry() {
     }
+    
     public JavascriptQueryHandlerRegistry(Bus b) {
         bus = b;
     }
     
     
-    @PostConstruct
     public void register() {
         if (bus != null) {
             QueryHandlerRegistry registry = bus.getExtension(QueryHandlerRegistry.class);

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/Messages.properties?rev=598106&r1=598105&r2=598106&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/Messages.properties
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/Messages.properties
Sun Nov 25 17:55:11 2007
@@ -22,4 +22,5 @@
 MULTIPLE_OUTPUTS=Operation {0} has more than one output part.
 RPC= Service {0} calls for unsupported RPC binding style.
 XML_BINDING= Service {0} calls for unsupported XML binding.
-MISSING_PART_ELEMENT= Part {0} lacks an element in the XML Schema.
\ No newline at end of file
+MISSING_PART_ELEMENT= Part {0} lacks an element in the XML Schema.
+MISSING_SERVICE_SCHEMA= Target namespace {0} specified for service {1} is not defined in
the service model.
\ No newline at end of file

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java?rev=598106&r1=598105&r2=598106&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java
Sun Nov 25 17:55:11 2007
@@ -30,6 +30,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.binding.soap.SoapBindingConstants;
+import org.apache.cxf.binding.soap.SoapBindingFactory;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.model.SoapBindingInfo;
 import org.apache.cxf.common.i18n.Message;
@@ -144,6 +145,11 @@
         code.append("}\n\n");
 
         serviceSchemaInfo = serviceInfo.getSchema(serviceInfo.getTargetNamespace());
+        if (serviceSchemaInfo == null) {
+            unsupportedConstruct("MISSING_SERVICE_SCHEMA",
+                                 serviceInfo.getTargetNamespace(),
+                                 serviceInfo.getName().toString());
+        }
     }
 
     private static class ElementAndNames {
@@ -580,8 +586,12 @@
         // hypothetically, we could generate two different JavaScript classes,
         // one for each.
         for (BindingInfo bindingInfo : service.getBindings()) {
+            // there is a JIRA about the confusion / profusion of URLS here.
             if (SoapBindingConstants.SOAP11_BINDING_ID.equals(bindingInfo.getBindingId())
-                || SoapBindingConstants.SOAP11_BINDING_ID.equals(bindingInfo.getBindingId()))
{
+                || SoapBindingConstants.SOAP12_BINDING_ID.equals(bindingInfo.getBindingId())
+                || SoapBindingFactory.SOAP_11_BINDING.equals(bindingInfo.getBindingId())
+                || SoapBindingFactory.SOAP_12_BINDING.equals(bindingInfo.getBindingId())
+                ) {
                 SoapBindingInfo sbi = (SoapBindingInfo)bindingInfo;
                 if (WSDLConstants.NS_SOAP11_HTTP_TRANSPORT.equals(sbi.getTransportURI())
                     || WSDLConstants.NS_SOAP12_HTTP_TRANSPORT.equals(sbi.getTransportURI())

Modified: incubator/cxf/trunk/rt/javascript/src/main/resources/META-INF/cxf/cxf-extension-javascript-client.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/resources/META-INF/cxf/cxf-extension-javascript-client.xml?rev=598106&r1=598105&r2=598106&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/resources/META-INF/cxf/cxf-extension-javascript-client.xml
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/resources/META-INF/cxf/cxf-extension-javascript-client.xml
Sun Nov 25 17:55:11 2007
@@ -22,9 +22,10 @@
        xsi:schemaLocation="
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
     
-    <bean class="org.apache.cxf.javascript.http.QueryHandlerRegistry"
-    	id="org.apache.cxf.javascript.http.QueryHandlerRegistry" 
-    	lazy-init="true">
+    <bean class="org.apache.cxf.javascript.JavascriptQueryHandlerRegistry"
+    	id="org.apache.cxf.javascript.JavascriptQueryHandlerRegistry" 
+    	init-method="register"
+    	>
         <constructor-arg ref="cxf"/>
     </bean>
 </beans>

Added: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/QueryHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/QueryHandlerTest.java?rev=598106&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/QueryHandlerTest.java
(added)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/QueryHandlerTest.java
Sun Nov 25 17:55:11 2007
@@ -0,0 +1,112 @@
+/**
+ * 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.javascript;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.nio.charset.Charset;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.test.AbstractCXFSpringTest;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.GenericApplicationContext;
+
+/**
+ * 
+ */
+public class QueryHandlerTest extends AbstractCXFSpringTest {
+    private static final Charset UTF8 = Charset.forName("utf-8");
+    private static final Logger LOG = LogUtils.getL7dLogger(QueryHandlerTest.class);
+    private EndpointImpl hwEndpoint;
+    private EndpointImpl dlbEndpoint;
+
+    public QueryHandlerTest() throws Exception {
+        super();
+    }
+
+    /** {@inheritDoc}*/
+    @Override
+    protected void additionalSpringConfiguration(GenericApplicationContext context) throws
Exception {
+        // we don't need any.
+    }
+
+    /** {@inheritDoc}*/
+    @Override
+    protected String[] getConfigLocations() {
+        return new String[] {"classpath:HelloWorldDocLitBeans.xml",
+                             "classpath:DocLitBareClientTestBeans.xml"};
+
+    }
+    
+    @Before
+    public void before() {
+        hwEndpoint = getBean(EndpointImpl.class, "hw-service-endpoint");
+        dlbEndpoint = getBean(EndpointImpl.class, "dlb-service-endpoint");
+
+    }
+    
+    // This service runs into yet another RFSB/JAXB bug.
+    @org.junit.Ignore
+    @Test
+    public void hwQueryTest() throws Exception {
+        URL endpointURL = new URL(hwEndpoint.getAddress()  + "?js");
+        InputStream jsStream = endpointURL.openStream();
+        InputStreamReader isr = new InputStreamReader(jsStream, UTF8);
+        BufferedReader in = new BufferedReader(isr);
+        String line = in.readLine();
+        StringBuilder js = new StringBuilder();
+        while (line != null) {
+            String[] tok = line.split("\\s");
+
+            for (int x = 0; x < tok.length; x++) {
+                String token = tok[x];
+                js.append("  " + token);
+            }
+            line = in.readLine();
+        }
+        assertNotSame(0, js.length());
+    }
+    
+    @Test
+    public void dlbQueryTest() throws Exception {
+        LOG.finest("logged to avoid warning on LOG");
+        URL endpointURL = new URL(dlbEndpoint.getAddress()  + "?js");
+        InputStream jsStream = endpointURL.openStream();
+        InputStreamReader isr = new InputStreamReader(jsStream, UTF8);
+        BufferedReader in = new BufferedReader(isr);
+        String line = in.readLine();
+        StringBuilder js = new StringBuilder();
+        while (line != null) {
+            String[] tok = line.split("\\s");
+
+            for (int x = 0; x < tok.length; x++) {
+                String token = tok[x];
+                js.append("  " + token);
+            }
+            line = in.readLine();
+        }
+        assertNotSame(0, js.length());
+    }
+}

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java?rev=598106&r1=598105&r2=598106&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
Sun Nov 25 17:55:11 2007
@@ -21,13 +21,12 @@
 
 import javax.jws.WebService;
 
-import org.apache.cxf.feature.Features;
-
+//import org.apache.cxf.feature.Features;
 /**
  * 
  */
-@WebService(endpointInterface = "org.apache.cxf.javascript.fortest.SimpleDocLitBare")
-@Features(features = "org.apache.cxf.feature.LoggingFeature")   
+@WebService(endpointInterface = "org.apache.cxf.javascript.fortest.SimpleDocLitBare",
+            targetNamespace = "uri:org.apache.cxf.javascript.fortest")
 public class SimpleDocLitBareImpl implements SimpleDocLitBare {
     
     private String lastString;

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java?rev=598106&r1=598105&r2=598106&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitWrappedImpl.java
Sun Nov 25 17:55:11 2007
@@ -26,7 +26,8 @@
 /**
  * 
  */
-@WebService(endpointInterface = "org.apache.cxf.javascript.fortest.SimpleDocLitWrapped")
+@WebService(endpointInterface = "org.apache.cxf.javascript.fortest.SimpleDocLitWrapped",
+            targetNamespace = "uri:org.apache.cxf.javascript.fortest")
 //@Features(features = "org.apache.cxf.feature.LoggingFeature")   
 public class SimpleDocLitWrappedImpl implements SimpleDocLitWrapped {
     

Added: incubator/cxf/trunk/rt/javascript/src/test/resources/HelloWorldDocLitBeans.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/HelloWorldDocLitBeans.xml?rev=598106&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/HelloWorldDocLitBeans.xml (added)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/HelloWorldDocLitBeans.xml Sun Nov
25 17:55:11 2007
@@ -0,0 +1,47 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:jaxws="http://cxf.apache.org/jaxws"
+  xsi:schemaLocation="
+           http://cxf.apache.org/jaxws                                 
+              http://cxf.apache.org/schemas/jaxws.xsd
+           http://www.springframework.org/schema/beans
+              http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+              
+  <import resource="classpath:META-INF/cxf/cxf.xml" />
+  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+  <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+  <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+  <import resource="classpath:META-INF/cxf/cxf-extension-javascript-client.xml" />
+  
+  <bean id='hw-service' class='org.apache.hello_world_doc_lit.GreeterImplDoc'/>
+  
+  <jaxws:endpoint id="hw-service-endpoint" 
+    implementor="#hw-service" 
+    address="http://localhost:8808/HelloWorldDocLit" >
+  </jaxws:endpoint>
+ 
+  <bean id="hw-proxy-factory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean" >
+    <property name="serviceClass" value="org.apache.hello_world_doc_lit.Greeter"/>
+    <property name="address" value="http://localhost:8808/HelloWorldDocLit"/>
+  </bean>
+ 
+ </beans>
\ No newline at end of file



Mime
View raw message