use of org.apache.synapse.core.SynapseEnvironment in project wso2-synapse by wso2.
the class LocalEntryDeployerTest method testUpdate.
/**
* Test updating a local entry
*
* @throws Exception
*/
@Test
public void testUpdate() throws Exception {
String inputXML = "<localEntry key=\"TestEntry\" xmlns=\"http://ws.apache.org/ns/synapse\">0.1</localEntry>";
OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
LocalEntryDeployer localEntryDeployer = new LocalEntryDeployer();
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);
localEntryDeployer.init(cfgCtx);
localEntryDeployer.deploySynapseArtifact(inputElement, "sampleFile", null);
String inputUpdateXML = "<localEntry key=\"TestEntryUpdated\" xmlns=\"http://ws.apache.org/ns/synapse\">0.1</localEntry>";
OMElement updatedElement = AXIOMUtil.stringToOM(inputUpdateXML);
String response = localEntryDeployer.updateSynapseArtifact(updatedElement, "sampleUpdateFile", "TestEntry", null);
Assert.assertEquals("Local Entry not updated!", "TestEntryUpdated", response);
}
use of org.apache.synapse.core.SynapseEnvironment in project wso2-synapse by wso2.
the class LocalEntryDeployerTest method testUndeploy.
/**
* Test undeploying a local entry
*
* @throws Exception
*/
@Test
public void testUndeploy() throws Exception {
String inputXML = "<localEntry key=\"TestEntry\" xmlns=\"http://ws.apache.org/ns/synapse\">0.1</localEntry>";
OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
LocalEntryDeployer localEntryDeployer = new LocalEntryDeployer();
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);
localEntryDeployer.init(cfgCtx);
localEntryDeployer.deploySynapseArtifact(inputElement, "sampleFile", null);
Assert.assertNotNull("Local Entry not deployed!", synapseConfiguration.getEntry("TestEntry"));
localEntryDeployer.undeploySynapseArtifact("TestEntry");
Assert.assertNull("Local Entry cannot be undeployed", synapseConfiguration.getEntry("TestEntry"));
}
use of org.apache.synapse.core.SynapseEnvironment in project wso2-synapse by wso2.
the class LocalEntryDeployerTest method testDeploy.
/**
* Testing the deployment of a local entry
*
* @throws Exception
*/
@Test
public void testDeploy() throws Exception {
String inputXML = "<localEntry key=\"TestEntry\" xmlns=\"http://ws.apache.org/ns/synapse\">0.1</localEntry>";
OMElement inputElement = AXIOMUtil.stringToOM(inputXML);
LocalEntryDeployer localEntryDeployer = new LocalEntryDeployer();
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);
localEntryDeployer.init(cfgCtx);
String response = localEntryDeployer.deploySynapseArtifact(inputElement, "sampleFile", null);
Assert.assertEquals("Local Entry not deployed!", "TestEntry", response);
}
use of org.apache.synapse.core.SynapseEnvironment 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.synapse.core.SynapseEnvironment in project wso2-synapse by wso2.
the class MessageStoreDeployerTest method testUpdate.
/**
* Test updating a message store
*
* @throws Exception
*/
@Test
public void testUpdate() 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);
messageStoreDeployer.deploySynapseArtifact(inputElement, "sampleFile", null);
String inputUpdatedXML = "<messageStore name=\"JMSMSnew\" 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 inputUpdatedElement = AXIOMUtil.stringToOM(inputUpdatedXML);
String response = messageStoreDeployer.updateSynapseArtifact(inputUpdatedElement, "sampleUpdatedFile", "JMSMS", null);
Assert.assertEquals("Message Store not updated!", "JMSMSnew", response);
}
Aggregations