use of org.apache.synapse.registry.SimpleInMemoryRegistry in project wso2-synapse by wso2.
the class SynapseXMLConfigurationSerializerTest method testSerializeConfiguration2.
/**
* Test serializeConfigurationMethod with registry set for SynapseConfiguration and assert OMElement returned
*/
@Test
public void testSerializeConfiguration2() {
SynapseXMLConfigurationSerializer serializer = new SynapseXMLConfigurationSerializer();
SynapseConfiguration synapseConfiguration = 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);
synapseConfiguration.setRegistry(registry);
OMElement element = serializer.serializeConfiguration(synapseConfiguration);
Assert.assertNotNull("OMElement is not returned", element);
Assert.assertEquals("definitions", element.getLocalName());
Assert.assertTrue("Registry added is not serialized.", element.getChildren().next().toString().contains("registry"));
}
use of org.apache.synapse.registry.SimpleInMemoryRegistry 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);
}
Aggregations