Author: sagara Date: Thu Jun 7 11:12:45 2012 New Revision: 1347570 URL: http://svn.apache.org/viewvc?rev=1347570&view=rev Log: Added latest patch for AXIS2-5335 after removing some unwanted text formatting.
Modified: axis/axis2/java/core/trunk/modules/kernel/test-resources/schemas/custom_schemas/printXSDReference.xsd axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/printWSDLreference.wsdl axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisMessageTest.java axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisService2WSDLTest.java axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisServiceTest.java axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/java2wsdl/XMLSchemaTest.java Modified: axis/axis2/java/core/trunk/modules/kernel/test-resources/schemas/custom_schemas/printXSDReference.xsd URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test-resources/schemas/custom_schemas/printXSDReference.xsd?rev=1347570&r1=1347569&r2=1347570&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/test-resources/schemas/custom_schemas/printXSDReference.xsd (original) +++ axis/axis2/java/core/trunk/modules/kernel/test-resources/schemas/custom_schemas/printXSDReference.xsd Thu Jun 7 11:12:45 2012 @@ -1,31 +1,26 @@ -<!-- - ~ 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. - --> +<!-- ~ 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. --> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3schools.com" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.w3schools.com"> - <xs:element name="note"> - <xs:complexType> - <xs:sequence> - <xs:element name="to" type="xs:string"/> - <xs:element name="from" type="xs:string"/> - <xs:element name="heading" type="xs:string"/> - <xs:element name="body" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3schools.com" + attributeFormDefault="unqualified" elementFormDefault="qualified" + targetNamespace="http://www.w3schools.com"> + <xs:element name="note"> + <xs:complexType> + <xs:sequence> + <xs:element name="to" type="xs:string" /> + <xs:element name="from" type="xs:string" /> + <xs:element name="heading" type="xs:string" /> + <xs:element name="body" type="xs:string" /> + </xs:sequence> + </xs:complexType> + </xs:element> </xs:schema> Modified: axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/printWSDLreference.wsdl URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/printWSDLreference.wsdl?rev=1347570&r1=1347569&r2=1347570&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/printWSDLreference.wsdl (original) +++ axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/printWSDLreference.wsdl Thu Jun 7 11:12:45 2012 @@ -1,5 +1,4 @@ <?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 @@ -18,62 +17,13 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - -<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://echo.sample.axis2.apache.org" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://echo.sample.axis2.apache.org"> - <wsdl:types> - <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://echo.sample.axis2.apache.org"> - <xs:element name="echoStringArray"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="in" nillable="true" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="echoStringArrayResponse"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="echoString"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="in" nillable="true" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="echoStringResponse"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:schema> - </wsdl:types> - <wsdl:message name="echoStringArrayRequest"> - <wsdl:part name="parameters" element="ns:echoStringArray"/> - </wsdl:message> - <wsdl:message name="echoStringArrayResponse"> - <wsdl:part name="parameters" element="ns:echoStringArrayResponse"/> - </wsdl:message> - <wsdl:message name="echoStringRequest"> - <wsdl:part name="parameters" element="ns:echoString"/> - </wsdl:message> - <wsdl:message name="echoStringResponse"> - <wsdl:part name="parameters" element="ns:echoStringResponse"/> - </wsdl:message> - <wsdl:portType name="MessagetestServicePortType"> - <wsdl:operation name="echoStringArray"> - <wsdl:input message="ns:echoStringArrayRequest" wsaw:Action="urn:echoStringArray"/> - <wsdl:output message="ns:echoStringArrayResponse" wsaw:Action="urn:echoStringArrayResponse"/> - </wsdl:operation> - <wsdl:operation name="echoString"> - <wsdl:input message="ns:echoStringRequest" wsaw:Action="urn:echoString"/> - <wsdl:output message="ns:echoStringResponse" wsaw:Action="urn:echoStringResponse"/> +<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tns="http://ws.apache.org/axis2" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://ws.apache.org/axis2"> + <wsdl:types/> + <wsdl:portType name="testPortType"> + <wsdl:operation name="test"> + <wsdl:input message="tns:null" wsaw:Action="urn:test"/> + <wsdl:output message="tns:null" wsaw:Action="urn:testResponse"/> </wsdl:operation> </wsdl:portType> - <wsdl:service name="MessagetestService"/> + <wsdl:service name="test"/> </wsdl:definitions> Modified: axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl?rev=1347570&r1=1347569&r2=1347570&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl (original) +++ axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl Thu Jun 7 11:12:45 2012 @@ -1,3 +1,4 @@ +<?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 @@ -16,36 +17,13 @@ ~ specific language governing permissions and limitations ~ under the License. --> - - - -<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://echo.sample.axis2.apache.org" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://echo.sample.axis2.apache.org"><wsdl:types><xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://echo.sample.axis2.apache.org"> - <xs:element name="echoStringArray"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="in" nillable="true" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="echoStringArrayResponse"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="echoString"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="in" nillable="true" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="echoStringResponse"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> -</xs:schema></wsdl:types><wsdl:message name="echoStringArrayRequest"><wsdl:part name="parameters" element="ns:echoStringArray"/></wsdl:message><wsdl:message name="echoStringArrayResponse"><wsdl:part name="parameters" element="ns:echoStringArrayResponse"/></wsdl:message><wsdl:message name="echoStringRequest"><wsdl:part name="parameters" element="ns:echoString"/></wsdl:message><wsdl:message name="echoStringResponse"><wsdl:part name="parameters" element="ns:echoStringResponse"/></wsdl:message><wsdl:portType name="MessagetestServicePortType"><wsdl:operation name="echoStringArray"><wsdl:input message="ns:echoStringArrayRequest" wsaw:Action="urn:echoStringArray"/><wsdl:output message="ns:echoStringArrayResponse" wsaw:Action="urn:echoStringArrayResponse"/></wsdl:operation><wsdl:operation name="echoString"><wsdl:input message="ns:echoStringRequest" wsaw:Action="urn:echoString"/><wsdl:output message="ns:echoStringResponse" wsaw:Action="urn:echoStringResponse"/></wsdl:operation></wsdl :portType><wsdl:service name="MessagetestService"/></wsdl:definitions> +<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tns="http://ws.apache.org/axis2" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://ws.apache.org/axis2"> + <wsdl:types/> + <wsdl:portType name="testPortType"> + <wsdl:operation name="test"> + <wsdl:input message="tns:null" wsaw:Action="urn:test"/> + <wsdl:output message="tns:null" wsaw:Action="urn:testResponse"/> + </wsdl:operation> + </wsdl:portType> + <wsdl:service name="test"/> +</wsdl:definitions> Modified: axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl?rev=1347570&r1=1347569&r2=1347570&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl (original) +++ axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl Thu Jun 7 11:12:45 2012 @@ -1,3 +1,4 @@ +<?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 @@ -16,34 +17,29 @@ ~ specific language governing permissions and limitations ~ under the License. --> - -<wsdl2:description xmlns:wsdl2="http://www.w3.org/ns/wsdl" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://echo.sample.axis2.apache.org" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wrpc="http://www.w3.org/ns/wsdl/rpc" xmlns:tns="http://echo.sample.axis2.apache.org" xmlns:wsoap="http://www.w3.org/ns/wsdl/soap" xmlns:wsdlx="http://www.w3.org/ns/wsdl-extensions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:whttp="http://www.w3.org/ns/wsdl/http" targetNamespace="http://echo.sample.axis2.apache.org"><wsdl2:types><xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://echo.sample.axis2.apache.org"> - <xs:element name="echoStringArray"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="in" nillable="true" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="echoStringArrayResponse"> - <xs:complexType> - <xs:sequence> - <xs:element maxOccurs="unbounded" minOccurs="0" name="return" nillable="true" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="echoString"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="in" nillable="true" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> - <xs:element name="echoStringResponse"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/> - </xs:sequence> - </xs:complexType> - </xs:element> -</xs:schema></wsdl2:types><wsdl2:interface name="ServiceInterface"><wsdl2:operation name="echoStringArray" style="http://www.w3.org/ns/wsdl/style/rpc" wrpc:signature="in #in return #return " pattern="http://www.w3.org/ns/wsdl/in-out"><wsdl2:input element="ns:echoStringArray" wsaw:Action="urn:echoStringArray"/><wsdl2:output element="ns:echoStringArrayResponse" wsaw:Action="urn:echoStringArrayResponse"/></wsdl2:operation><wsdl2:operation name="echoString" style="http://www.w3.org/ns/wsdl/style/rpc" wrpc:signature="in #in return #return " pattern="http://www.w3.org/ns/wsdl/in-out"><wsdl2:input element="ns:echoString" wsaw:Action="urn:echoString"/><wsdl2:output element="ns:echoStringResponse" wsaw:Action="urn:echoStringResponse"/></wsdl2:operation></wsdl2:interface><wsdl2:binding name="MessagetestServiceSOAP11Binding" interface="tns:ServiceInterface" type="http://www.w3.org/ns/wsdl/soap" wsoap:version="1.1" wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"><wsdl2:ope ration ref="tns:echoStringArray" wsoap:action="urn:echoStringArray"/><wsdl2:operation ref="tns:echoString" wsoap:action="urn:echoString"/></wsdl2:binding><wsdl2:binding name="MessagetestServiceSOAP12Binding" interface="tns:ServiceInterface" type="http://www.w3.org/ns/wsdl/soap" wsoap:version="1.2" wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"><wsdl2:operation ref="tns:echoStringArray" wsoap:action="urn:echoStringArray"/><wsdl2:operation ref="tns:echoString" wsoap:action="urn:echoString"/></wsdl2:binding><wsdl2:binding name="MessagetestServiceSOAP11Binding" interface="tns:ServiceInterface" type="http://www.w3.org/ns/wsdl/soap" wsoap:version="1.1" wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"><wsdl2:operation ref="tns:echoStringArray" wsoap:action="urn:echoStringArray"/><wsdl2:operation ref="tns:echoString" wsoap:action="urn:echoString"/></wsdl2:binding><wsdl2:binding name="MessagetestServiceHttpBinding" interface="tns:ServiceInterface" type="ht tp://www.w3.org/ns/wsdl/http"><wsdl2:operation ref="tns:creatSeq" whttp:location="creatSeq"/><wsdl2:operation ref="tns:echoStringArray" whttp:location="echoStringArray"/><wsdl2:operation ref="tns:echoString" whttp:location="echoString"/></wsdl2:binding><wsdl2:service name="MessagetestService" interface="tns:ServiceInterface"/></wsdl2:description> +<wsdl2:description xmlns:wsdl2="http://www.w3.org/ns/wsdl" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:tns="http://ws.apache.org/axis2" xmlns:wsoap="http://www.w3.org/ns/wsdl/soap" xmlns:wrpc="http://www.w3.org/ns/wsdl/rpc" xmlns:wsdlx="http://www.w3.org/ns/wsdl-extensions" xmlns:whttp="http://www.w3.org/ns/wsdl/http" targetNamespace="http://ws.apache.org/axis2"> + <wsdl2:types/> + <wsdl2:interface name="ServiceInterface"> + <wsdl2:operation name="test" pattern="http://www.w3.org/ns/wsdl/in-out"> + <wsdl2:input element="#none" wsaw:Action="urn:test"/> + <wsdl2:output element="#none" wsaw:Action="urn:testResponse"/> + </wsdl2:operation> + </wsdl2:interface> + <wsdl2:binding name="testSOAP11Binding" interface="tns:ServiceInterface" type="http://www.w3.org/ns/wsdl/soap" wsoap:version="1.1" wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"> + <wsdl2:operation ref="tns:test" wsoap:action="urn:test"/> + </wsdl2:binding> + <wsdl2:binding name="testSOAP12Binding" interface="tns:ServiceInterface" type="http://www.w3.org/ns/wsdl/soap" wsoap:version="1.2" wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"> + <wsdl2:operation ref="tns:test" wsoap:action="urn:test"/> + </wsdl2:binding> + <wsdl2:binding name="testSOAP11Binding" interface="tns:ServiceInterface" type="http://www.w3.org/ns/wsdl/soap" wsoap:version="1.1" wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP"> + <wsdl2:operation ref="tns:test" wsoap:action="urn:test"/> + </wsdl2:binding> + <wsdl2:binding name="testHttpBinding" interface="tns:ServiceInterface" type="http://www.w3.org/ns/wsdl/http"> + <wsdl2:operation ref="tns:test" whttp:location="test"/> + </wsdl2:binding> + <wsdl2:service name="test" interface="tns:ServiceInterface"> + <wsdl2:endpoint name="SOAP11Endpoint" binding="tns:testSOAP11Binding" address="test"/> + <wsdl2:endpoint name="SOAP12Endpoint" binding="tns:testSOAP12Binding" address="test"/> + <wsdl2:endpoint name="HTTPEndpoint" binding="tns:testHttpBinding" address="test"/> + </wsdl2:service> +</wsdl2:description> Modified: axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisMessageTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisMessageTest.java?rev=1347570&r1=1347569&r2=1347570&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisMessageTest.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisMessageTest.java Thu Jun 7 11:12:45 2012 @@ -19,50 +19,140 @@ package org.apache.axis2.description; +import java.util.ArrayList; + import javax.xml.namespace.QName; -import org.apache.axis2.AbstractTestCase; -import org.apache.axis2.context.ConfigurationContextFactory; +import org.apache.axis2.AxisFault; +import org.apache.axis2.client.OperationClient; +import org.apache.axis2.client.Options; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.context.OperationContext; +import org.apache.axis2.context.ServiceContext; import org.apache.axis2.description.java2wsdl.XMLSchemaTest; -import org.apache.axis2.engine.AxisConfiguration; -import org.apache.axis2.wsdl.WSDLConstants; +import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaElement; public class AxisMessageTest extends XMLSchemaTest { private AxisMessage axisMessage; protected AxisService service; - + private ArrayList<XmlSchema> schemas; private XmlSchemaElement element; @Override public void setUp() throws Exception { - String filename = AbstractTestCase.basedir - + "/test-resources/deployment/AxisMessageTestRepo"; - AxisConfiguration er = ConfigurationContextFactory - .createConfigurationContextFromFileSystem(filename, - filename + "/axis2.xml").getAxisConfiguration(); - - assertNotNull(er); - service = er.getService("MessagetestService"); - assertNotNull(service); - AxisOperation op = service.getOperation(new QName("echoString")); - assertNotNull(op); - axisMessage = op.getMessage("In"); + service=new AxisService(); + schemas=new ArrayList<XmlSchema>(); + loadSampleSchemaFile(schemas); + service.addSchema(schemas); + AxisOperation axisOperation=new AxisOperation() { + + @Override + public void setRemainingPhasesInFlow(ArrayList list) { + // TODO Auto-generated method stub + + } + + @Override + public void setPhasesOutFlow(ArrayList list) { + // TODO Auto-generated method stub + + } + + @Override + public AxisService getAxisService() { + // TODO Auto-generated method stub + return service; + } + + @Override + public void setPhasesOutFaultFlow(ArrayList list) { + // TODO Auto-generated method stub + + } + + @Override + public void setPhasesInFaultFlow(ArrayList list) { + // TODO Auto-generated method stub + + } + + @Override + public ArrayList getRemainingPhasesInFlow() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ArrayList getPhasesOutFlow() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ArrayList getPhasesOutFaultFlow() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ArrayList getPhasesInFaultFlow() { + // TODO Auto-generated method stub + return null; + } + + @Override + public AxisMessage getMessage(String label) { + // TODO Auto-generated method stub + return null; + } + + @Override + public OperationClient createClient(ServiceContext sc, Options options) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void addMessageContext(MessageContext msgContext, OperationContext opContext) + throws AxisFault { + // TODO Auto-generated method stub + + } + + @Override + public void addMessage(AxisMessage message, String label) { + // TODO Auto-generated method stub + + } + + @Override + public void addFaultMessageContext(MessageContext msgContext, OperationContext opContext) + throws AxisFault { + // TODO Auto-generated method stub + + } + }; + axisMessage = new AxisMessage(); + axisMessage.setParent(axisOperation); + axisMessage.setElementQName(new QName("http://www.w3schools.com", "note")); super.setUp(); } @Override protected void tearDown() throws Exception { axisMessage = null; + service=null; + schemas=null; super.tearDown(); } public void testGetSchemaElement() throws Exception { element = axisMessage.getSchemaElement(); - assertEquals(element.getName(), "echoString"); - assertEquals(element.getQName(), new QName( - "http://echo.sample.axis2.apache.org", "echoString")); + assertNotNull(element); + assertEquals(element.getName(), "note"); + } } Modified: axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisService2WSDLTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisService2WSDLTest.java?rev=1347570&r1=1347569&r2=1347570&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisService2WSDLTest.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisService2WSDLTest.java Thu Jun 7 11:12:45 2012 @@ -19,32 +19,64 @@ package org.apache.axis2.description; +import java.io.ByteArrayOutputStream; import java.io.File; -import java.io.PrintWriter; + +import javax.xml.namespace.QName; import org.apache.axiom.om.OMElement; +import org.apache.axis2.description.java2wsdl.XMLSchemaTest; +import org.apache.axis2.util.Utils; +import org.apache.axis2.util.XMLPrettyPrinter; + +public class AxisService2WSDLTest extends XMLSchemaTest { + + private AxisService service; + private ByteArrayOutputStream stream; + + @Override + protected void setUp() throws Exception { + service = Utils.createSimpleService(new QName("test"), "", new QName("test")); + stream = new ByteArrayOutputStream(); + } + @Override + protected void tearDown() throws Exception { + service = null; + stream = null; + super.tearDown(); + } -public class AxisService2WSDLTest extends AxisMessageTest{ - - //This test implicitly test the checkStyle(axisOperation); method - //This test belongs to AxisService2WSDL20 class - public void testGenerateInterfaceOperationElement20() throws Exception{ + // This test implicitly test the checkStyle(axisOperation); method + // This test belongs to AxisService2WSDL20 class + public void testGenerateInterfaceOperationElement20() throws Exception { + // if this not null test becomes useless assertNull(service.getParameterValue(WSDL2Constants.OPERATION_STYLE)); - AxisService2WSDL20 service2wsdl20=new AxisService2WSDL20(service); - OMElement element=service2wsdl20.generateOM(); - String s=readFile("test-resources"+ File.separator + "wsdl" + File.separator +"testGenerateInterfaceOperationElement_WSDL.wsdl"); - assertSimilarXML(s, element.toString()); - + AxisService2WSDL20 service2wsdl20 = new AxisService2WSDL20(service); + OMElement element = service2wsdl20.generateOM(); + // writeToFile("test-resources" + File.separator + "wsdl" + + // File.separator + // + "testGenerateInterfaceOperationElement_WSDL.wsdl", + // element.toString()); + XMLPrettyPrinter.prettify(element, stream); + assertSimilarXML(stream.toString(), readWSDLFromFile("test-resources" + File.separator + + "wsdl" + File.separator + "testGenerateInterfaceOperationElement_WSDL.wsdl")); + } - - //This test belongs to AxisService2WSDL11 class + + // This test belongs to AxisService2WSDL11 class public void testGenerateInterfaceOperationElement11() throws Exception { + // if this not null test becomes useless assertNull(service.getParameterValue(WSDL2Constants.OPERATION_STYLE)); - AxisService2WSDL11 service2wsdl11=new AxisService2WSDL11(service); - OMElement element=service2wsdl11.generateOM(); - String s=readFile("test-resources"+ File.separator + "wsdl" + File.separator +"testGenerateInterfaceOperationElement11_WSDL.wsdl"); - assertSimilarXML(s, element.toString()); + AxisService2WSDL11 service2wsdl11 = new AxisService2WSDL11(service); + OMElement element = service2wsdl11.generateOM(); + // writeToFile("test-resources" + File.separator + "wsdl" + + // File.separator + // + + // "testGenerateInterfaceOperationElement11_WSDL.wsdl",element.toString()); + XMLPrettyPrinter.prettify(element, stream); + assertSimilarXML(stream.toString(), readWSDLFromFile("test-resources" + File.separator + + "wsdl" + File.separator + "testGenerateInterfaceOperationElement11_WSDL.wsdl")); } Modified: axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisServiceTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisServiceTest.java?rev=1347570&r1=1347569&r2=1347570&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisServiceTest.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/AxisServiceTest.java Thu Jun 7 11:12:45 2012 @@ -27,20 +27,22 @@ import java.io.ObjectOutputStream; import java.util.ArrayList; import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.stream.StreamSource; -import org.apache.axis2.AbstractTestCase; import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.context.ConfigurationContextFactory; import org.apache.axis2.context.MessageContext; import org.apache.axis2.context.ServiceContext; import org.apache.axis2.context.ServiceGroupContext; import org.apache.axis2.deployment.DeploymentConstants; import org.apache.axis2.description.java2wsdl.XMLSchemaTest; import org.apache.axis2.engine.AxisConfiguration; +import org.apache.axis2.util.Utils; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaCollection; import org.apache.ws.commons.schema.XmlSchemaElement; +import org.w3c.dom.ls.DOMImplementationLS; +import org.w3c.dom.ls.LSSerializer; public class AxisServiceTest extends XMLSchemaTest { public static final String PARAM_NAME = "CustomParameter"; @@ -262,27 +264,33 @@ public class AxisServiceTest extends XML service.printXSD(stream, ""); // service has a single schema and it is printed. The it is compared // with the saved file - assertSimilarXML(stream.toString(), readFile(SampleSchemasDirectory + assertSimilarXML(stream.toString(), readXMLfromSchemaFile(SampleSchemasDirectory + "printXSDReference.xsd")); } public void testPrintWSDL() throws Exception { - // create a test service - // if MessageTestService is changed somehow printWSDLreference.wsdl file - // must changed according to it. Otherwise the test will fail - String filename = AbstractTestCase.basedir - + "/test-resources/deployment/AxisMessageTestRepo"; - AxisConfiguration er = ConfigurationContextFactory - .createConfigurationContextFromFileSystem(filename, filename + "/axis2.xml") - .getAxisConfiguration(); - - assertNotNull(er); - service = er.getService("MessagetestService"); + service = Utils.createSimpleService(new QName("test"), "", new QName("test")); ByteArrayOutputStream stream = new ByteArrayOutputStream(); - service.printWSDL(stream, null); - // printed WSDL value is compared with saved value - assertSimilarXML(stream.toString(), readFile("test-resources" + File.separator + "wsdl" - + File.separator + "printWSDLreference.wsdl")); + service.printWSDL(stream); + + String s = readWSDLFromFile("test-resources" + File.separator + "wsdl" + File.separator + + "printWSDLreference.wsdl"); + assertSimilarXML(stream.toString(), s); + } + + public String convertXMLFileToString(String fileName) { + try { + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + InputStream inputStream = new FileInputStream(new File(fileName)); + org.w3c.dom.Document doc = documentBuilderFactory.newDocumentBuilder().parse( + inputStream); + DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation(); + LSSerializer lsSerializer = domImplementation.createLSSerializer(); + return lsSerializer.writeToString(doc); + } catch (Exception e) { + e.printStackTrace(); + } + return null; } public void testGetSchema() throws Exception { Modified: axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/java2wsdl/XMLSchemaTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/java2wsdl/XMLSchemaTest.java?rev=1347570&r1=1347569&r2=1347570&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/java2wsdl/XMLSchemaTest.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/java2wsdl/XMLSchemaTest.java Thu Jun 7 11:12:45 2012 @@ -20,9 +20,11 @@ package org.apache.axis2.description.java2wsdl; import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; +import java.io.FileWriter; import java.io.InputStream; import java.util.ArrayList; @@ -30,6 +32,7 @@ import javax.xml.transform.stream.Stream import junit.framework.TestCase; +import org.apache.axis2.util.XMLPrettyPrinter; import org.apache.ws.commons.schema.XmlSchema; import org.apache.ws.commons.schema.XmlSchemaCollection; import org.custommonkey.xmlunit.Diff; @@ -103,9 +106,32 @@ public abstract class XMLSchemaTest exte int c = bufferedReader.read(); while (c != -1) { buffer[i++] = (char) c; - c = bufferedReader.read(); + c = bufferedReader.read(); } return new String(buffer); } + public String readXMLfromSchemaFile(String path) throws Exception { + InputStream is = new FileInputStream(path); + XmlSchemaCollection schemaCol = new XmlSchemaCollection(); + XmlSchema schema = schemaCol.read(new StreamSource(is), null); + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + schema.write(stream); + return stream.toString(); + } + + + public String readWSDLFromFile(String path) throws Exception { + File file=new File(path); + XMLPrettyPrinter.prettify(file); //this is used to correct unnecessary formatting in the file + return readFile(path); + } + + public void writeToFile(String path,String data) throws Exception{ + FileWriter fileWriter=new FileWriter(new File(path)); + fileWriter.write(data); + fileWriter.flush(); + fileWriter.close(); + } + }