Author: veithen
Date: Thu Apr 11 18:07:55 2013
New Revision: 1467021
URL: http://svn.apache.org/r1467021
Log:
Use UtilServer to simplify the code in JSONIntegrationTest.
Modified:
axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java
axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONTestConstants.java
Modified:
axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java?rev=1467021&r1=1467020&r2=1467021&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java
Thu Apr 11 18:07:55 2013
@@ -30,16 +30,12 @@ import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.testutils.PortAllocator;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.apache.axis2.testutils.UtilServer;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.BufferedReader;
-import java.io.File;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
@@ -50,37 +46,21 @@ public class JSONIntegrationTest impleme
private String expectedString;
- private static SimpleHTTPServer server;
-
- private static ConfigurationContext configurationContext;
-
private static EndpointReference echoTargetEPR;
private static String pojoUri;
@BeforeClass
public static void startServer() throws Exception {
- int testingPort = PortAllocator.allocatePort();
+ UtilServer.start("test-repository/json",
"test-repository/json/axis2.xml");
echoTargetEPR = new EndpointReference(
- "http://127.0.0.1:" + (testingPort)
+ "http://127.0.0.1:" + UtilServer.TESTING_PORT
+ "/axis2/services/EchoXMLService/echoOM");
- pojoUri = "http://127.0.0.1:" + testingPort +
"/axis2/services/POJOService";
-
- File configFile =
- new File(System.getProperty("basedir", ".") +
"/test-repository/json/axis2.xml");
- configurationContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(
- System.getProperty("basedir", ".") + "/test-repository/json",
- configFile.getAbsolutePath());
- server = new SimpleHTTPServer(configurationContext, testingPort);
- try {
- server.start();
- } finally {
-
- }
+ pojoUri = "http://127.0.0.1:" + UtilServer.TESTING_PORT +
"/axis2/services/POJOService";
}
@AfterClass
public static void stopServer() throws Exception {
- server.stop();
+ UtilServer.stop();
}
protected OMElement createEnvelope() throws Exception {
@@ -106,7 +86,7 @@ public class JSONIntegrationTest impleme
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setProperty(Constants.Configuration.HTTP_METHOD, httpMethod);
// ConfigurationContext clientConfigurationContext =
ConfigurationContextFactory.createDefaultConfigurationContext();
- ServiceClient sender = new ServiceClient(configurationContext, null);
+ ServiceClient sender = new
ServiceClient(UtilServer.getConfigurationContext(), null);
options.setAction(null);
sender.setOptions(options);
options.setTo(echoTargetEPR);
Modified:
axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONTestConstants.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONTestConstants.java?rev=1467021&r1=1467020&r2=1467021&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONTestConstants.java
(original)
+++
axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONTestConstants.java
Thu Apr 11 18:07:55 2013
@@ -19,16 +19,8 @@
package org.apache.axis2.json;
-import javax.xml.namespace.QName;
-
public interface JSONTestConstants {
- public static final QName serviceName = new QName("EchoXMLService");
-
- public static final QName operationName = new QName("echoOM");
-
- public static final QName swaServiceName = new QName("EchoSwAService");
-
public static final String CONTENT_TYPE_BADGERFISH =
"application/json/badgerfish";
public static final String CONTENT_TYPE_MAPPED = "application/json";