|
18 | 18 | import org.mockito.Mock;
|
19 | 19 | import org.mockito.Mockito;
|
20 | 20 | import org.mockito.MockitoAnnotations;
|
| 21 | +import org.springframework.amqp.core.BindingBuilder; |
| 22 | +import org.springframework.amqp.core.Queue; |
| 23 | +import org.springframework.amqp.core.TopicExchange; |
| 24 | +import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; |
| 25 | +import org.springframework.amqp.rabbit.core.RabbitAdmin; |
21 | 26 |
|
22 | 27 | import com.ericsson.ei.handlers.MatchIdRulesHandler;
|
23 | 28 | import com.ericsson.ei.jmespath.JmesPathInterface;
|
@@ -167,6 +172,7 @@ public void testPublishandReceiveEvent() {
|
167 | 172 | Channel channel = conn.createChannel();
|
168 | 173 | String queueName = "er001-eiffelxxx.eiffelintelligence.messageConsumer.durable";
|
169 | 174 | String exchange = "ei-poc-4";
|
| 175 | + createExchange(exchange, queueName); |
170 | 176 | Consumer consumer = new DefaultConsumer(channel) {
|
171 | 177 | @Override
|
172 | 178 | public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties,
|
@@ -199,4 +205,15 @@ public static void tearDown() throws Exception {
|
199 | 205 |
|
200 | 206 | }
|
201 | 207 |
|
| 208 | + |
| 209 | + private void createExchange(final String exchangeName, final String queueName) { |
| 210 | + final CachingConnectionFactory ccf = new CachingConnectionFactory(cf); |
| 211 | + RabbitAdmin admin = new RabbitAdmin(ccf); |
| 212 | + Queue queue = new Queue(queueName, false); |
| 213 | + admin.declareQueue(queue); |
| 214 | + final TopicExchange exchange = new TopicExchange(exchangeName); |
| 215 | + admin.declareExchange(exchange); |
| 216 | + admin.declareBinding(BindingBuilder.bind(queue).to(exchange).with("#")); |
| 217 | + ccf.destroy(); |
| 218 | + } |
202 | 219 | }
|
0 commit comments