use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class SessionFactoryTest method startServer.
private void startServer() throws Exception {
liveTC = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
final long broadcastPeriod = 250;
final String bcGroupName = "bc1";
final int localBindPort = 5432;
BroadcastGroupConfiguration broadcastGroupConfiguration = new BroadcastGroupConfiguration().setName(bcGroupName).setBroadcastPeriod(broadcastPeriod).setConnectorInfos(Arrays.asList(liveTC.getName())).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(getUDPDiscoveryAddress()).setGroupPort(getUDPDiscoveryPort()).setLocalBindPort(localBindPort));
Configuration liveConf = createDefaultInVMConfig().addConnectorConfiguration(liveTC.getName(), liveTC).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()).addBroadcastGroupConfiguration(broadcastGroupConfiguration);
liveService = createServer(false, liveConf);
liveService.start();
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class RedeliveryConsumerTest method setUp.
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
/**
* @param persistDeliveryCountBeforeDelivery
* @throws Exception
*/
private void setUp(final boolean persistDeliveryCountBeforeDelivery) throws Exception {
Configuration config = createDefaultInVMConfig().setPersistDeliveryCountBeforeDelivery(persistDeliveryCountBeforeDelivery);
server = createServer(true, config);
server.start();
locator = createInVMNonHALocator();
factory = createSessionFactory(locator);
ClientSession session = addClientSession(factory.createSession(false, false, false));
try {
session.createQueue(ADDRESS, ADDRESS, true);
} catch (ActiveMQException expected) {
// in case of restart
}
session.close();
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class SendAckFailTest method startServer.
public ActiveMQServer startServer(boolean fail) {
try {
// ActiveMQServerImpl server = (ActiveMQServerImpl) createServer(true, true);
AtomicInteger count = new AtomicInteger(0);
ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
Configuration configuration = createDefaultConfig(true);
ActiveMQServer server = new ActiveMQServerImpl(configuration, ManagementFactory.getPlatformMBeanServer(), securityManager) {
@Override
public StorageManager createStorageManager() {
StorageManager original = super.createStorageManager();
return new StorageManagerDelegate(original) {
@Override
public void storeMessage(Message message) throws Exception {
if (fail) {
if (count.incrementAndGet() == 110) {
System.out.println("Failing " + message);
System.out.flush();
Thread.sleep(100);
Runtime.getRuntime().halt(-1);
}
}
super.storeMessage(message);
}
};
}
};
System.out.println("Location::" + server.getConfiguration().getJournalLocation().getAbsolutePath());
server.start();
return server;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class ServerLocatorConnectTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
Configuration configuration = createDefaultConfig(isNetty());
server = createServer(false, configuration);
server.start();
}
use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.
the class WildCardRoutingTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
Configuration configuration = createDefaultInVMConfig().setWildcardRoutingEnabled(true).setTransactionTimeoutScanPeriod(500);
server = addServer(ActiveMQServers.newActiveMQServer(configuration, false));
server.start();
server.getManagementService().enableNotifications(false);
locator = createInVMNonHALocator();
sf = createSessionFactory(locator);
clientSession = addClientSession(sf.createSession(false, true, true));
}
Aggregations