/** Test that the broker starts up and sets SERVICE_UP correctly. */ @Test(groups = {"Integration", "WIP"}) public void canStartupAndShutdown() throws Exception { rabbit = app.createAndManageChild(EntitySpec.create(RabbitBroker.class)); rabbit.start(ImmutableList.of(testLocation)); EntityTestUtils.assertAttributeEqualsEventually(rabbit, Startable.SERVICE_UP, true); rabbit.stop(); assertFalse(rabbit.getAttribute(Startable.SERVICE_UP)); }
private Channel getAmqpChannel(RabbitBroker rabbit) throws Exception { String uri = rabbit.getAttribute(MessageBroker.BROKER_URL); log.warn("connecting to rabbit {}", uri); ConnectionFactory factory = new ConnectionFactory(); factory.setUri(uri); Connection conn = factory.newConnection(); Channel channel = conn.createChannel(); return channel; }