use of org.apache.synapse.config.SynapseConfiguration in project wso2-synapse by wso2.
the class MultiXMLConfigurationSerializerTest method testSerializeSynapseXML.
/**
* Test serializeSynapseXML method and assert synapse.xml is created.
*/
@Test
public void testSerializeSynapseXML() throws Exception {
MultiXMLConfigurationSerializer serializer = new MultiXMLConfigurationSerializer(TEST_DIRECTORY_NAME);
SynapseConfiguration configuration = new SynapseConfiguration();
serializer.serializeSynapseXML(configuration);
Assert.assertTrue("Error in serializing Synapse configuration.", new File(TEST_DIRECTORY_NAME + File.separator + SYNAPSE_XML).exists());
removeTestFolder(TEST_DIRECTORY_NAME);
}
use of org.apache.synapse.config.SynapseConfiguration in project wso2-synapse by wso2.
the class MultiXMLConfigurationSerializerTest method testSerialize3.
/**
* Test serialize method with registry set for SynapseConfiguration and assert synapse.xml is created.
*/
@Test
public void testSerialize3() {
MultiXMLConfigurationSerializer serializer = new MultiXMLConfigurationSerializer(TEST_DIRECTORY_NAME);
SynapseConfiguration configuration = new SynapseConfiguration();
Map<String, OMNode> data = new HashMap<>();
data.put(KEY_DYNAMIC_ENDPOINT_1, TestUtils.createOMElement(DYNAMIC_ENDPOINT_1));
data.put(KEY_DYNAMIC_SEQUENCE_1, TestUtils.createOMElement(DYNAMIC_SEQUENCE_1));
Registry registry = new SimpleInMemoryRegistry(data, 8000L);
configuration.setRegistry(registry);
serializer.serialize(configuration);
Assert.assertTrue("Error in serializing Synapse configuration.", new File(TEST_DIRECTORY_NAME + File.separator + SYNAPSE_XML).exists());
removeTestFolder(TEST_DIRECTORY_NAME);
}
use of org.apache.synapse.config.SynapseConfiguration in project wso2-synapse by wso2.
the class SynapseXMLConfigurationSerializerTest method testSerializeConfiguration10.
/**
* Test serializeConfigurationMethod with InboundEndpoint added for SynapseConfiguration
* and assert OMElement returned
*/
@Test
public void testSerializeConfiguration10() {
SynapseXMLConfigurationSerializer serializer = new SynapseXMLConfigurationSerializer();
SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
InboundEndpoint inboundEndpoint = new InboundEndpoint();
inboundEndpoint.setName("test_inbound_1");
inboundEndpoint.setProtocol("http");
synapseConfiguration.addInboundEndpoint(inboundEndpoint.getName(), inboundEndpoint);
OMElement element = serializer.serializeConfiguration(synapseConfiguration);
Assert.assertNotNull("OMElement is not returned", element);
Assert.assertEquals("definitions", element.getLocalName());
Assert.assertTrue("InboundEndpoint added is not serialized.", element.getChildren().next().toString().contains("name=\"test_inbound_1\""));
}
use of org.apache.synapse.config.SynapseConfiguration in project wso2-synapse by wso2.
the class SynapseXMLConfigurationSerializerTest method testSerializeConfiguration.
/**
* Test serializeConfigurationMethod and assert OMElement returned
*/
@Test
public void testSerializeConfiguration() {
SynapseXMLConfigurationSerializer serializer = new SynapseXMLConfigurationSerializer();
SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
synapseConfiguration.setDescription("testConfiguration");
OMElement element = serializer.serializeConfiguration(synapseConfiguration);
Assert.assertNotNull("OMElement is not returned", element);
Assert.assertEquals("definitions", element.getLocalName());
}
use of org.apache.synapse.config.SynapseConfiguration in project wso2-synapse by wso2.
the class SynapseXMLConfigurationSerializerTest method testSerializeConfiguration4.
/**
* Test serializeConfigurationMethod with proxyServices added for SynapseConfiguration and assert OMElement returned
*/
@Test
public void testSerializeConfiguration4() {
SynapseXMLConfigurationSerializer serializer = new SynapseXMLConfigurationSerializer();
SynapseConfiguration synapseConfiguration = new SynapseConfiguration();
ProxyService proxyService = new ProxyService("testProxyService");
synapseConfiguration.addProxyService(proxyService.getName(), proxyService);
OMElement element = serializer.serializeConfiguration(synapseConfiguration);
Assert.assertNotNull("OMElement is not returned", element);
Assert.assertEquals("definitions", element.getLocalName());
Assert.assertTrue("ProxyService added is not serialized.", element.getChildren().next().toString().contains("name=\"testProxyService\""));
}
Aggregations