use of org.jboss.as.test.integration.management.util.MgmtOperationException in project wildfly by wildfly.
the class ExpressionSupportSmokeTestCase method readResource.
private ModelNode readResource(PathAddress address, boolean defaults, boolean failIfMissing) throws IOException, MgmtOperationException {
try {
ModelNode op = createOperation(READ_RESOURCE_OPERATION, address);
op.get(INCLUDE_DEFAULTS).set(defaults);
return executeForResult(op, domainMasterLifecycleUtil.getDomainClient());
} catch (MgmtOperationException e) {
if (failIfMissing) {
throw e;
}
return new ModelNode();
}
}
use of org.jboss.as.test.integration.management.util.MgmtOperationException 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);
}
use of org.jboss.as.test.integration.management.util.MgmtOperationException in project wildfly by wildfly.
the class WorkManagerThreadsCheckTestCase method testOneLongRunningThreadPool.
@Test
public void testOneLongRunningThreadPool() throws IOException {
ModelNode address = new ModelNode();
address.add("subsystem", "jca");
address.add("workmanager", "default");
address.add("long-running-threads", "Long");
ModelNode operation = new ModelNode();
operation.get(OP_ADDR).set(address);
operation.get(OP).set(ADD);
operation.get("max-threads").set(10);
operation.get("queue-length").set(10);
try {
executeOperation(operation);
Assert.fail("NOT HERE!");
} catch (MgmtOperationException e) {
String reason = e.getResult().get("failure-description").asString();
Assert.assertEquals("WFLYJCA0101: Thread pool: Long(type: long-running-threads) can not be added for workmanager: default, only one thread pool is allowed for each type.", reason);
}
}
use of org.jboss.as.test.integration.management.util.MgmtOperationException in project wildfly by wildfly.
the class WorkManagerThreadsCheckTestCase method testOneShortRunningThreadPool.
@Test
public void testOneShortRunningThreadPool() throws IOException {
ModelNode address = new ModelNode();
address.add("subsystem", "jca");
address.add("workmanager", "default");
address.add("short-running-threads", "Short");
ModelNode operation = new ModelNode();
operation.get(OP_ADDR).set(address);
operation.get(OP).set(ADD);
operation.get("max-threads").set(10);
operation.get("queue-length").set(10);
try {
executeOperation(operation);
Assert.fail("NOT HERE!");
} catch (MgmtOperationException e) {
String reason = e.getResult().get("failure-description").asString();
Assert.assertEquals("WFLYJCA0101: Thread pool: Short(type: short-running-threads) can not be added for workmanager: default, only one thread pool is allowed for each type.", reason);
}
}
use of org.jboss.as.test.integration.management.util.MgmtOperationException in project wildfly by wildfly.
the class CredentialReferenceDatasourceTestCase method removeDatasourceSilently.
private void removeDatasourceSilently(final Scenario scenario) throws IOException {
final ModelNode removeOperation = Operations.createRemoveOperation(scenario.getDatasourceAddress().toModelNode());
removeOperation.get(ModelDescriptionConstants.OPERATION_HEADERS).get("allow-resource-service-restart").set(true);
try {
execute(removeOperation);
} catch (MgmtOperationException moe) {
// ignore
}
}
Aggregations