cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r606746 - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/common/xmlschema/ rt/javascript/src/main/java/org/apache/cxf/javascript/ rt/javascript/src/main/java/org/apache/cxf/javascript/types/ rt/javascript/src/test/java/...
Date Mon, 24 Dec 2007 22:39:52 GMT
Author: bimargulies
Date: Mon Dec 24 14:39:50 2007
New Revision: 606746

URL: http://svn.apache.org/viewvc?rev=606746&view=rev
Log:
Add test for an experiment in anyType, using Aegis. It passes, but it doesn't really work
due to CXF-1333.

Added:
    incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/
    incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml
  (with props)
Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaConstants.java
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
    incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptRhinoTest.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
    incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
    incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaConstants.java?rev=606746&r1=606745&r2=606746&view=diff
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaConstants.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/XmlSchemaConstants.java
Mon Dec 24 14:39:50 2007
@@ -29,4 +29,49 @@
     
     public static final String XSD_NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema";
     public static final QName ANY_TYPE_QNAME = new QName(XSD_NAMESPACE_URI, "anyType");
+    public static final QName ANY_URI_QNAME = new QName(XSD_NAMESPACE_URI, "anyURI");
+    public static final QName BASE64BINARY_QNAME = new QName(XSD_NAMESPACE_URI, "base64Binary");
+    public static final QName BOOLEAN_QNAME = new QName(XSD_NAMESPACE_URI, "boolean");
+    public static final QName BYTE_QNAME = new QName(XSD_NAMESPACE_URI, "byte");
+    public static final QName DATE_QNAME = new QName(XSD_NAMESPACE_URI, "date");
+    public static final QName DATETIME_QNAME = new QName(XSD_NAMESPACE_URI, "dateTime");
+    public static final QName DOUBLE_QNAME = new QName(XSD_NAMESPACE_URI, "double");
+    public static final QName DURATION_QNAME = new QName(XSD_NAMESPACE_URI, "duration");
+    public static final QName ENTITIES_QNAME = new QName(XSD_NAMESPACE_URI, "ENTITIES");
+    public static final QName ENTITY_QNAME = new QName(XSD_NAMESPACE_URI, "ENTITY");
+    public static final QName FLOAT_QNAME = new QName(XSD_NAMESPACE_URI, "float");
+    public static final QName GDAY_QNAME = new QName(XSD_NAMESPACE_URI, "gDay");
+    public static final QName GMONTH_QNAME = new QName(XSD_NAMESPACE_URI, "gMonth");
+    public static final QName GMONTHDAY_QNAME = new QName(XSD_NAMESPACE_URI, "gMonthDay");
+    public static final QName GYEAR_QNAME = new QName(XSD_NAMESPACE_URI, "gYear");
+    public static final QName GYEARMONTH_QNAME = new QName(XSD_NAMESPACE_URI, "gYearMonth");
+    public static final QName HEX_BINARY_QNAME = new QName(XSD_NAMESPACE_URI, "hexBinary");
+    public static final QName ID_QNAME = new QName(XSD_NAMESPACE_URI, "ID");
+    public static final QName IDREF_QNAME = new QName(XSD_NAMESPACE_URI, "IDREF");
+    public static final QName IDREFS_QNAME = new QName(XSD_NAMESPACE_URI, "IDREFS");
+    public static final QName INT_QNAME = new QName(XSD_NAMESPACE_URI, "int");
+    public static final QName INTEGER_QNAME = new QName(XSD_NAMESPACE_URI, "integer");
+    public static final QName LANGUAGE_QNAME = new QName(XSD_NAMESPACE_URI, "language");
+    public static final QName LONG_QNAME = new QName(XSD_NAMESPACE_URI, "long");
+    public static final QName NAME_QNAME = new QName(XSD_NAMESPACE_URI, "Name");
+    public static final QName NCNAME_QNAME = new QName(XSD_NAMESPACE_URI, "NCName");
+    public static final QName NEGATIVEINTEGER_QNAME = new QName(XSD_NAMESPACE_URI, "negativeInteger");
+    public static final QName NMTOKEN_QNAME = new QName(XSD_NAMESPACE_URI, "NMTOKEN");
+    public static final QName NMTOKENS_QNAME = new QName(XSD_NAMESPACE_URI, "NMTOKENS");
+    public static final QName NONNEGATIVEINTEGER_QNAME = new QName(XSD_NAMESPACE_URI, "nonNegativeInteger");
+    public static final QName NONPOSITIVEINTEGER_QNAME = new QName(XSD_NAMESPACE_URI, "nonPositiveInteger");
+    public static final QName NORMALIZEDSTRING_QNAME = 
+        new QName(XSD_NAMESPACE_URI, "normalizedStringInteger");
+    public static final QName NOTATION_QNAME = new QName(XSD_NAMESPACE_URI, "NOTATION");
+    public static final QName POSITIVEINTEGER_QNAME = new QName(XSD_NAMESPACE_URI, "positiveInteger");
+    public static final QName QNAME_QNAME = new QName(XSD_NAMESPACE_URI, "QName");
+    public static final QName SHORT_QNAME = new QName(XSD_NAMESPACE_URI, "short");
+    public static final QName STRING_QNAME = new QName(XSD_NAMESPACE_URI, "string");
+    public static final QName TIME_QNAME = new QName(XSD_NAMESPACE_URI, "time");
+    public static final QName TOKEN_QNAME = new QName(XSD_NAMESPACE_URI, "token");
+    public static final QName UNSIGNEDBYTE_QNAME = new QName(XSD_NAMESPACE_URI, "unsignedByte");
+    public static final QName UNSIGNEDINT_QNAME = new QName(XSD_NAMESPACE_URI, "unsignedInt");
+    public static final QName UNSIGNEDLONG_QNAME = new QName(XSD_NAMESPACE_URI, "unsignedLong");
+    public static final QName UNSIGNEDSHORT_QNAME = new QName(XSD_NAMESPACE_URI, "unsignedShort");
+
 }

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java?rev=606746&r1=606745&r2=606746&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/JavascriptUtils.java
Mon Dec 24 14:39:50 2007
@@ -256,6 +256,7 @@
         }
         
         // now for the thing itself.
+        // type will be null for anyType. Apparently, XmlSchema doesn't represent it.
         if (type instanceof XmlSchemaComplexType) {
             // it has a value
             // pass the extra null in the slot for the 'extra namespaces' needed by 'any'.
@@ -263,13 +264,17 @@
                              + ".serialize(cxfjsutils, '" 
                              + elementInfo.getXmlName() + "', null)");
         } else { // simple type
-            QName typeName = type.getQName();
             appendString("<" + elementInfo.getXmlName() + ">");
             // warning: this assumes that ordinary Javascript serialization is all we need.
             // except for &gt; ad all of that.
-            if (isStringSimpleType(typeName)) {
+            if (type != null && isStringSimpleType(type.getQName())) {
                 appendExpression("cxfjsutils.escapeXmlEntities(" + jsVar + ")");
             } else {
+                // in other words, an AnyType is a string ... of XML! 
+                // Or, to be exact, of anything permitted in XML!
+                // (That is, in the anyType case, type will be null, and we won't escape,
+                // and anything goes. If someone sticks a string with xml-y stuff into
+                // an 'int' the results here won't be pretty.)
                 appendExpression(jsVar);
             }
             appendString("</" + elementInfo.getXmlName() + ">");

Modified: incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java?rev=606746&r1=606745&r2=606746&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/main/java/org/apache/cxf/javascript/types/SchemaJavascriptBuilder.java
Mon Dec 24 14:39:50 2007
@@ -582,7 +582,10 @@
 
         utils.appendLine("var value = null;");
         utils.startIf("!cxfjsutils.isElementNil(curElement)");
-        if (simple) {
+        if (itemInfo.isAnyType()) {
+            // All I can think of to do is deliver the DOM.
+            utils.appendLine("value = curElement;");
+        } else if (simple) {
             utils.appendLine("value = cxfjsutils.getNodeText(curElement);");
             utils.appendLine(valueTarget 
                              + " = " 

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java?rev=606746&r1=606745&r2=606746&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
Mon Dec 24 14:39:50 2007
@@ -23,6 +23,7 @@
 import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.javascript.JavascriptTestUtilities.JSRunnable;
 import org.apache.cxf.javascript.fortest.AegisServiceImpl;
 import org.junit.Before;
@@ -34,7 +35,6 @@
  * We end up here with a part with isElement == true, a non-array element, 
  * but a complex type for an array of the element.
  */
-@org.junit.Ignore
 public class AegisTest extends JavascriptRhinoTest {
 
     private static final Logger LOG = LogUtils.getL7dLogger(AegisTest.class);
@@ -61,6 +61,7 @@
                    true);
         implementor = (AegisServiceImpl)rawImplementor;
         implementor.reset();
+        serverFactoryBean.getServer().getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
     }
     
     private Void acceptAny(Context context) {
@@ -68,7 +69,7 @@
         testUtilities.rhinoCall("testAnyNToServerRaw",  
                                 testUtilities.javaToJS(getAddress()));
         assertEquals("before items", implementor.getAcceptedString());
-        Collection<Object> something = implementor.getAcceptedCollection();
+        Collection<org.jdom.Element> something = implementor.getAcceptedCollection();
         assertNotNull(something);
         return null;
     }

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptRhinoTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptRhinoTest.java?rev=606746&r1=606745&r2=606746&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptRhinoTest.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptRhinoTest.java
Mon Dec 24 14:39:50 2007
@@ -34,6 +34,7 @@
     protected JavascriptTestUtilities testUtilities;
     protected JaxWsProxyFactoryBean clientProxyFactory;
     protected ServiceInfo serviceInfo;
+    protected ServerFactoryBean serverFactoryBean;
     protected Object rawImplementor;
     private Endpoint endpoint;
     
@@ -48,7 +49,7 @@
                            boolean validation) throws Exception {
         testUtilities.setBus(getBean(Bus.class, "cxf"));
         testUtilities.initializeRhino();
-        ServerFactoryBean serverFactoryBean = getBean(ServerFactoryBean.class, serviceEndpointBean);
+        serverFactoryBean = getBean(ServerFactoryBean.class, serviceEndpointBean);
         endpoint = serverFactoryBean.getServer().getEndpoint();
         // we need to find the implementor.
         rawImplementor = serverFactoryBean.getServiceBean();

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java?rev=606746&r1=606745&r2=606746&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisService.java
Mon Dec 24 14:39:50 2007
@@ -22,6 +22,6 @@
 import java.util.Collection;
 
 public interface AegisService {
-    void acceptAny(String before, Collection<Object> anything);
+    void acceptAny(String before, Collection<org.jdom.Element> anything);
 }
 

Modified: incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java?rev=606746&r1=606745&r2=606746&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/fortest/AegisServiceImpl.java
Mon Dec 24 14:39:50 2007
@@ -26,7 +26,7 @@
  */
 public class AegisServiceImpl implements AegisService {
     private String acceptedString;
-    private Collection<Object> acceptedCollection;
+    private Collection<org.jdom.Element> acceptedCollection;
     
     public void reset() {
         acceptedString = null;
@@ -34,7 +34,7 @@
     }
     
     /** {@inheritDoc}*/
-    public void acceptAny(String before, Collection<Object> anything) {
+    public void acceptAny(String before, Collection<org.jdom.Element> anything) {
         acceptedString = before;
         acceptedCollection = anything;
     }
@@ -42,7 +42,7 @@
     /**
      * @return Returns the acceptedCollection.
      */
-    public Collection<Object> getAcceptedCollection() {
+    public Collection<org.jdom.Element> getAcceptedCollection() {
         return acceptedCollection;
     }
 

Modified: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js?rev=606746&r1=606745&r2=606746&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js
(original)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/AegisTests.js
Mon Dec 24 14:39:50 2007
@@ -34,14 +34,22 @@
 	globalResponseObject = null;
 }
 
+// aegis/simple doesn't understand 'oneway'
+
+function success()
+{
+}
+
+function error()
+{
+}
+
 function testAnyNToServerRaw(url)
 {
-	var service = new cxf_apache_org_jstest_any_AcceptAny();
+	var service = new fortest_javascript_cxf_apache_org__AegisServicePortType();
 	service.url = url;
-	var param = new cxf_apache_org_jstest_types_any_acceptAnyN();
-	param.setBefore("before chalk");
-	var holder = new org_apache_cxf_raw_any_holder("<walrus xmlns='uri:iam'>tusks</walrus><penguin
xmlns='uri:linux'>emperor</penguin>");
-	param.setAny(holder);
-	param.setAfter("after chalk");
-	service.acceptAnyN(param);
+	
+	var arrayItem = new fortest_javascript_cxf_apache_org__ArrayOfAnyType();
+	arrayItem.setAnyType(["<walrus xmlns='uri:iam'>tusks</walrus>", "<penguin
xmlns='uri:linux'>emperor</penguin>"]); 
+	service.acceptAny(success, error, "before items", arrayItem);
 }

Added: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml?rev=606746&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml
(added)
+++ incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml
Mon Dec 24 14:39:50 2007
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the v 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.
+-->
+<mappings xmlns:ns="http://fortest.cxf.apache.org">
+  <mapping name="ns:AegisService">
+    <method name="acceptAny">
+      <parameter index="0" mappedName="before"/>
+      <parameter index="1" mappedName="anything"/>
+    </method>
+  </mapping>
+</mappings>
+

Propchange: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/javascript/src/test/resources/org/apache/cxf/javascript/fortest/AegisService.aegis.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message