use of org.apache.axis2.engine.AxisConfiguration in project wso2-synapse by wso2.
the class MessageStoreDeployerTest method testDeploy.
/**
* Testing the deployment of an message store
*
* @throws Exception
*/
@Test
public void testDeploy() throws Exception {
String inputXML = "<messageStore name=\"JMSMS\" class=\"org.apache.synapse.message.store.impl.jms.JmsStore\" xmlns=\"http://ws.apache.org/ns/synapse\">" + " <parameter name=\"java.naming.factory.initial\">org.wso2.andes.jndi.PropertiesFileInitialContextFactory</parameter>" + " <parameter name=\"java.naming.provider.url\">repository/conf/jndi.properties</parameter>" + " <parameter name=\"store.jms.destination\">ordersQueue</parameter>" + " <parameter name=\"store.jms.connection.factory\">QueueConnectionFactory</parameter>" + " <parameter name=\"store.jms.JMSSpecVersion\">1.1</parameter>" + "</messageStore>";
OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
MessageStoreDeployer messageStoreDeployer = new MessageStoreDeployer();
SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
AxisConfiguration axisConfiguration = synapseConfiguration.getAxisConfiguration();
ConfigurationContext cfgCtx = new ConfigurationContext(axisConfiguration);
SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration);
axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment));
axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfiguration));
cfgCtx.setAxisConfiguration(axisConfiguration);
messageStoreDeployer.init(cfgCtx);
String response = messageStoreDeployer.deploySynapseArtifact(inputElement, "sampleFile", null);
Assert.assertEquals("Message store not deployed!", "JMSMS", response);
}
use of org.apache.axis2.engine.AxisConfiguration in project wso2-synapse by wso2.
the class ProxyServiceDeployerTest method testUpdate.
/**
* Test updating a proxy service
*
* @throws Exception
*/
@Test
public void testUpdate() throws Exception {
String inputXML = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"TestProxy\">" + " <target>" + " <endpoint>" + " <address uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>" + " </endpoint>" + " <outSequence>" + " <send/>" + " </outSequence>" + " </target>" + " </proxy>";
OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
ProxyServiceDeployer proxyServiceDeployer = new ProxyServiceDeployer();
SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
AxisConfiguration axisConfiguration = synapseConfiguration.getAxisConfiguration();
ConfigurationContext cfgCtx = new ConfigurationContext(axisConfiguration);
SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration);
axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment));
axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfiguration));
cfgCtx.setAxisConfiguration(axisConfiguration);
proxyServiceDeployer.init(cfgCtx);
proxyServiceDeployer.deploySynapseArtifact(inputElement, "sampleFile", new Properties());
String inputUpdateXML = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"TestProxyUpdated\">" + " <target>" + " <endpoint>" + " <address uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>" + " </endpoint>" + " <outSequence>" + " <send/>" + " </outSequence>" + " </target>" + " </proxy>";
OMElement updatedElement = AXIOMUtil.stringToOM(inputUpdateXML);
String response = proxyServiceDeployer.updateSynapseArtifact(updatedElement, "sampleUpdateFile", "TestProxy", new Properties());
Assert.assertEquals("Proxy not updated!", "TestProxyUpdated", response);
}
use of org.apache.axis2.engine.AxisConfiguration in project wso2-synapse by wso2.
the class ProxyServiceDeployerTest method testDeploy.
/**
* Testing the deployment of a proxy service
*
* @throws Exception
*/
@Test
public void testDeploy() throws Exception {
String inputXML = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"TestProxy\">" + " <target>" + " <endpoint>" + " <address uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>" + " </endpoint>" + " <outSequence>" + " <send/>" + " </outSequence>" + " </target>" + " </proxy>";
OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
ProxyServiceDeployer proxyServiceDeployer = new ProxyServiceDeployer();
SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
AxisConfiguration axisConfiguration = synapseConfiguration.getAxisConfiguration();
ConfigurationContext cfgCtx = new ConfigurationContext(axisConfiguration);
SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration);
axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment));
axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfiguration));
cfgCtx.setAxisConfiguration(axisConfiguration);
proxyServiceDeployer.init(cfgCtx);
String response = proxyServiceDeployer.deploySynapseArtifact(inputElement, "sampleFile", new Properties());
Assert.assertEquals("Proxy service not deployed!", "TestProxy", response);
}
use of org.apache.axis2.engine.AxisConfiguration in project wso2-synapse by wso2.
the class ProxyServiceDeployerTest method testUndeploy.
/**
* Test undeploying a proxy service
*
* @throws Exception
*/
@Test
public void testUndeploy() throws Exception {
String inputXML = "<proxy xmlns=\"http://ws.apache.org/ns/synapse\" name=\"TestProxy\">" + " <target>" + " <endpoint>" + " <address uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>" + " </endpoint>" + " <outSequence>" + " <send/>" + " </outSequence>" + " </target>" + " </proxy>";
OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
ProxyServiceDeployer proxyServiceDeployer = new ProxyServiceDeployer();
SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
AxisConfiguration axisConfiguration = synapseConfiguration.getAxisConfiguration();
ConfigurationContext cfgCtx = new ConfigurationContext(axisConfiguration);
SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(cfgCtx, synapseConfiguration);
axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_ENV, synapseEnvironment));
axisConfiguration.addParameter(new Parameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfiguration));
cfgCtx.setAxisConfiguration(axisConfiguration);
proxyServiceDeployer.init(cfgCtx);
proxyServiceDeployer.deploySynapseArtifact(inputElement, "sampleFile", new Properties());
Assert.assertNotNull("Proxy not deployed!", synapseConfiguration.getProxyService("TestProxy"));
proxyServiceDeployer.undeploySynapseArtifact("TestProxy");
Assert.assertNull("Proxy service cannot be undeployed", synapseConfiguration.getProxyService("TestProxy"));
}
use of org.apache.axis2.engine.AxisConfiguration in project wso2-synapse by wso2.
the class DynamicLoadBalanceEndpointTest method createMessageContext.
/**
* Create a empty message context
*
* @return A context with empty message
* @throws AxisFault on an error creating a context
*/
private MessageContext createMessageContext() throws AxisFault {
Axis2SynapseEnvironment synapseEnvironment = new Axis2SynapseEnvironment(new SynapseConfiguration());
org.apache.axis2.context.MessageContext axis2MC = new org.apache.axis2.context.MessageContext();
axis2MC.setConfigurationContext(new ConfigurationContext(new AxisConfiguration()));
ServiceContext svcCtx = new ServiceContext();
OperationContext opCtx = new OperationContext(new InOutAxisOperation(), svcCtx);
axis2MC.setServiceContext(svcCtx);
axis2MC.setOperationContext(opCtx);
axis2MC.setTransportIn(new TransportInDescription("http"));
axis2MC.setTo(new EndpointReference("http://localhost:9000/services/SimpleStockQuoteService"));
MessageContext mc = new Axis2MessageContext(axis2MC, new SynapseConfiguration(), synapseEnvironment);
mc.setMessageID(UIDGenerator.generateURNString());
mc.setEnvelope(OMAbstractFactory.getSOAP12Factory().createSOAPEnvelope());
mc.getEnvelope().addChild(OMAbstractFactory.getSOAP12Factory().createSOAPBody());
return mc;
}
Aggregations