Search in sources :

Example 71 with Configuration

use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.

the class ConnectionFactoryWithJGroupsSerializationTest method testCopyConfiguration.

@Test
public void testCopyConfiguration() throws Exception {
    Assert.assertEquals(2, jmsServer.getActiveMQServer().getConfiguration().getDiscoveryGroupConfigurations().size());
    Configuration copiedconfig = jmsServer.getActiveMQServer().getConfiguration().copy();
    Assert.assertEquals(2, copiedconfig.getDiscoveryGroupConfigurations().size());
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) Test(org.junit.Test)

Example 72 with Configuration

use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.

the class AcceptorControlTest method testStartStop.

@Test
public void testStartStop() throws Exception {
    TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), new HashMap<String, Object>(), RandomUtil.randomString());
    Configuration config = createBasicConfig().addAcceptorConfiguration(acceptorConfig);
    ActiveMQServer service = createServer(false, config);
    service.setMBeanServer(mbeanServer);
    service.start();
    AcceptorControl acceptorControl = createManagementControl(acceptorConfig.getName());
    // started by the server
    Assert.assertTrue(acceptorControl.isStarted());
    ServerLocator locator = createInVMNonHALocator();
    ClientSessionFactory sf = createSessionFactory(locator);
    ClientSession session = sf.createSession(false, true, true);
    Assert.assertNotNull(session);
    session.close();
    acceptorControl.stop();
    Assert.assertFalse(acceptorControl.isStarted());
    try {
        sf.createSession(false, true, true);
        Assert.fail("acceptor must not accept connections when stopped accepting");
    } catch (ActiveMQException e) {
    }
    acceptorControl.start();
    Assert.assertTrue(acceptorControl.isStarted());
    locator = createInVMNonHALocator();
    sf = createSessionFactory(locator);
    session = sf.createSession(false, true, true);
    Assert.assertNotNull(session);
    session.close();
    acceptorControl.stop();
    Assert.assertFalse(acceptorControl.isStarted());
    try {
        sf.createSession(false, true, true);
        Assert.fail("acceptor must not accept connections when stopped accepting");
    } catch (ActiveMQException e) {
    }
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) Configuration(org.apache.activemq.artemis.core.config.Configuration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) AcceptorControl(org.apache.activemq.artemis.api.core.management.AcceptorControl) ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ClientSessionFactory(org.apache.activemq.artemis.api.core.client.ClientSessionFactory) InVMAcceptorFactory(org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory) ServerLocator(org.apache.activemq.artemis.api.core.client.ServerLocator) Test(org.junit.Test)

Example 73 with Configuration

use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.

the class JMSServerConfigParserTest method testParsing.

// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
// Public --------------------------------------------------------
@Test
public void testParsing() throws Exception {
    Configuration config = createDefaultInVMConfig().addConnectorConfiguration("netty", new TransportConfiguration());
    String conf = "activemq-jms-for-JMSServerDeployerTest.xml";
    FileJMSConfiguration jmsconfig = new FileJMSConfiguration();
    FileDeploymentManager deploymentManager = new FileDeploymentManager(conf);
    deploymentManager.addDeployable(jmsconfig);
    deploymentManager.readConfiguration();
    assertEquals(1, jmsconfig.getQueueConfigurations().size());
    JMSQueueConfiguration queueConfig = jmsconfig.getQueueConfigurations().get(0);
    assertEquals("fullConfigurationQueue", queueConfig.getName());
    assertEquals(1, jmsconfig.getTopicConfigurations().size());
    TopicConfiguration topicConfig = jmsconfig.getTopicConfigurations().get(0);
    assertEquals("fullConfigurationTopic", topicConfig.getName());
}
Also used : JMSQueueConfiguration(org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration) Configuration(org.apache.activemq.artemis.core.config.Configuration) JMSQueueConfiguration(org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration) TopicConfiguration(org.apache.activemq.artemis.jms.server.config.TopicConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) FileJMSConfiguration(org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration) FileJMSConfiguration(org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) TopicConfiguration(org.apache.activemq.artemis.jms.server.config.TopicConfiguration) FileDeploymentManager(org.apache.activemq.artemis.core.config.FileDeploymentManager) Test(org.junit.Test)

Example 74 with Configuration

use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.

the class BroadcastGroupControlTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    TransportConfiguration connectorConfiguration = new TransportConfiguration(NETTY_CONNECTOR_FACTORY);
    List<String> connectorInfos = new ArrayList<>();
    connectorInfos.add(connectorConfiguration.getName());
    broadcastGroupConfig = new BroadcastGroupConfiguration().setName(RandomUtil.randomString()).setBroadcastPeriod(RandomUtil.randomPositiveInt()).setConnectorInfos(connectorInfos).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(getUDPDiscoveryAddress()).setGroupPort(getUDPDiscoveryPort()).setLocalBindPort(1198));
    Configuration config = createDefaultInVMConfig().setJMXManagementEnabled(true).addConnectorConfiguration(connectorConfiguration.getName(), connectorConfiguration).addBroadcastGroupConfiguration(broadcastGroupConfig);
    server = addServer(ActiveMQServers.newActiveMQServer(config, mbeanServer, false));
    server.start();
    broadcastGroupControl = createManagementControl(broadcastGroupConfig.getName());
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ArrayList(java.util.ArrayList) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) UDPBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory) Before(org.junit.Before)

Example 75 with Configuration

use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.

the class RelativePathTest method testRelativePathOnDefaultConfig.

@Test
public void testRelativePathOnDefaultConfig() throws Exception {
    Configuration configuration = createDefaultConfig(false);
    ActiveMQServer server = createServer(true, configuration, AddressSettings.DEFAULT_PAGE_SIZE, AddressSettings.DEFAULT_MAX_SIZE_BYTES, new HashMap<String, AddressSettings>());
    server.start();
    server.stop();
    checkData(new File(configuration.getJournalDirectory()), ".amq");
    checkData(new File(configuration.getBindingsDirectory()), ".bindings");
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) Configuration(org.apache.activemq.artemis.core.config.Configuration) File(java.io.File) Test(org.junit.Test)

Aggregations

Configuration (org.apache.activemq.artemis.core.config.Configuration)331 Test (org.junit.Test)143 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)120 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)109 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)108 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)101 ClientProducer (org.apache.activemq.artemis.api.core.client.ClientProducer)93 ClientMessage (org.apache.activemq.artemis.api.core.client.ClientMessage)90 ClientConsumer (org.apache.activemq.artemis.api.core.client.ClientConsumer)81 ClientSessionFactory (org.apache.activemq.artemis.api.core.client.ClientSessionFactory)78 StoreConfiguration (org.apache.activemq.artemis.core.config.StoreConfiguration)78 DivertConfiguration (org.apache.activemq.artemis.core.config.DivertConfiguration)72 Before (org.junit.Before)59 ServerLocator (org.apache.activemq.artemis.api.core.client.ServerLocator)58 DatabaseStorageConfiguration (org.apache.activemq.artemis.core.config.storage.DatabaseStorageConfiguration)57 HashMap (java.util.HashMap)56 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)52 ActiveMQDefaultConfiguration (org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration)35 SharedStoreMasterPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)35 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)34