Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBDataHandlerStreamReader.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBDataHandlerStreamReader.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBDataHandlerStreamReader.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBDataHandlerStreamReader.java Sun Dec 17 22:34:08 2017 @@ -19,6 +19,9 @@ package org.apache.axis2.databinding.utils.reader; +import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; +import org.apache.axiom.ext.stax.datahandler.DataHandlerReader; +import org.apache.axiom.util.stax.XMLStreamReaderUtils; import org.apache.axis2.databinding.utils.ConverterUtil; import javax.activation.DataHandler; @@ -27,7 +30,7 @@ import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; -public class ADBDataHandlerStreamReader implements ADBXMLStreamReader { +public class ADBDataHandlerStreamReader implements ADBXMLStreamReader, DataHandlerReader { private static final int START_ELEMENT_STATE = 0; private static final int TEXT_STATE = 1; private static final int END_ELEMENT_STATE = 2; @@ -59,18 +62,37 @@ public class ADBDataHandlerStreamReader * @throws IllegalArgumentException */ public Object getProperty(String propKey) throws IllegalArgumentException { - if (OPTIMIZATION_ENABLED.equals(propKey)) { - return Boolean.TRUE; - } - if (state == TEXT_STATE) { - if (IS_BINARY.equals(propKey)) { - return Boolean.TRUE; - } else if (DATA_HANDLER.equals(propKey)) { - return value; - } - } + return XMLStreamReaderUtils.processGetProperty(this, propKey); + } + + @Override + public boolean isBinary() { + return state == TEXT_STATE; + } + + @Override + public boolean isOptimized() { + return true; + } + + @Override + public boolean isDeferred() { + return false; + } + + @Override + public String getContentID() { return null; + } + + @Override + public DataHandler getDataHandler() throws XMLStreamException { + return value; + } + @Override + public DataHandlerProvider getDataHandlerProvider() { + throw new UnsupportedOperationException(); } public int next() throws XMLStreamException {
Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderImpl.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderImpl.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderImpl.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderImpl.java Sun Dec 17 22:34:08 2017 @@ -19,10 +19,12 @@ package org.apache.axis2.databinding.utils.reader; +import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; +import org.apache.axiom.ext.stax.datahandler.DataHandlerReader; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; -import org.apache.axiom.om.impl.util.OMSerializerUtil; +import org.apache.axiom.util.stax.XMLStreamReaderUtils; import org.apache.axis2.databinding.typemapping.SimpleTypeMapper; import org.apache.axis2.databinding.utils.BeanUtil; import org.apache.axis2.databinding.utils.ConverterUtil; @@ -34,6 +36,7 @@ import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.lang.reflect.Array; /** @@ -57,8 +60,9 @@ import java.lang.reflect.Array; * possible * <p/> */ -public class ADBXMLStreamReaderImpl implements ADBXMLStreamReader { - +public class ADBXMLStreamReaderImpl implements ADBXMLStreamReader, DataHandlerReader { + private static final AtomicInteger nsPrefix = new AtomicInteger(); + private Object[] properties; private Object[] attributes; private QName elementQName; @@ -128,7 +132,7 @@ public class ADBXMLStreamReaderImpl impl if(qname !=null){ String prefix =qname.getPrefix(); if(prefix == null || "".equals(prefix)){ - prefix = OMSerializerUtil.getNextNSPrefix(); + prefix = getNextNSPrefix(); } qname = new QName(qname.getNamespaceURI(),qname.getLocalPart(),prefix); this.typeTable.getComplexSchemaMap().put(key,qname); @@ -140,6 +144,10 @@ public class ADBXMLStreamReaderImpl impl } } + private static String getNextNSPrefix() { + return "ns" + nsPrefix.incrementAndGet(); + } + /** add the namespace context */ public void addNamespaceContext(NamespaceContext nsContext) { @@ -168,20 +176,37 @@ public class ADBXMLStreamReaderImpl impl * @throws IllegalArgumentException */ public Object getProperty(String key) throws IllegalArgumentException { - if (OPTIMIZATION_ENABLED.equals(key)) { - return Boolean.TRUE; - } else if (state == TEXT_STATE) { - if (IS_BINARY.equals(key)) { - return Boolean.FALSE; - } else { - return null; - } - } else if (state == DELEGATED_STATE) { - return childReader.getProperty(key); - } else { - return null; - } + return XMLStreamReaderUtils.processGetProperty(this, key); + } + + @Override + public boolean isBinary() { + return state == DELEGATED_STATE && childReader instanceof DataHandlerReader && ((DataHandlerReader)childReader).isBinary(); + } + + @Override + public boolean isOptimized() { + return ((DataHandlerReader)childReader).isOptimized(); + } + + @Override + public boolean isDeferred() { + return ((DataHandlerReader)childReader).isDeferred(); + } + + @Override + public String getContentID() { + return ((DataHandlerReader)childReader).getContentID(); + } + + @Override + public DataHandler getDataHandler() throws XMLStreamException { + return ((DataHandlerReader)childReader).getDataHandler(); + } + @Override + public DataHandlerProvider getDataHandlerProvider() { + return ((DataHandlerReader)childReader).getDataHandlerProvider(); } public void require(int i, String string, String string1) @@ -454,7 +479,7 @@ public class ADBXMLStreamReaderImpl impl // first check it is already there if not add the namespace. String prefix = namespaceContext.getPrefix(attributeQName.getNamespaceURI()); if (prefix == null){ - prefix = OMSerializerUtil.getNextNSPrefix(); + prefix = getNextNSPrefix(); addToNsMap(prefix,attributeQName.getNamespaceURI()); } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/NameValuePairStreamReader.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/NameValuePairStreamReader.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/NameValuePairStreamReader.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/NameValuePairStreamReader.java Sun Dec 17 22:34:08 2017 @@ -49,19 +49,7 @@ public class NameValuePairStreamReader i } public Object getProperty(String key) throws IllegalArgumentException { - //since optimization is a global property - //we've to implement it everywhere - if (OPTIMIZATION_ENABLED.equals(key)) { - return Boolean.TRUE; - } else if (state == TEXT_STATE) { - if (IS_BINARY.equals(key)) { - return Boolean.FALSE; - } else { - return null; - } - } else { - return null; - } + return null; } public int next() throws XMLStreamException { Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/NullXMLStreamReader.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/NullXMLStreamReader.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/NullXMLStreamReader.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/NullXMLStreamReader.java Sun Dec 17 22:34:08 2017 @@ -44,13 +44,7 @@ public class NullXMLStreamReader impleme } public Object getProperty(String key) throws IllegalArgumentException { - //since optimization is a global property - //we've to implement it everywhere - if (OPTIMIZATION_ENABLED.equals(key)) { - return Boolean.TRUE; - } else { - return null; - } + return null; } public int next() throws XMLStreamException { Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/WrappingXMLStreamReader.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/WrappingXMLStreamReader.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/WrappingXMLStreamReader.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/databinding/utils/reader/WrappingXMLStreamReader.java Sun Dec 17 22:34:08 2017 @@ -19,20 +19,27 @@ package org.apache.axis2.databinding.utils.reader; +import javax.activation.DataHandler; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import javax.xml.stream.Location; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; -public class WrappingXMLStreamReader implements ADBXMLStreamReader { +import org.apache.axiom.ext.stax.datahandler.DataHandlerProvider; +import org.apache.axiom.ext.stax.datahandler.DataHandlerReader; +import org.apache.axiom.util.stax.XMLStreamReaderUtils; + +public class WrappingXMLStreamReader implements ADBXMLStreamReader, DataHandlerReader { private XMLStreamReader reader; + private DataHandlerReader dataHandlerReader; private int depth; private boolean done; public WrappingXMLStreamReader(XMLStreamReader reader) { this.reader = reader; + dataHandlerReader = XMLStreamReaderUtils.getDataHandlerReader(reader); } public boolean isDone() { @@ -40,7 +47,37 @@ public class WrappingXMLStreamReader imp } public Object getProperty(String string) throws IllegalArgumentException { - return reader.getProperty(string); + return XMLStreamReaderUtils.processGetProperty(this, string); + } + + @Override + public boolean isBinary() { + return dataHandlerReader != null && dataHandlerReader.isBinary(); + } + + @Override + public boolean isOptimized() { + return dataHandlerReader.isOptimized(); + } + + @Override + public boolean isDeferred() { + return dataHandlerReader.isDeferred(); + } + + @Override + public String getContentID() { + return dataHandlerReader.getContentID(); + } + + @Override + public DataHandler getDataHandler() throws XMLStreamException { + return dataHandlerReader.getDataHandler(); + } + + @Override + public DataHandlerProvider getDataHandlerProvider() { + return dataHandlerReader.getDataHandlerProvider(); } public int next() throws XMLStreamException { Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/rpc/receivers/RPCMessageReceiver.java Sun Dec 17 22:34:08 2017 @@ -25,8 +25,8 @@ package org.apache.axis2.rpc.receivers; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; -import org.apache.axiom.om.OMAbstractFactory; -import org.apache.axiom.om.impl.builder.StAXOMBuilder; +import org.apache.axiom.om.OMXMLBuilderFactory; +import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPBody; import org.apache.axiom.soap.SOAPEnvelope; import org.apache.axiom.soap.SOAPFactory; @@ -201,8 +201,8 @@ public class RPCMessageReceiver extends QName innerElementQName = new QName(elementQName.getNamespaceURI(), getSimpleClassName(exceptionType)); XMLStreamReader xr = BeanUtil.getPullParser(cause, innerElementQName, typeTable, true, false); - StAXOMBuilder stAXOMBuilder = new StAXOMBuilder(OMAbstractFactory.getOMFactory(), new StreamWrapper(xr)); - OMElement documentElement = stAXOMBuilder.getDocumentElement(); + OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(new StreamWrapper(xr)); + OMElement documentElement = builder.getDocumentElement(); exceptionElement.addChild(documentElement); } } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/adb/src/org/apache/axis2/rpc/receivers/RPCUtil.java Sun Dec 17 22:34:08 2017 @@ -41,6 +41,7 @@ import org.apache.axis2.description.java import org.apache.axis2.engine.ObjectSupplier; import org.apache.axis2.util.StreamWrapper; +import javax.activation.DataHandler; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamReader; @@ -355,7 +356,7 @@ public class RPCUtil { } else { resElemt = fac.createOMElement(partName, null); } - OMText text = fac.createOMText(resObject, true); + OMText text = fac.createOMText((DataHandler)resObject, true); resElemt.addChild(text); envelope.getBody().addChild(resElemt); } else { @@ -514,7 +515,7 @@ public class RPCUtil { } else if (SimpleTypeMapper.isDataHandler(resObject.getClass())) { OMElement resElemt = fac.createOMElement(method.getName() + "Response", ns); - OMText text = fac.createOMText(resObject, true); + OMText text = fac.createOMText((DataHandler)resObject, true); OMElement returnElement; if (service.isElementFormDefault()) { returnElement = fac.createOMElement(Constants.RETURN_WRAPPER, ns); Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/adb/test/org/apache/axis2/databinding/utils/BeanUtilTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/adb/test/org/apache/axis2/databinding/utils/BeanUtilTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/adb/test/org/apache/axis2/databinding/utils/BeanUtilTest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/adb/test/org/apache/axis2/databinding/utils/BeanUtilTest.java Sun Dec 17 22:34:08 2017 @@ -34,6 +34,9 @@ import javax.activation.DataHandler; import javax.mail.util.ByteArrayDataSource; import javax.xml.namespace.QName; +import static com.google.common.truth.Truth.assertAbout; +import static org.apache.axiom.truth.xml.XMLTruth.xml; + import java.io.ByteArrayInputStream; import java.math.BigInteger; import java.util.List; @@ -283,5 +286,14 @@ public class BeanUtilTest extends TestCa return new String(theChars); } - + /** + * Regression test for AXIS2-5751. + */ + public void testSerializeAnyTypeNull() { + assertAbout(xml()) + .that(BeanUtil.getPullParser(new ComplexTypeWithAnyTypeElement(), new QName("root"), null, false, false)) + .ignoringNamespaceDeclarations() + .ignoringNamespacePrefixes() + .hasSameContentAs("<root><prop xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:nil='true'/></root>"); + } } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/adb/test/org/apache/axis2/databinding/utils/ConverterUtilTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/adb/test/org/apache/axis2/databinding/utils/ConverterUtilTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/adb/test/org/apache/axis2/databinding/utils/ConverterUtilTest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/adb/test/org/apache/axis2/databinding/utils/ConverterUtilTest.java Sun Dec 17 22:34:08 2017 @@ -21,6 +21,8 @@ package org.apache.axis2.databinding.uti import junit.framework.TestCase; +import static com.google.common.truth.Truth.assertThat; + import java.math.BigDecimal; import java.math.BigInteger; import java.text.SimpleDateFormat; @@ -560,5 +562,8 @@ public class ConverterUtilTest extends T } - + public void testCompareInt() { + // https://stackoverflow.com/questions/46372764/axis2-adb-and-mininclusive-2147483648 + assertThat(ConverterUtil.compare(3, "-2147483648")).isGreaterThan(0); + } } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/adb/test/org/apache/axis2/databinding/utils/reader/ADBXMLStreamReaderTest.java Sun Dec 17 22:34:08 2017 @@ -25,11 +25,9 @@ import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; -import org.apache.axiom.om.impl.serialize.StreamingOMSerializer; -import org.apache.axiom.om.util.StAXUtils; +import org.apache.axiom.om.OMXMLBuilderFactory; import org.apache.axiom.util.base64.Base64Utils; import org.apache.axis2.databinding.utils.Constants; -import org.apache.axis2.util.StreamWrapper; import org.custommonkey.xmlunit.XMLTestCase; import org.w3c.dom.Document; import org.xml.sax.SAXException; @@ -41,9 +39,7 @@ import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.ParserConfigurationException; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -823,21 +819,7 @@ public class ADBXMLStreamReaderTest exte * @return */ private String getStringXML(XMLStreamReader reader) throws XMLStreamException { - //the returned pullparser starts at an Element rather than the start - //document event. This is somewhat disturbing but since an ADBBean - //denotes an XMLFragment, it is justifiable to keep the current event - //at the Start-element rather than the start document - //What it boils down to is that we need to wrap the reader in a - //stream wrapper to get a fake start-document event - - StreamingOMSerializer ser = new StreamingOMSerializer(); - ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); - XMLStreamWriter writer = StAXUtils.createXMLStreamWriter(byteArrayOutputStream); - ser.serialize( - new StreamWrapper(reader), - writer); - writer.flush(); - return byteArrayOutputStream.toString(); + return OMXMLBuilderFactory.createStAXOMBuilder(reader).getDocumentElement().toString(); } // /** Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/pom.xml?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/pom.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/pom.xml Sun Dec 17 22:34:08 2017 @@ -23,9 +23,9 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.axis2</groupId> - <artifactId>axis2-parent</artifactId> - <version>1.7.0-SNAPSHOT</version> - <relativePath>../parent/pom.xml</relativePath> + <artifactId>axis2</artifactId> + <version>1.8.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> </parent> <artifactId>addressing</artifactId> <packaging>mar</packaging> Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInFaultHandler.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInFaultHandler.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInFaultHandler.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInFaultHandler.java Sun Dec 17 22:34:08 2017 @@ -90,12 +90,12 @@ public class AddressingInFaultHandler ex SOAPFaultCode code = fault.getCode(); SOAPFaultSubCode subCode = code.getSubCode(); if (subCode == null) { - faultLocalName = code.getTextAsQName().getLocalPart(); + faultLocalName = code.getValueAsQName().getLocalPart(); } else { while (subCode.getSubCode() != null) { subCode = subCode.getSubCode(); } - faultLocalName = subCode.getValue().getTextAsQName().getLocalPart(); + faultLocalName = subCode.getValueAsQName().getLocalPart(); } String newReason = AddressingFaultsHelper Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java Sun Dec 17 22:34:08 2017 @@ -568,7 +568,7 @@ public class AddressingOutHandler extend if (multipleHeaders) { if (replaceHeaders) { QName qname = new QName(addressingNamespace, name, WSA_DEFAULT_PREFIX); - Iterator iterator = header.getChildrenWithName(qname); + Iterator<OMElement> iterator = header.getChildrenWithName(qname); while (iterator.hasNext()) { iterator.next(); iterator.remove(); Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/test-resources/axis2.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/test-resources/axis2.xml?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/test-resources/axis2.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/test-resources/axis2.xml Sun Dec 17 22:34:08 2017 @@ -22,7 +22,7 @@ <parameter name="hotupdate">true</parameter> <messageReceiver mep="INOUT" class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> - <transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> + <transportSender name="http" class="org.apache.axis2.transport.http.impl.httpclient4.HTTPClient4TransportSender"> <parameter name="PROTOCOL">HTTP/1.0</parameter> </transportSender> Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingOutHandlerTest.java Sun Dec 17 22:34:08 2017 @@ -21,6 +21,7 @@ package org.apache.axis2.handlers.addres import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMAttribute; +import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMXMLParserWrapper; import org.apache.axiom.soap.SOAPEnvelope; @@ -303,7 +304,7 @@ public class AddressingOutHandlerTest ex assertEquals("http://whatever.org", defaultEnvelope.getHeader() .getFirstChildWithName(Final.QNAME_WSA_TO).getText()); - Iterator iterator = + Iterator<OMElement> iterator = defaultEnvelope.getHeader().getChildrenWithName(Final.QNAME_WSA_RELATES_TO); int i = 0; while (iterator.hasNext()) { @@ -346,7 +347,7 @@ public class AddressingOutHandlerTest ex assertEquals("http://whatever.org", defaultEnvelope.getHeader() .getFirstChildWithName(Final.QNAME_WSA_TO).getText()); - Iterator iterator = + Iterator<OMElement> iterator = defaultEnvelope.getHeader().getChildrenWithName(Final.QNAME_WSA_RELATES_TO); int i = 0; while (iterator.hasNext()) { @@ -384,7 +385,7 @@ public class AddressingOutHandlerTest ex assertEquals("http://oldEPR.org", defaultEnvelope.getHeader() .getFirstChildWithName(Final.QNAME_WSA_TO).getText()); - Iterator iterator = + Iterator<OMElement> iterator = defaultEnvelope.getHeader().getChildrenWithName(Final.QNAME_WSA_RELATES_TO); int i = 0; while (iterator.hasNext()) { Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/clustering/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/clustering/pom.xml?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/clustering/pom.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/clustering/pom.xml Sun Dec 17 22:34:08 2017 @@ -23,9 +23,9 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.axis2</groupId> - <artifactId>axis2-parent</artifactId> - <version>1.7.0-SNAPSHOT</version> - <relativePath>../parent/pom.xml</relativePath> + <artifactId>axis2</artifactId> + <version>1.8.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> </parent> <artifactId>axis2-clustering</artifactId> <name>Apache Axis2 - Clustering</name> Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/build-wsdls.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/build-wsdls.xml?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/build-wsdls.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/build-wsdls.xml Sun Dec 17 22:34:08 2017 @@ -40,6 +40,7 @@ <mkdir dir="target/test-classes"/> <java fork="yes" classname="org.apache.axis2.wsdl.WSDL2Java" failonerror="yes"> + <jvmarg value="-Djavax.xml.accessExternalSchema=all" /> <classpath refid="maven.test.classpath" /> <classpath location="${compiled.classes.dir}" /> <arg line="-ap -o ${wsdl.output.base.dir}/version -d none -s -u -uri test-resources/wsdls/Version.wsdl" /> Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/pom.xml?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/pom.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/pom.xml Sun Dec 17 22:34:08 2017 @@ -23,9 +23,9 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.axis2</groupId> - <artifactId>axis2-parent</artifactId> - <version>1.7.0-SNAPSHOT</version> - <relativePath>../parent/pom.xml</relativePath> + <artifactId>axis2</artifactId> + <version>1.8.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> </parent> <artifactId>axis2-codegen</artifactId> <name>Apache Axis2 - Code Generation</name> @@ -42,6 +42,11 @@ <version>${project.version}</version> </dependency> <dependency> + <groupId>com.google.googlejavaformat</groupId> + <artifactId>google-java-format</artifactId> + <version>1.3</version> + </dependency> + <dependency> <groupId>${project.groupId}</groupId> <artifactId>axis2-transport-local</artifactId> <version>${project.version}</version> @@ -55,7 +60,7 @@ </dependency> <dependency> <groupId>com.sun.xml.ws</groupId> - <artifactId>jaxws-tools</artifactId> + <artifactId>jaxws-tools</artifactId> <exclusions> <exclusion> <groupId>com.sun.xml.ws</groupId> @@ -68,20 +73,25 @@ </exclusions> </dependency> <dependency> - <groupId>com.sun.xml.bind</groupId> - <artifactId>jaxb-xjc</artifactId> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-xjc</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.sun.xml.ws</groupId> - <artifactId>jaxws-rt</artifactId> + <artifactId>jaxws-rt</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>xmlunit</groupId> - <artifactId>xmlunit</artifactId> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>xmlunit</groupId> + <artifactId>xmlunit</artifactId> <scope>test</scope> - </dependency> + </dependency> </dependencies> <url>http://axis.apache.org/axis2/java/core/</url> <scm> @@ -138,10 +148,10 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <inherited>true</inherited> - <configuration> + <configuration> <includes> - <include>**/*Test.java</include> - </includes> + <include>**/*Test.java</include> + </includes> </configuration> </plugin> @@ -209,7 +219,7 @@ </goals> <configuration> <outputDirectory>${project.build.directory}/templates</outputDirectory> - <resources> + <resources> <resource> <directory>../adb-codegen/src</directory> <includes> @@ -229,13 +239,13 @@ </includes> </resource> <resource> - <directory>../jibx/src</directory> + <directory>../jibx-codegen/src</directory> <includes> <include>**/*.xsl</include> </includes> </resource> - </resources> - </configuration> + </resources> + </configuration> </execution> </executions> </plugin> Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java Sun Dec 17 22:34:08 2017 @@ -28,7 +28,9 @@ import java.util.Map; import org.apache.axis2.util.CommandLineOption; import org.apache.axis2.util.CommandLineOptionConstants; import org.apache.axis2.util.CommandLineOptionParser; +import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationEngine; +import org.apache.axis2.wsdl.codegen.CodegenConfigLoader; import org.apache.axis2.wsdl.codegen.jaxws.JAXWSCodeGenerationEngine; import org.apache.axis2.wsdl.i18n.CodegenMessages; import org.apache.axis2.wsdl.util.WSDL2JavaOptionsValidator; @@ -47,7 +49,9 @@ public class WSDL2Code { return; } if (isOptionsValid(commandLineOptionParser)){ - new CodeGenerationEngine(commandLineOptionParser).generate(); + CodeGenConfiguration config = new CodeGenConfiguration(); + CodegenConfigLoader.loadConfig(config, commandLineOptionParser.getAllOptions()); + new CodeGenerationEngine(config).generate(); } else { printUsage(); } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenConfiguration.java Sun Dec 17 22:34:08 2017 @@ -19,19 +19,32 @@ package org.apache.axis2.wsdl.codegen; +import org.apache.axis2.AxisFault; import org.apache.axis2.description.AxisService; -import org.apache.axis2.util.CommandLineOption; +import org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder; +import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; +import org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder; +import org.apache.axis2.description.WSDL20ToAxisServiceBuilder; import org.apache.axis2.util.CommandLineOptionConstants; import org.apache.axis2.util.URLProcessor; +import org.apache.axis2.wsdl.WSDLUtil; import org.apache.axis2.wsdl.databinding.TypeMapper; +import org.apache.axis2.wsdl.i18n.CodegenMessages; import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader; import org.apache.ws.commons.schema.XmlSchema; import javax.wsdl.Definition; +import javax.wsdl.WSDLException; +import javax.wsdl.xml.WSDLReader; +import javax.xml.namespace.QName; + import java.io.File; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URISyntaxException; +import java.net.URL; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -174,6 +187,10 @@ public class CodeGenConfiguration implem this.outputLanguage = outputLanguage; } + public void setOutputEncoding(String outputEncoding) { + this.outputEncoding = outputEncoding; + } + public void setAdvancedCodeGenEnabled(boolean advancedCodeGenEnabled) { this.advancedCodeGenEnabled = advancedCodeGenEnabled; } @@ -206,6 +223,7 @@ public class CodeGenConfiguration implem //get the defaults for these from the property file private String outputLanguage = ConfigPropertyFileLoader.getDefaultLanguage(); + private String outputEncoding = System.getProperty("file.encoding"); private String databindingType = ConfigPropertyFileLoader.getDefaultDBFrameworkName(); private boolean advancedCodeGenEnabled = false; @@ -377,8 +395,7 @@ public class CodeGenConfiguration implem * * @param optionMap */ - public CodeGenConfiguration(Map<String,CommandLineOption> optionMap) { - CodegenConfigLoader.loadConfig(this, optionMap); + public CodeGenConfiguration() { this.axisServices = new ArrayList<AxisService>(); this.outputFileNamesList = new ArrayList<String>(); } @@ -393,6 +410,10 @@ public class CodeGenConfiguration implem return outputLanguage; } + public String getOutputEncoding() { + return outputEncoding; + } + public boolean isAdvancedCodeGenEnabled() { return advancedCodeGenEnabled; } @@ -640,4 +661,126 @@ public class CodeGenConfiguration implem public void setUseOperationName(boolean useOperationName) { isUseOperationName = useOperationName; } + + public void loadWsdl(String wsdlUri) throws CodeGenerationException { + try { + // the redirected urls gives problems in code generation some times with jaxbri + // eg. https://www.paypal.com/wsdl/PayPalSvc.wsdl + // if there is a redirect url better to find it and use. + if (wsdlUri.startsWith("http")) { + URL url = new URL(wsdlUri); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setInstanceFollowRedirects(false); + connection.getResponseCode(); + String newLocation = connection.getHeaderField("Location"); + if (newLocation != null){ + wsdlUri = newLocation; + } + } + + if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2. + equals(getWSDLVersion())) { + + WSDL20ToAxisServiceBuilder builder; + + // jibx currently does not support multiservice + if ((getServiceName() != null) || (getDatabindingType().equals("jibx"))) { + builder = new WSDL20ToAxisServiceBuilder( + wsdlUri, + getServiceName(), + getPortName(), + isAllPorts()); + builder.setCodegen(true); + addAxisService(builder.populateService()); + } else { + builder = new WSDL20ToAllAxisServicesBuilder(wsdlUri, getPortName()); + builder.setCodegen(true); + builder.setAllPorts(isAllPorts()); + setAxisServices( + ((WSDL20ToAllAxisServicesBuilder)builder).populateAllServices()); + } + + } else { + //It'll be WSDL 1.1 + Definition wsdl4jDef = readInTheWSDLFile(wsdlUri); + + // we save the original wsdl definition to write it to the resource folder later + // this is required only if it has imports + Map imports = wsdl4jDef.getImports(); + if ((imports != null) && (imports.size() > 0)) { + setWsdlDefinition(readInTheWSDLFile(wsdlUri)); + } else { + setWsdlDefinition(wsdl4jDef); + } + + // we generate the code for one service and one port if the + // user has specified them. + // otherwise generate the code for every service. + // TODO: find out a permanant solution for this. + QName serviceQname = null; + + if (getServiceName() != null) { + serviceQname = new QName(wsdl4jDef.getTargetNamespace(), + getServiceName()); + } + + WSDL11ToAxisServiceBuilder builder; + // jibx currently does not support multiservice + if ((serviceQname != null) || (getDatabindingType().equals("jibx"))) { + builder = new WSDL11ToAxisServiceBuilder( + wsdl4jDef, + serviceQname, + getPortName(), + isAllPorts()); + builder.setCodegen(true); + addAxisService(builder.populateService()); + } else { + builder = new WSDL11ToAllAxisServicesBuilder(wsdl4jDef, getPortName()); + builder.setCodegen(true); + builder.setAllPorts(isAllPorts()); + setAxisServices( + ((WSDL11ToAllAxisServicesBuilder)builder).populateAllServices()); + } + } + setBaseURI(getBaseURI(wsdlUri)); + } catch (AxisFault axisFault) { + throw new CodeGenerationException( + CodegenMessages.getMessage("engine.wsdlParsingException"), axisFault); + } catch (WSDLException e) { + throw new CodeGenerationException( + CodegenMessages.getMessage("engine.wsdlParsingException"), e); + } catch (Exception e) { + throw new CodeGenerationException( + CodegenMessages.getMessage("engine.wsdlParsingException"), e); + } + } + + /** + * calculates the base URI Needs improvement but works fine for now ;) + * + * @param currentURI + */ + private String getBaseURI(String currentURI) throws URISyntaxException, IOException { + File file = new File(currentURI); + if (file.exists()) { + return file.getCanonicalFile().getParentFile().toURI().toString(); + } + String uriFragment = currentURI.substring(0, currentURI.lastIndexOf("/")); + return uriFragment + (uriFragment.endsWith("/") ? "" : "/"); + } + + /** + * Read the WSDL file + * + * @param uri + * @throws WSDLException + */ + private Definition readInTheWSDLFile(final String uri) throws WSDLException { + + WSDLReader reader = WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry(); + reader.setFeature("javax.wsdl.importDocuments", true); + + return reader.readWSDL(uri); + + } } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java Sun Dec 17 22:34:08 2017 @@ -19,15 +19,6 @@ package org.apache.axis2.wsdl.codegen; -import org.apache.axis2.AxisFault; -import org.apache.axis2.addressing.AddressingConstants; -import org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder; -import org.apache.axis2.description.WSDL11ToAxisServiceBuilder; -import org.apache.axis2.description.WSDL20ToAllAxisServicesBuilder; -import org.apache.axis2.description.WSDL20ToAxisServiceBuilder; -import org.apache.axis2.util.CommandLineOption; -import org.apache.axis2.util.CommandLineOptionConstants; -import org.apache.axis2.util.CommandLineOptionParser; import org.apache.axis2.wsdl.codegen.emitter.Emitter; import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension; import org.apache.axis2.wsdl.databinding.TypeMapper; @@ -36,20 +27,9 @@ import org.apache.axis2.wsdl.util.Config import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import javax.wsdl.Definition; -import javax.wsdl.WSDLException; -import javax.wsdl.Output; -import javax.wsdl.Input; -import javax.wsdl.extensions.AttributeExtensible; -import javax.wsdl.extensions.ExtensionRegistry; -import javax.wsdl.factory.WSDLFactory; -import javax.wsdl.xml.WSDLReader; -import javax.xml.namespace.QName; import java.io.File; import java.io.IOException; import java.net.URISyntaxException; -import java.net.URL; -import java.net.HttpURLConnection; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -76,116 +56,6 @@ public class CodeGenerationEngine { } /** - * @param parser - * @throws CodeGenerationException - */ - public CodeGenerationEngine(CommandLineOptionParser parser) throws CodeGenerationException { - Map allOptions = parser.getAllOptions(); - String wsdlUri; - try { - - CommandLineOption option = - (CommandLineOption)allOptions. - get(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION); - wsdlUri = option.getOptionValue(); - - // the redirected urls gives problems in code generation some times with jaxbri - // eg. https://www.paypal.com/wsdl/PayPalSvc.wsdl - // if there is a redirect url better to find it and use. - if (wsdlUri.startsWith("http")) { - URL url = new URL(wsdlUri); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setInstanceFollowRedirects(false); - connection.getResponseCode(); - String newLocation = connection.getHeaderField("Location"); - if (newLocation != null){ - wsdlUri = newLocation; - } - } - - configuration = new CodeGenConfiguration(allOptions); - - - if (CommandLineOptionConstants.WSDL2JavaConstants.WSDL_VERSION_2. - equals(configuration.getWSDLVersion())) { - - WSDL20ToAxisServiceBuilder builder; - - // jibx currently does not support multiservice - if ((configuration.getServiceName() != null) || (configuration.getDatabindingType().equals("jibx"))) { - builder = new WSDL20ToAxisServiceBuilder( - wsdlUri, - configuration.getServiceName(), - configuration.getPortName(), - configuration.isAllPorts()); - builder.setCodegen(true); - configuration.addAxisService(builder.populateService()); - } else { - builder = new WSDL20ToAllAxisServicesBuilder(wsdlUri, configuration.getPortName()); - builder.setCodegen(true); - builder.setAllPorts(configuration.isAllPorts()); - configuration.setAxisServices( - ((WSDL20ToAllAxisServicesBuilder)builder).populateAllServices()); - } - - } else { - //It'll be WSDL 1.1 - Definition wsdl4jDef = readInTheWSDLFile(wsdlUri); - - // we save the original wsdl definition to write it to the resource folder later - // this is required only if it has imports - Map imports = wsdl4jDef.getImports(); - if ((imports != null) && (imports.size() > 0)) { - configuration.setWsdlDefinition(readInTheWSDLFile(wsdlUri)); - } else { - configuration.setWsdlDefinition(wsdl4jDef); - } - - // we generate the code for one service and one port if the - // user has specified them. - // otherwise generate the code for every service. - // TODO: find out a permanant solution for this. - QName serviceQname = null; - - if (configuration.getServiceName() != null) { - serviceQname = new QName(wsdl4jDef.getTargetNamespace(), - configuration.getServiceName()); - } - - WSDL11ToAxisServiceBuilder builder; - // jibx currently does not support multiservice - if ((serviceQname != null) || (configuration.getDatabindingType().equals("jibx"))) { - builder = new WSDL11ToAxisServiceBuilder( - wsdl4jDef, - serviceQname, - configuration.getPortName(), - configuration.isAllPorts()); - builder.setCodegen(true); - configuration.addAxisService(builder.populateService()); - } else { - builder = new WSDL11ToAllAxisServicesBuilder(wsdl4jDef, configuration.getPortName()); - builder.setCodegen(true); - builder.setAllPorts(configuration.isAllPorts()); - configuration.setAxisServices( - ((WSDL11ToAllAxisServicesBuilder)builder).populateAllServices()); - } - } - configuration.setBaseURI(getBaseURI(wsdlUri)); - } catch (AxisFault axisFault) { - throw new CodeGenerationException( - CodegenMessages.getMessage("engine.wsdlParsingException"), axisFault); - } catch (WSDLException e) { - throw new CodeGenerationException( - CodegenMessages.getMessage("engine.wsdlParsingException"), e); - } catch (Exception e) { - throw new CodeGenerationException( - CodegenMessages.getMessage("engine.wsdlParsingException"), e); - } - - loadExtensions(); - } - - /** * Loads the relevant preExtensions * * @throws CodeGenerationException @@ -296,32 +166,6 @@ public class CodeGenerationEngine { } - - /** - * Read the WSDL file - * - * @param uri - * @throws WSDLException - */ - public Definition readInTheWSDLFile(final String uri) throws WSDLException { - - WSDLReader reader = WSDLFactory.newInstance().newWSDLReader(); - reader.setFeature("javax.wsdl.importDocuments", true); - - ExtensionRegistry extReg = WSDLFactory.newInstance().newPopulatedExtensionRegistry(); - extReg.registerExtensionAttributeType(Input.class, - new QName(AddressingConstants.Final.WSAW_NAMESPACE, AddressingConstants.WSA_ACTION), - AttributeExtensible.STRING_TYPE); - extReg.registerExtensionAttributeType(Output.class, - new QName(AddressingConstants.Final.WSAW_NAMESPACE, AddressingConstants.WSA_ACTION), - AttributeExtensible.STRING_TYPE); - reader.setExtensionRegistry(extReg); - - return reader.readWSDL(uri); - - } - - /** * gets a object from the class * @@ -361,20 +205,6 @@ public class CodeGenerationEngine { } /** - * calculates the base URI Needs improvement but works fine for now ;) - * - * @param currentURI - */ - private String getBaseURI(String currentURI) throws URISyntaxException, IOException { - File file = new File(currentURI); - if (file.exists()) { - return file.getCanonicalFile().getParentFile().toURI().toString(); - } - String uriFragment = currentURI.substring(0, currentURI.lastIndexOf("/")); - return uriFragment + (uriFragment.endsWith("/") ? "" : "/"); - } - - /** * calculates the URI * needs improvement * Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodegenConfigLoader.java Sun Dec 17 22:34:08 2017 @@ -31,9 +31,8 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; -class CodegenConfigLoader implements CommandLineOptionConstants { - - public static void loadConfig(CodeGenConfiguration config, Map<String,CommandLineOption> optionMap) { +public class CodegenConfigLoader implements CommandLineOptionConstants { + public static void loadConfig(CodeGenConfiguration config, Map<String,CommandLineOption> optionMap) throws CodeGenerationException { String outputLocation = "."; //default output directory is the current working directory CommandLineOption commandLineOption = loadOption(WSDL2JavaConstants.OUTPUT_LOCATION_OPTION, WSDL2JavaConstants.OUTPUT_LOCATION_OPTION_LONG, @@ -326,7 +325,7 @@ class CodegenConfigLoader implements Com } } - + config.loadWsdl(optionMap.get(WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION).getOptionValue()); } private static CommandLineOption loadOption(String shortOption, String longOption, Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JavaPrettyPrinterExtension.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JavaPrettyPrinterExtension.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JavaPrettyPrinterExtension.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/JavaPrettyPrinterExtension.java Sun Dec 17 22:34:08 2017 @@ -40,11 +40,6 @@ public class JavaPrettyPrinterExtension * @param file */ protected void prettifyFile(File file) { - // Special case jaxbri generated package-info.java - // as jalopy corrupts the package level annotations - if (file.getName().equals("package-info.java")) { - return; - } PrettyPrinter.prettify(file); } } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl Sun Dec 17 22:34:08 2017 @@ -59,9 +59,9 @@ protected org.apache.axis2.description.AxisOperation[] _operations; //hashmaps to keep the fault mapping - private java.util.HashMap faultExceptionNameMap = new java.util.HashMap(); - private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap(); - private java.util.HashMap faultMessageMap = new java.util.HashMap(); + private java.util.Map<org.apache.axis2.client.FaultMapKey,String> faultExceptionNameMap = new java.util.HashMap<org.apache.axis2.client.FaultMapKey,String>(); + private java.util.Map<org.apache.axis2.client.FaultMapKey,String> faultExceptionClassNameMap = new java.util.HashMap<org.apache.axis2.client.FaultMapKey,String>(); + private java.util.Map<org.apache.axis2.client.FaultMapKey,String> faultMessageMap = new java.util.HashMap<org.apache.axis2.client.FaultMapKey,String>(); private static int counter = 0; @@ -315,7 +315,7 @@ <xsl:for-each select="fault/param[@type!='']"> ,<xsl:value-of select="@name"/> </xsl:for-each>{ - org.apache.axis2.context.MessageContext _messageContext = null; + org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext(); try{ org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[<xsl:value-of select="position()-1"/>].getName()); _operationClient.getOptions().setAction("<xsl:value-of select="$soapAction"/>"); @@ -326,9 +326,6 @@ addPropertyToOperationClient(_operationClient,<xsl:value-of select="@name"/>,<xsl:value-of select="@value"/>); </xsl:for-each> - // create a message context - _messageContext = new org.apache.axis2.context.MessageContext(); - <!--todo if the stub was generated with unwrapping, wrap all parameters into a single element--> // create SOAP envelope with that payload @@ -383,9 +380,6 @@ </xsl:otherwise> </xsl:choose> - <xsl:if test="count(input/param[@location='soap_header']) > 0"> - env.build(); - </xsl:if> <xsl:for-each select="input/param[@location='soap_header']"> // add the children only if the parameter is not null if (<xsl:value-of select="@name"/>!=null){ @@ -486,7 +480,7 @@ java.lang.Object object = fromOM( _returnEnv.getBody().getFirstElement() , <xsl:value-of select="$outputtype"/>.class); - + org.apache.axis2.transport.TransportUtils.detachInputStream(_returnMessageContext); <xsl:choose> <xsl:when test="$outputparamcount=1"> return get<xsl:value-of select="$outputparamshorttype"/><xsl:value-of @@ -519,12 +513,12 @@ if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>"))){ //make the fault by reflection try{ - java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>")); + java.lang.String exceptionClassName = faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>")); java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class); java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage()); //message class - java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>")); + java.lang.String messageClassName = faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>")); java.lang.Class messageClass = java.lang.Class.forName(messageClassName); java.lang.Object messageObject = fromOM(faultElt,messageClass); java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", @@ -789,12 +783,12 @@ if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>"))){ //make the fault by reflection try{ - java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>")); + java.lang.String exceptionClassName = faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>")); java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(java.lang.String.class); java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage()); //message class - java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>")); + java.lang.String messageClassName = faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>")); java.lang.Class messageClass = java.lang.Class.forName(messageClassName); java.lang.Object messageObject = fromOM(faultElt,messageClass); java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", @@ -923,7 +917,7 @@ </xsl:for-each> </xsl:if> { - org.apache.axis2.context.MessageContext _messageContext = null; + org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext(); <xsl:if test="$mep='11'">try {</xsl:if> org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[<xsl:value-of select="position()-1"/>].getName()); @@ -937,7 +931,6 @@ <xsl:for-each select="input/param[@Action!='']">_operationClient.getOptions().setAction("<xsl:value-of select="@Action"/>");</xsl:for-each> org.apache.axiom.soap.SOAPEnvelope env = null; - _messageContext = new org.apache.axis2.context.MessageContext(); <xsl:variable name="count" select="count(input/param[@type!=''])"/> <xsl:choose> @@ -1049,12 +1042,12 @@ if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>"))){ //make the fault by reflection try{ - java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>")); + java.lang.String exceptionClassName = faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>")); java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); java.lang.Exception ex= (java.lang.Exception) exceptionClass.newInstance(); //message class - java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>")); + java.lang.String messageClassName = faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"<xsl:value-of select="@originalName"/>")); java.lang.Class messageClass = java.lang.Class.forName(messageClassName); java.lang.Object messageObject = fromOM(faultElt,messageClass); java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test-resources/schemas/custom_schemas/generated.xsd URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test-resources/schemas/custom_schemas/generated.xsd?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test-resources/schemas/custom_schemas/generated.xsd (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test-resources/schemas/custom_schemas/generated.xsd Sun Dec 17 22:34:08 2017 @@ -1,5 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3schools.com" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.w3schools.com"> +<?xml version="1.0" encoding="UTF-8"?><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> Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/CodeGenConfigurationTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/CodeGenConfigurationTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/CodeGenConfigurationTest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/CodeGenConfigurationTest.java Sun Dec 17 22:34:08 2017 @@ -21,13 +21,10 @@ package org.apache.axis2.wsdl.codegen; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.apache.axis2.description.AxisService; import org.apache.axis2.wsdl.codegen.XMLSchemaTest; -import org.apache.axis2.util.CommandLineOption; import org.apache.ws.commons.schema.XmlSchema; import org.junit.Test; @@ -55,8 +52,7 @@ public class CodeGenConfigurationTest ex @Test public void testGetSchemaListForAllServices(){ - Map<String, CommandLineOption> optionMap = new HashMap<String, CommandLineOption>(); - CodeGenConfiguration configuration = new CodeGenConfiguration(optionMap); + CodeGenConfiguration configuration = new CodeGenConfiguration(); configuration.addAxisService(service); List<XmlSchema> list=configuration.getSchemaListForAllServices(); assertEquals(schemas.get(0), list.get(0)); Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/JAXWSWapperExtensionTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/JAXWSWapperExtensionTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/JAXWSWapperExtensionTest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/JAXWSWapperExtensionTest.java Sun Dec 17 22:34:08 2017 @@ -21,8 +21,6 @@ package org.apache.axis2.wsdl.codegen.extension; import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; import javax.xml.namespace.QName; @@ -35,7 +33,6 @@ import org.apache.axis2.context.ServiceC import org.apache.axis2.description.AxisMessage; import org.apache.axis2.description.AxisOperation; import org.apache.axis2.description.AxisService; -import org.apache.axis2.util.CommandLineOption; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.XMLSchemaTest; import org.apache.ws.commons.schema.XmlSchema; @@ -144,8 +141,7 @@ public class JAXWSWapperExtensionTest ex axisOperation.addMessage(axisMessage, "test_message"); service.addOperation(axisOperation); JAXWSWapperExtension extension = new JAXWSWapperExtension(); - Map<String, CommandLineOption> optionMap = new HashMap<String, CommandLineOption>(); - CodeGenConfiguration configuration = new CodeGenConfiguration(optionMap); + CodeGenConfiguration configuration = new CodeGenConfiguration(); configuration.setOutputLanguage("jax-ws"); configuration.setParametersWrapped(false); configuration.addAxisService(service); @@ -156,8 +152,7 @@ public class JAXWSWapperExtensionTest ex @Test public void testWalkSchema() throws Exception{ JAXWSWapperExtension extension = new JAXWSWapperExtension(); - Map<String, CommandLineOption> optionMap = new HashMap<String, CommandLineOption>(); - CodeGenConfiguration configuration = new CodeGenConfiguration(optionMap); + CodeGenConfiguration configuration = new CodeGenConfiguration(); configuration.setOutputLanguage("jax-ws"); configuration.setParametersWrapped(false); configuration.addAxisService(service); Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtensionTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtensionTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtensionTest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/extension/WSDLValidatorExtensionTest.java Sun Dec 17 22:34:08 2017 @@ -21,7 +21,6 @@ package org.apache.axis2.wsdl.codegen.extension; import org.apache.axis2.description.AxisService; -import org.apache.axis2.util.CommandLineOption; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationException; import org.apache.axis2.wsdl.codegen.XMLSchemaTest; @@ -29,8 +28,6 @@ import org.apache.ws.commons.schema.XmlS import org.junit.Test; import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; public class WSDLValidatorExtensionTest extends XMLSchemaTest { @@ -43,10 +40,9 @@ public class WSDLValidatorExtensionTest try { AxisService service = new AxisService(); ArrayList<XmlSchema> list = new ArrayList<XmlSchema>(); - Map<String, CommandLineOption> optionMap = new HashMap<String, CommandLineOption>(); list.add(schema); service.addSchema(list); - CodeGenConfiguration configuration = new CodeGenConfiguration(optionMap); + CodeGenConfiguration configuration = new CodeGenConfiguration(); configuration.addAxisService(service); WSDLValidatorExtension extension = new WSDLValidatorExtension(); Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngineTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngineTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngineTest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngineTest.java Sun Dec 17 22:34:08 2017 @@ -36,6 +36,7 @@ public class JAXWSCodeGenerationEngineTe @Override protected void setUp() throws Exception { super.setUp(); + System.setProperty("javax.xml.accessExternalSchema", "all"); File dir = new File(filePath); assertEquals("Generated directory dtill exists ", false, dir.exists()); } Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/writer/SchemaWriterTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/writer/SchemaWriterTest.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/writer/SchemaWriterTest.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/codegen/test/org/apache/axis2/wsdl/codegen/writer/SchemaWriterTest.java Sun Dec 17 22:34:08 2017 @@ -23,29 +23,24 @@ import java.io.File; import org.apache.axis2.wsdl.codegen.XMLSchemaTest; import org.apache.ws.commons.schema.XmlSchema; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; +@RunWith(JUnit4.class) public class SchemaWriterTest extends XMLSchemaTest{ - private SchemaWriter writer; - - - @Override - protected void setUp() throws Exception { - writer=new SchemaWriter(new File(customDirectoryLocation)); - super.setUp(); - } - - @Override - protected void tearDown() throws Exception { - writer=null; - super.tearDown(); - } + @Rule + public final TemporaryFolder tmpFolder = new TemporaryFolder(); @Test public void testWriteSchema() throws Exception{ + File baseFolder = tmpFolder.getRoot(); + SchemaWriter writer = new SchemaWriter(baseFolder); XmlSchema schema=loadSingleSchemaFile(1); writer.writeSchema(schema, "generated.xsd"); - String s1=readXMLfromSchemaFile(customDirectoryLocation+"generated.xsd"); + String s1=readXMLfromSchemaFile(new File(baseFolder, "generated.xsd").getPath()); String s2=readXMLfromSchemaFile(customDirectoryLocation+"sampleSchema1.xsd"); assertSimilarXML(s1, s2); Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/corba/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/corba/pom.xml?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/corba/pom.xml (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/corba/pom.xml Sun Dec 17 22:34:08 2017 @@ -23,9 +23,9 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.axis2</groupId> - <artifactId>axis2-parent</artifactId> - <version>1.7.0-SNAPSHOT</version> - <relativePath>../parent/pom.xml</relativePath> + <artifactId>axis2</artifactId> + <version>1.8.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> </parent> <artifactId>axis2-corba</artifactId> <name>Apache Axis2 - CORBA</name> Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/corba/src/org/apache/axis2/corba/deployer/CorbaDeployer.java Sun Dec 17 22:34:08 2017 @@ -95,7 +95,7 @@ public class CorbaDeployer extends Abstr AxisServiceGroup serviceGroup = new AxisServiceGroup(axisConfig); serviceGroup.setServiceGroupClassLoader(deploymentFileData.getClassLoader()); ArrayList serviceList = processService(deploymentFileData, serviceGroup, configCtx); - DeploymentEngine.addServiceGroup(serviceGroup, serviceList, deploymentFileData.getFile().toURL(), deploymentFileData, axisConfig); + DeploymentEngine.addServiceGroup(serviceGroup, serviceList, deploymentFileData.getFile().toURI().toURL(), deploymentFileData, axisConfig); name = deploymentFileData.getName(); super.deploy(deploymentFileData); log.info("Deploying " + name); @@ -155,7 +155,7 @@ public class CorbaDeployer extends Abstr throws DeploymentException { try { // Processing service level parameters - Iterator itr = service_element.getChildrenWithName(new QName(TAG_PARAMETER)); + Iterator<OMElement> itr = service_element.getChildrenWithName(new QName(TAG_PARAMETER)); processParameters(itr, service, service.getParent()); // process service description @@ -242,9 +242,9 @@ public class CorbaDeployer extends Abstr ArrayList excludeops = null; if (excludeOperations != null) { excludeops = new ArrayList(); - Iterator excludeOp_itr = excludeOperations.getChildrenWithName(new QName(TAG_OPERATION)); + Iterator<OMElement> excludeOp_itr = excludeOperations.getChildrenWithName(new QName(TAG_OPERATION)); while (excludeOp_itr.hasNext()) { - OMElement opName = (OMElement) excludeOp_itr.next(); + OMElement opName = excludeOp_itr.next(); excludeops.add(opName.getText().trim()); } } @@ -253,9 +253,9 @@ public class CorbaDeployer extends Abstr } // processing service-wide modules which required to engage globally - Iterator moduleRefs = service_element.getChildrenWithName(new QName(TAG_MODULE)); + Iterator<OMElement> moduleRefs = service_element.getChildrenWithName(new QName(TAG_MODULE)); while (moduleRefs.hasNext()) { - OMElement moduleref = (OMElement) moduleRefs.next(); + OMElement moduleref = moduleRefs.next(); OMAttribute moduleRefAttribute = moduleref.getAttribute(new QName(TAG_REFERENCE)); String refName = moduleRefAttribute.getAttributeValue(); axisConfig.addGlobalModuleRef(refName); @@ -287,10 +287,10 @@ public class CorbaDeployer extends Abstr // processing transports OMElement transports = service_element.getFirstChildWithName(new QName(TAG_TRANSPORTS)); if (transports != null) { - Iterator transport_itr = transports.getChildrenWithName(new QName(TAG_TRANSPORT)); + Iterator<OMElement> transport_itr = transports.getChildrenWithName(new QName(TAG_TRANSPORT)); ArrayList trs = new ArrayList(); while (transport_itr.hasNext()) { - OMElement trsEle = (OMElement) transport_itr.next(); + OMElement trsEle = transport_itr.next(); String tarnsportName = trsEle.getText().trim(); trs.add(tarnsportName); } @@ -333,9 +333,9 @@ public class CorbaDeployer extends Abstr protected HashMap processMessageReceivers(ClassLoader loader, OMElement element) throws DeploymentException { HashMap meps = new HashMap(); - Iterator iterator = element.getChildrenWithName(new QName(TAG_MESSAGE_RECEIVER)); + Iterator<OMElement> iterator = element.getChildrenWithName(new QName(TAG_MESSAGE_RECEIVER)); while (iterator.hasNext()) { - OMElement receiverElement = (OMElement) iterator.next(); + OMElement receiverElement = iterator.next(); OMAttribute receiverName = receiverElement.getAttribute(new QName(TAG_CLASS_NAME)); String className = receiverName.getAttributeValue(); MessageReceiver receiver = loadMessageReceiver(loader, className); Modified: axis/axis2/java/core/branches/AXIS2-4091/modules/corba/src/org/apache/axis2/corba/deployer/SchemaGenerator.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4091/modules/corba/src/org/apache/axis2/corba/deployer/SchemaGenerator.java?rev=1818518&r1=1818517&r2=1818518&view=diff ============================================================================== --- axis/axis2/java/core/branches/AXIS2-4091/modules/corba/src/org/apache/axis2/corba/deployer/SchemaGenerator.java (original) +++ axis/axis2/java/core/branches/AXIS2-4091/modules/corba/src/org/apache/axis2/corba/deployer/SchemaGenerator.java Sun Dec 17 22:34:08 2017 @@ -40,21 +40,7 @@ import org.apache.axis2.description.java import org.apache.axis2.description.java2wsdl.Java2WSDLConstants; import org.apache.axis2.description.java2wsdl.NamespaceGenerator; import org.apache.axis2.description.java2wsdl.TypeTable; -import org.apache.ws.commons.schema.XmlSchema; -import org.apache.ws.commons.schema.XmlSchemaChoice; -import org.apache.ws.commons.schema.XmlSchemaCollection; -import org.apache.ws.commons.schema.XmlSchemaComplexType; -import org.apache.ws.commons.schema.XmlSchemaElement; -import org.apache.ws.commons.schema.XmlSchemaEnumerationFacet; -import org.apache.ws.commons.schema.XmlSchemaFacet; -import org.apache.ws.commons.schema.XmlSchemaForm; -import org.apache.ws.commons.schema.XmlSchemaFractionDigitsFacet; -import org.apache.ws.commons.schema.XmlSchemaImport; -import org.apache.ws.commons.schema.XmlSchemaObject; -import org.apache.ws.commons.schema.XmlSchemaSequence; -import org.apache.ws.commons.schema.XmlSchemaSimpleType; -import org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction; -import org.apache.ws.commons.schema.XmlSchemaTotalDigitsFacet; +import org.apache.ws.commons.schema.*; import org.apache.ws.commons.schema.utils.NamespaceMap; import javax.xml.namespace.QName; @@ -355,7 +341,7 @@ public class SchemaGenerator implements } else if (dataType instanceof UnionType) { XmlSchemaComplexType complexType = new XmlSchemaComplexType(xmlSchema, false); XmlSchemaChoice choice = new XmlSchemaChoice(); - List<XmlSchemaObject> items = choice.getItems(); + List<XmlSchemaChoiceMember> items = choice.getItems(); UnionType unionType = (UnionType) dataType; Member[] members = unionType.getMembers(); Propchange: axis/axis2/java/core/branches/AXIS2-4091/modules/distribution/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Sun Dec 17 22:34:08 2017 @@ -1,3 +1,5 @@ +.project +.settings *.iml *.iws *.ipr
