cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r598044 - in /incubator/cxf/trunk/rt/javascript/src: main/java/org/apache/cxf/javascript/service/ test/java/org/apache/cxf/javascript/ test/java/org/apache/cxf/javascript/fortest/ test/java/org/apache/cxf/javascript/service/ test/resources/...
Date Sun, 25 Nov 2007 19:59:50 GMT
Author: bimargulies
Date: Sun Nov 25 11:59:49 2007
New Revision: 598044

URL: http://svn.apache.org/viewvc?rev=598044&view=rev
Log:
Remove test that is painful to maintain and replaced by full client test.

Added:
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBare.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
    incubator/cxf/trunk/rt/javascript/src/test/resources/DocLitBareClientTestBeans.xml
    incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitBareTests.js
Removed:
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/service/
Modified:
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/service/ServiceJavascriptBuilder.java

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=598044&r1=598043&r2=598044&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 11:59:49 2007
@@ -54,6 +54,8 @@
 import org.apache.cxf.wsdl.WSDLConstants;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaSimpleType;
+import org.apache.ws.commons.schema.XmlSchemaType;
 
 public class ServiceJavascriptBuilder extends ServiceModelVisitor {
     private static final Logger LOG = LogUtils.getL7dLogger(ServiceJavascriptBuilder.class);
@@ -79,13 +81,14 @@
     private XmlSchemaComplexType inputWrapperComplexType;
 
     private MessagePartInfo outputWrapperPartInfo;
-    private String outputWrapperClassName;
     private XmlSchemaElement outputWrapperElement;
     private XmlSchemaComplexType outputWrapperComplexType;
 
     // Javascript parameter names for the input parameters,
     // derived from the parts.
     private List<String> inputParameterNames = new ArrayList<String>();
+    // when not wrapped, we use this to keep track of the bits.
+    private List<ElementAndNames> unwrappedElementsAndNames;
     
     private NamespacePrefixAccumulator prefixAccumulator;
     private BindingInfo xmlBindingInfo;
@@ -206,13 +209,10 @@
         if (isWrapped) {
             collectWrapperElementInfo();
         } else {
-            //TODO:
-            // build parameter list from parts
+            collectUnwrappedInputInfo();
         }
 
-        if (op.getInput() != null) {
-            buildParameterList(parameterList);
-        }
+        buildParameterList(parameterList);
 
         MessageInfo outputMessage = op.getOutput();
         buildSuccessFunction(outputMessage);
@@ -223,11 +223,25 @@
 
         createInputSerializer();
 
-        if (outputMessage != null) {
+        if (outputMessage != null && outputMessage.getMessageParts().size() != 0)
{
             createResponseDeserializer(outputMessage);
         }
     }
 
+    /**
+     * visit the input message parts and collect relevant data.
+     */
+    private void collectUnwrappedInputInfo() {
+        unwrappedElementsAndNames = new ArrayList<ElementAndNames>();
+        if (currentOperation.getInput() != null) {
+            getElementsForParts(currentOperation.getInput(), unwrappedElementsAndNames);
+        }
+        
+        for (ElementAndNames ean : unwrappedElementsAndNames) {
+            inputParameterNames.add(ean.getJavascriptName());
+        }
+    }
+
     private void buildOperationFunction(StringBuilder parameterList) {
         code.append("function " 
                     +  opFunctionGlobalName
@@ -369,21 +383,31 @@
         List<ElementAndNames> elements = new ArrayList<ElementAndNames>();
         String functionName = outputDeserializerFunctionName(outputMessage);
         code.append("function " + functionName + "(cxfjsutils, partElement) {\n");
-        getElementsForParts(elements, parts);
+        getElementsForParts(outputMessage, elements);
         ElementAndNames element = elements.get(0);
-        XmlSchemaComplexType type = (XmlSchemaComplexType)element.getElement().getSchemaType();
+        XmlSchemaType type = element.getElement().getSchemaType();
         assert type != null;
-        String typeObjectName = nameManager.getJavascriptName(type);
-        assert outputWrapperClassName.equals(typeObjectName);
-        utils
-            .appendLine("var returnObject = " + typeObjectName + "_deserialize (cxfjsutils,
partElement);\n");
+        if (type instanceof XmlSchemaComplexType) {
+            XmlSchemaComplexType complexType = (XmlSchemaComplexType)type;
+            String typeObjectName = nameManager.getJavascriptName(complexType);
+            utils
+                .appendLine("var returnObject = " 
+                            + typeObjectName 
+                            + "_deserialize (cxfjsutils, partElement);\n");
+        } else {
+            XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType)type;
+            utils.appendLine("var returnText = cxfjsutils.getNodeText(partElement);");
+            utils.appendLine("var returnObject = " 
+                             + utils.javascriptParseExpression(simpleType, "returnText")
+ ";");
+        }
+
         utils.appendLine("return returnObject;");
         code.append("}\n");
     }
 
     private void createInputSerializer() {
         
-        // We are working on a wrapped method, then we use the wrapper element.
+        // If are working on a wrapped method, then we use the wrapper element.
         // If we are working on an unwrapped method, we will have to work from the unwrapped
parts.
         
         MessageInfo message = currentOperation.getInput();
@@ -407,8 +431,6 @@
                                  + "]);");
                 px++;
             }
-        } else {
-            // TODO: implement unwrapped.
         }
 
         if (soapBindingInfo != null) {
@@ -433,7 +455,16 @@
                                                  serviceSchemaInfo.getNamespaceURI(),
                                                  null);
         } else {
-            // TODO: code unwrapped.
+            // Multiple parts violates WS-I, but we can still do them.
+            for (ElementAndNames ean : unwrappedElementsAndNames) {
+                utils.generateCodeToSerializeElement("cxfutils",
+                                                     ean.getElement(),
+                                                     ean.getJavascriptName(),
+                                                     ean.getXmlName(),
+                                                     xmlSchemaCollection,
+                                                     serviceSchemaInfo.getNamespaceURI(),
+                                                     null);
+            }
         }
 
 //        int px = 0;
@@ -455,8 +486,13 @@
                     + serializerFunctionGlobalName + ";\n\n");
     }
 
-    private void getElementsForParts(List<ElementAndNames> elements, List<MessagePartInfo>
parts) {
-        for (MessagePartInfo mpi : parts) {
+    /**
+     * Collect information about the parts of an unwrapped message.
+     * @param parts 
+     * @param elements
+     */
+    private void getElementsForParts(MessageInfo message, List<ElementAndNames> elements)
{
+        for (MessagePartInfo mpi : message.getMessageParts()) {
             XmlSchemaElement element = null;
             if (mpi.isElement()) {
                 element = (XmlSchemaElement)mpi.getXmlSchema();
@@ -536,7 +572,6 @@
                                                   outputWrapperElement, 
                                                   null);
             }
-            outputWrapperClassName = nameManager.getJavascriptName(outputWrapperComplexType);
         }
     }
 

Added: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java?rev=598044&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java
(added)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/DocLitBareClientTest.java
Sun Nov 25 11:59:49 2007
@@ -0,0 +1,170 @@
+/**
+ * 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.util.List;
+import java.util.logging.Logger;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.javascript.JavascriptTestUtilities.JSRunnable;
+import org.apache.cxf.javascript.JavascriptTestUtilities.Notifier;
+import org.apache.cxf.javascript.fortest.SimpleDocLitWrappedImpl;
+import org.apache.cxf.javascript.fortest.TestBean1;
+import org.apache.cxf.javascript.fortest.TestBean2;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.test.AbstractCXFSpringTest;
+import org.junit.Before;
+import org.junit.Test;
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.Scriptable;
+import org.springframework.context.support.GenericApplicationContext;
+
+@org.junit.Ignore
+public class DocLitBareClientTest extends AbstractCXFSpringTest {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(DocLitBareClientTest.class);
+
+    // shadow declaration from base class.
+    private JavascriptTestUtilities testUtilities;
+    private JaxWsProxyFactoryBean clientProxyFactory;
+    private EndpointImpl endpoint;
+
+    public DocLitBareClientTest() throws Exception {
+        testUtilities = new JavascriptTestUtilities(getClass());
+        testUtilities.addDefaultNamespaces();
+    }
+
+    @Before
+    public void setupRhino() throws Exception {
+        testUtilities.setBus(getBean(Bus.class, "cxf"));
+        testUtilities.initializeRhino();
+        testUtilities.readResourceIntoRhino("/org/apache/cxf/javascript/cxf-utils.js");
+        clientProxyFactory = getBean(JaxWsProxyFactoryBean.class, "dlb-proxy-factory");
+        Client client = clientProxyFactory.getClientFactoryBean().create();
+        List<ServiceInfo> serviceInfos = client.getEndpoint().getService().getServiceInfos();
+        // there can only be one.
+        assertEquals(1, serviceInfos.size());
+        ServiceInfo serviceInfo = serviceInfos.get(0);
+        testUtilities.loadJavascriptForService(serviceInfo);
+        testUtilities.readResourceIntoRhino("/org/apache/cxf/javascript/DocLitBareTests.js");
+        endpoint = getBean(EndpointImpl.class, "dlb-service-endpoint");
+    }
+    
+    @Override
+    protected void additionalSpringConfiguration(GenericApplicationContext context) throws
Exception {
+    }
+    
+    @Override
+    protected String[] getConfigLocations() {
+        return new String[] {"classpath:DocLitBareClientTestBeans.xml"};
+    }
+
+    private Void beanFunctionCaller(Context context) {
+        TestBean1 b1 = new TestBean1(); 
+        b1.stringItem = "strung";
+        TestBean1[] beans = new TestBean1[3];
+        beans[0] = new TestBean1();
+        beans[0].beanTwoNotRequiredItem = new TestBean2("bean2");
+        beans[1] = null;
+        beans[2] = new TestBean1();
+        beans[2].optionalIntArrayItem = new int[2];
+        beans[2].optionalIntArrayItem[0] = 4;
+        beans[2].optionalIntArrayItem[1] = 6;
+        
+        Object[] jsBeans = new Object[3];
+        jsBeans[0] = testBean1ToJS(testUtilities, context, beans[0]);
+        jsBeans[1] = testBean1ToJS(testUtilities, context, beans[1]);
+        jsBeans[2] = testBean1ToJS(testUtilities, context, beans[2]);
+        
+        Scriptable jsBean1 = testBean1ToJS(testUtilities, context, b1);
+        Scriptable jsBeanArray = context.newArray(testUtilities.getRhinoScope(), jsBeans);
+        
+        LOG.info("About to call beanFunctionTest " + endpoint.getAddress());
+        Notifier notifier = 
+            testUtilities.rhinoCallConvert("beanFunctionTest", Notifier.class, 
+                                           testUtilities.javaToJS(endpoint.getAddress()),
+                                           jsBean1,
+                                           jsBeanArray);
+        boolean notified = notifier.waitForJavascript(1000 * 10);
+        assertTrue(notified);
+        Integer errorStatus = testUtilities.rhinoEvaluateConvert("globalErrorStatus", Integer.class);
+        assertNull(errorStatus);
+        String errorText = testUtilities.rhinoEvaluateConvert("globalErrorStatusText", String.class);
+        assertNull(errorText);
+
+        // this method returns void, which translated into a Javascript object with no properties.

+        Scriptable responseObject = (Scriptable)testUtilities.rhinoEvaluate("globalResponseObject");
+        assertNotNull(responseObject);
+        SimpleDocLitWrappedImpl impl = getBean(SimpleDocLitWrappedImpl.class, "dlw-service");
+        TestBean1 b1returned = impl.getLastBean1();
+        assertEquals(b1, b1returned);
+        TestBean1[] beansReturned = impl.getLastBean1Array();
+        assertArrayEquals(beans, beansReturned);
+        return null;
+    }
+    
+    @Test
+    public void callFunctionWithBeans() {
+        LOG.info("about to call beanFunctionTest");
+        testUtilities.runInsideContext(Void.class, new JSRunnable<Void>() {
+            public Void run(Context context) {
+                return beanFunctionCaller(context);
+            }
+        });
+    }
+
+    public static Scriptable testBean1ToJS(JavascriptTestUtilities testUtilities,
+                                           Context context, 
+                                           TestBean1 b1) {
+        if (b1 == null) {
+            return null; // black is always in fashion. (Really, we can be called with a
null).
+        }
+        Scriptable rv = context.newObject(testUtilities.getRhinoScope(), 
+                                          "org_apache_cxf_javascript_testns_testBean1");
+        testUtilities.rhinoCallMethod(rv, "setStringItem", testUtilities.javaToJS(b1.stringItem));
+        testUtilities.rhinoCallMethod(rv, "setIntItem", testUtilities.javaToJS(b1.intItem));
+        testUtilities.rhinoCallMethod(rv, "setLongItem", testUtilities.javaToJS(b1.longItem));
+        testUtilities.rhinoCallMethod(rv, "setBase64Item", testUtilities.javaToJS(b1.base64Item));
+        testUtilities.rhinoCallMethod(rv, "setOptionalIntItem", testUtilities.javaToJS(b1.optionalIntItem));
+        testUtilities.rhinoCallMethod(rv, "setOptionalIntArrayItem",
+                                      testUtilities.javaToJS(b1.optionalIntArrayItem));
+        testUtilities.rhinoCallMethod(rv, "setDoubleItem", testUtilities.javaToJS(b1.doubleItem));
+        testUtilities.rhinoCallMethod(rv, "setBeanTwoItem", testBean2ToJS(testUtilities,
+                                                                          context, b1.beanTwoItem));
+        testUtilities.rhinoCallMethod(rv, "setBeanTwoNotRequiredItem", 
+                                      testBean2ToJS(testUtilities, context, b1.beanTwoNotRequiredItem));
+        return rv; 
+    }
+
+    public static Object testBean2ToJS(JavascriptTestUtilities testUtilities,
+                                       Context context, TestBean2 beanTwoItem) {
+        if (beanTwoItem == null) {
+            return null;
+        }
+        Scriptable rv = context.newObject(testUtilities.getRhinoScope(), 
+                                          "org_apache_cxf_javascript_testns3_testBean2");
+        testUtilities.rhinoCallMethod(rv, "setStringItem", beanTwoItem.stringItem);
+        return rv;
+    }
+}

Added: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBare.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBare.java?rev=598044&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBare.java
(added)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBare.java
Sun Nov 25 11:59:49 2007
@@ -0,0 +1,50 @@
+/**
+ * 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.fortest;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+/**
+ * Most of these violate WS-I(!)
+ */
+@WebService(targetNamespace = "uri:org.apache.cxf.javascript.fortest")
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public interface SimpleDocLitBare {
+    @WebMethod
+    String basicTypeFunctionReturnString(@WebParam(name = "s") String s, 
+                                         @WebParam(name = "i") int i, 
+                                         @WebParam(name = "d") double d);
+    
+    @WebMethod
+    TestBean1 functionReturnTestBean1();
+    
+    @WebMethod
+    int basicTypeFunctionReturnInt(@WebParam(name = "s") String s, 
+                                   @WebParam(name = "d") double d);
+    
+    @WebMethod
+    void beanFunction(@WebParam(name = "bean1") TestBean1 bean, 
+                      @WebParam(name = "beanArray") TestBean1[] beans);
+    
+    @WebMethod 
+    String compliant(@WebParam(name = "beanParam") TestBean1 green);
+}

Added: 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=598044&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
(added)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/SimpleDocLitBareImpl.java
Sun Nov 25 11:59:49 2007
@@ -0,0 +1,89 @@
+/**
+ * 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.fortest;
+
+import javax.jws.WebService;
+
+//import org.apache.cxf.feature.Features;
+
+/**
+ * 
+ */
+@WebService(endpointInterface = "org.apache.cxf.javascript.fortest.SimpleDocLitBare")
+//@Features(features = "org.apache.cxf.feature.LoggingFeature")   
+public class SimpleDocLitBareImpl implements SimpleDocLitBare {
+    
+    private String lastString;
+    private int lastInt;
+    private double lastDouble;
+    private TestBean1 lastBean1;
+    private TestBean1[] lastBean1Array;
+    
+
+    public int basicTypeFunctionReturnInt(String s, double d) {
+        lastString = s;
+        lastDouble = d;
+        return 44;
+    }
+
+    public String basicTypeFunctionReturnString(String s, int i, double d) {
+        lastString = s;
+        lastInt = i;
+        lastDouble = d;
+        return "If you are the University of Wisconsin Police, where are your Badgers?";
+    }
+
+    public void beanFunction(TestBean1 bean, TestBean1[] beans) {
+        lastBean1 = bean;
+        lastBean1Array = beans;
+    }
+
+    public TestBean1 functionReturnTestBean1() {
+        TestBean1 bean1 = new TestBean1();
+        bean1.intItem = 42;
+        return bean1;
+    }
+    
+    public String compliant(TestBean1 green) {
+        lastBean1 = green;
+        return green.stringItem;
+    }
+
+    public String getLastString() {
+        return lastString;
+    }
+
+    public int getLastInt() {
+        return lastInt;
+    }
+
+    public double getLastDouble() {
+        return lastDouble;
+    }
+
+    public TestBean1 getLastBean1() {
+        return lastBean1;
+    }
+
+    public TestBean1[] getLastBean1Array() {
+        return lastBean1Array;
+    }
+
+}

Added: incubator/cxf/trunk/rt/javascript/src/test/resources/DocLitBareClientTestBeans.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/DocLitBareClientTestBeans.xml?rev=598044&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/DocLitBareClientTestBeans.xml (added)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/DocLitBareClientTestBeans.xml Sun
Nov 25 11:59:49 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" />
+  
+  <bean id='dlb-service' class='org.apache.cxf.javascript.fortest.SimpleDocLitBareImpl'/>
+  
+  <!-- use # so that we can pull state out of the service object in the tests. -->
           
+  <jaxws:endpoint id="dlb-service-endpoint" 
+    implementor="#dlb-service" 
+    address="http://localhost:8808/SimpleDocLitBare" >
+  </jaxws:endpoint>
+ 
+  <bean id="dlb-proxy-factory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean" >
+    <property name="serviceClass" value="org.apache.cxf.javascript.fortest.SimpleDocLitBare"/>
+    <property name="address" value="http://localhost:8808/SimpleDocLitBare"/>
+  </bean>
+ 
+ </beans>
\ No newline at end of file

Added: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitBareTests.js
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitBareTests.js?rev=598044&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitBareTests.js
(added)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/DocLitBareTests.js
Sun Nov 25 11:59:49 2007
@@ -0,0 +1,69 @@
+/**
+ * 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.
+ */
+
+function assertionFailed(explanation)
+{
+ 	var assert = new Assert(explanation); // this will throw out in Java.
+}
+
+var globalNotifier = null;
+var globalErrorStatus = null;
+var globalErrorStatusText = null;
+var globalResponseObject = null;
+
+function resetGlobals() {
+	globalNotifier = null;
+	globalErrorStatus = null;
+	globalErrorStatusText = null;
+	globalResponseObject = null;
+}
+
+function test1ErrorCallback(httpStatus, httpStatusText) 
+{
+    org_apache_cxf_trace.trace("test1/2/3 error");
+	globalErrorStatus = httpStatus;
+	globalStatusText = httpStatusText;
+	globalNotifier.notify();
+}
+
+// Because there is an explicit response wrapper declared, we have a JavaScript
+// object here that wraps up the simple 'string'. It is easier to validate it
+// from Java, I think.
+function test1SuccessCallback(responseObject) 
+{
+    org_apache_cxf_trace.trace("test1/2/3 success");
+	globalResponseObject = responseObject;
+	globalNotifier.notify();
+}
+
+function beanFunctionTest(url, beanArg, beansArg)
+{
+	org_apache_cxf_trace.trace("Enter beanFunctionTest.");
+	resetGlobals();
+	globalNotifier = new org_apache_cxf_notifier();
+	
+	var intf;
+    intf = new org_apache_cxf_javascript_fortest_SimpleDocLitBare();
+	  
+	intf.url = url;
+	// param order from the interface
+    intf.beanFunction(test1SuccessCallback, test1ErrorCallback, beanArg, beansArg); 
+    // Return the notifier as a convenience to the Java code.
+	return globalNotifier;
+}



Mime
View raw message