當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。