You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2005/12/11 11:23:28 UTC
svn commit: r355954 - in /webservices/axis2/trunk/java/modules/core:
src/org/apache/axis2/client/ src/org/apache/axis2/context/
src/org/apache/axis2/description/ src/org/apache/axis2/transport/jms/
src/org/apache/axis2/transport/tcp/ test/org/apache/ax...
Author: sanjiva
Date: Sun Dec 11 02:23:17 2005
New Revision: 355954
URL: http://svn.apache.org/viewcvs?rev=355954&view=rev
Log:
Removed ugly way of creating a new ServiceGroupContext and also did some
minor refactoring in the process.
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisServiceGroup.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java
webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/ContextHierarchyTest.java
webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/OperationContextTest.java
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java?rev=355954&r1=355953&r2=355954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/MEPClient.java Sun Dec 11 02:23:17 2005
@@ -16,6 +16,11 @@
package org.apache.axis2.client;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
@@ -23,6 +28,7 @@
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.context.MessageContext;
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.TransportOutDescription;
@@ -37,22 +43,21 @@
import org.apache.axis2.soap.SOAPHeader;
import org.apache.axis2.util.UUIDGenerator;
-import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* This is the super class for all the MEPClients.
*/
public abstract class MEPClient {
ServiceContext serviceContext;
+
protected final String mep;
+
private List soapHeaderList;
/**
* Client will pass all the parameters to this invocation using this.
*/
protected Options clientOptions;
+
private static final String ANONYMOUS_SERVICE = "AnonymousService";
public MEPClient(ServiceContext service, String mep) {
@@ -67,50 +72,55 @@
protected void prepareInvocation(AxisOperation axisop, MessageContext msgCtx)
throws AxisFault {
- // user must provide the minimum information for the engine to proceed with the invocation.
- // For the time being, I think he should at least provide the toEPR. So I should check that is
+ // user must provide the minimum information for the engine to proceed
+ // with the invocation.
+ // For the time being, I think he should at least provide the toEPR. So
+ // I should check that is
// available either from the message context or from the options.
- if ((msgCtx == null || msgCtx.getTo() == null) && (clientOptions == null || clientOptions.getTo() == null)) {
- throw new AxisFault("Can not proceed without options being set for invocation. Set the" +
- "properties for this invocation via MEPClient.setOptions(Options) first.");
+ if ((msgCtx == null || msgCtx.getTo() == null)
+ && (clientOptions == null || clientOptions.getTo() == null)) {
+ throw new AxisFault(
+ "Can not proceed without options being set for invocation. Set the"
+ + "properties for this invocation via MEPClient.setOptions(Options) first.");
}
if (axisop == null) {
- throw new AxisFault(Messages.getMessage("cannotBeNullAxisOperation"));
+ throw new AxisFault(Messages
+ .getMessage("cannotBeNullAxisOperation"));
}
- //make sure operation is type right MEP
+ // make sure operation is type right MEP
if (mep.equals(axisop.getMessageExchangePattern())) {
- throw new AxisFault(
- Messages.getMessage(
- "mepClientSupportOnly",
- mep,
- axisop.getMessageExchangePattern()));
+ throw new AxisFault(Messages.getMessage("mepClientSupportOnly",
+ mep, axisop.getMessageExchangePattern()));
}
- //if operation not alrady added, add it
+ // if operation not alrady added, add it
if (serviceContext.getAxisService().getOperation(axisop.getName()) == null) {
serviceContext.getAxisService().addOperation(axisop);
}
- // now its the time to put the parameters set by the user in to the correct places and to the
+ // now its the time to put the parameters set by the user in to the
+ // correct places and to the
// operation context.
extractPropertiesFromOptionsToContexts(msgCtx);
- // check user has put any SOAPHeader using the call MEPClient methods and add them, if any, to the
+ // check user has put any SOAPHeader using the call MEPClient methods
+ // and add them, if any, to the
// the SOAP message
addUserAddedSOAPHeaders(msgCtx, clientOptions);
- //find and set the transport details
+ // find and set the transport details
configureTransportInformation(msgCtx);
}
/**
- * This will give chance to the derived class to configure his transport from the information
- * injected by the user via options.
- * This will be called within the prepare invocation method, so user should not bother to call
- * this explicitly.
+ * This will give chance to the derived class to configure his transport
+ * from the information injected by the user via options. This will be
+ * called within the prepare invocation method, so user should not bother to
+ * call this explicitly.
*/
- protected abstract void configureTransportInformation(MessageContext msgCtxt) throws AxisFault;
+ protected abstract void configureTransportInformation(MessageContext msgCtxt)
+ throws AxisFault;
private void extractPropertiesFromOptionsToContexts(MessageContext msgCtx) {
@@ -120,18 +130,24 @@
msgCtx.setFaultTo(clientOptions.getFaultTo());
msgCtx.setReplyTo(clientOptions.getReplyTo());
msgCtx.setRelatesTo(clientOptions.getRelatesTo());
- msgCtx.setMessageID((clientOptions.getMessageId() == null || "".equals(clientOptions.getMessageId())) ? UUIDGenerator.getUUID() : clientOptions.getMessageId());
+ msgCtx.setMessageID((clientOptions.getMessageId() == null || ""
+ .equals(clientOptions.getMessageId())) ? UUIDGenerator
+ .getUUID() : clientOptions.getMessageId());
msgCtx.setWSAAction(clientOptions.getAction());
msgCtx.setSoapAction(clientOptions.getSoapAction());
- msgCtx.setProperty(Constants.Configuration.IS_USING_SEPARATE_LISTENER, new Boolean(clientOptions.isUseSeparateListener()));
+ msgCtx.setProperty(Constants.Configuration.IS_USING_SEPARATE_LISTENER,
+ new Boolean(clientOptions.isUseSeparateListener()));
- // I'm not setting the properties here. Those will be set, when we create the operation context
+ // I'm not setting the properties here. Those will be set, when we
+ // create the operation context
}
- protected void addUserAddedSOAPHeaders(MessageContext msgCtx, Options options) {
- if (soapHeaderList != null && soapHeaderList.size() > 0 && msgCtx.getEnvelope() != null) {
+ protected void addUserAddedSOAPHeaders(MessageContext msgCtx,
+ Options options) {
+ if (soapHeaderList != null && soapHeaderList.size() > 0
+ && msgCtx.getEnvelope() != null) {
SOAPFactory soapFactory;
SOAPHeader header = msgCtx.getEnvelope().getHeader();
if (header == null) {
@@ -152,13 +168,15 @@
/**
* Prepares the SOAPEnvelope using the payload.
- *
+ *
* @param toSend
* @return
* @throws AxisFault
*/
- protected MessageContext prepareTheSOAPEnvelope(OMElement toSend) throws AxisFault {
- MessageContext msgctx = new MessageContext(serviceContext.getConfigurationContext());
+ protected MessageContext prepareTheSOAPEnvelope(OMElement toSend)
+ throws AxisFault {
+ MessageContext msgctx = new MessageContext(serviceContext
+ .getConfigurationContext());
SOAPEnvelope envelope = createDefaultSOAPEnvelope();
if (toSend != null) {
@@ -169,14 +187,15 @@
}
/**
- * Infers the transport by looking at the URL. The URL can be http://
- * tcp:// mail:// local://.
- *
+ * Infers the transport by looking at the URL. The URL can be http:// tcp://
+ * mail:// local://.
+ *
* @param epr
* @return
* @throws AxisFault
*/
- protected TransportOutDescription inferTransport(EndpointReference epr) throws AxisFault {
+ protected TransportOutDescription inferTransport(EndpointReference epr)
+ throws AxisFault {
if (epr != null) {
return inferTransport(epr.getAddress());
} else {
@@ -184,7 +203,8 @@
}
}
- protected TransportOutDescription inferTransport(String uri) throws AxisFault {
+ protected TransportOutDescription inferTransport(String uri)
+ throws AxisFault {
String transport = null;
if (uri != null) {
int index = uri.indexOf(':');
@@ -194,8 +214,9 @@
}
if (transport != null) {
- return serviceContext.getConfigurationContext().getAxisConfiguration().getTransportOut(
- new QName(transport));
+ return serviceContext.getConfigurationContext()
+ .getAxisConfiguration().getTransportOut(
+ new QName(transport));
} else {
throw new AxisFault(Messages.getMessage("cannotInferTransport"));
@@ -205,23 +226,27 @@
/**
* Creates SOAPEvelope(in terms of version) from the values set.
- *
+ *
* @return
* @throws AxisFault
*/
protected SOAPEnvelope createDefaultSOAPEnvelope() throws AxisFault {
- // I added code to check the nullity in the prepareInvocation(). But it seems that this method
+ // I added code to check the nullity in the prepareInvocation(). But it
+ // seems that this method
// can be called before prepareInvocation().
if (clientOptions == null) {
- throw new AxisFault("Can not proceed without options being set for invocation. Set the" +
- "properties for this invocation via MEPClient.setOptions(Options) first.");
+ throw new AxisFault(
+ "Can not proceed without options being set for invocation. Set the"
+ + "properties for this invocation via MEPClient.setOptions(Options) first.");
}
String soapVersionURI = clientOptions.getSoapVersionURI();
if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI)) {
return OMAbstractFactory.getSOAP12Factory().getDefaultEnvelope();
- } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapVersionURI) || "".equals(soapVersionURI) || soapVersionURI == null) {
+ } else if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI
+ .equals(soapVersionURI)
+ || "".equals(soapVersionURI) || soapVersionURI == null) {
return OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
} else {
throw new AxisFault(Messages.getMessage("invaidSOAPversion"));
@@ -229,16 +254,19 @@
}
/**
- * Engages a given module to the current invocation. But in order to call this method, the
- * module *MUST* be enabled ( i.e. picked up by the deployment and known to Axis Engine). If not,
- * an exception will be thrown. To be enabled, the modules are added to the AXIS2_REPOSITORY/modules directory.
- *
+ * Engages a given module to the current invocation. But in order to call
+ * this method, the module *MUST* be enabled ( i.e. picked up by the
+ * deployment and known to Axis Engine). If not, an exception will be
+ * thrown. To be enabled, the modules are added to the
+ * AXIS2_REPOSITORY/modules directory.
+ *
* @param name
* @throws AxisFault
*/
public void engageModule(QName name) throws AxisFault {
- AxisConfiguration axisConf = serviceContext.getConfigurationContext().getAxisConfiguration();
- //if it is already engeged do not engege it agaien
+ AxisConfiguration axisConf = serviceContext.getConfigurationContext()
+ .getAxisConfiguration();
+ // if it is already engeged do not engege it agaien
if (!axisConf.isEngaged(name)) {
axisConf.engageModule(name);
}
@@ -262,24 +290,26 @@
}
/**
- * Assumes the values for the ConfigurationContext and ServiceContext to make the NON WSDL cases simple.
- *
+ * Assumes the values for the ConfigurationContext and ServiceContext to
+ * make the NON WSDL cases simple.
+ *
* @throws AxisFault
*/
- protected void assumeServiceContext(String clientHome)
- throws AxisFault {
- ConfigurationContext configurationContext =
- new ConfigurationContextFactory().buildClientConfigurationContext(clientHome);
+ protected void assumeServiceContext(String clientHome) throws AxisFault {
+ ConfigurationContext configurationContext = new ConfigurationContextFactory()
+ .buildClientConfigurationContext(clientHome);
QName assumedServiceName = new QName(ANONYMOUS_SERVICE);
- AxisService axisService = configurationContext.getAxisConfiguration().getService(ANONYMOUS_SERVICE);
+ AxisService axisService = configurationContext.getAxisConfiguration()
+ .getService(ANONYMOUS_SERVICE);
if (axisService == null) {
- //we will assume a Service and operations
+ // we will assume a Service and operations
axisService = new AxisService(assumedServiceName);
}
configurationContext.getAxisConfiguration().addService(axisService);
- serviceContext = axisService.getParent().getServiceGroupContext(configurationContext).getServiceContext(
- assumedServiceName.getLocalPart());
+ serviceContext = new ServiceGroupContext(configurationContext,
+ axisService.getParent()).getServiceContext(assumedServiceName
+ .getLocalPart());
}
public Options getClientOptions() {
@@ -287,8 +317,9 @@
}
/**
- * User will set all the options and parameters for this invocation using this.
- *
+ * User will set all the options and parameters for this invocation using
+ * this.
+ *
* @param clientOptions
* @see Options for more details.
*/
@@ -297,16 +328,18 @@
}
/**
- * Allows users to add their own headers to the out going message from the client. It is
- * restrictive, in the sense, that user can set a
- * header with only one text. <code><pre><HeaderBlockName>your text</HeaderBlockName></pre></code>. A more flexible
- * way is to use addSOAPHeader(OMElement).
- *
+ * Allows users to add their own headers to the out going message from the
+ * client. It is restrictive, in the sense, that user can set a header with
+ * only one text. <code><pre>
+ * <HeaderBlockName>your text</HeaderBlockName>
+ * </pre></code>. A more flexible way is to use addSOAPHeader(OMElement).
+ *
* @param soapHeaderQName
* @param soapHeaderText
*/
public void addSOAPHeader(QName soapHeaderQName, String soapHeaderText) {
- OMElement omElement = OMAbstractFactory.getOMFactory().createOMElement(soapHeaderQName, null);
+ OMElement omElement = OMAbstractFactory.getOMFactory().createOMElement(
+ soapHeaderQName, null);
omElement.setText(soapHeaderText);
if (soapHeaderList == null) {
soapHeaderList = new ArrayList();
@@ -316,7 +349,7 @@
/**
* Allows users to add a SOAP header block.
- *
+ *
* @param soapHeaderBlock
*/
public void addSOAPHeader(OMElement soapHeaderBlock) {
@@ -330,32 +363,44 @@
soapHeaderList.add(soapHeaderBlock);
}
- protected void inferTransportOutDescription(MessageContext msgCtx) throws AxisFault {
- // user can set the transport by giving a TransportOutDescription or we will deduce that from the
+ protected void inferTransportOutDescription(MessageContext msgCtx)
+ throws AxisFault {
+ // user can set the transport by giving a TransportOutDescription or we
+ // will deduce that from the
// to epr information
// if user has not set the TransportOutDescription, lets infer that
if (clientOptions.getSenderTransport() == null) {
- AxisConfiguration axisConfig = this.serviceContext.getConfigurationContext().getAxisConfiguration();
+ AxisConfiguration axisConfig = this.serviceContext
+ .getConfigurationContext().getAxisConfiguration();
- // we have a deprecated method for user to set the transport protocol directly. Lets support that also
- String senderTrasportProtocol = clientOptions.getSenderTransportProtocol();
+ // we have a deprecated method for user to set the transport
+ // protocol directly. Lets support that also
+ String senderTrasportProtocol = clientOptions
+ .getSenderTransportProtocol();
if (axisConfig != null) {
- if (senderTrasportProtocol == null || "".equals(senderTrasportProtocol)) {
- // by this time we have passed all the information we collected via Options to the
+ if (senderTrasportProtocol == null
+ || "".equals(senderTrasportProtocol)) {
+ // by this time we have passed all the information we
+ // collected via Options to the
// message context
- clientOptions.setSenderTransport(inferTransport(msgCtx.getTo()));
+ clientOptions.setSenderTransport(inferTransport(msgCtx
+ .getTo()));
} else {
- // if he has not set the transport information, we gonna infer that from the to EPR
- clientOptions.setSenderTransport(axisConfig.getTransportOut(new QName(senderTrasportProtocol)));
+ // if he has not set the transport information, we gonna
+ // infer that from the to EPR
+ clientOptions
+ .setSenderTransport(axisConfig
+ .getTransportOut(new QName(
+ senderTrasportProtocol)));
}
}
if (this.clientOptions.getSenderTransport() == null) {
- throw new AxisFault(Messages.getMessage("unknownTransport", senderTrasportProtocol));
+ throw new AxisFault(Messages.getMessage("unknownTransport",
+ senderTrasportProtocol));
}
}
}
-
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java?rev=355954&r1=355953&r2=355954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java Sun Dec 11 02:23:17 2005
@@ -229,7 +229,7 @@
if (messageContext.getAxisService() != null) {
AxisServiceGroup axisServiceGroup =
messageContext.getAxisService().getParent();
- serviceGroupContext = axisServiceGroup.getServiceGroupContext(this);
+ serviceGroupContext = new ServiceGroupContext (this, axisServiceGroup);
serviceContext = serviceGroupContext.getServiceContext(
messageContext.getAxisService().getName().
getLocalPart());
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisServiceGroup.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisServiceGroup.java?rev=355954&r1=355953&r2=355954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisServiceGroup.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisServiceGroup.java Sun Dec 11 02:23:17 2005
@@ -32,7 +32,7 @@
public class AxisServiceGroup implements ParameterInclude {
- //to add and get parameters
+ // to add and get parameters
protected ParameterInclude paramInclude;
private Log log = LogFactory.getLog(getClass());
@@ -40,7 +40,8 @@
// to keep name of the service group
private String serviceGroupName;
- // to keep the parent of service group , to chcek parameter lock checking and serching
+ // to keep the parent of service group , to chcek parameter lock checking
+ // and serching
private AxisConfiguration parent;
/**
@@ -48,16 +49,16 @@
*/
private HashMap services;
- //to store modeule configuration info
+ // to store modeule configuration info
private HashMap moduleConfigmap;
// to store service Group engagedModules name
private ArrayList engagedModules;
- //to store module ref at deploy time parsing
+ // to store module ref at deploy time parsing
private ArrayList mdoulesList = new ArrayList();
- //class loader
+ // class loader
private ClassLoader serviceGroupClassLoader;
public AxisServiceGroup() {
@@ -99,7 +100,8 @@
}
}
- public void deserializeParameters(OMElement parameterElement) throws AxisFault {
+ public void deserializeParameters(OMElement parameterElement)
+ throws AxisFault {
this.paramInclude.deserializeParameters(parameterElement);
}
@@ -121,14 +123,15 @@
/**
* Adding module configuration , if there is moduleConfig tag in service
- *
+ *
* @param moduleConfiguration
*/
public void addModuleConfig(ModuleConfiguration moduleConfiguration) {
if (moduleConfigmap == null) {
moduleConfigmap = new HashMap();
}
- moduleConfigmap.put(moduleConfiguration.getModuleName(), moduleConfiguration);
+ moduleConfigmap.put(moduleConfiguration.getModuleName(),
+ moduleConfiguration);
}
public ModuleConfiguration getModuleConfig(QName moduleName) {
@@ -139,20 +142,20 @@
engagedModules.add(moduleName);
}
- public void engageModuleToGroup(QName moduleName) {
+ public void engageModuleToGroup(QName moduleName) {
if (moduleName == null) {
return;
}
boolean needToadd = true;
- for (Iterator iterator = engagedModules.iterator();
- iterator.hasNext();) {
+ for (Iterator iterator = engagedModules.iterator(); iterator.hasNext();) {
QName modu = (QName) iterator.next();
if (modu.getLocalPart().equals(moduleName.getLocalPart())) {
- log.info(moduleName.getLocalPart() +
- " module has alredy been engaged on the service Group. " +
- " Operation terminated !!!");
+ log
+ .info(moduleName.getLocalPart()
+ + " module has alredy been engaged on the service Group. "
+ + " Operation terminated !!!");
needToadd = false;
-// return;
+ // return;
}
}
Iterator srevice = getServices();
@@ -177,7 +180,6 @@
return engagedModules;
}
-
public Iterator getServices() {
return services.values().iterator();
}
@@ -193,8 +195,10 @@
if (moduleDesc != null) {
service.engageModule(moduleDesc, axisConfig);
} else {
- throw new AxisFault("Trying to engage a module which is not " +
- "available : " + moduleName.getLocalPart());
+ throw new AxisFault(
+ "Trying to engage a module which is not "
+ + "available : "
+ + moduleName.getLocalPart());
}
}
}
@@ -222,17 +226,12 @@
return mdoulesList;
}
-
public synchronized void removeService(QName name) throws AxisFault {
AxisService service = getService(name);
if (service != null) {
this.parent.notifyObservers(AxisEvent.SERVICE_DEPLOY, service);
}
services.remove(name);
- }
-
- public ServiceGroupContext getServiceGroupContext(ConfigurationContext parent) {
- return new ServiceGroupContext(parent, this);
}
public ClassLoader getServiceGroupClassLoader() {
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java?rev=355954&r1=355953&r2=355954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/jms/SimpleJMSListener.java Sun Dec 11 02:23:17 2005
@@ -125,7 +125,7 @@
return connector;
}
- public ConfigurationContext getSystemContext() {
+ public ConfigurationContext getConfigurationContext() {
return this.configurationContext;
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java?rev=355954&r1=355953&r2=355954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/tcp/TCPServer.java Sun Dec 11 02:23:17 2005
@@ -131,7 +131,7 @@
}
}
- public ConfigurationContext getSystemContext() {
+ public ConfigurationContext getConfigurationContext() {
return this.configContext;
}
Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/ContextHierarchyTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/ContextHierarchyTest.java?rev=355954&r1=355953&r2=355954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/ContextHierarchyTest.java (original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/ContextHierarchyTest.java Sun Dec 11 02:23:17 2005
@@ -28,7 +28,9 @@
public class ContextHierarchyTest extends TestCase {
private AxisOperation axisOperation;
+
private AxisService axisService;
+
private AxisConfiguration axisConfiguration;
public ContextHierarchyTest(String arg0) {
@@ -44,22 +46,21 @@
}
public void testCompleteHiracy() throws AxisFault {
- ConfigurationContext configurationContext =
- new ConfigurationContext(axisConfiguration);
- ServiceGroupContext serviceGroupContext = axisService.getParent().getServiceGroupContext(configurationContext);
- ServiceContext serviceCOntext =
- serviceGroupContext.getServiceContext(axisService.getName().getLocalPart());
- MessageContext msgctx =
- new MessageContext(configurationContext);
- OperationContext opContext =
- axisOperation.findOperationContext(msgctx,
- serviceCOntext);
- msgctx.setServiceContext(serviceCOntext);
+ ConfigurationContext configurationContext = new ConfigurationContext(
+ axisConfiguration);
+ ServiceGroupContext serviceGroupContext = new ServiceGroupContext(
+ configurationContext, axisService.getParent());
+ ServiceContext serviceContext = serviceGroupContext
+ .getServiceContext(axisService.getName().getLocalPart());
+ MessageContext msgctx = new MessageContext(configurationContext);
+ OperationContext opContext = axisOperation.findOperationContext(msgctx,
+ serviceContext);
+ msgctx.setServiceContext(serviceContext);
- //test the complte Hisracy built
+ // test the complte Hisracy built
assertEquals(msgctx.getParent(), opContext);
- assertEquals(opContext.getParent(), serviceCOntext);
- assertEquals(serviceCOntext.getParent(), serviceGroupContext);
+ assertEquals(opContext.getParent(), serviceContext);
+ assertEquals(serviceContext.getParent(), serviceGroupContext);
String key1 = "key1";
String value1 = "Val1";
@@ -80,13 +81,12 @@
}
public void testDisconntectedHiracy() throws AxisFault {
- ConfigurationContext configurationContext =
- new ConfigurationContext(axisConfiguration);
+ ConfigurationContext configurationContext = new ConfigurationContext(
+ axisConfiguration);
+
+ MessageContext msgctx = new MessageContext(configurationContext);
- MessageContext msgctx =
- new MessageContext(configurationContext);
-
- //test the complte Hisracy built
+ // test the complte Hisracy built
assertEquals(msgctx.getParent(), null);
String key1 = "key1";
Modified: webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/OperationContextTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/OperationContextTest.java?rev=355954&r1=355953&r2=355954&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/OperationContextTest.java (original)
+++ webservices/axis2/trunk/java/modules/core/test/org/apache/axis2/context/OperationContextTest.java Sun Dec 11 02:23:17 2005
@@ -31,7 +31,8 @@
public class OperationContextTest extends AbstractTestCase {
- private ConfigurationContext engineCtx = new ConfigurationContext(new AxisConfiguration());
+ private ConfigurationContext configContext = new ConfigurationContext(
+ new AxisConfiguration());
public OperationContextTest(String arg0) {
super(arg0);
@@ -39,35 +40,33 @@
public void testMEPfindingOnRelatesTO() throws Exception {
- AxisService serviceConfig = new AxisService(new QName("TempSC"));
- engineCtx.getAxisConfiguration().addService(serviceConfig);
- ServiceGroupContext sgc = serviceConfig.getParent().getServiceGroupContext(engineCtx);
+ AxisService axisService = new AxisService(new QName("TempSC"));
+ configContext.getAxisConfiguration().addService(axisService);
+ ServiceGroupContext sgc = new ServiceGroupContext(configContext,
+ axisService.getParent());
ServiceContext sessionContext = sgc.getServiceContext("TempSC");
MessageContext messageContext1 = this.getBasicMessageContext();
- messageContext1.setMessageID(
- UUIDGenerator.getUUID());
- AxisOperation axisOperation = new InOutAxisOperation(
- new QName("test"));
- OperationContext operationContext1 = axisOperation.findOperationContext(
- messageContext1, sessionContext);
+ messageContext1.setMessageID(UUIDGenerator.getUUID());
+ AxisOperation axisOperation = new InOutAxisOperation(new QName("test"));
+ OperationContext operationContext1 = axisOperation
+ .findOperationContext(messageContext1, sessionContext);
MessageContext messageContext2 = this.getBasicMessageContext();
- messageContext2.setMessageID(
- UUIDGenerator.getUUID());
+ messageContext2.setMessageID(UUIDGenerator.getUUID());
messageContext2.getMessageInformationHeaders().setRelatesTo(
new RelatesTo(messageContext1.getMessageID()));
- OperationContext operationContext2 = axisOperation.findOperationContext(
- messageContext2, sessionContext);
+ OperationContext operationContext2 = axisOperation
+ .findOperationContext(messageContext2, sessionContext);
assertEquals(operationContext1, operationContext2);
}
public MessageContext getBasicMessageContext() throws AxisFault {
- return new MessageContext(engineCtx,
- new TransportInDescription(new QName("axis")),
- new TransportOutDescription(new QName("axis")));
+ return new MessageContext(configContext, new TransportInDescription(
+ new QName("axis")), new TransportOutDescription(new QName(
+ "axis")));
}