Search in sources :

Example 31 with ConfigurationImpl

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);
}
Also used : OrderedExecutorFactory(org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) JournalStorageManager(org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager) Test(org.junit.Test)

Example 32 with ConfigurationImpl

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);
}
Also used : OrderedExecutorFactory(org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) JournalStorageManager(org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager) Test(org.junit.Test)

Example 33 with ConfigurationImpl

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);
}
Also used : HashMap(java.util.HashMap) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl)

Example 34 with ConfigurationImpl

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);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) ActiveMQJAASSecurityManager(org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) Role(org.apache.activemq.artemis.core.security.Role) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) ActiveMQSecurityManager(org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 35 with ConfigurationImpl

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);
}
Also used : AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ClientSessionFactory(org.apache.activemq.artemis.api.core.client.ClientSessionFactory) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) Before(org.junit.Before)

Aggregations

ConfigurationImpl (org.apache.activemq.artemis.core.config.impl.ConfigurationImpl)45 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)26 Configuration (org.apache.activemq.artemis.core.config.Configuration)21 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)13 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)12 Before (org.junit.Before)12 HashMap (java.util.HashMap)11 ActiveMQJAASSecurityManager (org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager)7 File (java.io.File)5 JMSConfigurationImpl (org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl)5 HashSet (java.util.HashSet)4 InVMConnectorFactory (org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory)4 ClusterConnectionConfiguration (org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration)3 CoreQueueConfiguration (org.apache.activemq.artemis.core.config.CoreQueueConfiguration)3 JournalStorageManager (org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager)3 Role (org.apache.activemq.artemis.core.security.Role)3 OrderedExecutorFactory (org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory)3 Test (org.junit.Test)3 Set (java.util.Set)2 ActiveMQDefaultConfiguration (org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration)2