use of org.apache.activemq.artemis.core.config.impl.ConfigurationImpl in project activemq-artemis by apache.
the class JournalFileSizeTest method testIncorrectFileSizeHalf.
@Test
public void testIncorrectFileSizeHalf() {
ConfigurationImpl config = new ConfigurationImpl();
int origFileSize = config.getJournalFileSize();
config.setJournalFileSize(origFileSize + (align / 2));
JournalStorageManager manager = new JournalStorageManager(config, EmptyCriticalAnalyzer.getInstance(), new OrderedExecutorFactory(null), new OrderedExecutorFactory(null));
int fileSize = manager.getMessageJournal().getFileSize();
Assert.assertEquals(origFileSize + align, fileSize);
}
use of org.apache.activemq.artemis.core.config.impl.ConfigurationImpl in project activemq-artemis by apache.
the class JournalFileSizeTest method testIncorrectFileSizeLower.
@Test
public void testIncorrectFileSizeLower() {
ConfigurationImpl config = new ConfigurationImpl();
int origFileSize = config.getJournalFileSize();
config.setJournalFileSize(origFileSize + (align / 2 - 1));
JournalStorageManager manager = new JournalStorageManager(config, EmptyCriticalAnalyzer.getInstance(), new OrderedExecutorFactory(null), new OrderedExecutorFactory(null));
int fileSize = manager.getMessageJournal().getFileSize();
Assert.assertEquals(origFileSize, fileSize);
}
use of org.apache.activemq.artemis.core.config.impl.ConfigurationImpl in project activemq-artemis by apache.
the class CoreClientOverOneWaySSLTest method createCustomSslServer.
private void createCustomSslServer(String cipherSuites, String protocols, boolean useVerifiedKeystore) throws Exception {
Map<String, Object> params = new HashMap<>();
params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
params.put(TransportConstants.KEYSTORE_PROVIDER_PROP_NAME, storeType);
if (useVerifiedKeystore) {
params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, "verified-" + SERVER_SIDE_KEYSTORE);
} else {
params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, SERVER_SIDE_KEYSTORE);
}
params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, PASSWORD);
params.put(TransportConstants.HOST_PROP_NAME, "localhost");
if (cipherSuites != null) {
params.put(TransportConstants.ENABLED_CIPHER_SUITES_PROP_NAME, cipherSuites);
}
if (protocols != null) {
params.put(TransportConstants.ENABLED_PROTOCOLS_PROP_NAME, protocols);
}
ConfigurationImpl config = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params, "nettySSL"));
server = createServer(false, config);
server.start();
waitForServerToStart(server);
tc = new TransportConfiguration(NETTY_CONNECTOR_FACTORY);
}
use of org.apache.activemq.artemis.core.config.impl.ConfigurationImpl in project activemq-artemis by apache.
the class DualAuthenticationTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
Map<String, Object> params = new HashMap<>();
params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true);
params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, SERVER_SIDE_KEYSTORE);
params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, PASSWORD);
params.put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, SERVER_SIDE_TRUSTSTORE);
params.put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, PASSWORD);
params.put(TransportConstants.NEED_CLIENT_AUTH_PROP_NAME, true);
params.put(TransportConstants.PORT_PROP_NAME, "61617");
ConfigurationImpl config = createBasicConfig();
config.addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params));
config.addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY));
config.setSecurityEnabled(true);
ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager("DualAuthenticationPropertiesLogin", "DualAuthenticationCertLogin");
server = addServer(ActiveMQServers.newActiveMQServer(config, ManagementFactory.getPlatformMBeanServer(), securityManager, false));
HierarchicalRepository<Set<Role>> securityRepository = server.getSecurityRepository();
Role sendRole = new Role("producers", true, false, true, false, true, false, false, false, false, false);
Role receiveRole = new Role("consumers", false, true, false, false, false, false, false, false, false, false);
Set<Role> roles = new HashSet<>();
roles.add(sendRole);
roles.add(receiveRole);
securityRepository.addMatch(DualAuthenticationTest.QUEUE.toString(), roles);
server.start();
waitForServerToStart(server);
tc = new TransportConfiguration(NETTY_CONNECTOR_FACTORY);
}
use of org.apache.activemq.artemis.core.config.impl.ConfigurationImpl in project activemq-artemis by apache.
the class ExpiryRunnerTest method setUp.
//
// public static void main(final String[] args) throws Exception
// {
// for (int i = 0; i < 1000; i++)
// {
// TestSuite suite = new TestSuite();
// ExpiryRunnerTest expiryRunnerTest = new ExpiryRunnerTest();
// expiryRunnerTest.setName("testExpireWhilstConsuming");
// suite.addTest(expiryRunnerTest);
//
// TestResult result = TestRunner.run(suite);
// if (result.errorCount() > 0 || result.failureCount() > 0)
// {
// System.exit(1);
// }
// }
// }
@Override
@Before
public void setUp() throws Exception {
super.setUp();
ConfigurationImpl configuration = (ConfigurationImpl) createDefaultInVMConfig().setMessageExpiryScanPeriod(1000);
server = addServer(ActiveMQServers.newActiveMQServer(configuration, false));
// start the server
server.start();
// then we create a client as normal
locator = createInVMNonHALocator().setBlockOnAcknowledge(true);
ClientSessionFactory sessionFactory = createSessionFactory(locator);
clientSession = sessionFactory.createSession(false, true, true);
clientSession.createQueue(qName, RoutingType.MULTICAST, qName, null, false);
expiryAddress = new SimpleString("EA");
expiryQueue = new SimpleString("expiryQ");
AddressSettings addressSettings = new AddressSettings().setExpiryAddress(expiryAddress);
server.getAddressSettingsRepository().addMatch(qName.toString(), addressSettings);
server.getAddressSettingsRepository().addMatch(qName2.toString(), addressSettings);
clientSession.createQueue(expiryAddress, RoutingType.MULTICAST, expiryQueue, null, false);
}
Aggregations