You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by da...@apache.org on 2007/02/05 21:27:14 UTC

svn commit: r503855 - in /webservices/axis2/trunk/java/modules/json/test/org/apache/axis2/json: JSONBadgerfishIntegrationTest.java JSONIntegrationTest.java

Author: davidillsley
Date: Mon Feb  5 12:27:13 2007
New Revision: 503855

URL: http://svn.apache.org/viewvc?view=rev&rev=503855
Log:
Refactor JSON 'integration tests' to improve pass rate with Maven2

Removed:
    webservices/axis2/trunk/java/modules/json/test/org/apache/axis2/json/JSONBadgerfishIntegrationTest.java
Modified:
    webservices/axis2/trunk/java/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java

Modified: webservices/axis2/trunk/java/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java?view=diff&rev=503855&r1=503854&r2=503855
==============================================================================
--- webservices/axis2/trunk/java/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java (original)
+++ webservices/axis2/trunk/java/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java Mon Feb  5 12:27:13 2007
@@ -46,8 +46,9 @@
     public JSONIntegrationTest() {
     }
 
+    private static int count = 0;
     protected void setUp() throws Exception {
-
+    	if(count == 0){
         File configFile = new File(System.getProperty("basedir",".") + "/test-resources/axis2.xml");
         configurationContext = ConfigurationContextFactory
                 .createConfigurationContextFromFileSystem(null, configFile
@@ -62,10 +63,14 @@
                 operationName);
         server.getConfigurationContext().getAxisConfiguration().addService(
                 service);
+        count++;
+    	}
     }
 
     protected void tearDown() throws Exception {
-        server.stop();
+    	if(count == 2){
+    		server.stop();
+    	}
     }
 
     protected OMElement createEnvelope() throws Exception {
@@ -83,14 +88,14 @@
         return rpcWrapEle;
     }
 
-    public void testEchoOMWithJSON() throws Exception {
-        OMElement payload = createEnvelope();
+    private void doEchoOM(String messageType) throws Exception{
+    	OMElement payload = createEnvelope();
         Options options = new Options();
         options.setTo(targetEPR);
-        options.setProperty(Constants.Configuration.MESSAGE_TYPE, getMessageType());
+        options.setProperty(Constants.Configuration.MESSAGE_TYPE, messageType);
         options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-
-        ServiceClient sender = new ServiceClient(configurationContext, null);
+        ConfigurationContext clientConfigurationContext = ConfigurationContextFactory.createDefaultConfigurationContext();
+        ServiceClient sender = new ServiceClient(clientConfigurationContext, null);
         options.setAction(null);
         sender.setOptions(options);
         options.setTo(targetEPR);
@@ -98,9 +103,13 @@
         OMElement ele = (OMElement) result.getFirstOMChild();
         compareWithCreatedOMText(ele.getText());
     }
-
-    protected String getMessageType() {
-        return "application/json";
+    
+    public void testEchoOMWithJSONBadgerfish() throws Exception{
+    	doEchoOM("application/json/badgerfish");
+    }
+    
+    public void testEchoOMWithJSON() throws Exception {
+    	doEchoOM("application/json");
     }
 
     protected void compareWithCreatedOMText(String response) {



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