use of org.apache.activemq.broker.BrokerService in project camel by apache.
the class PahoComponentTest method doPreSetup.
@Override
public void doPreSetup() throws Exception {
super.doPreSetup();
broker = new BrokerService();
broker.setPersistent(false);
broker.addConnector("mqtt://localhost:" + mqttPort);
broker.start();
}
use of org.apache.activemq.broker.BrokerService in project camel by apache.
the class JmsTestSupport method doPreSetup.
/**
* Set up the Broker
*
* @see org.apache.camel.test.junit4.CamelTestSupport#doPreSetup()
*
* @throws Exception
*/
@Override
protected void doPreSetup() throws Exception {
deleteDirectory("target/activemq-data");
broker = new BrokerService();
int port = AvailablePortFinder.getNextAvailable(33333);
brokerUri = "tcp://localhost:" + port;
broker.getManagementContext().setConnectorPort(AvailablePortFinder.getNextAvailable(port + 1));
configureBroker(broker);
startBroker();
}
use of org.apache.activemq.broker.BrokerService in project camel by apache.
the class SjmsConnectionTestSupport method createBroker.
protected void createBroker() throws Exception {
String connectString = getConnectionUri();
if (ObjectHelper.isEmpty(connectString)) {
connectString = TCP_BROKER_CONNECT_STRING;
}
brokerService = new BrokerService();
brokerService.setPersistent(isPersistenceEnabled());
brokerService.addConnector(connectString);
brokerService.start();
brokerService.waitUntilStarted();
}
use of org.apache.activemq.broker.BrokerService in project camel by apache.
the class MQTTDuplicatesTest method testMqttDuplicatesAfterBrokerRestartWithoutClientID.
@Test
public void testMqttDuplicatesAfterBrokerRestartWithoutClientID() throws Exception {
brokerService.stop();
brokerService.waitUntilStopped();
LOG.info(">>>>>>>>>> Restarting broker...");
brokerService = new BrokerService();
brokerService.setPersistent(false);
brokerService.setAdvisorySupport(false);
brokerService.addConnector(MQTTTestSupport.getConnection() + "?trace=true");
brokerService.start();
brokerService.waitUntilStarted();
LOG.info(">>>>>>>>>> Broker restarted");
for (int i = 0; i < MESSAGE_COUNT; i++) {
String body = System.currentTimeMillis() + ": Dummy-restart-without-clientID! " + i;
templateWithoutClientID.asyncSendBody("direct:withoutClientID", body);
Thread.sleep(WAIT_MILLIS);
}
assertNoDuplicates();
}
use of org.apache.activemq.broker.BrokerService in project beam by apache.
the class JmsIOTest method startBroker.
@Before
public void startBroker() throws Exception {
broker = new BrokerService();
broker.setUseJmx(false);
broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
broker.addConnector(BROKER_URL);
broker.setBrokerName("localhost");
broker.setPopulateJMSXUserID(true);
broker.setUseAuthenticatedPrincipalForJMSXUserID(true);
// enable authentication
List<AuthenticationUser> users = new ArrayList<>();
// username and password to use to connect to the broker.
// This user has users privilege (able to browse, consume, produce, list destinations)
users.add(new AuthenticationUser(USERNAME, PASSWORD, "users"));
SimpleAuthenticationPlugin plugin = new SimpleAuthenticationPlugin(users);
BrokerPlugin[] plugins = new BrokerPlugin[] { plugin };
broker.setPlugins(plugins);
broker.start();
// create JMS connection factory
connectionFactory = new ActiveMQConnectionFactory(BROKER_URL);
connectionFactoryWithoutPrefetch = new ActiveMQConnectionFactory(BROKER_URL + "?jms.prefetchPolicy.all=0");
}
Aggregations