Skip to content

Commit e877e6b

Browse files
author
Vali (Vasile Baluta)
committed
add queue creation
1 parent bf29cc2 commit e877e6b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/test/java/com/ericsson/ei/waitlist/TestWaitListWorker.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
import org.mockito.Mock;
1919
import org.mockito.Mockito;
2020
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;
2126

2227
import com.ericsson.ei.handlers.MatchIdRulesHandler;
2328
import com.ericsson.ei.jmespath.JmesPathInterface;
@@ -167,6 +172,7 @@ public void testPublishandReceiveEvent() {
167172
Channel channel = conn.createChannel();
168173
String queueName = "er001-eiffelxxx.eiffelintelligence.messageConsumer.durable";
169174
String exchange = "ei-poc-4";
175+
createExchange(exchange, queueName);
170176
Consumer consumer = new DefaultConsumer(channel) {
171177
@Override
172178
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties,
@@ -199,4 +205,15 @@ public static void tearDown() throws Exception {
199205

200206
}
201207

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+
}
202219
}

0 commit comments

Comments
 (0)