当前位置: 首页>>代码示例>>Java>>正文


Java Axis2SynapseEnvironment类代码示例

本文整理汇总了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"));
    }
 
开发者ID:wso2-attic,项目名称:carbon-ml,代码行数:30,代码来源:PredictMediatorTest.java

示例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;
}
 
开发者ID:vanjikumaran,项目名称:ISO8583Mediator,代码行数:34,代码来源:XLinkISO8583MediatorTest.java


注:本文中的org.apache.synapse.core.axis2.Axis2SynapseEnvironment类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。