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 [23/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/MessageContextSaveCTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveCTest.java?view=diff&rev=514453&r1=514452&r2=514453
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveCTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/MessageContextSaveCTest.java Sun Mar 4 10:16:54 2007
@@ -21,7 +21,12 @@
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.ServiceContext;
+import org.apache.axis2.context.ServiceGroupContext;
import org.apache.axis2.description.AxisMessage;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
@@ -30,14 +35,12 @@
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;
import org.apache.axis2.transport.http.CommonsHTTPTransportSender;
import org.apache.axis2.transport.http.SimpleHTTPServer;
import org.apache.axis2.util.MetaDataEntry;
-import org.apache.axis2.util.ObjectStateUtils;
import org.apache.axis2.util.UUIDGenerator;
import org.apache.axis2.wsdl.WSDLConstants;
@@ -45,20 +48,17 @@
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.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
-import java.util.Map;
/**
* Provides tests that focus on the message context object graph
*/
-public class MessageContextSaveCTest extends TestCase
-{
+public class MessageContextSaveCTest extends TestCase {
private String testArg = null;
private File persistentStore = null;
@@ -71,21 +71,21 @@
// the phase contains handlers that split the action across
// two handlers
private ConfigurationContext saveConfigurationContext = null;
- private AxisConfiguration saveAxisConfiguration = null;
+ private AxisConfiguration saveAxisConfiguration = null;
// used on a restore of a message context, uses the same setup
// as the regular top-level objects with the exception that the
// context objects don't exist. also, the phase contains handlers
// that split the action across two handlers
private ConfigurationContext restoreConfigurationContext = null;
- private AxisConfiguration restoreAxisConfiguration = null;
+ private AxisConfiguration restoreAxisConfiguration = null;
// used on a restore of a message context, uses the same setup
// as the regular top-level objects with service-level context objects
// with the name service name. also, the phase contains handlers
// that split the action across two handlers
private ConfigurationContext equivConfigurationContext = null;
- private AxisConfiguration equivAxisConfiguration = null;
+ private AxisConfiguration equivAxisConfiguration = null;
//------------------------------
@@ -93,108 +93,105 @@
//------------------------------
private String serviceGroupName_ABC = "ABCServiceGroup";
- private String serviceName_A = "ServiceA";
- private String serviceName_B = "ServiceB";
- private String serviceName_C = "ServiceC";
+ private String serviceName_A = "ServiceA";
+ private String serviceName_B = "ServiceB";
+ private String serviceName_C = "ServiceC";
private QName service_QName_A = new QName(serviceName_A);
private QName service_QName_B = new QName(serviceName_B);
private QName service_QName_C = new QName(serviceName_C);
- private String operationName_A1 = "TestOperationA1";
- private String operationName_A2 = "TestOperationA2";
- private QName operation_QName_A1 = new QName(operationName_A1);
- private QName operation_QName_A2 = new QName(operationName_A2);
-
- private ServiceGroupContext srvGrpCtx_ABC_save = null;
- private AxisServiceGroup axisSrvGrp_ABC_save = null;
-
- private AxisServiceGroup axisSrvGrp_ABC_restore = null;
-
- private ServiceGroupContext srvGrpCtx_ABC_equiv = null;
- private AxisServiceGroup axisSrvGrp_ABC_equiv = null;
-
- private ServiceContext srvCtx_A_save = null;
- private ServiceContext srvCtx_B_save = null;
- private ServiceContext srvCtx_C_save = null;
- private AxisService axisSrv_A_save = null;
- private AxisService axisSrv_B_save = null;
- private AxisService axisSrv_C_save = null;
-
- private ServiceContext srvCtx_A_restore = null;
- private ServiceContext srvCtx_B_restore = null;
- private ServiceContext srvCtx_C_restore = null;
- private AxisService axisSrv_A_restore = null;
- private AxisService axisSrv_B_restore = null;
- private AxisService axisSrv_C_restore = null;
-
- private ServiceContext srvCtx_A_equiv = null;
- private ServiceContext srvCtx_B_equiv = null;
- private ServiceContext srvCtx_C_equiv = null;
- private AxisService axisSrv_A_equiv = null;
- private AxisService axisSrv_B_equiv = null;
- private AxisService axisSrv_C_equiv = null;
-
- private OperationContext opCtx_A1_save = null;
- private OperationContext opCtx_A2_save = null;
- private AxisOperation axisOp_A1_save = null;
- private AxisOperation axisOp_A2_save = null;
-
- private OperationContext opCtx_A1_restore = null;
- private OperationContext opCtx_A2_restore = null;
- private AxisOperation axisOp_A1_restore = null;
- private AxisOperation axisOp_A2_restore = null;
-
- private OperationContext opCtx_A1_equiv = null;
- private OperationContext opCtx_A2_equiv = null;
- private AxisOperation axisOp_A1_equiv = null;
- private AxisOperation axisOp_A2_equiv = null;
-
- private MessageContext msgCtx_A1_1_save = null;
- private MessageContext msgCtx_A1_2_save = null;
- private MessageContext msgCtx_A2_save = null;
-
- private MessageContext msgCtx_A1_1_equiv = null;
- private MessageContext msgCtx_A1_2_equiv = null;
- private MessageContext msgCtx_A2_equiv = null;
-
+ private String operationName_A1 = "TestOperationA1";
+ private String operationName_A2 = "TestOperationA2";
+ private QName operation_QName_A1 = new QName(operationName_A1);
+ private QName operation_QName_A2 = new QName(operationName_A2);
+
+ private ServiceGroupContext srvGrpCtx_ABC_save = null;
+ private AxisServiceGroup axisSrvGrp_ABC_save = null;
+
+ private AxisServiceGroup axisSrvGrp_ABC_restore = null;
+
+ private ServiceGroupContext srvGrpCtx_ABC_equiv = null;
+ private AxisServiceGroup axisSrvGrp_ABC_equiv = null;
+
+ private ServiceContext srvCtx_A_save = null;
+ private ServiceContext srvCtx_B_save = null;
+ private ServiceContext srvCtx_C_save = null;
+ private AxisService axisSrv_A_save = null;
+ private AxisService axisSrv_B_save = null;
+ private AxisService axisSrv_C_save = null;
+
+ private ServiceContext srvCtx_A_restore = null;
+ private ServiceContext srvCtx_B_restore = null;
+ private ServiceContext srvCtx_C_restore = null;
+ private AxisService axisSrv_A_restore = null;
+ private AxisService axisSrv_B_restore = null;
+ private AxisService axisSrv_C_restore = null;
+
+ private ServiceContext srvCtx_A_equiv = null;
+ private ServiceContext srvCtx_B_equiv = null;
+ private ServiceContext srvCtx_C_equiv = null;
+ private AxisService axisSrv_A_equiv = null;
+ private AxisService axisSrv_B_equiv = null;
+ private AxisService axisSrv_C_equiv = null;
+
+ private OperationContext opCtx_A1_save = null;
+ private OperationContext opCtx_A2_save = null;
+ private AxisOperation axisOp_A1_save = null;
+ private AxisOperation axisOp_A2_save = null;
+
+ private OperationContext opCtx_A1_restore = null;
+ private OperationContext opCtx_A2_restore = null;
+ private AxisOperation axisOp_A1_restore = null;
+ private AxisOperation axisOp_A2_restore = null;
+
+ private OperationContext opCtx_A1_equiv = null;
+ private OperationContext opCtx_A2_equiv = null;
+ private AxisOperation axisOp_A1_equiv = null;
+ private AxisOperation axisOp_A2_equiv = null;
+
+ private MessageContext msgCtx_A1_1_save = null;
+ private MessageContext msgCtx_A1_2_save = null;
+ private MessageContext msgCtx_A2_save = null;
+
+ private MessageContext msgCtx_A1_1_equiv = null;
+ private MessageContext msgCtx_A1_2_equiv = null;
+ private MessageContext msgCtx_A2_equiv = null;
//-------------------------------------
// objects needed for message context
//------------------------------------
- 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 Phase phaseSave = null;
+ private Phase phaseSave = null;
private Phase phaseRestore = null;
- private Phase phaseEquiv = null;
+ private Phase phaseEquiv = null;
private ArrayList executedHandlers = null;
private MessageContext restoredMessageContext = null;
-
//-------------------------------------------------------------------------
// methods
//-------------------------------------------------------------------------
- public MessageContextSaveCTest(String arg0)
- {
+ public MessageContextSaveCTest(String arg0) {
super(arg0);
testArg = new String(arg0);
- try
- {
+ try {
prepare();
}
- catch (Exception e)
- {
- System.out.println("MessageContextSaveCTest:constructor: error in setting up object graph ["+e.getClass().getName()+" : "+e.getMessage()+"]");
+ catch (Exception e) {
+ System.out.println(
+ "MessageContextSaveCTest:constructor: error in setting up object graph [" +
+ e.getClass().getName() + " : " + e.getMessage() + "]");
}
}
@@ -202,8 +199,7 @@
//
// prepare the object hierarchy for testing
//
- private void prepare() throws Exception
- {
+ private void prepare() throws Exception {
//-----------------------------------------------------------------
// setup the top-level objects
//-----------------------------------------------------------------
@@ -235,28 +231,32 @@
saveAxisConfiguration = new AxisConfiguration();
saveConfigurationContext = new ConfigurationContext(saveAxisConfiguration);
- saveConfigurationContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
- saveConfigurationContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-out", new RawXMLINOutMessageReceiver());
+ saveConfigurationContext.getAxisConfiguration().addMessageReceiver(
+ "http://www.w3.org/2004/08/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
+ saveConfigurationContext.getAxisConfiguration().addMessageReceiver(
+ "http://www.w3.org/2004/08/wsdl/in-out", new RawXMLINOutMessageReceiver());
saveConfigurationContext.getAxisConfiguration().getGlobalInFlow().add(dispatchPhase);
restoreAxisConfiguration = new AxisConfiguration();
restoreConfigurationContext = new ConfigurationContext(restoreAxisConfiguration);
- restoreConfigurationContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
- restoreConfigurationContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-out", new RawXMLINOutMessageReceiver());
+ restoreConfigurationContext.getAxisConfiguration().addMessageReceiver(
+ "http://www.w3.org/2004/08/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
+ restoreConfigurationContext.getAxisConfiguration().addMessageReceiver(
+ "http://www.w3.org/2004/08/wsdl/in-out", new RawXMLINOutMessageReceiver());
restoreConfigurationContext.getAxisConfiguration().getGlobalInFlow().add(dispatchPhase);
equivAxisConfiguration = new AxisConfiguration();
equivConfigurationContext = new ConfigurationContext(equivAxisConfiguration);
- equivConfigurationContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
- equivConfigurationContext.getAxisConfiguration().addMessageReceiver("http://www.w3.org/2004/08/wsdl/in-out", new RawXMLINOutMessageReceiver());
+ equivConfigurationContext.getAxisConfiguration().addMessageReceiver(
+ "http://www.w3.org/2004/08/wsdl/in-only", new RawXMLINOnlyMessageReceiver());
+ equivConfigurationContext.getAxisConfiguration().addMessageReceiver(
+ "http://www.w3.org/2004/08/wsdl/in-out", new RawXMLINOutMessageReceiver());
equivConfigurationContext.getAxisConfiguration().getGlobalInFlow().add(dispatchPhase);
-
-
//----------------------------
// transport-related objects
//----------------------------
- 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());
@@ -298,23 +298,23 @@
//----------------------------
// phase-related objects
//----------------------------
- persistentStore = File.createTempFile("mcObjTest",null);
+ persistentStore = File.createTempFile("mcObjTest", null);
phaseSave = new Phase("PhaseTest");
- phaseSave.addHandler(new TempHandler(1,1));
- phaseSave.addHandler(new SaveHandler(2,persistentStore,true));
- phaseSave.addHandler(new TempHandler(3,1));
+ phaseSave.addHandler(new TempHandler(1, 1));
+ phaseSave.addHandler(new SaveHandler(2, persistentStore, true));
+ phaseSave.addHandler(new TempHandler(3, 1));
ArrayList phases_Save = new ArrayList();
phases_Save.add(phaseSave);
saveAxisConfiguration.setInPhasesUptoAndIncludingPostDispatch(phases_Save);
-
+
phaseRestore = new Phase("PhaseTest");
- phaseRestore.addHandler(new TempHandler(1,1));
- phaseRestore.addHandler(new SaveHandler(2,persistentStore,false));
- phaseRestore.addHandler(new TempHandler(3,1));
+ phaseRestore.addHandler(new TempHandler(1, 1));
+ phaseRestore.addHandler(new SaveHandler(2, persistentStore, false));
+ phaseRestore.addHandler(new TempHandler(3, 1));
ArrayList phases_Restore = new ArrayList();
phases_Restore.add(phaseRestore);
@@ -322,16 +322,14 @@
restoreAxisConfiguration.setInPhasesUptoAndIncludingPostDispatch(phases_Restore);
phaseEquiv = new Phase("PhaseTest");
- phaseEquiv.addHandler(new TempHandler(1,1));
- phaseEquiv.addHandler(new SaveHandler(2,persistentStore,true));
- phaseEquiv.addHandler(new TempHandler(3,1));
+ phaseEquiv.addHandler(new TempHandler(1, 1));
+ phaseEquiv.addHandler(new SaveHandler(2, persistentStore, true));
+ phaseEquiv.addHandler(new TempHandler(3, 1));
ArrayList phases_Equiv = new ArrayList();
phases_Equiv.add(phaseEquiv);
equivAxisConfiguration.setInPhasesUptoAndIncludingPostDispatch(phases_Equiv);
-
-
//-----------------------------------------------------------------
// setup the axis side of the hierachy
@@ -339,33 +337,29 @@
// ABC group
//----------------------------
- axisSrvGrp_ABC_save = new AxisServiceGroup(saveAxisConfiguration);
+ axisSrvGrp_ABC_save = new AxisServiceGroup(saveAxisConfiguration);
axisSrvGrp_ABC_save.setServiceGroupName(serviceGroupName_ABC);
- axisSrv_A_save = new AxisService(service_QName_A.getLocalPart());
- axisSrv_B_save = new AxisService(service_QName_B.getLocalPart());
- axisSrv_C_save = new AxisService(service_QName_C.getLocalPart());
-
- axisSrvGrp_ABC_save.addService(axisSrv_A_save);
- axisSrvGrp_ABC_save.addService(axisSrv_B_save);
- axisSrvGrp_ABC_save.addService(axisSrv_C_save);
-
- axisOp_A1_save = new InOutAxisOperation(operation_QName_A1);
- axisOp_A2_save = new InOutAxisOperation(operation_QName_A2);
-
- axisOp_A1_save.setMessageReceiver(new MessageReceiver()
- {
- public void receive(MessageContext messageCtx)
- {
- }
- });
-
- axisOp_A2_save.setMessageReceiver(new MessageReceiver()
- {
- public void receive(MessageContext messageCtx)
- {
- }
- });
+ axisSrv_A_save = new AxisService(service_QName_A.getLocalPart());
+ axisSrv_B_save = new AxisService(service_QName_B.getLocalPart());
+ axisSrv_C_save = new AxisService(service_QName_C.getLocalPart());
+
+ axisSrvGrp_ABC_save.addService(axisSrv_A_save);
+ axisSrvGrp_ABC_save.addService(axisSrv_B_save);
+ axisSrvGrp_ABC_save.addService(axisSrv_C_save);
+
+ axisOp_A1_save = new InOutAxisOperation(operation_QName_A1);
+ axisOp_A2_save = new InOutAxisOperation(operation_QName_A2);
+
+ axisOp_A1_save.setMessageReceiver(new MessageReceiver() {
+ public void receive(MessageContext messageCtx) {
+ }
+ });
+
+ axisOp_A2_save.setMessageReceiver(new MessageReceiver() {
+ public void receive(MessageContext messageCtx) {
+ }
+ });
axisSrv_A_save.addOperation(axisOp_A1_save);
axisSrv_A_save.mapActionToOperation(operation_QName_A1.getLocalPart(), axisOp_A1_save);
@@ -377,42 +371,39 @@
saveAxisConfiguration.addService(axisSrv_B_save);
saveAxisConfiguration.addService(axisSrv_C_save);
-
//---------------------
- axisSrvGrp_ABC_restore = new AxisServiceGroup(restoreAxisConfiguration);
+ axisSrvGrp_ABC_restore = new AxisServiceGroup(restoreAxisConfiguration);
axisSrvGrp_ABC_restore.setServiceGroupName(serviceGroupName_ABC);
- axisSrv_A_restore = new AxisService(service_QName_A.getLocalPart());
- axisSrv_B_restore = new AxisService(service_QName_B.getLocalPart());
- axisSrv_C_restore = new AxisService(service_QName_C.getLocalPart());
-
- axisSrvGrp_ABC_restore.addService(axisSrv_A_restore);
- axisSrvGrp_ABC_restore.addService(axisSrv_B_restore);
- axisSrvGrp_ABC_restore.addService(axisSrv_C_restore);
-
- axisOp_A1_restore = new InOutAxisOperation(operation_QName_A1);
- axisOp_A2_restore = new InOutAxisOperation(operation_QName_A2);
-
- axisOp_A1_restore.setMessageReceiver(new MessageReceiver()
- {
- public void receive(MessageContext messageCtx)
- {
- }
- });
-
- axisOp_A2_restore.setMessageReceiver(new MessageReceiver()
- {
- public void receive(MessageContext messageCtx)
- {
- }
- });
+ axisSrv_A_restore = new AxisService(service_QName_A.getLocalPart());
+ axisSrv_B_restore = new AxisService(service_QName_B.getLocalPart());
+ axisSrv_C_restore = new AxisService(service_QName_C.getLocalPart());
+
+ axisSrvGrp_ABC_restore.addService(axisSrv_A_restore);
+ axisSrvGrp_ABC_restore.addService(axisSrv_B_restore);
+ axisSrvGrp_ABC_restore.addService(axisSrv_C_restore);
+
+ axisOp_A1_restore = new InOutAxisOperation(operation_QName_A1);
+ axisOp_A2_restore = new InOutAxisOperation(operation_QName_A2);
+
+ axisOp_A1_restore.setMessageReceiver(new MessageReceiver() {
+ public void receive(MessageContext messageCtx) {
+ }
+ });
+
+ axisOp_A2_restore.setMessageReceiver(new MessageReceiver() {
+ public void receive(MessageContext messageCtx) {
+ }
+ });
axisSrv_A_restore.addOperation(axisOp_A1_restore);
- axisSrv_A_restore.mapActionToOperation(operation_QName_A1.getLocalPart(), axisOp_A1_restore);
+ axisSrv_A_restore
+ .mapActionToOperation(operation_QName_A1.getLocalPart(), axisOp_A1_restore);
axisSrv_A_restore.addOperation(axisOp_A2_restore);
- axisSrv_A_restore.mapActionToOperation(operation_QName_A2.getLocalPart(), axisOp_A2_restore);
+ axisSrv_A_restore
+ .mapActionToOperation(operation_QName_A2.getLocalPart(), axisOp_A2_restore);
restoreAxisConfiguration.addService(axisSrv_A_restore);
@@ -420,7 +411,6 @@
restoreAxisConfiguration.addService(axisSrv_C_restore);
-
axisOp_A1_save.getRemainingPhasesInFlow().add(phaseSave);
axisOp_A2_save.getRemainingPhasesInFlow().add(phaseSave);
@@ -429,33 +419,29 @@
//-------------------------------
- axisSrvGrp_ABC_equiv = new AxisServiceGroup(equivAxisConfiguration);
+ axisSrvGrp_ABC_equiv = new AxisServiceGroup(equivAxisConfiguration);
axisSrvGrp_ABC_equiv.setServiceGroupName(serviceGroupName_ABC);
- axisSrv_A_equiv = new AxisService(service_QName_A.getLocalPart());
- axisSrv_B_equiv = new AxisService(service_QName_B.getLocalPart());
- axisSrv_C_equiv = new AxisService(service_QName_C.getLocalPart());
-
- axisSrvGrp_ABC_equiv.addService(axisSrv_A_equiv);
- axisSrvGrp_ABC_equiv.addService(axisSrv_B_equiv);
- axisSrvGrp_ABC_equiv.addService(axisSrv_C_equiv);
-
- axisOp_A1_equiv = new InOutAxisOperation(operation_QName_A1);
- axisOp_A2_equiv = new InOutAxisOperation(operation_QName_A2);
-
- axisOp_A1_equiv.setMessageReceiver(new MessageReceiver()
- {
- public void receive(MessageContext messageCtx)
- {
- }
- });
-
- axisOp_A2_equiv.setMessageReceiver(new MessageReceiver()
- {
- public void receive(MessageContext messageCtx)
- {
- }
- });
+ axisSrv_A_equiv = new AxisService(service_QName_A.getLocalPart());
+ axisSrv_B_equiv = new AxisService(service_QName_B.getLocalPart());
+ axisSrv_C_equiv = new AxisService(service_QName_C.getLocalPart());
+
+ axisSrvGrp_ABC_equiv.addService(axisSrv_A_equiv);
+ axisSrvGrp_ABC_equiv.addService(axisSrv_B_equiv);
+ axisSrvGrp_ABC_equiv.addService(axisSrv_C_equiv);
+
+ axisOp_A1_equiv = new InOutAxisOperation(operation_QName_A1);
+ axisOp_A2_equiv = new InOutAxisOperation(operation_QName_A2);
+
+ axisOp_A1_equiv.setMessageReceiver(new MessageReceiver() {
+ public void receive(MessageContext messageCtx) {
+ }
+ });
+
+ axisOp_A2_equiv.setMessageReceiver(new MessageReceiver() {
+ public void receive(MessageContext messageCtx) {
+ }
+ });
axisSrv_A_equiv.addOperation(axisOp_A1_equiv);
axisSrv_A_equiv.mapActionToOperation(operation_QName_A1.getLocalPart(), axisOp_A1_equiv);
@@ -467,44 +453,49 @@
equivAxisConfiguration.addService(axisSrv_B_equiv);
equivAxisConfiguration.addService(axisSrv_C_equiv);
-
//-----------------------------------------------------------------
// setup the context objects
//-----------------------------------------------------------------
- srvGrpCtx_ABC_save = ContextFactory.createServiceGroupContext(saveConfigurationContext, axisSrvGrp_ABC_save);
+ srvGrpCtx_ABC_save = ContextFactory
+ .createServiceGroupContext(saveConfigurationContext, axisSrvGrp_ABC_save);
srvGrpCtx_ABC_save.setId(serviceGroupName_ABC);
- srvCtx_A_save =ContextFactory.createServiceContext(srvGrpCtx_ABC_save,axisSrv_A_save);
- srvCtx_B_save = ContextFactory.createServiceContext(srvGrpCtx_ABC_save,axisSrv_B_save);
- srvCtx_C_save = ContextFactory.createServiceContext(srvGrpCtx_ABC_save,axisSrv_C_save);
+ srvCtx_A_save = ContextFactory.createServiceContext(srvGrpCtx_ABC_save, axisSrv_A_save);
+ srvCtx_B_save = ContextFactory.createServiceContext(srvGrpCtx_ABC_save, axisSrv_B_save);
+ srvCtx_C_save = ContextFactory.createServiceContext(srvGrpCtx_ABC_save, axisSrv_C_save);
opCtx_A1_save = srvCtx_A_save.createOperationContext(operation_QName_A1);
opCtx_A2_save = srvCtx_A_save.createOperationContext(operation_QName_A2);
//----------------------------------------
- srvGrpCtx_ABC_equiv =ContextFactory.createServiceGroupContext(
+ srvGrpCtx_ABC_equiv = ContextFactory.createServiceGroupContext(
equivConfigurationContext, axisSrvGrp_ABC_equiv);
srvGrpCtx_ABC_equiv.setId(serviceGroupName_ABC);
- srvCtx_A_equiv =ContextFactory.createServiceContext(srvGrpCtx_ABC_equiv,axisSrv_A_equiv);
- srvCtx_B_equiv = ContextFactory.createServiceContext(srvGrpCtx_ABC_equiv,axisSrv_B_equiv);
- srvCtx_C_equiv =ContextFactory.createServiceContext(srvGrpCtx_ABC_equiv,axisSrv_C_equiv);
+ srvCtx_A_equiv = ContextFactory.createServiceContext(srvGrpCtx_ABC_equiv, axisSrv_A_equiv);
+ srvCtx_B_equiv = ContextFactory.createServiceContext(srvGrpCtx_ABC_equiv, axisSrv_B_equiv);
+ srvCtx_C_equiv = ContextFactory.createServiceContext(srvGrpCtx_ABC_equiv, axisSrv_C_equiv);
opCtx_A1_equiv = srvCtx_A_equiv.createOperationContext(operation_QName_A1);
opCtx_A2_equiv = srvCtx_A_equiv.createOperationContext(operation_QName_A2);
-
//----------------------------------------
// message context objects
//----------------------------------------
- msgCtx_A1_1_save = createMessageContext(opCtx_A1_save, saveConfigurationContext, MessageContext.IN_FLOW);
- msgCtx_A1_2_save = createMessageContext(opCtx_A1_save, saveConfigurationContext, MessageContext.OUT_FLOW);
- msgCtx_A2_save = createMessageContext(opCtx_A2_save, saveConfigurationContext, MessageContext.IN_FLOW);
-
- msgCtx_A1_1_equiv = createMessageContext(opCtx_A1_equiv, equivConfigurationContext, MessageContext.IN_FLOW);
- msgCtx_A1_2_equiv = createMessageContext(opCtx_A1_equiv, equivConfigurationContext, MessageContext.OUT_FLOW);
- msgCtx_A2_equiv = createMessageContext(opCtx_A2_equiv, equivConfigurationContext, MessageContext.IN_FLOW);
+ msgCtx_A1_1_save = createMessageContext(opCtx_A1_save, saveConfigurationContext,
+ MessageContext.IN_FLOW);
+ msgCtx_A1_2_save = createMessageContext(opCtx_A1_save, saveConfigurationContext,
+ MessageContext.OUT_FLOW);
+ msgCtx_A2_save = createMessageContext(opCtx_A2_save, saveConfigurationContext,
+ MessageContext.IN_FLOW);
+
+ msgCtx_A1_1_equiv = createMessageContext(opCtx_A1_equiv, equivConfigurationContext,
+ MessageContext.IN_FLOW);
+ msgCtx_A1_2_equiv = createMessageContext(opCtx_A1_equiv, equivConfigurationContext,
+ MessageContext.OUT_FLOW);
+ msgCtx_A2_equiv = createMessageContext(opCtx_A2_equiv, equivConfigurationContext,
+ MessageContext.IN_FLOW);
//-----------------------------------------------------------------
// other objects
@@ -513,8 +504,8 @@
}
- private MessageContext createMessageContext(OperationContext oc, ConfigurationContext cc, int flowType) throws Exception
- {
+ private MessageContext createMessageContext(OperationContext oc, ConfigurationContext cc,
+ int flowType) throws Exception {
MessageContext mc = ContextFactory.createMessageContext(cc);
mc.setFLOW(flowType);
@@ -534,13 +525,13 @@
mc.setMessageID(UUIDGenerator.getUUID());
- axisOperation.registerOperationContext(mc,oc);
+ axisOperation.registerOperationContext(mc, oc);
mc.setOperationContext(oc);
ServiceContext sc = oc.getServiceContext();
mc.setServiceContext(sc);
- mc.setTo(new EndpointReference("axis2/services/NullService"));
+ mc.setTo(new EndpointReference("axis2/services/NullService"));
mc.setWSAAction("DummyOp");
AxisMessage axisMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
@@ -549,61 +540,63 @@
return mc;
}
- protected void setUp() throws Exception
- {
+ protected void setUp() throws Exception {
//org.apache.log4j.BasicConfigurator.configure();
}
- public void testHierarchyNewContext() throws Exception
- {
+ public void testHierarchyNewContext() throws Exception {
String title = "MessageContextSaveCTest:testHierarchyNewContext(): ";
AxisEngine engineSave = new AxisEngine(saveConfigurationContext);
MessageContext mc = msgCtx_A1_2_save;
OperationContext oc = mc.getOperationContext();
- System.out.println(title+"*** Original OperationContext message context table ****");
+ System.out.println(title + "*** Original OperationContext message context table ****");
showMCTable(oc);
// run the message through the message processing
// this causes the message context to get saved
- System.out.println(title+"- - - Save the message context from the engine - - - -");
+ System.out.println(title + "- - - Save the message context from the engine - - - -");
engineSave.receive(mc);
LinkedHashMap original_object_graph = getObjectGraphInfo(mc);
- System.out.println(title+"*** Originial object graph ****");
+ System.out.println(title + "*** Originial object graph ****");
showObjectGraphInfo(original_object_graph);
- System.out.println(title+"- - - Restore the message context on a separate engine - - - - - - - - - - - - - - - -");
+ System.out.println(title +
+ "- - - Restore the message context on a separate engine - - - - - - - - - - - - - - - -");
AxisEngine engineRestore = new AxisEngine(restoreConfigurationContext);
- MessageContext mc2 = restoreMessageContext(persistentStore,restoreConfigurationContext);
+ MessageContext mc2 = restoreMessageContext(persistentStore, restoreConfigurationContext);
LinkedHashMap restored_object_graph = getObjectGraphInfo(mc2);
- System.out.println(title+"*** Restored object graph ****");
+ System.out.println(title + "*** Restored object graph ****");
showObjectGraphInfo(restored_object_graph);
OperationContext oc2 = mc2.getOperationContext();
- System.out.println(title+"*** Restored OperationContext message context table ****");
+ System.out.println(title + "*** Restored OperationContext message context table ****");
showMCTable(oc2);
- boolean mcTableMatch = compareMCTable(oc,oc2);
+ boolean mcTableMatch = compareMCTable(oc, oc2);
assertTrue(mcTableMatch);
// resume the restored paused message context on an engine that has the
// same setup as the engine where the save occurred
// but doesn't have the Context objects
- System.out.println(title+"- - - Resume the restored message context - - - - - - - - - - - - - - - -");
+ System.out.println(title +
+ "- - - Resume the restored message context - - - - - - - - - - - - - - - -");
engineRestore.resume(mc2);
LinkedHashMap resumed_object_graph = getObjectGraphInfo(mc2);
- System.out.println(title+"*** Post Resumed object graph ****");
+ System.out.println(title + "*** Post Resumed object graph ****");
showObjectGraphInfo(resumed_object_graph);
// compare object hashcodes - expect differences
- boolean expectFalse = compareObjectGraphInfo(original_object_graph, restored_object_graph, true);
+ boolean expectFalse =
+ compareObjectGraphInfo(original_object_graph, restored_object_graph, true);
assertFalse(expectFalse);
- boolean expectSameObjectIds = compareObjectGraphInfo(original_object_graph, restored_object_graph, false);
+ boolean expectSameObjectIds =
+ compareObjectGraphInfo(original_object_graph, restored_object_graph, false);
assertTrue(expectSameObjectIds);
boolean isSame = compareObjectGraphInfo(restored_object_graph, resumed_object_graph, false);
@@ -611,8 +604,7 @@
}
- public void testHierarchyReuse() throws Exception
- {
+ public void testHierarchyReuse() throws Exception {
String title = "MessageContextSaveCTest:testHierarchyReuse(): ";
AxisEngine engineSave = new AxisEngine(saveConfigurationContext);
@@ -621,25 +613,27 @@
// run the message through the message processing
// this causes the message context to get saved
- System.out.println(title+"- - - Save the message context from the engine - - - -");
+ System.out.println(title + "- - - Save the message context from the engine - - - -");
engineSave.receive(mc);
LinkedHashMap original_object_graph = getObjectGraphInfo(mc);
- System.out.println(title+"*** Originial object graph ****");
+ System.out.println(title + "*** Originial object graph ****");
showObjectGraphInfo(original_object_graph);
- System.out.println(title+"- - - Restore the message context on a separate engine - - - - - - - - - - - - - - - -");
+ System.out.println(title +
+ "- - - Restore the message context on a separate engine - - - - - - - - - - - - - - - -");
AxisEngine engineEquiv = new AxisEngine(equivConfigurationContext);
- MessageContext mc2 = restoreMessageContext(persistentStore,equivConfigurationContext);
+ MessageContext mc2 = restoreMessageContext(persistentStore, equivConfigurationContext);
LinkedHashMap restored_object_graph = getObjectGraphInfo(mc2);
- System.out.println(title+"*** Restored object graph ****");
+ System.out.println(title + "*** Restored object graph ****");
showObjectGraphInfo(restored_object_graph);
// we don't use strict checking here since the engine where the
// restoration takes place is a "copy", ie, there are new objects
// for the same names/identifications
- boolean hasEquivalence = compareObjectGraphInfo(original_object_graph, restored_object_graph, false);
+ boolean hasEquivalence =
+ compareObjectGraphInfo(original_object_graph, restored_object_graph, false);
assertTrue(hasEquivalence);
// get an object graph from an equivalent message context on the separate engine
@@ -648,17 +642,19 @@
LinkedHashMap separate_object_graph = getObjectGraphInfo(msgCtx_A1_1_equiv);
// compare the restored object graph with the existing object graph
- boolean expectStrict = compareObjectGraphInfo(restored_object_graph,separate_object_graph,true);
+ boolean expectStrict =
+ compareObjectGraphInfo(restored_object_graph, separate_object_graph, true);
assertTrue(expectStrict);
// resume the restored paused message context on an engine that has the
// same setup as the engine where the save occurred
// and save has the Service-level Context objects
- System.out.println(title+"- - - Resume the restored message context - - - - - - - - - - - - - - - -");
+ System.out.println(title +
+ "- - - Resume the restored message context - - - - - - - - - - - - - - - -");
engineEquiv.resume(mc2);
LinkedHashMap resumed_object_graph = getObjectGraphInfo(mc2);
- System.out.println(title+"*** Post Resumed object graph ****");
+ System.out.println(title + "*** Post Resumed object graph ****");
showObjectGraphInfo(resumed_object_graph);
// there should be no changes in the object graph in our case after the resume
@@ -671,13 +667,12 @@
/**
* Restores a previously saved message context
*/
- public MessageContext restoreMessageContext(File restoreFile, ConfigurationContext cc)
- {
+ public MessageContext restoreMessageContext(File restoreFile, ConfigurationContext cc) {
String title = "restoreMessageContext(): ";
MessageContext restoredMC = null;
- File theFile = restoreFile;
+ File theFile = restoreFile;
String theFilename = null;
// the configuration context to use for message context activation
@@ -685,16 +680,14 @@
boolean restoredOk = false;
- if ((theFile != null) && (theFile.exists()))
- {
+ if ((theFile != null) && (theFile.exists())) {
theFilename = theFile.getName();
- System.out.println(title + "temp file = ["+theFilename+"]");
+ System.out.println(title + "temp file = [" + theFilename + "]");
// ---------------------------------------------------------
// restore from the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an input stream to the file
FileInputStream inStream = new FileInputStream(theFile);
@@ -719,9 +712,9 @@
// variable for the test
restoredMC = msgContext2;
}
- catch (Exception ex2)
- {
- System.out.println(title + "error with restoring message context = ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ System.out.println(title + "error with restoring message context = [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
restoredMessageContext = null;
}
@@ -731,14 +724,11 @@
// if the restore of the message context succeeded,
// then don't keep the temporary file around
boolean removeTmpFile = restoredOk;
- if (removeTmpFile)
- {
- try
- {
+ if (removeTmpFile) {
+ try {
theFile.delete();
}
- catch (Exception e)
- {
+ catch (Exception e) {
// just absorb it
}
}
@@ -748,32 +738,30 @@
}
- private LinkedHashMap getObjectGraphInfo(MessageContext msgCtx)
- {
- if (msgCtx == null)
- {
+ private LinkedHashMap getObjectGraphInfo(MessageContext msgCtx) {
+ if (msgCtx == null) {
return null;
}
- MetaDataEntry metaMC = null;
- MetaDataEntry metaOC = null;
- MetaDataEntry metaSC = null;
+ MetaDataEntry metaMC = null;
+ MetaDataEntry metaOC = null;
+ MetaDataEntry metaSC = null;
MetaDataEntry metaSGC = null;
- MetaDataEntry metaCC = null;
- MetaDataEntry metaAO = null;
- MetaDataEntry metaAS = null;
+ MetaDataEntry metaCC = null;
+ MetaDataEntry metaAO = null;
+ MetaDataEntry metaAS = null;
MetaDataEntry metaASG = null;
- MetaDataEntry metaAC = null;
+ MetaDataEntry metaAC = null;
- String keyMC = null;
- String keyOC = null;
- String keySC = null;
+ String keyMC = null;
+ String keyOC = null;
+ String keySC = null;
String keySGC = null;
- String keyCC = null;
- String keyAO = null;
- String keyAS = null;
+ String keyCC = null;
+ String keyAO = null;
+ String keyAS = null;
String keyASG = null;
- String keyAC = null;
+ String keyAC = null;
LinkedHashMap objInfo = new LinkedHashMap();
@@ -784,55 +772,55 @@
// message context
keyMC = msgCtx.getClass().getName();
- metaMC = new MetaDataEntry(keyMC, msgCtx.getMessageID(), "["+msgCtx.hashCode()+"]" );
+ metaMC = new MetaDataEntry(keyMC, msgCtx.getMessageID(), "[" + msgCtx.hashCode() + "]");
objInfo.put(keyMC, metaMC);
// operation context
OperationContext oc = msgCtx.getOperationContext();
keyOC = oc.getClass().getName();
- metaOC = new MetaDataEntry(keyOC, oc.getOperationName(),"["+oc.hashCode()+"]" );
+ metaOC = new MetaDataEntry(keyOC, oc.getOperationName(), "[" + oc.hashCode() + "]");
objInfo.put(keyOC, metaOC);
// service context
ServiceContext sc = msgCtx.getServiceContext();
keySC = sc.getClass().getName();
- metaSC = new MetaDataEntry(keySC, sc.getName(),"["+sc.hashCode()+"]" );
+ metaSC = new MetaDataEntry(keySC, sc.getName(), "[" + sc.hashCode() + "]");
objInfo.put(keySC, metaSC);
// service group context
ServiceGroupContext sgc = msgCtx.getServiceGroupContext();
keySGC = sgc.getClass().getName();
- metaSGC = new MetaDataEntry(keySGC, sgc.getId(),"["+sgc.hashCode()+"]" );
+ metaSGC = new MetaDataEntry(keySGC, sgc.getId(), "[" + sgc.hashCode() + "]");
objInfo.put(keySGC, metaSGC);
// configuration context
ConfigurationContext cc = msgCtx.getConfigurationContext();
keyCC = cc.getClass().getName();
- metaCC = new MetaDataEntry(keyCC, null,"["+cc.hashCode()+"]" );
+ metaCC = new MetaDataEntry(keyCC, null, "[" + cc.hashCode() + "]");
objInfo.put(keyCC, metaCC);
// axis operation
AxisOperation ao = msgCtx.getAxisOperation();
keyAO = ao.getClass().getName();
- metaAO = new MetaDataEntry(keyAO, ao.getName().toString(),"["+ao.hashCode()+"]" );
+ metaAO = new MetaDataEntry(keyAO, ao.getName().toString(), "[" + ao.hashCode() + "]");
objInfo.put(keyAO, metaAO);
// axis service
AxisService as = msgCtx.getAxisService();
keyAS = as.getClass().getName();
- metaAS = new MetaDataEntry(keyAS, as.getName(),"["+as.hashCode()+"]" );
+ metaAS = new MetaDataEntry(keyAS, as.getName(), "[" + as.hashCode() + "]");
objInfo.put(keyAS, metaAS);
// axis service group
AxisServiceGroup asg = msgCtx.getAxisServiceGroup();
keyASG = asg.getClass().getName();
- metaASG = new MetaDataEntry(keyASG, asg.getServiceGroupName(),"["+asg.hashCode()+"]" );
+ metaASG = new MetaDataEntry(keyASG, asg.getServiceGroupName(), "[" + asg.hashCode() + "]");
objInfo.put(keyASG, metaASG);
// axis configuration
AxisConfiguration ac = cc.getAxisConfiguration();
keyAC = ac.getClass().getName();
- metaAC = new MetaDataEntry(keyAC, null,"["+ac.hashCode()+"]" );
+ metaAC = new MetaDataEntry(keyAC, null, "[" + ac.hashCode() + "]");
objInfo.put(keyAC, metaAC);
return objInfo;
@@ -841,108 +829,91 @@
/**
* Compare two mappings containing object graph info.
* This uses the class name and object ID.
- * <P>
- * Strict comparison includes the object hash codes. If
+ * <p/>
+ * Strict comparison includes the object hash codes. If
* you expect the same object to be represented in
* both maps, you may want to use Strict checking.
- * <P>
+ * <p/>
+ *
* @param map1 The first object graph info map
* @param map2 The second object graph info map
* @param strict TRUE if strict comparison
* @return Outcome of the comparison: TRUE if equivalent, FALSE otherwise
*/
- private boolean compareObjectGraphInfo(LinkedHashMap map1, LinkedHashMap map2, boolean strict)
- {
+ private boolean compareObjectGraphInfo(LinkedHashMap map1, LinkedHashMap map2, boolean strict) {
String title = "MessageContextSaveCTest: compareObjectGraphInfo(): ";
- if ((map1 != null) && (map2 != null))
- {
- if (map1.size() != map2.size())
- {
- System.out.println(title+"Object graph info mappings are different sizes.");
+ if ((map1 != null) && (map2 != null)) {
+ if (map1.size() != map2.size()) {
+ System.out.println(title + "Object graph info mappings are different sizes.");
return false;
}
Iterator it = map1.keySet().iterator();
- while (it.hasNext())
- {
+ while (it.hasNext()) {
// the key is the class name associated with the object
String key = (String) it.next();
// skip certain objects, those will always be unique
- if ( (key.indexOf("MessageContext")==-1) &&
- (key.indexOf("OperationContext")==-1) &&
- (key.indexOf("ConfigurationContext")==-1) &&
- (key.indexOf("AxisConfiguration")==-1)
- )
- {
+ if ((key.indexOf("MessageContext") == -1) &&
+ (key.indexOf("OperationContext") == -1) &&
+ (key.indexOf("ConfigurationContext") == -1) &&
+ (key.indexOf("AxisConfiguration") == -1)
+ ) {
// the class names listed above were not found
// so we're dealing with the other objects
MetaDataEntry value1 = (MetaDataEntry) map1.get(key);
MetaDataEntry value2 = (MetaDataEntry) map2.get(key);
- if ((value1 != null) && (value2 != null))
- {
+ if ((value1 != null) && (value2 != null)) {
// check the object identification
String name1 = value1.getName();
String name2 = value2.getName();
- if ((name1 != null) && (name2 != null))
- {
- if (name1.equals(name2)==false)
- {
- System.out.println(title+"name1 ["+name1+"] != name2 ["+name2+"]");
+ if ((name1 != null) && (name2 != null)) {
+ if (name1.equals(name2) == false) {
+ System.out.println(title + "name1 [" + name1 + "] != name2 [" +
+ name2 + "]");
return false;
}
- }
- else if ((name1 == null) && (name2 == null))
- {
+ } else if ((name1 == null) && (name2 == null)) {
// ok
- }
- else
- {
+ } else {
// mismatch
- System.out.println(title+"name1 ["+name1+"] != name2 ["+name2+"]");
+ System.out.println(
+ title + "name1 [" + name1 + "] != name2 [" + name2 + "]");
return false;
}
// Strict testing means checking the object hashcodes.
// Use this option when you expect the same
// objects in the map.
- if (strict)
- {
+ if (strict) {
String code1 = value1.getExtraName();
String code2 = value2.getExtraName();
- if ((code1 != null) && (code2 != null))
- {
- if (code1.equals(code2)==false)
- {
- System.out.println(title+"name ["+name1+"] code1 ["+code1+"] != code2 ["+code2+"]");
+ if ((code1 != null) && (code2 != null)) {
+ if (code1.equals(code2) == false) {
+ System.out.println(title + "name [" + name1 + "] code1 [" +
+ code1 + "] != code2 [" + code2 + "]");
return false;
}
- }
- else if ((code1 == null) && (code2 == null))
- {
+ } else if ((code1 == null) && (code2 == null)) {
// ok
- }
- else
- {
+ } else {
// mismatch
- System.out.println(title+"name ["+name1+"]code1 ["+code1+"] != code2 ["+code2+"]");
+ System.out.println(title + "name [" + name1 + "]code1 [" + code1 +
+ "] != code2 [" + code2 + "]");
return false;
}
}
- }
- else if ((value1 == null) && (value2 == null))
- {
+ } else if ((value1 == null) && (value2 == null)) {
// ok
- }
- else
- {
+ } else {
// mismatch
- System.out.println(title+"value1 ["+value1+"] != value2 ["+value2+"]");
+ System.out.println(
+ title + "value1 [" + value1 + "] != value2 [" + value2 + "]");
return false;
}
}
@@ -950,41 +921,34 @@
return true;
- }
- else if ((map1 == null) && (map2 == null))
- {
+ } else if ((map1 == null) && (map2 == null)) {
return true;
- }
- else
- {
- System.out.println(title+"mismatch: one or more of the maps are null. ");
+ } else {
+ System.out.println(title + "mismatch: one or more of the maps are null. ");
return false;
}
}
- private void showObjectGraphInfo(LinkedHashMap map)
- {
- if (map == null)
- {
+ private void showObjectGraphInfo(LinkedHashMap map) {
+ if (map == null) {
return;
}
Iterator it = map.keySet().iterator();
- while (it.hasNext())
- {
+ while (it.hasNext()) {
String metaClassName = (String) it.next();
MetaDataEntry meta = (MetaDataEntry) map.get(metaClassName);
- if (meta != null)
- {
+ if (meta != null) {
String classname = meta.getClassName();
- String name = meta.getName();
- String hashcode = meta.getExtraName();
+ String name = meta.getName();
+ String hashcode = meta.getExtraName();
- System.out.println("class["+classname+"] id["+name+"] hashcode"+hashcode+" ");
+ System.out.println(
+ "class[" + classname + "] id[" + name + "] hashcode" + hashcode + " ");
}
}
@@ -992,108 +956,87 @@
}
- private boolean compareMCTable(OperationContext oc1, OperationContext oc2)
- {
+ private boolean compareMCTable(OperationContext oc1, OperationContext oc2) {
String title = "compareMCTable: ";
- if ((oc1 != null) && (oc2 != null))
- {
+ if ((oc1 != null) && (oc2 != null)) {
HashMap mcTable1 = oc1.getMessageContexts();
HashMap mcTable2 = oc2.getMessageContexts();
- if ((mcTable1 != null) && (mcTable2 != null))
- {
- if ((!mcTable1.isEmpty()) && (!mcTable2.isEmpty()))
- {
+ if ((mcTable1 != null) && (mcTable2 != null)) {
+ if ((!mcTable1.isEmpty()) && (!mcTable2.isEmpty())) {
int size1 = mcTable1.size();
int size2 = mcTable2.size();
- if (size1 != size2)
- {
- System.out.println(title+" Return FALSE: table sizes don't match size1["+size1+"] != size2 ["+size2+"] ");
+ if (size1 != size2) {
+ System.out.println(title +
+ " Return FALSE: table sizes don't match size1[" + size1 +
+ "] != size2 [" + size2 + "] ");
return false;
}
Iterator it1 = mcTable1.keySet().iterator();
- while (it1.hasNext())
- {
+ while (it1.hasNext()) {
String key1 = (String) it1.next();
MessageContext mc1 = (MessageContext) mcTable1.get(key1);
MessageContext mc2 = (MessageContext) mcTable2.get(key1);
- if ((mc1 != null) && (mc2 != null))
- {
+ if ((mc1 != null) && (mc2 != null)) {
// check the IDs
String id1 = mc1.getMessageID();
String id2 = mc2.getMessageID();
- if ((id1 != null) && (id2 != null))
- {
- if (!id1.equals(id2))
- {
- System.out.println(title+" Return FALSE: message IDs don't match id1["+id1+"] != id2 ["+id2+"] ");
+ if ((id1 != null) && (id2 != null)) {
+ if (!id1.equals(id2)) {
+ System.out.println(title +
+ " Return FALSE: message IDs don't match id1[" + id1 +
+ "] != id2 [" + id2 + "] ");
return false;
}
- }
- else if ((id1 == null) && (id2 == null))
- {
+ } else if ((id1 == null) && (id2 == null)) {
// can't tell, keep going
- }
- else
- {
+ } else {
// mismatch
- System.out.println(title+" Return FALSE: message IDs don't match id1["+id1+"] != id2 ["+id2+"] ");
+ System.out.println(title +
+ " Return FALSE: message IDs don't match id1[" + id1 +
+ "] != id2 [" + id2 + "] ");
return false;
}
- }
- else if ((mc1 == null) && (mc2 == null))
- {
+ } else if ((mc1 == null) && (mc2 == null)) {
// entries match
- }
- else
- {
+ } else {
// mismatch
- System.out.println(title+" Return FALSE: message context objects don't match ");
+ System.out.println(
+ title + " Return FALSE: message context objects don't match ");
return false;
}
}
- System.out.println(title+" Return TRUE: message context tables match");
+ System.out.println(title + " Return TRUE: message context tables match");
return true;
- }
- else if (mcTable1.isEmpty() && mcTable2.isEmpty())
- {
- System.out.println(title+" Return TRUE: message context tables are both empty ");
+ } else if (mcTable1.isEmpty() && mcTable2.isEmpty()) {
+ System.out.println(
+ title + " Return TRUE: message context tables are both empty ");
return true;
- }
- else
- {
- System.out.println(title+" Return FALSE: message context tables mismatch");
+ } else {
+ System.out.println(title + " Return FALSE: message context tables mismatch");
return false;
}
- }
- else if ((mcTable1 == null) && (mcTable2 == null))
- {
- System.out.println(title+" Return TRUE: message context tables are null");
+ } else if ((mcTable1 == null) && (mcTable2 == null)) {
+ System.out.println(title + " Return TRUE: message context tables are null");
return true;
- }
- else
- {
- System.out.println(title+" Return FALSE: message context tables don't match");
+ } else {
+ System.out.println(title + " Return FALSE: message context tables don't match");
return false;
}
- }
- else if ((oc1 == null) && (oc2 == null))
- {
- System.out.println(title+" Return TRUE: operation context objects are null ");
+ } else if ((oc1 == null) && (oc2 == null)) {
+ System.out.println(title + " Return TRUE: operation context objects are null ");
return true;
- }
- else
- {
- System.out.println(title+" Return FALSE: operation context objects don't match ");
+ } else {
+ System.out.println(title + " Return FALSE: operation context objects don't match ");
return false;
}
@@ -1101,31 +1044,27 @@
}
- private void showMCTable(OperationContext oc)
- {
- if (oc == null)
- {
+ private void showMCTable(OperationContext oc) {
+ if (oc == null) {
return;
}
HashMap mcTable = oc.getMessageContexts();
- if ((mcTable == null) || (mcTable.isEmpty()))
- {
+ if ((mcTable == null) || (mcTable.isEmpty())) {
return;
}
Iterator it = mcTable.keySet().iterator();
- while (it.hasNext())
- {
+ while (it.hasNext()) {
String key = (String) it.next();
MessageContext mc = (MessageContext) mcTable.get(key);
- if (mc != null)
- {
+ if (mc != null) {
String id = mc.getMessageID();
- System.out.println("message context table entry: label ["+key+"] message ID ["+id+"] ");
+ System.out.println("message context table entry: label [" + key +
+ "] message ID [" + id + "] ");
}
}
@@ -1134,25 +1073,21 @@
/**
* 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 TempHandler)
- {
- id = ((TempHandler)o).getHandlerID();
+ if (o instanceof TempHandler) {
+ id = ((TempHandler) o).getHandlerID();
}
return id;
}
-
-
//=========================================================================
// Handler classes
//=========================================================================
@@ -1160,56 +1095,48 @@
/**
* Pauses and saves the message context the message context
*/
- public class SaveHandler extends AbstractHandler
- {
+ public class SaveHandler extends AbstractHandler {
private Integer handlerID = null;
- private File theFile = null;
+ private File theFile = null;
private String theFilename = null;
private boolean performSave = true;
- private boolean savedOk = false;
+ private boolean savedOk = false;
//-----------------------------------------------------------------
// constructors
//-----------------------------------------------------------------
- public SaveHandler()
- {
+ public SaveHandler() {
this.handlerID = new Integer(-5);
}
- public SaveHandler(int index, File saveFile, boolean doIt)
- {
+ public SaveHandler(int index, File saveFile, boolean doIt) {
this.handlerID = new Integer(index);
init(new HandlerDescription(new String("handler" + index)));
theFile = saveFile;
performSave = doIt;
}
-
//-----------------------------------------------------------------
// methods
//-----------------------------------------------------------------
- public int getHandlerID()
- {
- if (handlerID != null)
- {
+ public int getHandlerID() {
+ if (handlerID != null) {
return handlerID.intValue();
}
return -5;
}
- public InvocationResponse invoke(MessageContext msgContext) throws AxisFault
- {
- String title = "SaveHandler["+getHandlerID()+"]:invoke(): ";
- savedOk = false;
+ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+ String title = "SaveHandler[" + getHandlerID() + "]:invoke(): ";
+ savedOk = false;
- if (performSave == false)
- {
+ if (performSave == false) {
System.out.println(title + "Configured for no action to be performed.");
return InvocationResponse.CONTINUE;
}
@@ -1218,28 +1145,24 @@
System.out.println(title + "msgContext.pause()");
msgContext.pause();
- if (theFile != null)
- {
- try
- {
+ if (theFile != null) {
+ try {
System.out.println(title + "Resetting the file to use.");
theFile.delete();
theFile.createNewFile();
theFilename = theFile.getName();
- System.out.println(title + "temp file = ["+theFilename+"]");
+ System.out.println(title + "temp file = [" + theFilename + "]");
}
- catch (Exception ex)
- {
- System.out.println(title + "error creating new file = ["+ex.getMessage()+"]");
+ catch (Exception ex) {
+ System.out
+ .println(title + "error creating new file = [" + ex.getMessage() + "]");
}
- if (theFile.exists() == true)
- {
+ if (theFile.exists() == true) {
// ---------------------------------------------------------
// save to the temporary file
// ---------------------------------------------------------
- try
- {
+ try {
// setup an output stream to a physical file
FileOutputStream outStream = new FileOutputStream(theFile);
@@ -1262,12 +1185,13 @@
System.out.println(title + "....saved message context.....");
long filesize = theFile.length();
- System.out.println(title + "file size after save ["+filesize+"] temp file = ["+theFilename+"]");
+ System.out.println(title + "file size after save [" + filesize +
+ "] temp file = [" + theFilename + "]");
}
- catch (Exception ex2)
- {
- System.out.println(title + "error with saving message context = ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]");
+ catch (Exception ex2) {
+ System.out.println(title + "error with saving message context = [" +
+ ex2.getClass().getName() + " : " + ex2.getMessage() + "]");
ex2.printStackTrace();
}
@@ -1276,7 +1200,7 @@
}
}
- System.out.println(title + "executedHandlers.add("+handlerID+")");
+ System.out.println(title + "executedHandlers.add(" + handlerID + ")");
executedHandlers.add(handlerID);
return InvocationResponse.SUSPEND;
@@ -1286,9 +1210,7 @@
}
-
- public class TempHandler extends AbstractHandler
- {
+ public class TempHandler extends AbstractHandler {
private Integer handlerID = null;
private int count = 0;
private int numberProperties = 3;
@@ -1299,19 +1221,16 @@
// constructors
//-----------------------------------------------------------------
- public TempHandler()
- {
+ public TempHandler() {
this.handlerID = new Integer(-5);
}
- public TempHandler(int index)
- {
+ public TempHandler(int index) {
this.handlerID = new Integer(index);
init(new HandlerDescription(new String("handler" + index)));
}
- public TempHandler(int index, int number)
- {
+ public TempHandler(int index, int number) {
this.handlerID = new Integer(index);
init(new HandlerDescription(new String("handler" + index)));
numberProperties = number;
@@ -1321,10 +1240,8 @@
// methods
//-----------------------------------------------------------------
- public int getHandlerID()
- {
- if (handlerID != null)
- {
+ public int getHandlerID() {
+ if (handlerID != null) {
return handlerID.intValue();
}
@@ -1332,32 +1249,28 @@
}
- public InvocationResponse invoke(MessageContext msgContext) throws AxisFault
- {
- String title = "TempHandler["+getHandlerID()+"]:invoke(): ";
+ public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+ String title = "TempHandler[" + getHandlerID() + "]:invoke(): ";
// get the service context from the message context
ServiceContext serviceContext = msgContext.getServiceContext();
- if (serviceContext == null)
- {
+ if (serviceContext == null) {
// get the service context from the operation context
OperationContext operationContext = msgContext.getOperationContext();
serviceContext = operationContext.getServiceContext();
}
- if (serviceContext != null)
- {
- for (int j=0; j<numberProperties; j++)
- {
+ if (serviceContext != null) {
+ for (int j = 0; j < numberProperties; j++) {
count++;
- String key = new String(propertyKey +".ID["+getHandlerID()+"]."+count);
- String value = new String(propertyValue + "["+count+"]");
- serviceContext.setProperty(key,value);
+ String key = new String(propertyKey + ".ID[" + getHandlerID() + "]." + count);
+ String value = new String(propertyValue + "[" + count + "]");
+ serviceContext.setProperty(key, value);
}
}
- System.out.println(title + "executedHandlers.add("+handlerID+")");
+ System.out.println(title + "executedHandlers.add(" + handlerID + ")");
executedHandlers.add(handlerID);
return InvocationResponse.CONTINUE;
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org