Search in sources :

Example 1 with JMSOperations

use of org.jboss.as.test.integration.common.jms.JMSOperations in project wildfly by wildfly.

the class ConnectionFactoryManagementTestCase method testWriteDiscoveryGroupAttributeWhenConnectorIsAlreadyDefined.

@Test
public void testWriteDiscoveryGroupAttributeWhenConnectorIsAlreadyDefined() throws Exception {
    JMSOperations jmsOperations = JMSOperationsProvider.getInstance(managementClient.getControllerClient());
    ModelNode attributes = new ModelNode();
    attributes.get(CommonAttributes.CONNECTORS).add("in-vm");
    jmsOperations.addJmsConnectionFactory(CF_NAME, "java:/jms/" + CF_NAME, attributes);
    final ModelNode writeAttribute = new ModelNode();
    writeAttribute.get(OP).set(WRITE_ATTRIBUTE_OPERATION);
    writeAttribute.get(OP_ADDR).set(jmsOperations.getServerAddress().add("connection-factory", CF_NAME));
    writeAttribute.get(NAME).set(CommonAttributes.DISCOVERY_GROUP);
    writeAttribute.get(VALUE).set(randomUUID().toString());
    try {
        executeOperation(writeAttribute);
        fail("it is not possible to define a discovery group when the connector attribute is already defined");
    } catch (MgmtOperationException e) {
        assertEquals(FAILED, e.getResult().get(OUTCOME).asString());
        assertEquals(true, e.getResult().get(ROLLED_BACK).asBoolean());
        assertTrue(e.getResult().get(FAILURE_DESCRIPTION).asString().contains("WFLYCTL0105"));
    }
    jmsOperations.removeJmsConnectionFactory(CF_NAME);
}
Also used : JMSOperations(org.jboss.as.test.integration.common.jms.JMSOperations) ModelNode(org.jboss.dmr.ModelNode) MgmtOperationException(org.jboss.as.test.integration.management.util.MgmtOperationException) Test(org.junit.Test)

Example 2 with JMSOperations

use of org.jboss.as.test.integration.common.jms.JMSOperations in project wildfly by wildfly.

the class ExportImportJournalTestCase method tearDown.

@After
public void tearDown() {
    JMSOperations jmsOperations = JMSOperationsProvider.getInstance(managementClient.getControllerClient());
    jmsOperations.removeJmsQueue(jmsQueueName);
    jmsOperations.close();
}
Also used : JMSOperations(org.jboss.as.test.integration.common.jms.JMSOperations) After(org.junit.After)

Example 3 with JMSOperations

use of org.jboss.as.test.integration.common.jms.JMSOperations in project wildfly by wildfly.

the class ClusteredMessagingTestCase method setUp.

@Before
public void setUp() throws Exception {
    container.start(CONTAINER_0);
    container.start(CONTAINER_1);
    // both servers are started and configured
    assertTrue(container.isStarted(CONTAINER_0));
    assertTrue(container.isStarted(CONTAINER_1));
    try (ModelControllerClient client = createClient1()) {
        JMSOperations jmsOperations = JMSOperationsProvider.getInstance(client);
        jmsOperations.createJmsQueue(jmsQueueName, "java:jboss/exported/" + jmsQueueLookup);
        jmsOperations.createJmsTopic(jmsTopicName, "java:jboss/exported/" + jmsTopicLookup);
    }
    try (ModelControllerClient client = createClient2()) {
        JMSOperations jmsOperations = JMSOperationsProvider.getInstance(client);
        jmsOperations.createJmsQueue(jmsQueueName, "java:jboss/exported/" + jmsQueueLookup);
        jmsOperations.createJmsTopic(jmsTopicName, "java:jboss/exported/" + jmsTopicLookup);
    }
}
Also used : ModelControllerClient(org.jboss.as.controller.client.ModelControllerClient) JMSOperations(org.jboss.as.test.integration.common.jms.JMSOperations) Before(org.junit.Before)

Example 4 with JMSOperations

use of org.jboss.as.test.integration.common.jms.JMSOperations in project wildfly by wildfly.

the class LegacyJMSTestCase method tearDown.

@After
public void tearDown() throws IOException {
    JMSOperations jmsOperations = JMSOperationsProvider.getInstance(managementClient.getControllerClient());
    jmsOperations.removeJmsQueue(QUEUE_NAME);
    jmsOperations.removeJmsTopic(TOPIC_NAME);
    ModelNode legacyConnectionFactoryAddress = jmsOperations.getServerAddress().clone().add("legacy-connection-factory", CF_NAME);
    ModelNode addLegacyConnectionFactoryOp = Util.createOperation(REMOVE, PathAddress.pathAddress(legacyConnectionFactoryAddress));
    managementClient.getControllerClient().execute(addLegacyConnectionFactoryOp);
}
Also used : JMSOperations(org.jboss.as.test.integration.common.jms.JMSOperations) ModelNode(org.jboss.dmr.ModelNode) After(org.junit.After)

Example 5 with JMSOperations

use of org.jboss.as.test.integration.common.jms.JMSOperations in project wildfly by wildfly.

the class LegacyJMSTestCase method setUp.

@Before
public void setUp() throws IOException {
    JMSOperations jmsOperations = JMSOperationsProvider.getInstance(managementClient.getControllerClient());
    ModelNode queueAttributes = new ModelNode();
    queueAttributes.get("legacy-entries").add(LEGACY_QUEUE_ENTRY);
    jmsOperations.createJmsQueue(QUEUE_NAME, QUEUE_ENTRY, queueAttributes);
    ModelNode topicAttributes = new ModelNode();
    topicAttributes.get("legacy-entries").add(LEGACY_TOPIC_ENTRY);
    jmsOperations.createJmsTopic(TOPIC_NAME, TOPIC_ENTRY, topicAttributes);
    ModelNode legacyConnectionFactoryAddress = jmsOperations.getServerAddress().clone().add("legacy-connection-factory", CF_NAME);
    ModelNode addLegacyConnectionFactoryOp = Util.createOperation(ModelDescriptionConstants.ADD, PathAddress.pathAddress(legacyConnectionFactoryAddress));
    addLegacyConnectionFactoryOp.get("connectors").add("http-connector");
    addLegacyConnectionFactoryOp.get("entries").add(LEGACY_CF_ENTRY);
    managementClient.getControllerClient().execute(addLegacyConnectionFactoryOp);
}
Also used : JMSOperations(org.jboss.as.test.integration.common.jms.JMSOperations) ModelNode(org.jboss.dmr.ModelNode) Before(org.junit.Before)

Aggregations

JMSOperations (org.jboss.as.test.integration.common.jms.JMSOperations)15 ModelNode (org.jboss.dmr.ModelNode)7 ModelControllerClient (org.jboss.as.controller.client.ModelControllerClient)4 After (org.junit.After)4 Before (org.junit.Before)4 Test (org.junit.Test)3 InitialContext (javax.naming.InitialContext)2 MgmtOperationException (org.jboss.as.test.integration.management.util.MgmtOperationException)1