You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/07/01 18:31:50 UTC
svn commit: r1800521 [2/4] - in
/axis/axis2/java/core/branches/hermetic-tests: ./ apidocs/
databinding-tests/jaxbri-tests/ etc/ modules/adb-codegen/
modules/adb-codegen/src/org/apache/axis2/schema/template/
modules/adb-codegen/test-resources/testsuite/...
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/SAXSourceDispatchTests.java Sat Jul 1 18:31:49 2017
@@ -21,13 +21,12 @@ package org.apache.axis2.jaxws.dispatch;
import junit.framework.Test;
import junit.framework.TestSuite;
+
+import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axis2.jaxws.TestLogger;
import org.apache.axis2.jaxws.framework.AbstractTestCase;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
import org.xml.sax.InputSource;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.Source;
import javax.xml.transform.sax.SAXSource;
import javax.xml.ws.Dispatch;
@@ -35,6 +34,7 @@ import javax.xml.ws.Response;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceException;
import java.io.ByteArrayInputStream;
+import java.io.StringWriter;
import java.util.concurrent.Future;
/**
@@ -42,9 +42,6 @@ import java.util.concurrent.Future;
* forms of a javax.xml.transform.sax.SAXSource.
*/
public class SAXSourceDispatchTests extends AbstractTestCase{
-
- private static final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
public static Test suite() {
return getTestSetup(new TestSuite(SAXSourceDispatchTests.class));
}
@@ -71,9 +68,9 @@ public class SAXSourceDispatchTests exte
assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
- Reader2Writer r2w = new Reader2Writer(reader);
- String responseText = r2w.getAsString();
+ StringWriter sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ String responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -93,9 +90,9 @@ public class SAXSourceDispatchTests exte
assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(response);
- r2w = new Reader2Writer(reader);
- responseText = r2w.getAsString();
+ sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -128,9 +125,9 @@ public class SAXSourceDispatchTests exte
assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
- Reader2Writer r2w = new Reader2Writer(reader);
- String responseText = r2w.getAsString();
+ StringWriter sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ String responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -151,9 +148,9 @@ public class SAXSourceDispatchTests exte
assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(response);
- r2w = new Reader2Writer(reader);
- responseText = r2w.getAsString();
+ sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -194,9 +191,9 @@ public class SAXSourceDispatchTests exte
assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
- Reader2Writer r2w = new Reader2Writer(reader);
- String responseText = r2w.getAsString();
+ StringWriter sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ String responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -225,9 +222,9 @@ public class SAXSourceDispatchTests exte
assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(response);
- r2w = new Reader2Writer(reader);
- responseText = r2w.getAsString();
+ sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -268,9 +265,9 @@ public class SAXSourceDispatchTests exte
assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
- Reader2Writer r2w = new Reader2Writer(reader);
- String responseText = r2w.getAsString();
+ StringWriter sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ String responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -299,9 +296,9 @@ public class SAXSourceDispatchTests exte
assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(response);
- r2w = new Reader2Writer(reader);
- responseText = r2w.getAsString();
+ sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -339,9 +336,9 @@ public class SAXSourceDispatchTests exte
assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
- Reader2Writer r2w = new Reader2Writer(reader);
- String responseText = r2w.getAsString();
+ StringWriter sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ String responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -368,9 +365,9 @@ public class SAXSourceDispatchTests exte
assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(response);
- r2w = new Reader2Writer(reader);
- responseText = r2w.getAsString();
+ sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -408,9 +405,9 @@ public class SAXSourceDispatchTests exte
assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
- Reader2Writer r2w = new Reader2Writer(reader);
- String responseText = r2w.getAsString();
+ StringWriter sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ String responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -437,9 +434,9 @@ public class SAXSourceDispatchTests exte
assertNotNull("dispatch invoke returned null", response);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(response);
- r2w = new Reader2Writer(reader);
- responseText = r2w.getAsString();
+ sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/dispatch/StreamSourceDispatchTests.java Sat Jul 1 18:31:49 2017
@@ -21,12 +21,11 @@ package org.apache.axis2.jaxws.dispatch;
import junit.framework.Test;
import junit.framework.TestSuite;
+
+import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axis2.jaxws.TestLogger;
import org.apache.axis2.jaxws.framework.AbstractTestCase;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.Dispatch;
@@ -35,6 +34,7 @@ import javax.xml.ws.Service;
import javax.xml.ws.Service.Mode;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
+import java.io.StringWriter;
import java.util.concurrent.Future;
/**
@@ -43,10 +43,6 @@ import java.util.concurrent.Future;
*
*/
public class StreamSourceDispatchTests extends AbstractTestCase {
-
- private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
-
public static Test suite() {
return getTestSetup(new TestSuite(StreamSourceDispatchTests.class));
}
@@ -75,9 +71,9 @@ public class StreamSourceDispatchTests e
assertNotNull(response);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
- Reader2Writer r2w = new Reader2Writer(reader);
- String responseText = r2w.getAsString();
+ StringWriter sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ String responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -96,9 +92,9 @@ public class StreamSourceDispatchTests e
assertNotNull(response);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(response);
- r2w = new Reader2Writer(reader);
- responseText = r2w.getAsString();
+ sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -131,9 +127,9 @@ public class StreamSourceDispatchTests e
assertNotNull(response);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
- Reader2Writer r2w = new Reader2Writer(reader);
- String responseText = r2w.getAsString();
+ StringWriter sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ String responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -151,9 +147,9 @@ public class StreamSourceDispatchTests e
assertNotNull(response);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(response);
- r2w = new Reader2Writer(reader);
- responseText = r2w.getAsString();
+ sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -197,9 +193,9 @@ public class StreamSourceDispatchTests e
assertNotNull(response);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
- Reader2Writer r2w = new Reader2Writer(reader);
- String responseText = r2w.getAsString();
+ StringWriter sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ String responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -226,9 +222,9 @@ public class StreamSourceDispatchTests e
assertNotNull(response);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(response);
- r2w = new Reader2Writer(reader);
- responseText = r2w.getAsString();
+ sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -272,9 +268,9 @@ public class StreamSourceDispatchTests e
assertNotNull(response);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
- Reader2Writer r2w = new Reader2Writer(reader);
- String responseText = r2w.getAsString();
+ StringWriter sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ String responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -306,9 +302,9 @@ public class StreamSourceDispatchTests e
assertNotNull(response);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(response);
- r2w = new Reader2Writer(reader);
- responseText = r2w.getAsString();
+ sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -348,9 +344,9 @@ public class StreamSourceDispatchTests e
assertNotNull(response);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
- Reader2Writer r2w = new Reader2Writer(reader);
- String responseText = r2w.getAsString();
+ StringWriter sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ String responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -376,9 +372,9 @@ public class StreamSourceDispatchTests e
assertNotNull(response);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(response);
- r2w = new Reader2Writer(reader);
- responseText = r2w.getAsString();
+ sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -419,9 +415,9 @@ public class StreamSourceDispatchTests e
assertNotNull(response);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(response);
- Reader2Writer r2w = new Reader2Writer(reader);
- String responseText = r2w.getAsString();
+ StringWriter sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ String responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
@@ -448,9 +444,9 @@ public class StreamSourceDispatchTests e
assertNotNull(response);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(response);
- r2w = new Reader2Writer(reader);
- responseText = r2w.getAsString();
+ sw = new StringWriter();
+ OMXMLBuilderFactory.createOMBuilder(response).getDocument().serializeAndConsume(sw);
+ responseText = sw.toString();
TestLogger.logger.debug(responseText);
// Check to make sure the content is correct
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXMessageSourceTests.java Sat Jul 1 18:31:49 2017
@@ -19,14 +19,11 @@
package org.apache.axis2.jaxws.xmlhttp;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
import org.apache.axis2.testutils.Axis2Server;
import org.junit.ClassRule;
import org.junit.Test;
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.Dispatch;
@@ -35,8 +32,8 @@ import javax.xml.ws.WebServiceException;
import javax.xml.ws.handler.MessageContext;
import javax.xml.ws.http.HTTPBinding;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertAbout;
+import static org.apache.axiom.truth.xml.XMLTruth.xml;
import static org.junit.Assert.fail;
import java.io.ByteArrayInputStream;
@@ -46,8 +43,6 @@ public class DispatchXMessageSourceTests
@ClassRule
public static Axis2Server server = new Axis2Server("target/repo");
- private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
private QName SERVICE_NAME = new QName("http://ws.apache.org/axis2", "XMessageSourceProvider");
private QName PORT_NAME = new QName("http://ws.apache.org/axis2", "XMessageSourceProviderPort");
@@ -77,12 +72,7 @@ public class DispatchXMessageSourceTests
Source outSource = dispatch.invoke(inSource);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(outSource);
- Reader2Writer r2w = new Reader2Writer(reader);
- String response = r2w.getAsString();
-
- assertTrue(response != null);
- assertTrue(request.equals(response));
+ assertAbout(xml()).that(outSource).hasSameContentAs(XML_TEXT);
// Test a second time to verify
stream = new ByteArrayInputStream(request.getBytes());
@@ -91,12 +81,7 @@ public class DispatchXMessageSourceTests
outSource = dispatch.invoke(inSource);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(outSource);
- r2w = new Reader2Writer(reader);
- response = r2w.getAsString();
-
- assertTrue(response != null);
- assertTrue(request.equals(response));
+ assertAbout(xml()).that(outSource).hasSameContentAs(XML_TEXT);
}
@Test
@@ -115,10 +100,7 @@ public class DispatchXMessageSourceTests
dispatch.getRequestContext().put(MessageContext.HTTP_REQUEST_METHOD, "GET");
Source outSource = dispatch.invoke(null);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(outSource);
- Reader2Writer r2w = new Reader2Writer(reader);
- String response = r2w.getAsString();
- assertEquals(GET_RESPONSE, response);
+ assertAbout(xml()).that(outSource).hasSameContentAs(GET_RESPONSE);
// this should fail again
dispatch.getRequestContext().remove(MessageContext.HTTP_REQUEST_METHOD);
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/jaxws-integration/test/org/apache/axis2/jaxws/xmlhttp/DispatchXPayloadSourceTests.java Sat Jul 1 18:31:49 2017
@@ -19,21 +19,19 @@
package org.apache.axis2.jaxws.xmlhttp;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
import org.apache.axis2.testutils.Axis2Server;
import org.junit.ClassRule;
import org.junit.Test;
import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.http.HTTPBinding;
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertAbout;
+import static org.apache.axiom.truth.xml.XMLTruth.xml;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@@ -42,8 +40,6 @@ public class DispatchXPayloadSourceTests
@ClassRule
public static Axis2Server server = new Axis2Server("target/repo");
- private static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
private QName SERVICE_NAME = new QName("http://ws.apache.org/axis2", "XPayloadSourceProvider");
private QName PORT_NAME = new QName("http://ws.apache.org/axis2", "XPayloadSourceProviderPort");
@@ -71,12 +67,7 @@ public class DispatchXPayloadSourceTests
Source outSource = dispatch.invoke(inSource);
// Prepare the response content for checking
- XMLStreamReader reader = inputFactory.createXMLStreamReader(outSource);
- Reader2Writer r2w = new Reader2Writer(reader);
- String response = r2w.getAsString();
-
- assertTrue(response != null);
- assertTrue(request.equals(response));
+ assertAbout(xml()).that(outSource).hasSameContentAs(XML_TEXT);
// Try a second time to verify
stream = new ByteArrayInputStream(request.getBytes());
@@ -85,12 +76,7 @@ public class DispatchXPayloadSourceTests
outSource = dispatch.invoke(inSource);
// Prepare the response content for checking
- reader = inputFactory.createXMLStreamReader(outSource);
- r2w = new Reader2Writer(reader);
- response = r2w.getAsString();
-
- assertTrue(response != null);
- assertTrue(request.equals(response));
+ assertAbout(xml()).that(outSource).hasSameContentAs(XML_TEXT);
}
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/framework/JAXWSDeployer.java Sat Jul 1 18:31:49 2017
@@ -77,16 +77,15 @@ public class JAXWSDeployer extends Abstr
ClassLoader threadClassLoader = null;
try {
threadClassLoader = Thread.currentThread().getContextClassLoader();
- ArrayList<URL> urls = new ArrayList<URL>();
- urls.add(repository);
+ List<URL> extraUrls = new ArrayList<>();
String webLocation = DeploymentEngine.getWebLocationString();
if (webLocation != null) {
- urls.add(new File(webLocation).toURL());
+ extraUrls.add(new File(webLocation).toURL());
}
ClassLoader classLoader = Utils.createClassLoader(
- urls,
+ repository,
+ extraUrls.toArray(new URL[extraUrls.size()]),
axisConfig.getSystemClassLoader(),
- true,
(File) axisConfig.
getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR),
axisConfig.isChildFirstClassLoading());
@@ -131,21 +130,20 @@ public class JAXWSDeployer extends Abstr
URL location = deploymentFileData.getFile().toURL();
if (isJar(deploymentFileData.getFile())) {
log.info("Deploying artifact : " + deploymentFileData.getAbsolutePath());
- ArrayList<URL> urls = new ArrayList<URL>();
- urls.add(deploymentFileData.getFile().toURL());
- urls.add(axisConfig.getRepository());
+ List<URL> extraUrls = new ArrayList<>();
+ extraUrls.add(axisConfig.getRepository());
// adding libs under jaxws deployment dir
- addJaxwsLibs(urls, axisConfig.getRepository().getPath() + directory);
+ addJaxwsLibs(extraUrls, axisConfig.getRepository().getPath() + directory);
String webLocation = DeploymentEngine.getWebLocationString();
if (webLocation != null) {
- urls.add(new File(webLocation).toURL());
+ extraUrls.add(new File(webLocation).toURL());
}
ClassLoader classLoader = Utils.createClassLoader(
- urls,
+ deploymentFileData.getFile().toURI().toURL(),
+ extraUrls.toArray(new URL[extraUrls.size()]),
axisConfig.getSystemClassLoader(),
- true,
(File) axisConfig.
getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR),
axisConfig.isChildFirstClassLoading());
@@ -237,7 +235,7 @@ public class JAXWSDeployer extends Abstr
* @param jaxwsDepDirPath - jaxws deployment folder path
* @throws Exception - on error while geting URLs of libs
*/
- private void addJaxwsLibs(ArrayList<URL> urls, String jaxwsDepDirPath)
+ private void addJaxwsLibs(List<URL> urls, String jaxwsDepDirPath)
throws Exception {
File jaxwsDepDirLib = new File(jaxwsDepDirPath + File.separator + "lib");
if (jaxwsDepDirLib.exists() && jaxwsDepDirLib.isDirectory()) {
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/SourceBlockImpl.java Sat Jul 1 18:31:49 2017
@@ -19,19 +19,19 @@
package org.apache.axis2.jaxws.message.databinding.impl;
+import org.apache.axiom.blob.Blobs;
+import org.apache.axiom.blob.MemoryBlob;
import org.apache.axiom.om.OMDataSource;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMSourcedElement;
import org.apache.axiom.om.util.StAXUtils;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axis2.datasource.SourceDataSource;
-import org.apache.axis2.java.security.AccessController;
import org.apache.axis2.jaxws.ExceptionFactory;
import org.apache.axis2.jaxws.i18n.Messages;
import org.apache.axis2.jaxws.message.databinding.SourceBlock;
import org.apache.axis2.jaxws.message.factory.BlockFactory;
import org.apache.axis2.jaxws.message.impl.BlockImpl;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
import org.apache.axis2.jaxws.utility.ConvertUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -45,13 +45,12 @@ import javax.xml.stream.XMLStreamWriter;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stax.StAXSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.WebServiceException;
import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
+import java.io.IOException;
+import java.io.OutputStream;
/**
* SourceBlock
@@ -71,26 +70,6 @@ import java.security.PrivilegedException
public class SourceBlockImpl extends BlockImpl<Source,Void> implements SourceBlock {
private static final Log log = LogFactory.getLog(SourceBlockImpl.class);
- private static Class<?> staxSource = null;
-
- static {
- try {
- // Dynamically discover if StAXSource is available
- staxSource = forName("javax.xml.transform.stax.StAXSource");
- } catch (Exception e) {
- if (log.isDebugEnabled()) {
- log.debug("StAXSource is not present in the JDK. " +
- "This is acceptable. Processing continues");
- }
- }
- try {
- // Woodstox does not work with StAXSource
- if(XMLInputFactory.newInstance().getClass().getName().indexOf("wstx")!=-1){
- staxSource = null;
- }
- } catch (Exception e){
- }
- }
/**
* Constructor called from factory
@@ -107,7 +86,7 @@ public class SourceBlockImpl extends Blo
if (busObject instanceof DOMSource ||
busObject instanceof SAXSource ||
busObject instanceof StreamSource ||
- (busObject.getClass().equals(staxSource)) ||
+ busObject instanceof StAXSource ||
busObject instanceof JAXBSource) {
// Okay, these are supported Source objects
if (log.isDebugEnabled()) {
@@ -131,32 +110,6 @@ public class SourceBlockImpl extends Blo
super(omElement, null, qName, factory);
}
- private Source _getBOFromReader(XMLStreamReader reader, Void busContext)
- throws XMLStreamException {
-
- // Best solution is to use a StAXSource
- // However StAXSource is not widely accepted.
- // For now, a StreamSource is always returned
- /*
- if (staxSource != null) {
- try {
- // TODO Constructor should be statically cached for performance
- Constructor c =
- staxSource.getDeclaredConstructor(new Class[] { XMLStreamReader.class });
- return c.newInstance(new Object[] { reader });
- } catch (Exception e) {
- }
- }
- */
-
- // TODO StreamSource is not performant...work is needed here to make this faster
- Reader2Writer r2w = new Reader2Writer(reader);
- String text = r2w.getAsString();
- StringReader sr = new StringReader(text);
- return new StreamSource(sr);
-
- }
-
@Override
protected Source _getBOFromOM(OMElement omElement, Void busContext)
throws XMLStreamException, WebServiceException {
@@ -179,16 +132,19 @@ public class SourceBlockImpl extends Blo
}
// Transform reader into business object
- if (!hasFault) {
- busObject = _getBOFromReader(omElement.getXMLStreamReader(false), busContext);
- }
- else {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- omElement.serialize(baos);
-
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- busObject = new StreamSource(bais);
+ MemoryBlob blob = Blobs.createMemoryBlob();
+ OutputStream out = blob.getOutputStream();
+ try {
+ if (!hasFault) {
+ omElement.serializeAndConsume(out);
+ } else {
+ omElement.serialize(out);
+ }
+ out.close();
+ } catch (IOException ex) {
+ throw new XMLStreamException(ex);
}
+ busObject = new StreamSource(blob.getInputStream());
return busObject;
}
@@ -294,32 +250,6 @@ public class SourceBlockImpl extends Blo
return false; // The source could be a text or element etc.
}
- /**
- * Return the class for this name
- * @return Class
- */
- private static Class<?> forName(final String className) throws ClassNotFoundException {
- // NOTE: This method must remain private because it uses AccessController
- Class<?> cl = null;
- try {
- cl = AccessController.doPrivileged(
- new PrivilegedExceptionAction<Class<?>>() {
- @Override
- public Class<?> run() throws ClassNotFoundException {
- return Class.forName(className);
- }
- }
- );
- } catch (PrivilegedActionException e) {
- if (log.isDebugEnabled()) {
- log.debug("Exception thrown from AccessController: " + e);
- }
- throw (ClassNotFoundException)e.getException();
- }
-
- return cl;
- }
-
@Override
public void close() {
return; // Nothing to close
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/databinding/impl/XMLStringBlockImpl.java Sat Jul 1 18:31:49 2017
@@ -30,7 +30,6 @@ import org.apache.axis2.jaxws.ExceptionF
import org.apache.axis2.jaxws.message.databinding.XMLStringBlock;
import org.apache.axis2.jaxws.message.factory.BlockFactory;
import org.apache.axis2.jaxws.message.impl.BlockImpl;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
@@ -69,18 +68,6 @@ public class XMLStringBlockImpl extends
super(omElement, null, qName, factory);
}
- private String _getBOFromReader(XMLStreamReader reader, Void busContext)
- throws XMLStreamException {
- // Create a Reader2Writer converter and get the output as a String
- Reader2Writer r2w;
- if ((busContext == null) && (omElement != null) && (omElement.isComplete())) {
- r2w = new Reader2Writer(reader, false);
- } else {
- r2w = new Reader2Writer(reader);
- }
- return r2w.getAsString();
- }
-
@Override
protected String _getBOFromOM(OMElement omElement, Void busContext)
throws XMLStreamException, WebServiceException {
@@ -92,7 +79,7 @@ public class XMLStringBlockImpl extends
return ((StringOMDataSource) ds).getObject();
}
}
- return _getBOFromReader(omElement.getXMLStreamReader(false), busContext);
+ return omElement.toStringWithConsume();
}
@Override
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/impl/XMLSpineImpl.java Sat Jul 1 18:31:49 2017
@@ -740,9 +740,9 @@ class XMLSpineImpl implements XMLSpine {
return null;
}
QName qName = new QName(namespace, localPart);
- Iterator it = om.getChildrenWithName(qName);
+ Iterator<OMElement> it = om.getChildrenWithName(qName);
if (it != null && it.hasNext()) {
- return (OMElement)it.next();
+ return it.next();
}
return null;
}
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/util/Reader2Writer.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/util/Reader2Writer.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/util/Reader2Writer.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/src/org/apache/axis2/jaxws/message/util/Reader2Writer.java Sat Jul 1 18:31:49 2017
@@ -23,7 +23,6 @@ import org.apache.axiom.om.OMDocument;
import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMXMLBuilderFactory;
import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.util.StAXUtils;
import org.apache.axis2.jaxws.utility.JavaUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -31,7 +30,6 @@ import org.apache.commons.logging.LogFac
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
-import java.io.StringWriter;
import java.util.Iterator;
/**
@@ -87,23 +85,4 @@ public class Reader2Writer {
reader.close();
}
}
-
- /**
- * Utility method to write the reader contents to a String
- * @return String
- */
- public String getAsString() throws XMLStreamException {
- StringWriter sw = new StringWriter();
- XMLStreamWriter writer = StAXUtils.createXMLStreamWriter(sw);
-
- // Write the reader to the writer
- outputTo(writer);
-
- // Flush the writer and get the String
- writer.flush();
- sw.flush();
- String str = sw.toString();
- writer.close();
- return str;
- }
}
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/test/org/apache/axis2/jaxws/message/BlockTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/test/org/apache/axis2/jaxws/message/BlockTests.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/test/org/apache/axis2/jaxws/message/BlockTests.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/test/org/apache/axis2/jaxws/message/BlockTests.java Sat Jul 1 18:31:49 2017
@@ -37,7 +37,6 @@ import org.apache.axis2.jaxws.message.fa
import org.apache.axis2.jaxws.message.factory.OMBlockFactory;
import org.apache.axis2.jaxws.message.factory.SourceBlockFactory;
import org.apache.axis2.jaxws.message.factory.XMLStringBlockFactory;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
import org.apache.axis2.jaxws.unitTest.TestLogger;
import org.w3c.dom.Document;
@@ -62,6 +61,10 @@ import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
+
+import static com.google.common.truth.Truth.assertAbout;
+import static org.apache.axiom.truth.xml.XMLTruth.xml;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.StringReader;
@@ -123,10 +126,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
-
+ assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
}
/**
@@ -162,10 +162,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
-
+ assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
}
/**
@@ -197,9 +194,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
+ assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
}
/**
@@ -346,8 +341,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
+ String newText = OMXMLBuilderFactory.createStAXOMBuilder(reader).getDocumentElement().toString();
assertTrue(newText.contains("Hello World"));
assertTrue(newText.contains("echoString"));
@@ -395,8 +389,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
+ String newText = OMXMLBuilderFactory.createStAXOMBuilder(reader).getDocumentElement().toString();
assertTrue(newText.contains("Hello World"));
assertTrue(newText.contains("echoString"));
@@ -642,10 +635,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
-
+ assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
}
@@ -684,10 +674,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
-
+ assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
}
/**
@@ -755,10 +742,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
-
+ assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
}
/**
@@ -796,10 +780,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
-
+ assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
}
/**
@@ -836,9 +817,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
+ assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
}
/**
@@ -868,11 +847,7 @@ public class BlockTests extends TestCase
assertTrue(block.isConsumed());
// Check the String for accuracy
- XMLStreamReader reader = inputFactory.createXMLStreamReader((Source) bo);
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
-
+ assertAbout(xml()).that(bo).hasSameContentAs(sampleText);
}
/**
@@ -908,11 +883,7 @@ public class BlockTests extends TestCase
assertTrue(block.isConsumed());
// Check the String for accuracy
- XMLStreamReader reader = inputFactory.createXMLStreamReader((Source) bo);
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
-
+ assertAbout(xml()).that(bo).hasSameContentAs(sampleText);
}
/**
@@ -950,11 +921,7 @@ public class BlockTests extends TestCase
assertTrue(block.isConsumed());
// Check the String for accuracy
- XMLStreamReader reader = inputFactory.createXMLStreamReader((Source) bo);
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
-
+ assertAbout(xml()).that(bo).hasSameContentAs(sampleText);
}
/*
* Testing JAXBSource, Creating Source Block using JAXBSource and then
@@ -1027,9 +994,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(echoSample.equals(newText));
+ assertAbout(xml()).that(reader).hasSameContentAs(echoSample);
}
/**
* Create a Block representing a DOMSource instance and simulate an
@@ -1073,9 +1038,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
+ assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
}
/**
@@ -1111,9 +1074,7 @@ public class BlockTests extends TestCase
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(reader);
- String newText = r2w.getAsString();
- assertTrue(sampleText.equals(newText));
+ assertAbout(xml()).that(reader).hasSameContentAs(sampleText);
}
}
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/jaxws/test/org/apache/axis2/jaxws/message/SOAP12Tests.java Sat Jul 1 18:31:49 2017
@@ -27,7 +27,6 @@ import org.apache.axiom.soap.SOAPEnvelop
import org.apache.axiom.soap.SOAPModelBuilder;
import org.apache.axis2.jaxws.message.factory.MessageFactory;
import org.apache.axis2.jaxws.message.factory.XMLStringBlockFactory;
-import org.apache.axis2.jaxws.message.util.Reader2Writer;
import org.apache.axis2.jaxws.registry.FactoryRegistry;
import org.apache.axis2.jaxws.unitTest.TestLogger;
import org.apache.log4j.BasicConfigurator;
@@ -102,8 +101,7 @@ public class SOAP12Tests extends TestCas
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(om.getXMLStreamReader());
- String newText = r2w.getAsString();
+ String newText = OMXMLBuilderFactory.createStAXOMBuilder(om.getXMLStreamReader()).getDocumentElement().toString();
TestLogger.logger.debug(newText);
assertTrue(newText.contains(sampleText));
assertTrue(newText.contains("soap"));
@@ -147,8 +145,7 @@ public class SOAP12Tests extends TestCas
// To check that the output is correct, get the String contents of the
// reader
- Reader2Writer r2w = new Reader2Writer(om.getXMLStreamReaderWithoutCaching());
- String newText = r2w.getAsString();
+ String newText = OMXMLBuilderFactory.createStAXOMBuilder(om.getXMLStreamReaderWithoutCaching()).getDocumentElement().toString();
TestLogger.logger.debug(newText);
assertTrue(newText.contains(sampleText));
assertTrue(newText.contains("soap"));
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/jibx/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/jibx/pom.xml?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/jibx/pom.xml (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/jibx/pom.xml Sat Jul 1 18:31:49 2017
@@ -56,18 +56,6 @@
<dependency>
<groupId>org.jibx</groupId>
<artifactId>jibx-bind</artifactId>
- <exclusions>
- <exclusion>
- <groupId>bcel</groupId>
- <artifactId>bcel</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <!-- TODO: workaround for AXIS2-5704 while waiting for BCEL 6.0; see BCEL-173 -->
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>bcel-findbugs</artifactId>
- <version>6.0</version>
</dependency>
<dependency>
<groupId>org.jibx</groupId>
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/json/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/json/pom.xml?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/json/pom.xml (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/json/pom.xml Sat Jul 1 18:31:49 2017
@@ -85,6 +85,11 @@
<artifactId>commons-httpclient</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-truth</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<url>http://axis.apache.org/axis2/java/core/</url>
<scm>
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/json/src/org/apache/axis2/json/JSONUtil.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/json/src/org/apache/axis2/json/JSONUtil.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/json/src/org/apache/axis2/json/JSONUtil.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/json/src/org/apache/axis2/json/JSONUtil.java Sat Jul 1 18:31:49 2017
@@ -35,8 +35,8 @@ public final class JSONUtil {
Object value = service.getParameterValue("xmlToJsonNamespaceMap");
if (value != null) {
if (value instanceof OMElement && ((OMElement)value).getLocalName().equals("mappings")) {
- for (Iterator it = ((OMElement)value).getChildrenWithName(new QName("mapping")); it.hasNext(); ) {
- OMElement mapping = (OMElement)it.next();
+ for (Iterator<OMElement> it = ((OMElement)value).getChildrenWithName(new QName("mapping")); it.hasNext(); ) {
+ OMElement mapping = it.next();
ns2jnsMap.put(mapping.getAttributeValue(new QName("xmlNamespace")),
mapping.getAttributeValue(new QName("jsonNamespace")));
}
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/json/test/org/apache/axis2/json/JSONDataSourceTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/json/test/org/apache/axis2/json/JSONDataSourceTest.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/json/test/org/apache/axis2/json/JSONDataSourceTest.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/json/test/org/apache/axis2/json/JSONDataSourceTest.java Sat Jul 1 18:31:49 2017
@@ -19,102 +19,43 @@
package org.apache.axis2.json;
-import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisService;
-import org.codehaus.jettison.json.JSONException;
import org.custommonkey.xmlunit.XMLTestCase;
-import org.xml.sax.SAXException;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
+import static com.google.common.truth.Truth.assertAbout;
+import static org.apache.axiom.truth.xml.XMLTruth.xml;
+
import java.io.StringReader;
public class JSONDataSourceTest extends XMLTestCase {
- public void testMappedSerialize1() throws Exception {
- String jsonString = getMappedJSONString();
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- JSONDataSource source = getMappedDataSource(jsonString);
- source.serialize(outStream, new OMOutputFormat());
- assertXMLEqual("<mapping><inner><first>test string one</first></inner><inner>test string two</inner><name>foo</name></mapping>",
- outStream.toString("utf-8"));
- }
-
- public void testMappedSerialize2() throws Exception {
- String jsonString = getMappedJSONString();
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- OutputStreamWriter writer = new OutputStreamWriter(outStream);
- JSONDataSource source = getMappedDataSource(jsonString);
- source.serialize(writer, new OMOutputFormat());
- writer.flush();
- assertXMLEqual("<mapping><inner><first>test string one</first></inner><inner>test string two</inner><name>foo</name></mapping>",
- outStream.toString("utf-8"));
- }
-
- public void testMappedSerialize3() throws Exception {
- String jsonString = getMappedJSONString();
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- XMLStreamWriter writer = StAXUtils.createXMLStreamWriter(outStream);
- JSONDataSource source = getMappedDataSource(jsonString);
- source.serialize(writer);
- writer.flush();
- assertXMLEqual("<mapping><inner><first>test string one</first></inner><inner>test string two</inner><name>foo</name></mapping>",
- outStream.toString("utf-8"));
- }
-
- public void testBadgerfishSerialize1() throws Exception {
- String jsonString = getBadgerfishJSONString();
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- JSONBadgerfishDataSource source = getBadgerfishDataSource(jsonString);
- source.serialize(outStream, new OMOutputFormat());
- assertXMLEqual("<p xmlns=\"http://def.ns\" xmlns:bb=\"http://other.nsb\" xmlns:aa=\"http://other.ns\"><sam att=\"lets\">555</sam></p>",
- outStream.toString("utf-8"));
- }
-
- public void testBadgerfishSerialize2() throws Exception {
- String jsonString = getBadgerfishJSONString();
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- OutputStreamWriter writer = new OutputStreamWriter(outStream);
- JSONBadgerfishDataSource source = getBadgerfishDataSource(jsonString);
- source.serialize(writer, new OMOutputFormat());
- writer.flush();
- assertXMLEqual("<p xmlns=\"http://def.ns\" xmlns:bb=\"http://other.nsb\" xmlns:aa=\"http://other.ns\"><sam att=\"lets\">555</sam></p>",
- outStream.toString("utf-8"));
- }
-
- public void testBadgerfishSerialize3() throws XMLStreamException, JSONException, IOException,
- ParserConfigurationException, SAXException {
- String jsonString = getBadgerfishJSONString();
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- XMLStreamWriter writer = StAXUtils.createXMLStreamWriter(outStream);
- JSONBadgerfishDataSource source = getBadgerfishDataSource(jsonString);
- source.serialize(writer);
- writer.flush();
- assertXMLEqual("<p xmlns=\"http://def.ns\" xmlns:bb=\"http://other.nsb\" xmlns:aa=\"http://other.ns\"><sam att=\"lets\">555</sam></p>",
- outStream.toString("utf-8"));
+ public void testMappedSerialize() throws Exception {
+ JSONDataSource source = getMappedDataSource(
+ "{\"mapping\":{\"inner\":[{\"first\":\"test string one\"},\"test string two\"],\"name\":\"foo\"}}");
+ assertAbout(xml())
+ .that(OMAbstractFactory.getOMFactory().createOMElement(source))
+ .hasSameContentAs(
+ "<mapping><inner><first>test string one</first></inner><inner>test string two</inner><name>foo</name></mapping>");
+ }
+
+ public void testBadgerfishSerialize() throws Exception {
+ JSONBadgerfishDataSource source = getBadgerfishDataSource(
+ "{\"p\":{\"@xmlns\":{\"bb\":\"http://other.nsb\",\"aa\":\"http://other.ns\",\"$\":\"http://def.ns\"},\"sam\":{\"$\":\"555\", \"@att\":\"lets\"}}}");
+ assertAbout(xml())
+ .that(OMAbstractFactory.getOMFactory().createOMElement(source))
+ .hasSameContentAs(
+ "<p xmlns=\"http://def.ns\" xmlns:bb=\"http://other.nsb\" xmlns:aa=\"http://other.ns\"><sam att=\"lets\">555</sam></p>");
}
private JSONBadgerfishDataSource getBadgerfishDataSource(String jsonString) {
return new JSONBadgerfishDataSource(new StringReader(jsonString));
}
- private String getBadgerfishJSONString() {
- return "{\"p\":{\"@xmlns\":{\"bb\":\"http://other.nsb\",\"aa\":\"http://other.ns\",\"$\":\"http://def.ns\"},\"sam\":{\"$\":\"555\", \"@att\":\"lets\"}}}";
- }
-
private JSONDataSource getMappedDataSource(String jsonString) {
MessageContext messageContext = new MessageContext();
messageContext.setAxisService(new AxisService());
return new JSONDataSource(new StringReader(jsonString), messageContext);
}
-
- private String getMappedJSONString() {
- return "{\"mapping\":{\"inner\":[{\"first\":\"test string one\"},\"test string two\"],\"name\":\"foo\"}}";
- }
}
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/AxisFault.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/AxisFault.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/AxisFault.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/AxisFault.java Sat Jul 1 18:31:49 2017
@@ -40,6 +40,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
+import java.util.Locale;
/**
* An exception which maps cleanly to a SOAP fault.
@@ -230,7 +231,7 @@ public class AxisFault extends RemoteExc
}
if (soapFaultReason != null) {
- message = soapFaultReason.getText();
+ message = soapFaultReason.getFaultReasonText(Locale.ENGLISH);
}
if (soapFaultCode != null) {
@@ -380,7 +381,7 @@ public class AxisFault extends RemoteExc
if (faultReasonList.size() >= 1) {
return faultReasonList.get(0).getText();
} else if (soapFaultReason != null) {
- return soapFaultReason.getText();
+ return soapFaultReason.getFaultReasonText(Locale.ENGLISH);
}
return null;
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/dataretrieval/AxisDataLocatorImpl.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/dataretrieval/AxisDataLocatorImpl.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/dataretrieval/AxisDataLocatorImpl.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/dataretrieval/AxisDataLocatorImpl.java Sat Jul 1 18:31:49 2017
@@ -119,11 +119,11 @@ public class AxisDataLocatorImpl impleme
* caching ServiceData for Axis2 Data Locators
*/
private void cachingServiceData(OMElement e) {
- Iterator i = e.getChildrenWithName(new QName(
+ Iterator<OMElement> i = e.getChildrenWithName(new QName(
DRConstants.SERVICE_DATA.DATA));
String saveKey = "";
while (i.hasNext()) {
- ServiceData data = new ServiceData((OMElement) i.next());
+ ServiceData data = new ServiceData(i.next());
saveKey = data.getDialect();
String identifier = data.getIdentifier();
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/deployment/AxisConfigBuilder.java Sat Jul 1 18:31:49 2017
@@ -95,7 +95,7 @@ public class AxisConfigBuilder extends D
}
// processing Parameters
// Processing service level parameters
- Iterator itr = config_element.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> itr = config_element.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(itr, axisConfig, axisConfig);
@@ -111,19 +111,19 @@ public class AxisConfigBuilder extends D
}
}
// Process Module refs
- Iterator moduleitr =
+ Iterator<OMElement> moduleitr =
config_element.getChildrenWithName(new QName(DeploymentConstants.TAG_MODULE));
processModuleRefs(moduleitr, axisConfig);
// Processing Transport Senders
- Iterator trs_senders =
+ Iterator<OMElement> trs_senders =
config_element.getChildrenWithName(new QName(TAG_TRANSPORT_SENDER));
processTransportSenders(trs_senders);
// Processing Transport Receivers
- Iterator trs_Reivers =
+ Iterator<OMElement> trs_Reivers =
config_element.getChildrenWithName(new QName(TAG_TRANSPORT_RECEIVER));
processTransportReceivers(trs_Reivers);
@@ -139,22 +139,22 @@ public class AxisConfigBuilder extends D
processThreadContextMigrators(axisConfig, threadContextMigrators);
// Process Observers
- Iterator obs_ittr = config_element.getChildrenWithName(new QName(TAG_LISTENER));
+ Iterator<OMElement> obs_ittr = config_element.getChildrenWithName(new QName(TAG_LISTENER));
processObservers(obs_ittr);
// Processing Phase orders
- Iterator phaseorders = config_element.getChildrenWithName(new QName(TAG_PHASE_ORDER));
+ Iterator<OMElement> phaseorders = config_element.getChildrenWithName(new QName(TAG_PHASE_ORDER));
processPhaseOrders(phaseorders);
- Iterator moduleConfigs =
+ Iterator<OMElement> moduleConfigs =
config_element.getChildrenWithName(new QName(TAG_MODULE_CONFIG));
processModuleConfig(moduleConfigs, axisConfig, axisConfig);
// processing <wsp:Policy> .. </..> elements
- Iterator policyElements = PolicyUtil.getPolicyChildren(config_element);
+ Iterator<OMElement> policyElements = PolicyUtil.getPolicyChildren(config_element);
if (policyElements != null && policyElements.hasNext()) {
processPolicyElements(policyElements,
@@ -162,7 +162,7 @@ public class AxisConfigBuilder extends D
}
// processing <wsp:PolicyReference> .. </..> elements
- Iterator policyRefElements = PolicyUtil.getPolicyRefChildren(config_element);
+ Iterator<OMElement> policyRefElements = PolicyUtil.getPolicyRefChildren(config_element);
if (policyRefElements != null && policyRefElements.hasNext()) {
processPolicyRefElements(policyElements,
@@ -187,7 +187,7 @@ public class AxisConfigBuilder extends D
OMElement transactionElement = config_element.getFirstChildWithName(new QName(TAG_TRANSACTION));
if (transactionElement != null) {
ParameterInclude transactionParameters = new ParameterIncludeImpl();
- Iterator parameters = transactionElement.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> parameters = transactionElement.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(parameters, transactionParameters, null);
TransactionConfiguration txcfg = null;
@@ -270,7 +270,7 @@ public class AxisConfigBuilder extends D
}
}
//Processing deployers.
- Iterator deployerItr = config_element.getChildrenWithName(new QName(DEPLOYER));
+ Iterator<OMElement> deployerItr = config_element.getChildrenWithName(new QName(DEPLOYER));
if (deployerItr != null) {
processDeployers(deployerItr);
}
@@ -290,9 +290,9 @@ public class AxisConfigBuilder extends D
private void processTargetResolvers(AxisConfiguration axisConfig, OMElement targetResolvers) {
if (targetResolvers != null) {
- Iterator iterator = targetResolvers.getChildrenWithName(new QName(TAG_TARGET_RESOLVER));
+ Iterator<OMElement> iterator = targetResolvers.getChildrenWithName(new QName(TAG_TARGET_RESOLVER));
while (iterator.hasNext()) {
- OMElement targetResolver = (OMElement) iterator.next();
+ OMElement targetResolver = iterator.next();
OMAttribute classNameAttribute =
targetResolver.getAttribute(new QName(TAG_CLASS_NAME));
String className = classNameAttribute.getAttributeValue();
@@ -313,9 +313,9 @@ public class AxisConfigBuilder extends D
private void processThreadContextMigrators(AxisConfiguration axisConfig, OMElement targetResolvers) {
if (targetResolvers != null) {
- Iterator iterator = targetResolvers.getChildrenWithName(new QName(TAG_THREAD_CONTEXT_MIGRATOR));
+ Iterator<OMElement> iterator = targetResolvers.getChildrenWithName(new QName(TAG_THREAD_CONTEXT_MIGRATOR));
while (iterator.hasNext()) {
- OMElement threadContextMigrator = (OMElement) iterator.next();
+ OMElement threadContextMigrator = iterator.next();
OMAttribute listIdAttribute =
threadContextMigrator.getAttribute(new QName(TAG_LIST_ID));
String listId = listIdAttribute.getAttributeValue();
@@ -358,9 +358,9 @@ public class AxisConfigBuilder extends D
if (soaproleconfigElement != null) {
final boolean isUltimateReceiever = JavaUtils.isTrue(soaproleconfigElement.getAttributeValue(new QName(Constants.SOAP_ROLE_IS_ULTIMATE_RECEIVER_ATTRIBUTE)), true);
ArrayList roles = new ArrayList();
- Iterator iterator = soaproleconfigElement.getChildrenWithName(new QName(Constants.SOAP_ROLE_ELEMENT));
+ Iterator<OMElement> iterator = soaproleconfigElement.getChildrenWithName(new QName(Constants.SOAP_ROLE_ELEMENT));
while (iterator.hasNext()) {
- OMElement roleElement = (OMElement) iterator.next();
+ OMElement roleElement = iterator.next();
roles.add(roleElement.getText());
}
final List unmodifiableRoles = Collections.unmodifiableList(roles);
@@ -421,9 +421,9 @@ public class AxisConfigBuilder extends D
deployer.setDirectory(directory);
deployer.setExtension(extension);
- for (Iterator<?> itr = element.getChildrenWithName(new QName(
+ for (Iterator<OMElement> itr = element.getChildrenWithName(new QName(
TAG_SERVICE_BUILDER_EXTENSION)); itr.hasNext();) {
- OMElement serviceBuilderEle = (OMElement) itr.next();
+ OMElement serviceBuilderEle = itr.next();
String serviceBuilderClass = serviceBuilderEle.getAttributeValue(new QName(
TAG_CLASS_NAME));
String serviceBuilderName = serviceBuilderEle.getAttributeValue(new QName(
@@ -476,7 +476,7 @@ public class AxisConfigBuilder extends D
String module = moduleName_att.getAttributeValue();
ModuleConfiguration moduleConfiguration =
new ModuleConfiguration(module, parent);
- Iterator parameters = moduleConfig.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> parameters = moduleConfig.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(parameters, moduleConfiguration, parent);
config.addModuleConfig(moduleConfiguration);
@@ -527,7 +527,7 @@ public class AxisConfigBuilder extends D
observer = (AxisObserver) observerclass.newInstance();
// processing Parameters
// Processing service level parameters
- Iterator itr = observerelement.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> itr = observerelement.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(itr, observer, axisConfig);
// initialization
try {
@@ -546,10 +546,10 @@ public class AxisConfigBuilder extends D
private ArrayList processPhaseList(OMElement phaseOrders) throws DeploymentException {
ArrayList phaselist = new ArrayList();
- Iterator phases = phaseOrders.getChildrenWithName(new QName(TAG_PHASE));
+ Iterator<OMElement> phases = phaseOrders.getChildrenWithName(new QName(TAG_PHASE));
while (phases.hasNext()) {
- OMElement phaseelement = (OMElement) phases.next();
+ OMElement phaseelement = phases.next();
String phaseName =
phaseelement.getAttribute(new QName(ATTRIBUTE_NAME)).getAttributeValue();
String phaseClass = phaseelement.getAttributeValue(new QName(TAG_CLASS_NAME));
@@ -564,10 +564,10 @@ public class AxisConfigBuilder extends D
phase.setName(phaseName);
- Iterator handlers = phaseelement.getChildrenWithName(new QName(TAG_HANDLER));
+ Iterator<OMElement> handlers = phaseelement.getChildrenWithName(new QName(TAG_HANDLER));
while (handlers.hasNext()) {
- OMElement omElement = (OMElement) handlers.next();
+ OMElement omElement = handlers.next();
HandlerDescription handler = processHandler(omElement, axisConfig, phaseName);
handler.getRules().setPhaseName(phaseName);
@@ -616,9 +616,9 @@ public class AxisConfigBuilder extends D
private void processDefaultModuleVersions(OMElement defaultVersions)
throws DeploymentException {
- Iterator moduleVersions = defaultVersions.getChildrenWithName(new QName(TAG_MODULE));
+ Iterator<OMElement> moduleVersions = defaultVersions.getChildrenWithName(new QName(TAG_MODULE));
while (moduleVersions.hasNext()) {
- OMElement omElement = (OMElement) moduleVersions.next();
+ OMElement omElement = moduleVersions.next();
String name = omElement.getAttributeValue(new QName(ATTRIBUTE_NAME));
if (name == null) {
throw new DeploymentException(Messages.getMessage("modulenamecannotbenull"));
@@ -670,7 +670,7 @@ public class AxisConfigBuilder extends D
}
}
try {
- Iterator itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(itr, transportIN, axisConfig);
// adding to axis2 config
axisConfig.addTransportIn(transportIN);
@@ -717,7 +717,7 @@ public class AxisConfigBuilder extends D
// process Parameters
// processing Parameters
// Processing service level parameters
- Iterator itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));
+ Iterator<OMElement> itr = transport.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(itr, transportout, axisConfig);
// adding to axis2 config
@@ -760,11 +760,11 @@ public class AxisConfigBuilder extends D
axisConfig.addDataLocatorClassNames(DRConstants.GLOBAL_LEVEL,
className);
}
- Iterator iterator = dataLocatorElement.getChildrenWithName(new QName(
+ Iterator<OMElement> iterator = dataLocatorElement.getChildrenWithName(new QName(
DRConstants.DIALECT_LOCATOR_ELEMENT));
while (iterator.hasNext()) {
- OMElement locatorElement = (OMElement) iterator.next();
+ OMElement locatorElement = iterator.next();
OMAttribute dialect = locatorElement.getAttribute(new QName(
DRConstants.DIALECT_ATTRIBUTE));
OMAttribute dialectclass = locatorElement.getAttribute(new QName(
Modified: axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java?rev=1800521&r1=1800520&r2=1800521&view=diff
==============================================================================
--- axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java (original)
+++ axis/axis2/java/core/branches/hermetic-tests/modules/kernel/src/org/apache/axis2/deployment/ClusterBuilder.java Sat Jul 1 18:31:49 2017
@@ -130,9 +130,9 @@ public class ClusterBuilder extends Desc
return;
}
- for (Iterator iter = lbEle.getChildrenWithName(new QName("applicationDomain"));
+ for (Iterator<OMElement> iter = lbEle.getChildrenWithName(new QName("applicationDomain"));
iter.hasNext();) {
- OMElement omElement = (OMElement) iter.next();
+ OMElement omElement = iter.next();
String domainName = omElement.getAttributeValue(new QName("name")).trim();
String handlerClass = omElement.getAttributeValue(new QName("agent")).trim();
String descAttrib = omElement.getAttributeValue(new QName("description"));
@@ -265,9 +265,9 @@ public class ClusterBuilder extends Desc
replicationEle.getFirstChildWithName(new QName(TAG_DEFAULTS));
if (defaultsEle != null) {
List<String> defaults = new ArrayList<String>();
- for (Iterator iter = defaultsEle.getChildrenWithName(new QName(TAG_EXCLUDE));
+ for (Iterator<OMElement> iter = defaultsEle.getChildrenWithName(new QName(TAG_EXCLUDE));
iter.hasNext();) {
- OMElement excludeEle = (OMElement) iter.next();
+ OMElement excludeEle = iter.next();
OMAttribute nameAtt = excludeEle.getAttribute(new QName(ATTRIBUTE_NAME));
defaults.add(nameAtt.getAttributeValue());
}
@@ -275,15 +275,15 @@ public class ClusterBuilder extends Desc
}
// Process specifics
- for (Iterator iter = replicationEle.getChildrenWithName(new QName(TAG_CONTEXT));
+ for (Iterator<OMElement> iter = replicationEle.getChildrenWithName(new QName(TAG_CONTEXT));
iter.hasNext();) {
- OMElement contextEle = (OMElement) iter.next();
+ OMElement contextEle = iter.next();
String ctxClassName =
contextEle.getAttribute(new QName(ATTRIBUTE_CLASS)).getAttributeValue();
List<String> excludes = new ArrayList<String>();
- for (Iterator iter2 = contextEle.getChildrenWithName(new QName(TAG_EXCLUDE));
+ for (Iterator<OMElement> iter2 = contextEle.getChildrenWithName(new QName(TAG_EXCLUDE));
iter2.hasNext();) {
- OMElement excludeEle = (OMElement) iter2.next();
+ OMElement excludeEle = iter2.next();
OMAttribute nameAtt = excludeEle.getAttribute(new QName(ATTRIBUTE_NAME));
excludes.add(nameAtt.getAttributeValue());
}