本文整理汇总了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;
}