本文整理匯總了Java中org.apache.synapse.core.axis2.Axis2SynapseEnvironment類的典型用法代碼示例。如果您正苦於以下問題:Java Axis2SynapseEnvironment類的具體用法?Java Axis2SynapseEnvironment怎麽用?Java Axis2SynapseEnvironment使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Axis2SynapseEnvironment類屬於org.apache.synapse.core.axis2包,在下文中一共展示了Axis2SynapseEnvironment類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testMediation
import org.apache.synapse.core.axis2.Axis2SynapseEnvironment; //導入依賴的package包/類
public void testMediation() throws AxisFault {
MLCoreServiceValueHolder valueHolder = MLCoreServiceValueHolder.getInstance();
valueHolder.setMlProperties(new Properties());
OMElement mediatorElement = SynapseConfigUtils.stringToOM(xml);
PredictMediatorFactory factory = new PredictMediatorFactory();
PredictMediator mediator =
(PredictMediator) factory.createSpecificMediator(mediatorElement, new Properties());
SynapseConfiguration synCfg = new SynapseConfiguration();
AxisConfiguration config = new AxisConfiguration();
MessageContext messageContext =
new Axis2MessageContext(new org.apache.axis2.context.MessageContext(), synCfg,
new Axis2SynapseEnvironment(new ConfigurationContext(config),synCfg));
((Axis2MessageContext) messageContext).getAxis2MessageContext().setConfigurationContext(new ConfigurationContext(config));
SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
messageContext.setEnvelope(envelope);
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://ws.apache.org/axis2", "ns");
OMElement parent = fac.createOMElement("getPrediction", omNs);
OMElement features = fac.createOMElement("features", omNs);
addFeatureValues(features);
parent.addChild(features);
messageContext.getEnvelope().getBody().addChild(parent);
mediator.mediate(messageContext);
assertEquals("0", messageContext.getProperty("result"));
}
示例2: build
import org.apache.synapse.core.axis2.Axis2SynapseEnvironment; //導入依賴的package包/類
/**
* Build the test message context. This method returns a new (and
* independent) instance on every invocation.
*
* @return
* @throws Exception
*/
public MessageContext build() throws Exception {
SynapseConfiguration testConfig = new SynapseConfiguration();
// TODO: check whether we need a SynapseEnvironment in all cases
SynapseEnvironment synEnv = new Axis2SynapseEnvironment(
new ConfigurationContext(new AxisConfiguration()),
testConfig);
MessageContext synCtx = new Axis2MessageContext(
new org.apache.axis2.context.MessageContext(), testConfig,
synEnv);
for (Map.Entry<String, Entry> mapEntry : entries.entrySet()) {
testConfig.addEntry(mapEntry.getKey(), mapEntry.getValue());
}
;
SOAPEnvelope envelope = OMAbstractFactory.getSOAP11Factory()
.getDefaultEnvelope();
org.apache.axis2.context.MessageContext axis2MsgCtx = ((Axis2MessageContext) synCtx)
.getAxis2MessageContext();
axis2MsgCtx.setEnvelope(envelope);
return synCtx;
}