axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r558840 - in /webservices/axis2/trunk/java/modules/adb-codegen: ./ test-resources/testsuite/ test/org/apache/axis2/schema/extension/ test/org/apache/axis2/schema/rampart/
Date Mon, 23 Jul 2007 19:30:03 GMT
Author: amilas
Date: Mon Jul 23 12:30:02 2007
New Revision: 558840

URL: http://svn.apache.org/viewvc?view=rev&rev=558840
Log:
add test cases to test getXmlStreamReader method in ADBDatasource

Added:
    webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/rampart.xsd
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/rampart/
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/rampart/RampartTest.java
Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/sub-build.xml
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/extension/ComplexExtenstionTest.java
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/extension/SimpleExtensionTest.java

Modified: webservices/axis2/trunk/java/modules/adb-codegen/sub-build.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/sub-build.xml?view=diff&rev=558840&r1=558839&r2=558840
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/sub-build.xml (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/sub-build.xml Mon Jul 23 12:30:02 2007
@@ -354,6 +354,14 @@
 			<arg file="${testsuite.source.dir}/anytype.xsd"/>
 			<arg file="${schema.generated.src.dir}"/>
 		</java>
+        <echo>Compiling rampart.xsd</echo>
+		<java classname="org.apache.axis2.schema.XSD2Java" fork="true">
+			<jvmarg line="${maven.junit.jvmargs}"/>
+			<classpath refid="maven.dependency.classpath"/>
+			<classpath location="${compiled.classes.dir}"/>
+			<arg file="${testsuite.source.dir}/rampart.xsd"/>
+			<arg file="${schema.generated.src.dir}"/>
+		</java>
     </target>
 
 </project>

Added: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/rampart.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/rampart.xsd?view=auto&rev=558840
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/rampart.xsd
(added)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/rampart.xsd
Mon Jul 23 12:30:02 2007
@@ -0,0 +1,28 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
+           targetNamespace="http://www.w3.org/2005/05/xmlmime">
+    <xs:attribute name="contentType">
+        <xs:simpleType>
+            <xs:restriction base="xs:string">
+                <xs:minLength value="3"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:attribute>
+    <xs:attribute name="expectedContentTypes" type="xs:string"/>
+    <xs:complexType name="base64Binary">
+        <xs:simpleContent>
+            <xs:extension base="xs:base64Binary">
+                <xs:attribute ref="xmime:contentType"/>
+            </xs:extension>
+        </xs:simpleContent>
+    </xs:complexType>
+    <xs:complexType name="hexBinary">
+        <xs:simpleContent>
+            <xs:extension base="xs:hexBinary">
+                <xs:attribute ref="xmime:contentType"/>
+            </xs:extension>
+        </xs:simpleContent>
+    </xs:complexType>
+    <xs:element name="TestExtension" type="xmime:base64Binary"/>
+</xs:schema>
+

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/extension/ComplexExtenstionTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/extension/ComplexExtenstionTest.java?view=diff&rev=558840&r1=558839&r2=558840
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/extension/ComplexExtenstionTest.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/extension/ComplexExtenstionTest.java
Mon Jul 23 12:30:02 2007
@@ -45,15 +45,30 @@
 
         try {
             OMElement omElement = testComplexElement.getOMElement(TestComplexElement.MY_QNAME,
OMAbstractFactory.getSOAP11Factory());
-            String omElementString = omElement.toStringWithConsume();
+            String omElementString;
+            XMLStreamReader xmlReader;
+            TestComplexElement result;
+
+            omElementString = omElement.toStringWithConsume();
             System.out.println("OM String ==> " + omElementString);
-            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
-            TestComplexElement result = TestComplexElement.Factory.parse(xmlReader);
+            xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            result = TestComplexElement.Factory.parse(xmlReader);
             assertEquals(result.getTestComplexElement().getFirst(),"Amila");
             assertEquals(result.getTestComplexElement().getMiddle(),"Chinthaka");
             assertEquals(result.getTestComplexElement().getLast(),"Suriarachchi");
             assertEquals(result.getTestComplexElement().getParentElement1(),"test1");
             assertEquals(result.getTestComplexElement().getParentElement2(),"test2");
+
+            omElementString = omElement.toString();
+            System.out.println("OM String ==> " + omElementString);
+            xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            result = TestComplexElement.Factory.parse(xmlReader);
+            assertEquals(result.getTestComplexElement().getFirst(),"Amila");
+            assertEquals(result.getTestComplexElement().getMiddle(),"Chinthaka");
+            assertEquals(result.getTestComplexElement().getLast(),"Suriarachchi");
+            assertEquals(result.getTestComplexElement().getParentElement1(),"test1");
+            assertEquals(result.getTestComplexElement().getParentElement2(),"test2");
+
         } catch (Exception e) {
             assertFalse(true);
         }

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/extension/SimpleExtensionTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/extension/SimpleExtensionTest.java?view=diff&rev=558840&r1=558839&r2=558840
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/extension/SimpleExtensionTest.java
(original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/extension/SimpleExtensionTest.java
Mon Jul 23 12:30:02 2007
@@ -38,22 +38,37 @@
         fullName.setMiddle("chinthaka");
         fullName.setLast("suriarachchi");
         fullName.setLanguage(new Language("singhala"));
-        fullName.setAttribute1(BaseType.Factory.fromString(BaseType._s1,""));
+        fullName.setAttribute1(BaseType.Factory.fromString(BaseType._s1, ""));
 
-        fullName.setAttribute2(SimpleType.Factory.fromString("ATTRIBUTE",""));
+        fullName.setAttribute2(SimpleType.Factory.fromString("ATTRIBUTE", ""));
 
-         try {
+        try {
             OMElement omElement = fullName.getOMElement(FullName.MY_QNAME, OMAbstractFactory.getSOAP11Factory());
-            String omElementString = omElement.toStringWithConsume();
+            String omElementString;
+            XMLStreamReader xmlReader;
+            FullName newFullName;
+
+            omElementString = omElement.toStringWithConsume();
+            System.out.println("OM String ==> " + omElementString);
+            xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            newFullName = FullName.Factory.parse(xmlReader);
+            assertEquals(newFullName.getFirst(), "amila");
+            assertEquals(newFullName.getMiddle(), "chinthaka");
+            assertEquals(newFullName.getLast(), "suriarachchi");
+            assertEquals(newFullName.getLanguage().toString(), "singhala");
+            assertEquals(newFullName.getAttribute1().toString(), BaseType._s1);
+            assertEquals(newFullName.getAttribute2().toString(), "ATTRIBUTE");
+
+            omElementString = omElement.toString();
             System.out.println("OM String ==> " + omElementString);
-            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
-            FullName newFullName = FullName.Factory.parse(xmlReader);
-            assertEquals(newFullName.getFirst(),"amila");
-            assertEquals(newFullName.getMiddle(),"chinthaka");
-            assertEquals(newFullName.getLast(),"suriarachchi");
-            assertEquals(newFullName.getLanguage().toString(),"singhala");
-            assertEquals(newFullName.getAttribute1().toString(),BaseType._s1);
-            assertEquals(newFullName.getAttribute2().toString(),"ATTRIBUTE");
+            xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            newFullName = FullName.Factory.parse(xmlReader);
+            assertEquals(newFullName.getFirst(), "amila");
+            assertEquals(newFullName.getMiddle(), "chinthaka");
+            assertEquals(newFullName.getLast(), "suriarachchi");
+            assertEquals(newFullName.getLanguage().toString(), "singhala");
+            assertEquals(newFullName.getAttribute1().toString(), BaseType._s1);
+            assertEquals(newFullName.getAttribute2().toString(), "ATTRIBUTE");
         } catch (Exception e) {
             assertFalse(true);
         }

Added: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/rampart/RampartTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/rampart/RampartTest.java?view=auto&rev=558840
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/rampart/RampartTest.java
(added)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/rampart/RampartTest.java
Mon Jul 23 12:30:02 2007
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.axis2.schema.rampart;
+
+import junit.framework.TestCase;
+import org.w3.www._2005._05.xmlmime.TestExtension;
+import org.w3.www._2005._05.xmlmime.Base64Binary;
+import org.w3.www._2005._05.xmlmime.ContentType_type0;
+import org.apache.axiom.attachments.ByteArrayDataSource;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.databinding.ADBException;
+
+import javax.activation.DataHandler;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamException;
+import java.io.ByteArrayInputStream;
+
+
+public class RampartTest extends TestCase {
+
+    public void testExtension(){
+        TestExtension testExtension = new TestExtension();
+
+        Base64Binary base64Binary = new Base64Binary();
+        testExtension.setTestExtension(base64Binary);
+
+        String testString = "test base 64 eleemnt";
+        DataHandler dataHandler = new DataHandler(new ByteArrayDataSource(testString.getBytes()));
+        base64Binary.setBase64Binary(dataHandler);
+
+        ContentType_type0 contentType_type0 = new ContentType_type0();
+        contentType_type0.setContentType_type0("test string");
+        base64Binary.setContentType(contentType_type0);
+
+        try {
+            OMElement omElement = testExtension.getOMElement(TestExtension.MY_QNAME, OMAbstractFactory.getOMFactory());
+            String omElementString = omElement.toString();
+            System.out.println("OM String " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestExtension result = TestExtension.Factory.parse(xmlReader);
+            
+        } catch (ADBException e) {
+            fail();
+        } catch (XMLStreamException e) {
+            fail();
+        } catch (Exception e) {
+            fail();
+        }
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message