|
28 | 28 | import org.apache.synapse.config.xml.inbound.InboundEndpointSerializer; |
29 | 29 | import org.apache.synapse.inbound.InboundEndpoint; |
30 | 30 |
|
| 31 | +import java.util.Properties; |
| 32 | + |
31 | 33 | /** |
32 | 34 | * Testing InboundEndpoint related operations |
33 | 35 | */ |
@@ -73,6 +75,30 @@ public class InboundEndpointTestCase extends TestCase { |
73 | 75 | + "<sequence xmlns=\"http://ws.apache.org/ns/synapse\" name=\"receiveSeq\">\n" + " <send/>\n" |
74 | 76 | + "</sequence>"; |
75 | 77 |
|
| 78 | + private static final String rabbitMQInbound = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + |
| 79 | + "<inboundEndpoint name=\"RabbitMQInbound\" sequence=\"RabbitMQInbound-inboundSequence\" onError=\"RabbitMQInbound-inboundErrorSequence\" suspend=\"false\" protocol=\"rabbitmq\">\n" + |
| 80 | + " <parameters xmlns=\"http://ws.apache.org/ns/synapse\">\n" + |
| 81 | + " <parameter name=\"rabbitmq.connection.factory\">QueueConnectionFactory</parameter>\n" + |
| 82 | + " <parameter name=\"rabbitmq.server.host.name\">localhost</parameter>\n" + |
| 83 | + " <parameter name=\"rabbitmq.server.port\">5672</parameter>\n" + |
| 84 | + " <parameter name=\"rabbitmq.server.user.name\">guest</parameter>\n" + |
| 85 | + " <parameter name=\"rabbitmq.server.password\">guest</parameter>\n" + |
| 86 | + " <parameter name=\"rabbitmq.queue.name\">queue_transaction</parameter>\n" + |
| 87 | + " <parameter name=\"sequential\">true</parameter>\n" + |
| 88 | + " <parameter name=\"coordination\">true</parameter>\n" + |
| 89 | + " <parameter name=\"rabbitmq.queue.durable\">false</parameter>\n" + |
| 90 | + " <parameter name=\"rabbitmq.queue.exclusive\">false</parameter>\n" + |
| 91 | + " <parameter name=\"rabbitmq.queue.auto.delete\">false</parameter>\n" + |
| 92 | + " <parameter name=\"rabbitmq.queue.auto.ack\">false</parameter>\n" + |
| 93 | + " <parameter name=\"rabbitmq.queue.autodeclare\">false</parameter>\n" + |
| 94 | + " <parameter name=\"rabbitmq.exchange.durable\">false</parameter>\n" + |
| 95 | + " <parameter name=\"rabbitmq.exchange.auto.delete\">false</parameter>\n" + |
| 96 | + " <parameter name=\"rabbitmq.exchange.autodeclare\">false</parameter>\n" + |
| 97 | + " <parameter name=\"rabbitmq.connection.ssl.enabled\">false</parameter>\n" + |
| 98 | + " <parameter name=\"rabbitmq.channel.consumer.qos\">0</parameter>\n" + |
| 99 | + " </parameters>\n" + |
| 100 | + "</inboundEndpoint>"; |
| 101 | + |
76 | 102 | public void testCreateValidInboundEP() throws Exception { |
77 | 103 | ep = factory.createInboundEndpoint(AXIOMUtil.stringToOM(sampleEP), config); |
78 | 104 | Assert.assertNotNull("Inbound Endpoint is null", ep); |
@@ -110,4 +136,28 @@ public void testCreateInvalidInboundEP() throws Exception { |
110 | 136 | Assert.assertEquals(e.getMessage().contains("Inbound Endpoint name cannot be null"), true); |
111 | 137 | } |
112 | 138 | } |
| 139 | + |
| 140 | + public void testInboundEPWithVersionedDeployment() throws Exception { |
| 141 | + |
| 142 | + Properties properties = new Properties(); |
| 143 | + properties.put("synapse.artifact.versioned.deployment", true); |
| 144 | + properties.put("synapse.artifact.identifier", "com.microintegrator.projects__beta1__1.0.2"); |
| 145 | + |
| 146 | + ep = factory.createInboundEndpoint(AXIOMUtil.stringToOM(rabbitMQInbound), config, properties); |
| 147 | + Assert.assertEquals("RabbitMQInbound", ep.getName()); |
| 148 | + Assert.assertEquals("com.microintegrator.projects__beta1__1.0.2__RabbitMQInbound-inboundSequence", ep.getInjectingSeq()); |
| 149 | + Assert.assertEquals("com.microintegrator.projects__beta1__1.0.2__RabbitMQInbound-inboundErrorSequence", ep.getOnErrorSeq()); |
| 150 | + } |
| 151 | + |
| 152 | + public void testInboundEPWithNonVersionedDeployment() throws Exception { |
| 153 | + |
| 154 | + Properties properties = new Properties(); |
| 155 | + properties.put("synapse.artifact.versioned.deployment", false); |
| 156 | + properties.put("synapse.artifact.identifier", "com.microintegrator.projects__beta1__1.0.2"); |
| 157 | + |
| 158 | + ep = factory.createInboundEndpoint(AXIOMUtil.stringToOM(rabbitMQInbound), config, properties); |
| 159 | + Assert.assertEquals("RabbitMQInbound", ep.getName()); |
| 160 | + Assert.assertEquals("RabbitMQInbound-inboundSequence", ep.getInjectingSeq()); |
| 161 | + Assert.assertEquals("RabbitMQInbound-inboundErrorSequence", ep.getOnErrorSeq()); |
| 162 | + } |
113 | 163 | } |
0 commit comments