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 gd...@apache.org on 2007/03/04 19:17:07 UTC
svn commit: r514453 [24/26] - in
/webservices/axis2/trunk/java/modules/kernel: src/org/apache/axis2/
src/org/apache/axis2/addressing/ src/org/apache/axis2/addressing/wsdl/
src/org/apache/axis2/builder/ src/org/apache/axis2/client/
src/org/apache/axis2/...
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSelfManagedDataTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSelfManagedDataTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSelfManagedDataTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSelfManagedDataTest.java Sun Mar 4 10:16:54 2007
@@ -16,26 +16,18 @@
package org.apache.axis2.engine;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
import junit.framework.TestCase;
-
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.*;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.OperationContext;
+import org.apache.axis2.context.SelfManagedDataManager;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.AxisServiceGroup;
@@ -43,7 +35,6 @@
import org.apache.axis2.description.InOutAxisOperation;
import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.handlers.AbstractHandler;
import org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver;
import org.apache.axis2.receivers.RawXMLINOutMessageReceiver;
@@ -51,8 +42,19 @@
import org.apache.axis2.transport.http.SimpleHTTPServer;
import org.apache.axis2.util.UUIDGenerator;
-public class MessageContextSelfManagedDataTest extends TestCase
-{
+import javax.xml.namespace.QName;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+public class MessageContextSelfManagedDataTest extends TestCase {
private File theFile = null;
boolean savedMessageContext = false;
@@ -62,22 +64,22 @@
private QName serviceName = new QName("NullService");
private QName operationName = new QName("DummyOp");
- private ConfigurationContext cfgContext = null;
- private ServiceGroupContext serviceGroupContext = null;
- private ServiceContext serviceContext = null;
- private OperationContext operationContext = null;
-
- private AxisConfiguration axisConfiguration = null;
- private AxisServiceGroup axisServiceGroup = null;
- private AxisService axisService = null;
- private AxisOperation axisOperation = null;
+ private ConfigurationContext cfgContext = null;
+ private ServiceGroupContext serviceGroupContext = null;
+ private ServiceContext serviceContext = null;
+ private OperationContext operationContext = null;
+
+ private AxisConfiguration axisConfiguration = null;
+ private AxisServiceGroup axisServiceGroup = null;
+ private AxisService axisService = null;
+ private AxisOperation axisOperation = null;
- private TransportOutDescription transportOut = null;
+ private TransportOutDescription transportOut = null;
private TransportOutDescription transportOut2 = null;
private TransportOutDescription transportOut3 = null;
- private TransportInDescription transportIn = null;
- private TransportInDescription transportIn2 = null;
- private TransportInDescription transportIn3 = null;
+ private TransportInDescription transportIn = null;
+ private TransportInDescription transportIn2 = null;
+ private TransportInDescription transportIn3 = null;
private MessageContext mc = null;
@@ -94,66 +96,58 @@
// use this to count how many times methods get called for a particular test
private int invokecallcount = 0;
-
// key-value pairs to be used for self managed data
- private String key01 = "key01";
- private String testData01 = "TempHandler01_01";
-
- private String key02 = "key02";
- private String testData02 = "TempHandler01_02";
+ private String key01 = "key01";
+ private String testData01 = "TempHandler01_01";
- private String key03 = "key03";
- private byte [] testData03 = { 0x1A,0x1B,0x1C,0x1D,0x1E,0x1B,0x1C,0x1D,0x1E,0x1F,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F};
+ private String key02 = "key02";
+ private String testData02 = "TempHandler01_02";
- private String key04 = "key04";
- private long [] testData04 = {0L,1L,-6601664200673063531L,-7753637088257391858L};
+ private String key03 = "key03";
+ private byte [] testData03 = {0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x01,
+ 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F};
- private String key05 = "key05";
- private int testData05 = 123456;
+ private String key04 = "key04";
+ private long [] testData04 = {0L, 1L, -6601664200673063531L, -7753637088257391858L};
+ private String key05 = "key05";
+ private int testData05 = 123456;
- public MessageContextSelfManagedDataTest(String arg0)
- {
+ public MessageContextSelfManagedDataTest(String arg0) {
super(arg0);
initAll();
}
- protected void initAll()
- {
- try
- {
+ protected void initAll() {
+ try {
prepare();
}
- catch (Exception e)
- {
- System.out.println("MessageContextSelfManagedDataTest:initAll: error in setting up object graph ["+e.getClass().getName()+" : "+e.getMessage()+"]");
+ catch (Exception e) {
+ System.out.println(
+ "MessageContextSelfManagedDataTest:initAll: error in setting up object graph [" +
+ e.getClass().getName() + " : " + e.getMessage() + "]");
}
- if (handler01 == null)
- {
+ if (handler01 == null) {
handler01 = new TempHandler01(101);
}
- if (handler02 == null)
- {
+ if (handler02 == null) {
handler02 = new TempHandler02(102);
}
- if (handler03 == null)
- {
+ if (handler03 == null) {
handler03 = new TempHandler03(103);
}
- if (handler04 == null)
- {
+ if (handler04 == null) {
handler04 = new TempHandler04(104);
}
- if (subhandler == null)
- {
+ if (subhandler == null) {
subhandler = new TempHandler02(1000);
}
@@ -163,16 +157,17 @@
//
// prepare the object hierarchy for testing
//
- private void prepare() throws Exception
- {
+ private void prepare() throws Exception {
//-----------------------------------------------------------------
axisConfiguration = new AxisConfiguration();
cfgContext = new ConfigurationContext(axisConfiguration);
- cfgContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
- cfgContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-out", new RawXMLINOutMessageReceiver());
+ cfgContext.getAxisConfiguration().addMessageReceiver(
+ "http://www.w3.org/2004/08/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
+ cfgContext.getAxisConfiguration().addMessageReceiver(
+ "http://www.w3.org/2004/08/wsdl/in-out", new RawXMLINOutMessageReceiver());
DispatchPhase dispatchPhase = new DispatchPhase();
dispatchPhase.setName("Dispatch");
@@ -211,13 +206,11 @@
axisOperation = new InOutAxisOperation(operationName);
- axisOperation.setMessageReceiver(new MessageReceiver()
- {
- public void receive(MessageContext messageCtx)
- {
+ axisOperation.setMessageReceiver(new MessageReceiver() {
+ public void receive(MessageContext messageCtx) {
- }
- });
+ }
+ });
axisService.addOperation(axisOperation);
axisService.mapActionToOperation(operationName.getLocalPart(), axisOperation);
@@ -227,16 +220,17 @@
//-----------------------------------------------------------------
- serviceGroupContext = ContextFactory.createServiceGroupContext(cfgContext, (AxisServiceGroup) axisService.getParent());
+ serviceGroupContext = ContextFactory
+ .createServiceGroupContext(cfgContext, (AxisServiceGroup) axisService.getParent());
serviceGroupContext.setId("ServiceGroupContextTest");
- serviceContext = ContextFactory.createServiceContext(serviceGroupContext,axisService);
+ serviceContext = ContextFactory.createServiceContext(serviceGroupContext, axisService);
- operationContext = serviceContext.createOperationContext(operationName);
+ operationContext = serviceContext.createOperationContext(operationName);
//-----------------------------------------------------------------
- transportOut = new TransportOutDescription(new QName("null"));
+ transportOut = new TransportOutDescription(new QName("null"));
transportOut2 = new TransportOutDescription(new QName("happy"));
transportOut3 = new TransportOutDescription(new QName("golucky"));
transportOut.setSender(new CommonsHTTPTransportSender());
@@ -269,8 +263,7 @@
* in order to run the desired test. See the handler class comments
* for their respective functions.
*/
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
//org.apache.log4j.BasicConfigurator.configure();
invokecallcount = 0;
@@ -320,11 +313,11 @@
mc.setMessageID(UUIDGenerator.getUUID());
//operationContext.addMessageContext(mc); gets done via the register
- axisOperation.registerOperationContext(mc,operationContext);
+ axisOperation.registerOperationContext(mc, operationContext);
mc.setOperationContext(operationContext);
mc.setServiceContext(serviceContext);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction(operationName.getLocalPart());
mc.setSoapAction(operationName.getLocalPart());
@@ -339,62 +332,57 @@
/**
* Test case for setting and removing data from a message context
*/
- public void testSelfManagedData01()
- {
- System.out.println("MessageContextSelfManagedDataTest::testSelfManagedData01()=======================================");
- try
- {
+ public void testSelfManagedData01() {
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testSelfManagedData01()=======================================");
+ try {
ArrayList handlers = new ArrayList();
handlers.add(handler01);
cfgContext.getAxisConfiguration().setInPhasesUptoAndIncludingPostDispatch(handlers);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisEngine engine = new AxisEngine(cfgContext);
engine.receive(mc);
}
- catch (Exception e)
- {
+ catch (Exception e) {
e.printStackTrace();
}
assertEquals(testData01, handler01.getTestData01FromMessageContext(mc));
assertEquals(testData02, handler01.getTestData02FromMessageContext(mc));
- boolean isOk3 = isEquals(testData03, handler01.getTestData03FromMessageContext(mc) );
+ boolean isOk3 = isEquals(testData03, handler01.getTestData03FromMessageContext(mc));
assertTrue(isOk3);
- boolean isOk4 = isEquals(testData04, handler01.getTestData04FromMessageContext(mc) );
+ boolean isOk4 = isEquals(testData04, handler01.getTestData04FromMessageContext(mc));
assertTrue(isOk4);
assertEquals(1, invokecallcount);
}
-
/**
* Test for setting, saving, restoring self managed data with no exceptions
*/
- public void testPause01_noExceptions()
- {
- System.out.println("MessageContextSelfManagedDataTest::testPause01_noExceptions()=======================================");
+ public void testPause01_noExceptions() {
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testPause01_noExceptions()=======================================");
- try
- {
+ try {
ArrayList handlers = new ArrayList();
handlers.add(handler02);
cfgContext.getAxisConfiguration().setInPhasesUptoAndIncludingPostDispatch(handlers);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisEngine engine = new AxisEngine(cfgContext);
engine.receive(mc);
}
- catch (Exception e)
- {
+ catch (Exception e) {
e.printStackTrace();
}
@@ -408,24 +396,22 @@
/**
* Test for verifying the self managed data used during the save and restore
*/
- public void testPause02_saveRestoreSelfManagedData()
- {
- System.out.println("MessageContextSelfManagedDataTest::testPause02_saveRestoreSelfManagedData()=======================================");
+ public void testPause02_saveRestoreSelfManagedData() {
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testPause02_saveRestoreSelfManagedData()=======================================");
- try
- {
+ try {
ArrayList handlers = new ArrayList();
handlers.add(handler02);
cfgContext.getAxisConfiguration().setInPhasesUptoAndIncludingPostDispatch(handlers);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisEngine engine = new AxisEngine(cfgContext);
engine.receive(mc);
}
- catch (Exception e)
- {
+ catch (Exception e) {
e.printStackTrace();
}
@@ -437,24 +423,22 @@
/**
* Test for save and restore of self managed data and the AxisOperation
*/
- public void testPause03_saveRestoreOperation()
- {
- System.out.println("MessageContextSelfManagedDataTest::testPause03_saveRestoreOperation()=======================================");
+ public void testPause03_saveRestoreOperation() {
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testPause03_saveRestoreOperation()=======================================");
- try
- {
+ try {
ArrayList handlers = new ArrayList();
handlers.add(handler02);
cfgContext.getAxisConfiguration().setInPhasesUptoAndIncludingPostDispatch(handlers);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisEngine engine = new AxisEngine(cfgContext);
engine.receive(mc);
}
- catch (Exception e)
- {
+ catch (Exception e) {
e.printStackTrace();
}
@@ -468,24 +452,22 @@
/**
* Test for save and restore of self managed data and the AxisService
*/
- public void testPause04_saveRestoreAxisService()
- {
- System.out.println("MessageContextSelfManagedDataTest::testPause04_saveRestoreAxisService()=======================================");
+ public void testPause04_saveRestoreAxisService() {
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testPause04_saveRestoreAxisService()=======================================");
- try
- {
+ try {
ArrayList handlers = new ArrayList();
handlers.add(handler02);
cfgContext.getAxisConfiguration().setInPhasesUptoAndIncludingPostDispatch(handlers);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisEngine engine = new AxisEngine(cfgContext);
engine.receive(mc);
}
- catch (Exception e)
- {
+ catch (Exception e) {
e.printStackTrace();
}
@@ -498,25 +480,23 @@
/**
* Test for save and restore of self managed data and the AxisServiceGroup
*/
- public void testPause05_saveRestoreAxisServiceGroup()
- {
- System.out.println("MessageContextSelfManagedDataTest::testPause05_saveRestoreAxisServiceGroup()=======================================");
+ public void testPause05_saveRestoreAxisServiceGroup() {
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testPause05_saveRestoreAxisServiceGroup()=======================================");
- try
- {
+ try {
ArrayList handlers = new ArrayList();
handlers.add(handler02);
cfgContext.getAxisConfiguration().setInPhasesUptoAndIncludingPostDispatch(handlers);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisEngine engine = new AxisEngine(cfgContext);
engine.receive(mc);
}
- catch (Exception e)
- {
+ catch (Exception e) {
e.printStackTrace();
}
@@ -529,9 +509,9 @@
/**
* Test for phases
*/
- public void testPause06_saveRestorePhases()
- {
- System.out.println("MessageContextSelfManagedDataTest::testPause06_saveRestorePhases()=======================================");
+ public void testPause06_saveRestorePhases() {
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testPause06_saveRestorePhases()=======================================");
TempHandler02 handlerA = new TempHandler02(666);
@@ -562,8 +542,7 @@
phase603.addHandler(new TempHandler02(67)); // slot 11
phase603.addHandler(new TempHandler03(68)); // slot 12
- try
- {
+ try {
ArrayList phases = new ArrayList();
phases.add(phase601);
phases.add(phase602);
@@ -571,14 +550,13 @@
cfgContext.getAxisConfiguration().setInPhasesUptoAndIncludingPostDispatch(phases);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisEngine engine = new AxisEngine(cfgContext);
engine.receive(mc);
}
- catch (Exception e)
- {
+ catch (Exception e) {
e.printStackTrace();
}
@@ -587,26 +565,20 @@
int it_count = 0;
Iterator it = restoredPhases.iterator();
- while (it.hasNext())
- {
+ while (it.hasNext()) {
// we know everything at this level is a Phase.
// if you change it, you might get a ClassCastException
- Phase restored_phase = (Phase)it.next();
+ Phase restored_phase = (Phase) it.next();
Phase original_phase = null;
it_count++;
- if (it_count == 1)
- {
+ if (it_count == 1) {
original_phase = phase601;
- }
- else if (it_count == 2)
- {
+ } else if (it_count == 2) {
original_phase = phase602;
- }
- else if (it_count == 3)
- {
+ } else if (it_count == 3) {
original_phase = phase603;
}
@@ -624,19 +596,21 @@
// Notice we do currently have a subhandler in the subPhase object.
// When axis2 decides to support nested handlers, the
// first three assertEquals below will fail.
- System.out.println("MessageContextSelfManagedDataTest::testPause06_saveRestorePhases():: invokecallcount ["+invokecallcount+"]");
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testPause06_saveRestorePhases():: invokecallcount [" +
+ invokecallcount + "]");
assertEquals(11, invokecallcount);
-
- // even though there are two occurrances of the same instance of
+ // even though there are two occurrances of the same instance of
// handlerA in the executionChain, its serialize and deserialize
// should only be called once per unique instance in the list
int count_s = handlerA.getSerializecallcount();
- System.out.println("MessageContextSelfManagedDataTest::testPause06_saveRestorePhases():: handlerA serialize call count ["+count_s+"]");
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testPause06_saveRestorePhases():: handlerA serialize call count [" +
+ count_s + "]");
assertEquals(11, count_s);
-
- // here comes some fun math...
+ // here comes some fun math...
// Since a handler (TempHandler02) in this case
// doesn't add any data until its invoke method gets called,
// and the invoke is what causes the save/restore (and thus
@@ -645,7 +619,9 @@
// invoke is called in the executionChain. Observing our phases,
// we see it is in slot #3. 11 - 3 = 8
int count_d = handlerA.getDeserializecallcount();
- System.out.println("MessageContextSelfManagedDataTest::testPause06_saveRestorePhases():: handlerA deserialize call count ["+count_d+"]");
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testPause06_saveRestorePhases():: handlerA deserialize call count [" +
+ count_d + "]");
assertEquals(8, count_d);
assertEquals(subhandler.testData, subhandler.getTestDataFromMessageContext(mc));
@@ -655,60 +631,55 @@
/**
* Test for save and restore of binary self managed data
*/
- public void testSelfManagedData07()
- {
- System.out.println("MessageContextSelfManagedDataTest::testSelfManagedData07()=======================================");
- try
- {
+ public void testSelfManagedData07() {
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testSelfManagedData07()=======================================");
+ try {
ArrayList handlers = new ArrayList();
handlers.add(handler03);
cfgContext.getAxisConfiguration().setInPhasesUptoAndIncludingPostDispatch(handlers);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisEngine engine = new AxisEngine(cfgContext);
engine.receive(mc);
}
- catch (Exception e)
- {
+ catch (Exception e) {
e.printStackTrace();
}
- boolean isOk3 = isEquals(testData03, (byte []) handler03.getTestDataFromMessageContext(mc) );
+ boolean isOk3 = isEquals(testData03, (byte []) handler03.getTestDataFromMessageContext(mc));
assertTrue(isOk3);
assertEquals(1, invokecallcount);
}
-
/**
* Test for handler04
*/
- public void testSelfManagedData08()
- {
- System.out.println("MessageContextSelfManagedDataTest::testSelfManagedData08()=======================================");
- try
- {
+ public void testSelfManagedData08() {
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testSelfManagedData08()=======================================");
+ try {
ArrayList handlers = new ArrayList();
handlers.add(handler04);
cfgContext.getAxisConfiguration().setInPhasesUptoAndIncludingPostDispatch(handlers);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisEngine engine = new AxisEngine(cfgContext);
engine.receive(mc);
}
- catch (Exception e)
- {
+ catch (Exception e) {
e.printStackTrace();
}
- boolean isOk4 = isEquals(testData04, (long []) handler04.getTestDataFromMessageContext(mc) );
+ boolean isOk4 = isEquals(testData04, (long []) handler04.getTestDataFromMessageContext(mc));
assertTrue(isOk4);
assertEquals(1, invokecallcount);
@@ -718,33 +689,31 @@
/**
* Test for handler03 and handler04
*/
- public void testSelfManagedData09()
- {
- System.out.println("MessageContextSelfManagedDataTest::testSelfManagedData09()=======================================");
- try
- {
+ public void testSelfManagedData09() {
+ System.out.println(
+ "MessageContextSelfManagedDataTest::testSelfManagedData09()=======================================");
+ try {
ArrayList handlers = new ArrayList();
handlers.add(handler03);
handlers.add(handler04);
cfgContext.getAxisConfiguration().setInPhasesUptoAndIncludingPostDispatch(handlers);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisEngine engine = new AxisEngine(cfgContext);
engine.receive(mc);
}
- catch (Exception e)
- {
+ catch (Exception e) {
e.printStackTrace();
}
- boolean isOk3 = isEquals(testData03, (byte []) handler03.getTestDataFromMessageContext(mc) );
+ boolean isOk3 = isEquals(testData03, (byte []) handler03.getTestDataFromMessageContext(mc));
assertTrue(isOk3);
- boolean isOk4 = isEquals(testData04, (long []) handler04.getTestDataFromMessageContext(mc) );
+ boolean isOk4 = isEquals(testData04, (long []) handler04.getTestDataFromMessageContext(mc));
assertTrue(isOk4);
assertEquals(2, invokecallcount);
@@ -756,34 +725,29 @@
/**
* Saves the specified message context to a temporary
- * file, then restores it.
- *
- * @param mc1 The message context object to save
- * @param fnprefix A prefix for the filename of the temporary file
- * @param desc Text that describes the caller's situation
+ * file, then restores it.
+ *
+ * @param mc1 The message context object to save
+ * @param fnprefix A prefix for the filename of the temporary file
+ * @param desc Text that describes the caller's situation
* @return The restored message context object or NULL
*/
- private MessageContext saveAndRestore(MessageContext mc1, String fnprefix, String desc)
- {
+ private MessageContext saveAndRestore(MessageContext mc1, String fnprefix, String desc) {
MessageContext msgContext2 = null;
- String title = "MessageContextSelfManagedDataTest::saveAndRestore::["+desc+"] ";
+ String title = "MessageContextSelfManagedDataTest::saveAndRestore::[" + desc + "] ";
System.out.println(title);
- try
- {
- theFile = File.createTempFile(fnprefix,null);
- System.out.println(title + "temp file = ["+theFile.getName()+"]");
+ try {
+ theFile = File.createTempFile(fnprefix, null);
+ System.out.println(title + "temp file = [" + theFile.getName() + "]");
}
- catch (Exception ex)
- {
- System.out.println(title + "error creating temp file = ["+ex.getMessage()+"]");
+ catch (Exception ex) {
+ System.out.println(title + "error creating temp file = [" + ex.getMessage() + "]");
theFile = null;
}
- if (theFile != null)
- {
- try
- {
+ if (theFile != null) {
+ try {
// setup an output stream to a physical file
FileOutputStream outStream = new FileOutputStream(theFile);
@@ -828,16 +792,14 @@
System.out.println(title + "....restored message context .....");
}
- catch (Exception ex2)
- {
- if (savedMessageContext != true)
- {
- System.out.println(title + "Error with saving message context = ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ if (savedMessageContext != true) {
+ System.out.println(title + "Error with saving message context = [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
- }
- else
- {
- System.out.println(title + "Error with restoring message context = ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ } else {
+ System.out.println(title + "Error with restoring message context = [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
}
@@ -845,14 +807,11 @@
// if the save/restore of the message context succeeded,
// then don't keep the temporary file around
boolean removeTmpFile = savedMessageContext && restoredMessageContext;
- if (removeTmpFile)
- {
- try
- {
+ if (removeTmpFile) {
+ try {
theFile.delete();
}
- catch (Exception e)
- {
+ catch (Exception e) {
// just absorb it
}
}
@@ -864,30 +823,22 @@
/**
* Gets the ID associated with the handler object.
- *
- * @param o The handler object
+ *
+ * @param o The handler object
* @return The ID associated with the handler,
* -1 otherwise
*/
- private int getHandlerID(Object o)
- {
+ private int getHandlerID(Object o) {
int id = -1;
- if (o instanceof TempHandler01)
- {
- id = ((TempHandler01)o).getID();
- }
- else if (o instanceof TempHandler02)
- {
- id = ((TempHandler02)o).getID();
- }
- else if (o instanceof TempHandler03)
- {
- id = ((TempHandler03)o).getID();
- }
- else if (o instanceof TempHandler04)
- {
- id = ((TempHandler04)o).getID();
+ if (o instanceof TempHandler01) {
+ id = ((TempHandler01) o).getID();
+ } else if (o instanceof TempHandler02) {
+ id = ((TempHandler02) o).getID();
+ } else if (o instanceof TempHandler03) {
+ id = ((TempHandler03) o).getID();
+ } else if (o instanceof TempHandler04) {
+ id = ((TempHandler04) o).getID();
}
return id;
@@ -896,45 +847,41 @@
/**
* Check the handler objects to see if they are equivalent.
- *
- * @param o1 The first handler
- * @param o2 The second handler
+ *
+ * @param o1 The first handler
+ * @param o2 The second handler
* @return TRUE if the handler objects are equivalent,
* FALSE otherwise
*/
- private boolean compareHandlers(Object o1, Object o2)
- {
- if ((o1 == null) && (o2 == null))
- {
+ private boolean compareHandlers(Object o1, Object o2) {
+ if ((o1 == null) && (o2 == null)) {
return true;
}
- if ((o1 != null) && (o2 != null))
- {
+ if ((o1 != null) && (o2 != null)) {
String c1 = o1.getClass().getName();
String c2 = o2.getClass().getName();
- if (c1.equals(c2))
- {
- System.out.println("MessagecontextSelfManagedDataTest::compareHandlers: class ["+c1+"] match ");
+ if (c1.equals(c2)) {
+ System.out.println("MessagecontextSelfManagedDataTest::compareHandlers: class [" +
+ c1 + "] match ");
int id1 = getHandlerID(o1);
int id2 = getHandlerID(o2);
- if (id1 == id2)
- {
- System.out.println("MessagecontextSelfManagedDataTest::compareHandlers: id ["+id1+"] match");
+ if (id1 == id2) {
+ System.out.println("MessagecontextSelfManagedDataTest::compareHandlers: id [" +
+ id1 + "] match");
return true;
- }
- else
- {
- System.out.println("MessagecontextSelfManagedDataTest::compareHandlers: id1 ["+id1+"] != id2 ["+id2+"] ");
+ } else {
+ System.out.println(
+ "MessagecontextSelfManagedDataTest::compareHandlers: id1 [" + id1 +
+ "] != id2 [" + id2 + "] ");
return false;
}
- }
- else
- {
- System.out.println("MessagecontextSelfManagedDataTest::compareHandlers: class1 ["+c1+"] != class2 ["+c2+"] ");
+ } else {
+ System.out.println("MessagecontextSelfManagedDataTest::compareHandlers: class1 [" +
+ c1 + "] != class2 [" + c2 + "] ");
return false;
}
}
@@ -945,76 +892,59 @@
/**
* Compare two phases.
- *
- * @param o1 The first phase object
- * @param o2 The second phase object
+ *
+ * @param o1 The first phase object
+ * @param o2 The second phase object
* @return TRUE if the phases are equivalent,
* FALSE otherwise
*/
- private boolean comparePhases(Object o1, Object o2)
- {
- if ((o1 == null) && (o2 == null))
- {
+ private boolean comparePhases(Object o1, Object o2) {
+ if ((o1 == null) && (o2 == null)) {
return true;
}
- try
- {
- if ( ((o1 != null) && (o2 != null))
- && ((o1 instanceof Phase) && (o2 instanceof Phase))
- )
- {
+ try {
+ if (((o1 != null) && (o2 != null))
+ && ((o1 instanceof Phase) && (o2 instanceof Phase))
+ ) {
Phase p1 = (Phase) o1;
Phase p2 = (Phase) o2;
ArrayList list1 = p1.getHandlers();
ArrayList list2 = p2.getHandlers();
- if ((list1 == null) && (list2 == null))
- {
+ if ((list1 == null) && (list2 == null)) {
return true;
}
- if ((list1 != null) && (list2 != null))
- {
+ if ((list1 != null) && (list2 != null)) {
int size1 = list1.size();
int size2 = list2.size();
- if (size1 != size2)
- {
+ if (size1 != size2) {
return false;
}
- for (int j=0; j<size1; j++)
- {
+ for (int j = 0; j < size1; j++) {
Object obj1 = list1.get(j);
Object obj2 = list2.get(j);
- if ((obj1 == null) && (obj2 == null))
- {
+ if ((obj1 == null) && (obj2 == null)) {
// ok
- }
- else if ((obj1 != null) && (obj2 != null))
- {
+ } else if ((obj1 != null) && (obj2 != null)) {
boolean check = false;
- if (obj1 instanceof Phase)
- {
+ if (obj1 instanceof Phase) {
check = comparePhases(obj1, obj2);
- }
- else
- {
+ } else {
// must be a handler
check = compareHandlers(obj1, obj2);
}
- if (check == false)
- {
+ if (check == false) {
return false;
}
- }
- else
- {
+ } else {
// mismatch
return false;
}
@@ -1028,8 +958,7 @@
}
}
- catch (Exception e)
- {
+ catch (Exception e) {
// some error
e.printStackTrace();
}
@@ -1068,48 +997,39 @@
* TempHandler01 simply sets and/or removes data from the MessageContext
* object.
*/
- public class TempHandler01 extends AbstractHandler
- {
+ public class TempHandler01 extends AbstractHandler {
private int id = -2;
- public TempHandler01()
- {
+ public TempHandler01() {
id = -1;
}
- public TempHandler01(int id)
- {
+ public TempHandler01(int id) {
this.id = id;
}
- public int getID()
- {
+ public int getID() {
return this.id;
}
- public String getName()
- {
+ public String getName() {
return new String(Integer.toString(id));
}
- public String getTestData01FromMessageContext(MessageContext _mc)
- {
- return(String)_mc.getSelfManagedData(this.getClass(), key01);
+ public String getTestData01FromMessageContext(MessageContext _mc) {
+ return (String) _mc.getSelfManagedData(this.getClass(), key01);
}
- public String getTestData02FromMessageContext(MessageContext _mc)
- {
- return(String)_mc.getSelfManagedData(this.getClass(), key02);
+ public String getTestData02FromMessageContext(MessageContext _mc) {
+ return (String) _mc.getSelfManagedData(this.getClass(), key02);
}
- public byte [] getTestData03FromMessageContext(MessageContext _mc)
- {
- return(byte [])_mc.getSelfManagedData(this.getClass(), key03);
+ public byte [] getTestData03FromMessageContext(MessageContext _mc) {
+ return (byte []) _mc.getSelfManagedData(this.getClass(), key03);
}
- public long [] getTestData04FromMessageContext(MessageContext _mc)
- {
- return(long [])_mc.getSelfManagedData(this.getClass(), key04);
+ public long [] getTestData04FromMessageContext(MessageContext _mc) {
+ return (long []) _mc.getSelfManagedData(this.getClass(), key04);
}
/* we're just using the invoke to set/change/remove data
@@ -1119,22 +1039,21 @@
* for key03: set, remove, set, get
* for key04: set, get, set, get
*/
- public InvocationResponse invoke(MessageContext _mc) throws AxisFault
- {
+ public InvocationResponse invoke(MessageContext _mc) throws AxisFault {
- String desc = "TempHandler01[id="+id+"].invoke()";
- String title = "MessageContextSelfManagedDataTest::"+desc;
+ String desc = "TempHandler01[id=" + id + "].invoke()";
+ String title = "MessageContextSelfManagedDataTest::" + desc;
System.out.println(title);
String tmp = "whaaa?";
_mc.setSelfManagedData(this.getClass(), key02, tmp);
- String data2 = (String)_mc.getSelfManagedData(this.getClass(), key02);
+ String data2 = (String) _mc.getSelfManagedData(this.getClass(), key02);
assertEquals(tmp, data2);
_mc.setSelfManagedData(this.getClass(), key01, testData01);
_mc.removeSelfManagedData(this.getClass(), key01);
_mc.setSelfManagedData(this.getClass(), key01, testData01);
- String data1 = (String)_mc.getSelfManagedData(this.getClass(), key01);
+ String data1 = (String) _mc.getSelfManagedData(this.getClass(), key01);
assertEquals(data1, testData01);
_mc.setSelfManagedData(this.getClass(), key02, testData02);
@@ -1154,7 +1073,7 @@
invokecallcount++;
- System.out.println(title+": Completed");
+ System.out.println(title + ": Completed");
return InvocationResponse.CONTINUE;
}
@@ -1166,8 +1085,7 @@
* called by the MessageContext object when saved in this handler's invoke()),
*
*/
- public class TempHandler02 extends AbstractHandler implements SelfManagedDataManager
- {
+ public class TempHandler02 extends AbstractHandler implements SelfManagedDataManager {
private int id = -2;
private int serializecallcount = 0;
private int deserializecallcount = 0;
@@ -1176,8 +1094,7 @@
/*
* constructor
*/
- public TempHandler02()
- {
+ public TempHandler02() {
this.id = -1;
this.serializecallcount = 0;
this.deserializecallcount = 0;
@@ -1186,26 +1103,22 @@
/*
* constructor
*/
- public TempHandler02(int id)
- {
+ public TempHandler02(int id) {
this.id = id;
this.serializecallcount = 0;
this.deserializecallcount = 0;
}
- public int getID()
- {
+ public int getID() {
return this.id;
}
- public String getName()
- {
+ public String getName() {
return new String(Integer.toString(id));
}
- public String getTestDataFromMessageContext(MessageContext _mc)
- {
- return(String)_mc.getSelfManagedData(this.getClass(), Integer.toString(id));
+ public String getTestDataFromMessageContext(MessageContext _mc) {
+ return (String) _mc.getSelfManagedData(this.getClass(), Integer.toString(id));
}
/*
@@ -1217,17 +1130,18 @@
* 2. verify that deserializeSelfManagedData is actually called when restoring the MessageContext object
* 3. verify that any SelfManagedData stored in the MessageContext is properly saved/restored (via serializeSelfManagedData/deserializeSelfManagedData)
*/
- public InvocationResponse invoke(MessageContext _mc) throws AxisFault
- {
- String desc = "TempHandler02[id="+id+"].invoke()";
- String title = "MessageContextSelfManagedDataTest::"+desc;
+ public InvocationResponse invoke(MessageContext _mc) throws AxisFault {
+ String desc = "TempHandler02[id=" + id + "].invoke()";
+ String title = "MessageContextSelfManagedDataTest::" + desc;
System.out.println(title);
MessageContext msgContext2 = null; // this will be the restored one
- _mc.setSelfManagedData(this.getClass(), Integer.toString(id), testData + Integer.toString(id));
+ _mc.setSelfManagedData(this.getClass(), Integer.toString(id),
+ testData + Integer.toString(id));
- System.out.println(title+": Setting self managed data using key ["+Integer.toString(id)+"]");
+ System.out.println(title + ": Setting self managed data using key [" +
+ Integer.toString(id) + "]");
msgContext2 = saveAndRestore(_mc, "TempHandler02_", desc);
@@ -1236,17 +1150,18 @@
invokecallcount++;
- System.out.println(title+": Completed");
+ System.out.println(title + ": Completed");
return InvocationResponse.CONTINUE;
}
- public void deserializeSelfManagedData(ByteArrayInputStream data, MessageContext _mc) throws IOException
- {
+ public void deserializeSelfManagedData(ByteArrayInputStream data, MessageContext _mc)
+ throws IOException {
deserializecallcount++;
- String desc = "TempHandler02[id="+id+"].deserializeSelfManagedData() count ["+deserializecallcount+"]";
- String title = "MessageContextSelfManagedDataTest::"+desc;
+ String desc = "TempHandler02[id=" + id + "].deserializeSelfManagedData() count [" +
+ deserializecallcount + "]";
+ String title = "MessageContextSelfManagedDataTest::" + desc;
System.out.println(title);
ObjectInputStream ois = new ObjectInputStream(data);
@@ -1255,24 +1170,24 @@
}
- public void restoreTransientData(MessageContext _mc)
- {
+ public void restoreTransientData(MessageContext _mc) {
// not necessary to test
}
- public ByteArrayOutputStream serializeSelfManagedData(MessageContext _mc) throws IOException
- {
+ public ByteArrayOutputStream serializeSelfManagedData(MessageContext _mc)
+ throws IOException {
serializecallcount++;
- String desc = "TempHandler02[id="+id+"].serializeSelfManagedData() count ["+serializecallcount+"]";
- String title = "MessageContextSelfManagedDataTest::"+desc;
+ String desc = "TempHandler02[id=" + id + "].serializeSelfManagedData() count [" +
+ serializecallcount + "]";
+ String title = "MessageContextSelfManagedDataTest::" + desc;
System.out.println(title);
- String storedTestData = (String)_mc.getSelfManagedData(this.getClass(), Integer.toString(id));
- if (storedTestData == null)
- {
- System.out.println(title+": No self managed data to serialize");
+ String storedTestData =
+ (String) _mc.getSelfManagedData(this.getClass(), Integer.toString(id));
+ if (storedTestData == null) {
+ System.out.println(title + ": No self managed data to serialize");
return null;
}
@@ -1283,18 +1198,19 @@
int baos_size = baos.size();
baos.close();
- System.out.println(title+": saved self managed data string length ["+storedTestData.length()+"]");
- System.out.println(title+": saved self managed data byte array output stream (UTF) length ["+baos_size+"]");
+ System.out.println(title + ": saved self managed data string length [" +
+ storedTestData.length() + "]");
+ System.out.println(title +
+ ": saved self managed data byte array output stream (UTF) length [" +
+ baos_size + "]");
return baos;
}
- public int getDeserializecallcount()
- {
+ public int getDeserializecallcount() {
return deserializecallcount;
}
- public int getSerializecallcount()
- {
+ public int getSerializecallcount() {
return serializecallcount;
}
}
@@ -1305,34 +1221,28 @@
* called by the MessageContext object when saved in this handler's invoke()),
*
*/
- public class TempHandler03 extends AbstractHandler implements SelfManagedDataManager
- {
+ public class TempHandler03 extends AbstractHandler implements SelfManagedDataManager {
private int id = -2;
private int serializecallcount = 0;
private int deserializecallcount = 0;
- public TempHandler03()
- {
+ public TempHandler03() {
id = -1;
}
- public TempHandler03(int id)
- {
+ public TempHandler03(int id) {
this.id = id;
}
- public int getID()
- {
+ public int getID() {
return this.id;
}
- public String getName()
- {
+ public String getName() {
return new String(Integer.toString(id));
}
- public Object getTestDataFromMessageContext(MessageContext _mc)
- {
+ public Object getTestDataFromMessageContext(MessageContext _mc) {
return _mc.getSelfManagedData(this.getClass(), Integer.toString(id));
}
@@ -1347,8 +1257,8 @@
*/
public InvocationResponse invoke(MessageContext _mc) throws AxisFault {
- String desc = "TempHandler03[id="+id+"].invoke()";
- String title = "MessageContextSelfManagedDataTest::"+desc;
+ String desc = "TempHandler03[id=" + id + "].invoke()";
+ String title = "MessageContextSelfManagedDataTest::" + desc;
System.out.println(title);
MessageContext msgContext2 = null; // this will be the restored one
@@ -1356,7 +1266,8 @@
// add the byte [] of data
_mc.setSelfManagedData(this.getClass(), Integer.toString(id), testData03);
- System.out.println(title+": Setting self managed data using key ["+Integer.toString(id)+"]");
+ System.out.println(title + ": Setting self managed data using key [" +
+ Integer.toString(id) + "]");
msgContext2 = saveAndRestore(_mc, "TempHandler03_", desc);
@@ -1365,18 +1276,19 @@
invokecallcount++;
- System.out.println(title+": Completed");
+ System.out.println(title + ": Completed");
return InvocationResponse.CONTINUE;
}
- public void deserializeSelfManagedData(ByteArrayInputStream data, MessageContext _mc) throws IOException
- {
+ public void deserializeSelfManagedData(ByteArrayInputStream data, MessageContext _mc)
+ throws IOException {
boolean isOK = true;
deserializecallcount++;
- String desc = "TempHandler03[id="+id+"].deserializeSelfManagedData() count ["+deserializecallcount+"]";
- String title = "MessageContextSelfManagedDataTest::"+desc;
+ String desc = "TempHandler03[id=" + id + "].deserializeSelfManagedData() count [" +
+ deserializecallcount + "]";
+ String title = "MessageContextSelfManagedDataTest::" + desc;
System.out.println(title);
int expected = testData03.length;
@@ -1386,24 +1298,19 @@
boolean keepGoing = true;
int index = 0;
- while (keepGoing)
- {
+ while (keepGoing) {
int tmpdata = data.read();
- if (tmpdata != -1)
- {
+ if (tmpdata != -1) {
Integer value = new Integer(tmpdata);
tmp[index] = value.byteValue();
index++;
- if (index > expected)
- {
+ if (index > expected) {
isOK = false;
assertTrue(isOK);
}
- }
- else
- {
+ } else {
keepGoing = false;
}
}
@@ -1414,24 +1321,24 @@
_mc.setSelfManagedData(this.getClass(), Integer.toString(id), tmp);
}
- public void restoreTransientData(MessageContext _mc)
- {
+ public void restoreTransientData(MessageContext _mc) {
// not necessary to test
}
- public ByteArrayOutputStream serializeSelfManagedData(MessageContext _mc) throws IOException {
+ public ByteArrayOutputStream serializeSelfManagedData(MessageContext _mc)
+ throws IOException {
serializecallcount++;
- String desc = "TempHandler03[id="+id+"].serializeSelfManagedData() count ["+serializecallcount+"]";
- String title = "MessageContextSelfManagedDataTest::"+desc;
+ String desc = "TempHandler03[id=" + id + "].serializeSelfManagedData() count [" +
+ serializecallcount + "]";
+ String title = "MessageContextSelfManagedDataTest::" + desc;
System.out.println(title);
- byte [] tmp = (byte []) _mc.getSelfManagedData(this.getClass(), Integer.toString(id));
+ byte [] tmp = (byte []) _mc.getSelfManagedData(this.getClass(), Integer.toString(id));
- if (tmp == null)
- {
- System.out.println(title+": No self managed data to serialize");
+ if (tmp == null) {
+ System.out.println(title + ": No self managed data to serialize");
return null;
}
@@ -1440,19 +1347,20 @@
int baos_size = baos.size();
baos.close();
- System.out.println(title+": saved self managed data byte [] length ["+tmp.length+"]");
- System.out.println(title+": saved self managed data byte array output stream length ["+baos_size+"]");
+ System.out.println(
+ title + ": saved self managed data byte [] length [" + tmp.length + "]");
+ System.out.println(title +
+ ": saved self managed data byte array output stream length [" + baos_size +
+ "]");
return baos;
}
- public int getDeserializecallcout()
- {
+ public int getDeserializecallcout() {
return deserializecallcount;
}
- public int getSerializecallcount()
- {
+ public int getSerializecallcount() {
return serializecallcount;
}
}
@@ -1463,35 +1371,29 @@
* called by the MessageContext object when saved in this handler's invoke()),
*
*/
- public class TempHandler04 extends AbstractHandler implements SelfManagedDataManager
- {
+ public class TempHandler04 extends AbstractHandler implements SelfManagedDataManager {
private int id = -2;
private int serializecallcount = 0;
private int deserializecallcount = 0;
- public TempHandler04()
- {
+ public TempHandler04() {
id = -1;
}
- public TempHandler04(int id)
- {
+ public TempHandler04(int id) {
this.id = id;
}
- public int getID()
- {
+ public int getID() {
return this.id;
}
- public String getName()
- {
+ public String getName() {
return new String(Integer.toString(id));
}
- public Object getTestDataFromMessageContext(MessageContext _mc)
- {
+ public Object getTestDataFromMessageContext(MessageContext _mc) {
return _mc.getSelfManagedData(this.getClass(), Integer.toString(id));
}
@@ -1506,8 +1408,8 @@
*/
public InvocationResponse invoke(MessageContext _mc) throws AxisFault {
- String desc = "TempHandler04[id="+id+"].invoke()";
- String title = "MessageContextSelfManagedDataTest::"+desc;
+ String desc = "TempHandler04[id=" + id + "].invoke()";
+ String title = "MessageContextSelfManagedDataTest::" + desc;
System.out.println(title);
MessageContext msgContext2 = null; // this will be the restored one
@@ -1515,7 +1417,8 @@
// add the byte [] of data
_mc.setSelfManagedData(this.getClass(), Integer.toString(id), testData04);
- System.out.println(title+": Setting self managed data using key ["+Integer.toString(id)+"]");
+ System.out.println(title + ": Setting self managed data using key [" +
+ Integer.toString(id) + "]");
msgContext2 = saveAndRestore(_mc, "TempHandler04_", desc);
@@ -1524,18 +1427,19 @@
invokecallcount++;
- System.out.println(title+": Completed");
+ System.out.println(title + ": Completed");
return InvocationResponse.CONTINUE;
}
- public void deserializeSelfManagedData(ByteArrayInputStream data, MessageContext _mc) throws IOException
- {
+ public void deserializeSelfManagedData(ByteArrayInputStream data, MessageContext _mc)
+ throws IOException {
boolean isOK = true;
deserializecallcount++;
- String desc = "TempHandler04[id="+id+"].deserializeSelfManagedData() count ["+deserializecallcount+"]";
- String title = "MessageContextSelfManagedDataTest::"+desc;
+ String desc = "TempHandler04[id=" + id + "].deserializeSelfManagedData() count [" +
+ deserializecallcount + "]";
+ String title = "MessageContextSelfManagedDataTest::" + desc;
System.out.println(title);
int expected = testData04.length;
@@ -1549,25 +1453,20 @@
int sizeWritten = ois.readInt();
- if (sizeWritten > 0)
- {
- while (keepGoing)
- {
- try
- {
+ if (sizeWritten > 0) {
+ while (keepGoing) {
+ try {
long tmpdata = ois.readLong();
tmp[index] = tmpdata;
index++;
- if (index > expected)
- {
+ if (index > expected) {
isOK = false;
assertTrue(isOK);
}
}
- catch (Exception exc)
- {
+ catch (Exception exc) {
keepGoing = false;
}
}
@@ -1580,36 +1479,35 @@
}
- public void restoreTransientData(MessageContext _mc)
- {
+ public void restoreTransientData(MessageContext _mc) {
// not necessary to test
}
- public ByteArrayOutputStream serializeSelfManagedData(MessageContext _mc) throws IOException {
+ public ByteArrayOutputStream serializeSelfManagedData(MessageContext _mc)
+ throws IOException {
serializecallcount++;
- String desc = "TempHandler04[id="+id+"].serializeSelfManagedData() count ["+serializecallcount+"]";
- String title = "MessageContextSelfManagedDataTest::"+desc;
+ String desc = "TempHandler04[id=" + id + "].serializeSelfManagedData() count [" +
+ serializecallcount + "]";
+ String title = "MessageContextSelfManagedDataTest::" + desc;
System.out.println(title);
- long [] tmp = (long []) _mc.getSelfManagedData(this.getClass(), Integer.toString(id));
+ long [] tmp = (long []) _mc.getSelfManagedData(this.getClass(), Integer.toString(id));
- if (tmp == null)
- {
- System.out.println(title+": No self managed data to serialize");
+ if (tmp == null) {
+ System.out.println(title + ": No self managed data to serialize");
return null;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
int size = tmp.length;
oos.writeInt(size);
- for (int i=0; i<size; i++)
- {
+ for (int i = 0; i < size; i++) {
oos.writeLong(tmp[i]);
}
@@ -1617,19 +1515,20 @@
int baos_size = baos.size();
baos.close();
- System.out.println(title+": saved self managed data byte [] length ["+tmp.length+"]");
- System.out.println(title+": saved self managed data byte array output stream length ["+baos_size+"]");
+ System.out.println(
+ title + ": saved self managed data byte [] length [" + tmp.length + "]");
+ System.out.println(title +
+ ": saved self managed data byte array output stream length [" + baos_size +
+ "]");
return baos;
}
- public int getDeserializecallcount()
- {
+ public int getDeserializecallcount() {
return deserializecallcount;
}
- public int getSerializecallcount()
- {
+ public int getSerializecallcount() {
return serializecallcount;
}
}
@@ -1638,20 +1537,16 @@
/*
* compares the two byte arrays to see if they are equal
*/
- private boolean isEquals(byte [] b1, byte [] b2)
- {
+ private boolean isEquals(byte [] b1, byte [] b2) {
int size1 = b1.length;
int size2 = b2.length;
- if (size1 != size2)
- {
+ if (size1 != size2) {
return false;
}
- for (int i=0; i<size1; i++)
- {
- if (b1[i] != b2[i])
- {
+ for (int i = 0; i < size1; i++) {
+ if (b1[i] != b2[i]) {
return false;
}
}
@@ -1662,20 +1557,16 @@
/*
* compares the two long arrays to see if they are equal
*/
- private boolean isEquals(long [] L1, long [] L2)
- {
+ private boolean isEquals(long [] L1, long [] L2) {
int size1 = L1.length;
int size2 = L2.length;
- if (size1 != size2)
- {
+ if (size1 != size2) {
return false;
}
- for (int i=0; i<size1; i++)
- {
- if (L1[i] != L2[i])
- {
+ for (int i = 0; i < size1; i++) {
+ if (L1[i] != L2[i]) {
return false;
}
}
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextTest.java Sun Mar 4 10:16:54 2007
@@ -22,8 +22,8 @@
import org.apache.axis2.AbstractTestCase;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
import org.apache.axis2.context.ContextFactory;
+import org.apache.axis2.context.MessageContext;
import org.apache.axis2.description.AxisService;
public class MessageContextTest extends AbstractTestCase {
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ModuleConfigTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ModuleConfigTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ModuleConfigTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ModuleConfigTest.java Sun Mar 4 10:16:54 2007
@@ -36,13 +36,16 @@
public class ModuleConfigTest extends TestCase {
AxisConfiguration ar;
- String axis2xml = System.getProperty("basedir") + "/target/test-resources/deployment/moduleConfig/axis2.xml";
+ String axis2xml = System.getProperty("basedir") +
+ "/target/test-resources/deployment/moduleConfig/axis2.xml";
String repo = System.getProperty("basedir") + "/target/test-resources/deployment/moduleConfig";
public void testModuleConfigAtAxisConfig() {
try {
- ar = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, axis2xml).getAxisConfiguration();
+ ar = ConfigurationContextFactory
+ .createConfigurationContextFromFileSystem(null, axis2xml)
+ .getAxisConfiguration();
ModuleConfiguration moduleConfiguration =
ar.getModuleConfig(new QName("testModule"));
assertNotNull(moduleConfiguration);
@@ -62,7 +65,8 @@
public void testModuleConfigAtService() {
try {
- ConfigurationContext configurationContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, axis2xml);
+ ConfigurationContext configurationContext = ConfigurationContextFactory
+ .createConfigurationContextFromFileSystem(null, axis2xml);
ar = configurationContext.getAxisConfiguration();
@@ -73,7 +77,8 @@
ServiceBuilder sbuilder = new ServiceBuilder(in, configurationContext, service);
sbuilder.populateService(sbuilder.buildOM());
- ModuleConfiguration moduleConfiguration = service.getModuleConfig(new QName("Servie_module"));
+ ModuleConfiguration moduleConfiguration =
+ service.getModuleConfig(new QName("Servie_module"));
assertNotNull(moduleConfiguration);
Parameter para = moduleConfiguration.getParameter("Servie_module_para");
assertNotNull(para);
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ModuleEngageTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ModuleEngageTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ModuleEngageTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ModuleEngageTest.java Sun Mar 4 10:16:54 2007
@@ -35,8 +35,8 @@
DeploymentException,
AxisFault,
XMLStreamException {
- String filename = System.getProperty("basedir")+"/target/test-resources/deployment";
- ac = ConfigurationContextFactory.createConfigurationContextFromFileSystem(filename,null)
+ String filename = System.getProperty("basedir") + "/target/test-resources/deployment";
+ ac = ConfigurationContextFactory.createConfigurationContextFromFileSystem(filename, null)
.getAxisConfiguration();
AxisModule module = ac.getModule(new QName("module1"));
assertNotNull(module);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org