use of org.apache.synapse.config.SynapseConfiguration in project wso2-synapse by wso2.
the class SynapseXMLConfigurationSerializerTest method testSerializeConfiguration5.
/**
* Test serializeConfigurationMethod with TemplateMediator added for SynapseConfiguration
* and assert OMElement returned
*/
@Test
public void testSerializeConfiguration5() {
SynapseXMLConfigurationSerializer serializer = new SynapseXMLConfigurationSerializer();
SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
org.apache.synapse.mediators.TestMediator t1 = new org.apache.synapse.mediators.TestMediator();
org.apache.synapse.mediators.TestMediator t2 = new org.apache.synapse.mediators.TestMediator();
org.apache.synapse.mediators.TestMediator t3 = new org.apache.synapse.mediators.TestMediator();
TemplateMediator templateMediator = new TemplateMediator();
templateMediator.addChild(t1);
templateMediator.addChild(t2);
templateMediator.addChild(t3);
synapseConfiguration.addSequence("testSequence", templateMediator);
OMElement element = serializer.serializeConfiguration(synapseConfiguration);
Assert.assertNotNull("OMElement is not returned", element);
Assert.assertEquals("definitions", element.getLocalName());
Assert.assertTrue("Template added is not serialized.", element.getChildren().next().toString().contains("template"));
}
use of org.apache.synapse.config.SynapseConfiguration in project wso2-synapse by wso2.
the class SynapseXMLConfigurationSerializerTest method testSerializeConfiguration11.
/**
* Test serializeConfigurationMethod with API added for SynapseConfiguration and assert OMElement returned
*/
@Test
public void testSerializeConfiguration11() {
SynapseXMLConfigurationSerializer serializer = new SynapseXMLConfigurationSerializer();
SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
API api = new API("testAPI", "/");
synapseConfiguration.addAPI(api.getName(), api);
OMElement element = serializer.serializeConfiguration(synapseConfiguration);
Assert.assertNotNull("OMElement is not returned", element);
Assert.assertEquals("definitions", element.getLocalName());
Assert.assertTrue("testAPI added is not serialized.", element.getChildren().next().toString().contains("name=\"testAPI\""));
}
use of org.apache.synapse.config.SynapseConfiguration in project wso2-synapse by wso2.
the class SynapseXMLConfigurationSerializerTest method testSerializeConfiguration6.
/**
* Test serializeConfigurationMethod with Endpoint added for SynapseConfiguration and assert OMElement returned
*/
@Test
public void testSerializeConfiguration6() {
SynapseXMLConfigurationSerializer serializer = new SynapseXMLConfigurationSerializer();
SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
AddressEndpoint endpoint = new AddressEndpoint();
EndpointDefinition definition = new EndpointDefinition();
definition.setAddress("testUrl");
endpoint.setName("testEndpoint");
endpoint.setDefinition(definition);
synapseConfiguration.addEndpoint(endpoint.getName(), endpoint);
OMElement element = serializer.serializeConfiguration(synapseConfiguration);
Assert.assertNotNull("OMElement is not returned", element);
Assert.assertEquals("definitions", element.getLocalName());
Assert.assertTrue("Endpoint added is not serialized.", element.getChildren().next().toString().contains("name=\"testEndpoint\""));
}
use of org.apache.synapse.config.SynapseConfiguration in project wso2-synapse by wso2.
the class SynapseXMLConfigurationSerializerTest method testSerializeConfiguration7.
/**
* Test serializeConfigurationMethod with Entry added for SynapseConfiguration and assert OMElement returned
*/
@Test
public void testSerializeConfiguration7() throws MalformedURLException {
SynapseXMLConfigurationSerializer serializer = new SynapseXMLConfigurationSerializer();
SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
Entry entry = PowerMockito.mock(Entry.class);
entry.setType(Entry.URL_SRC);
doReturn(new URL("https://test")).when(entry).getSrc();
doReturn("testKey").when(entry).getKey();
synapseConfiguration.addEntry("root_wsdl", entry);
OMElement element = serializer.serializeConfiguration(synapseConfiguration);
Assert.assertNotNull("OMElement is not returned", element);
Assert.assertEquals("definitions", element.getLocalName());
Assert.assertTrue("Entry added is not serialized.", element.getChildren().next().toString().contains("key=\"testKey\""));
}
use of org.apache.synapse.config.SynapseConfiguration in project wso2-synapse by wso2.
the class SynapseXMLConfigurationSerializerTest method testSerializeConfiguration9.
/**
* Test serializeConfigurationMethod with messageStore added for SynapseConfiguration and assert OMElement returned
*/
@Test
public void testSerializeConfiguration9() {
SynapseXMLConfigurationSerializer serializer = new SynapseXMLConfigurationSerializer();
SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
MessageStore messageStore = new JmsStore();
Map<String, Object> parameters = new HashMap<>();
parameters.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
parameters.put("java.naming.provider.url", "tcp://127.0.0.1:61616");
messageStore.setName("testMessageStore");
messageStore.setParameters(parameters);
synapseConfiguration.addMessageStore(messageStore.getName(), messageStore);
OMElement element = serializer.serializeConfiguration(synapseConfiguration);
Assert.assertNotNull("OMElement is not returned", element);
Assert.assertEquals("definitions", element.getLocalName());
Assert.assertTrue("MessageStore added is not serialized.", element.getChildren().next().toString().contains("name=\"testMessageStore\""));
}
Aggregations