cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r662928 - in /cxf/trunk/rt: core/src/main/java/org/apache/cxf/test/ databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/ databinding/aegis/src/main/java/org/apache/cxf/aegis/type/ databinding/aegis/src/test/java/org/apache/cxf/...
Date Wed, 04 Jun 2008 00:04:34 GMT
Author: bimargulies
Date: Tue Jun  3 17:04:33 2008
New Revision: 662928

URL: http://svn.apache.org/viewvc?rev=662928&view=rev
Log:
Fix CXF-1628.

Added:
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/TypeCreationOptionsSpringTest.java
  (with props)
    cxf/trunk/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/
    cxf/trunk/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml
  (with props)
Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFSpringTest.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.java
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.java
    cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFSpringTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFSpringTest.java?rev=662928&r1=662927&r2=662928&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFSpringTest.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFSpringTest.java Tue Jun
 3 17:04:33 2008
@@ -39,7 +39,7 @@
     // is likely to include a Jetty or something else that we can't get rid of.
     private static GenericApplicationContext applicationContext;
     private DefaultResourceLoader resourceLoader;
-
+    private Class<?> configContextClass = AbstractCXFSpringTest.class;
     /**
      * Load up all the beans from the XML files returned by the getConfigLocations method.
      * @throws Exception 
@@ -53,7 +53,7 @@
             return;
         }
         applicationContext = new GenericApplicationContext();
-        resourceLoader = new DefaultResourceLoader(getClass().getClassLoader());
+        resourceLoader = new DefaultResourceLoader(configContextClass.getClassLoader());
         for (String beanDefinitionPath : getConfigLocations()) {
             XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(applicationContext);
             Resource resource = resourceLoader.getResource(beanDefinitionPath);
@@ -111,4 +111,8 @@
     protected <T> T getBean(Class<T> type, String beanName) {
         return type.cast(applicationContext.getBean(beanName));
     }
+
+    protected void setConfigContextClass(Class<?> configContextClass) {
+        this.configContextClass = configContextClass;
+    }
 }

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java?rev=662928&r1=662927&r2=662928&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/databinding/AegisDatabinding.java
Tue Jun  3 17:04:33 2008
@@ -282,6 +282,7 @@
             if (overrideTypes != null) {
                 aegisContext.setRootClassNames(overrideTypes);
             }
+            
             if (configuration != null) {
                 aegisContext.setTypeCreationOptions(configuration);
             }

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java?rev=662928&r1=662927&r2=662928&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/AbstractTypeCreator.java
Tue Jun  3 17:04:33 2008
@@ -184,11 +184,14 @@
 
         if (info.getMinOccurs() != -1) {
             type.setMinOccurs(info.getMinOccurs());
+        } else {
+            type.setMinOccurs(typeConfiguration.getDefaultMinOccurs());
         }
+        
         if (info.getMaxOccurs() != -1) {
             type.setMaxOccurs(info.getMaxOccurs());
         }
-
+        
         type.setFlat(info.isFlat());
 
         return type;
@@ -398,15 +401,10 @@
 
         Object keyType;
         Object valueType;
-        
         QName mappedName;
-
         QName typeName;
-
         Class type;
-
         String description;
-
         long minOccurs = -1;
         long maxOccurs = -1;
         boolean flat;
@@ -515,5 +513,6 @@
         public void setValueType(Object valueType) {
             this.valueType = valueType;
         }
+
     }
 }

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.java?rev=662928&r1=662927&r2=662928&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/ArrayService.java
Tue Jun  3 17:04:33 2008
@@ -18,11 +18,17 @@
  */
 package org.apache.cxf.aegis.services;
 
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
 /**
  * An array service for testing.
+ * There are some JAX-WS annotations for tests with JAX-WS.
  * 
  * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
  */
+@WebService(targetNamespace = "urn:org.apache.cxf.aegis",
+            serviceName = "arrayService")
 public class ArrayService {
     
     private org.jdom.Element[] jdomArray;
@@ -30,6 +36,7 @@
     private String beforeValue;
     private String afterValue;
     
+    @WebMethod
     public SimpleBean[] getBeanArray() {
         SimpleBean bean = new SimpleBean();
         bean.setBleh("bleh");
@@ -38,6 +45,10 @@
         return new SimpleBean[] {bean};
     }
     
+    @WebMethod
+    public void takeOneSimpleBean(SimpleBean sb) {
+    }
+    
     public void resetValues() {
         beforeValue = null;
         afterValue = null;
@@ -45,30 +56,36 @@
         w3cArray = null;
     }
 
+    @WebMethod
     public String[] getStringArray() {
         return new String[] {"bleh", "bleh"};
     }
 
+    @WebMethod
     public boolean submitStringArray(String[] array) {
         return true;
     }
 
+    @WebMethod
     public boolean submitBeanArray(SimpleBean[] array) {
         return true;
     }
     
+    @WebMethod
     public void submitJDOMArray(String before, org.jdom.Element[] anything, String after)
{
         beforeValue = before;
         jdomArray = anything;
         afterValue = after;
     }
 
+    @WebMethod
     public void submitW3CArray(String before, org.w3c.dom.Document[] anything, String after)
{
         beforeValue = before;
         w3cArray = anything;
         afterValue = after;
     }
 
+    @WebMethod
     public org.jdom.Element[] getJdomArray() {
         return jdomArray;
     }

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.java?rev=662928&r1=662927&r2=662928&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/services/SimpleBean.java
Tue Jun  3 17:04:33 2008
@@ -37,6 +37,16 @@
     public void setNumbers(int[] numbers) {
         this.numbers = numbers;
     }
+    
+    // this property has no XML mapping,
+    // useful for testing defaults.
+    public int[] getDefaultSchemaNumbers() {
+        return numbers;
+    }
+    
+    public void setDefaultSchemaNumbers(int[] n) {
+        this.numbers = n;
+    }
 
     public String getBleh() {
         return bleh;

Added: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/TypeCreationOptionsSpringTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/TypeCreationOptionsSpringTest.java?rev=662928&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/TypeCreationOptionsSpringTest.java
(added)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/TypeCreationOptionsSpringTest.java
Tue Jun  3 17:04:33 2008
@@ -0,0 +1,59 @@
+/**
+ * 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.aegis.type;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.test.AbstractCXFSpringTest;
+import org.apache.cxf.test.TestUtilities;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class TypeCreationOptionsSpringTest extends AbstractCXFSpringTest {
+
+    @Override
+    protected String[] getConfigLocations() {
+        setConfigContextClass(TypeCreationOptionsSpringTest.class);
+        return new String[] {"/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml"};
+    }
+    
+    @Test 
+    public void testMinOccurs() throws Exception {
+        TestUtilities testUtilities = new TestUtilities(TypeCreationOptionsSpringTest.class);
+        testUtilities.setBus(getBean(Bus.class, "cxf"));
+        testUtilities.addDefaultNamespaces();
+        testUtilities.addNamespace("ts", "http://cxf.org.apache/service");
+        //{urn:org.apache.cxf.aegis}arrayService
+        Server s = testUtilities.getServerForService(new QName("urn:org.apache.cxf.aegis",

+                                                               "arrayService"));
+        Document wsdl = testUtilities.getWSDLDocument(s);
+        assertXPathEquals("//xsd:complexType[@name='ArrayOfInt']/" 
+                          + "xsd:sequence/xsd:element[@name='int']/@minOccurs", 
+                          "3", wsdl);
+
+    }
+    
+}

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/TypeCreationOptionsSpringTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/TypeCreationOptionsSpringTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java?rev=662928&r1=662927&r2=662928&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/test/java/org/apache/cxf/aegis/type/basic/BeanTest.java
Tue Jun  3 17:04:33 2008
@@ -363,7 +363,7 @@
         type.setSchemaType(new QName("urn:Bean", "bean"));
 
         PropertyDescriptor[] pds = info.getPropertyDescriptors();
-        assertEquals(3, pds.length);
+        assertEquals(4, pds.length);
 
         ExtendedBean bean = new ExtendedBean();
         bean.setHowdy("howdy");

Added: cxf/trunk/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml?rev=662928&view=auto
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml
(added)
+++ cxf/trunk/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml
Tue Jun  3 17:04:33 2008
@@ -0,0 +1,65 @@
+<?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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:jaxws="http://cxf.apache.org/jaxws"
+	xmlns:soap="http://cxf.apache.org/bindings/soap"
+	xsi:schemaLocation="
+           http://www.springframework.org/schema/beans
+              http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+           http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
+           http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.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-xml.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+
+        <bean id="aegisBean" class="org.apache.cxf.aegis.databinding.AegisDatabinding">
+                <property name="configuration">
+                        <bean class="org.apache.cxf.aegis.type.TypeCreationOptions">
+                        <property name="defaultMinOccurs" value="3"/>
+                        <property name="defaultNillable" value="false"/>
+                        </bean>
+                </property>
+        </bean>
+           
+        <bean id="jaxws-and-aegis-service-factory"
+        	class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
+        	scope="prototype">
+        	<property name="dataBinding" ref="aegisBean" />
+        </bean>
+
+        <bean id="aegisService"
+        	class="org.apache.cxf.aegis.services.ArrayService">
+        </bean>
+
+        <jaxws:endpoint id="aegisServiceTest"
+        	implementor="#aegisService" address="http://localhost:9876/aegis">
+        	<jaxws:serviceFactory>
+        		<ref bean='jaxws-and-aegis-service-factory' />
+        	</jaxws:serviceFactory>
+        </jaxws:endpoint>
+
+
+</beans>
+

Propchange: cxf/trunk/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/rt/databinding/aegis/src/test/resources/org/apache/cxf/aegis/type/aegisOptionsTestBeans.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message