use of org.jboss.as.test.integration.management.util.MgmtOperationException in project wildfly by wildfly.
the class CredentialReferenceDatasourceTestCase method removeXADatasourceSilently.
private void removeXADatasourceSilently(final Scenario scenario) throws IOException {
final ModelNode removeOperation = Operations.createRemoveOperation(scenario.getXADatasourceAddress().toModelNode());
removeOperation.get(ModelDescriptionConstants.OPERATION_HEADERS).get("allow-resource-service-restart").set(true);
try {
execute(removeOperation);
} catch (MgmtOperationException moe) {
// ignore
}
}
use of org.jboss.as.test.integration.management.util.MgmtOperationException in project wildfly by wildfly.
the class DomainHostExcludesTest method awaitServerLaunch.
private void awaitServerLaunch(ModelControllerClient client, PathAddress serverAddr) throws InterruptedException {
long timeout = TimeoutUtil.adjust(20000);
long expired = System.currentTimeMillis() + timeout;
ModelNode op = Util.getReadAttributeOperation(serverAddr, "server-state");
do {
try {
ModelNode state = DomainTestUtils.executeForResult(op, client);
if ("running".equalsIgnoreCase(state.asString())) {
return;
}
} catch (IOException | MgmtOperationException e) {
// ignore and try again
}
TimeUnit.MILLISECONDS.sleep(250L);
} while (System.currentTimeMillis() < expired);
Assert.fail("Server did not start in " + timeout + " ms");
}
use of org.jboss.as.test.integration.management.util.MgmtOperationException in project wildfly by wildfly.
the class AbstractModuleDeploymentTestCaseSetup method remove.
protected void remove(final ModelNode address, final ManagementClient managementClient) throws IOException, MgmtOperationException {
final ModelNode operation = new ModelNode();
operation.get(OP).set("remove");
operation.get(OP_ADDR).set(address);
final ModelNode result = managementClient.getControllerClient().execute(operation);
if (!SUCCESS.equals(result.get(OUTCOME).asString())) {
throw new MgmtOperationException("Module removal failed: " + result.get(FAILURE_DESCRIPTION), operation, result);
}
final ModelNode responseHeaders = result.get(RESPONSE_HEADERS);
if (responseHeaders.hasDefined(PROCESS_STATE) && ControlledProcessState.State.RELOAD_REQUIRED.toString().equals(responseHeaders.get(PROCESS_STATE).asString())) {
this.reloadRequired = true;
}
}
use of org.jboss.as.test.integration.management.util.MgmtOperationException in project wildfly by wildfly.
the class MixedDomainTestSupport method startSlaveServer.
private void startSlaveServer() {
DomainClient client = getDomainMasterLifecycleUtil().getDomainClient();
PathElement hostElement = PathElement.pathElement("host", "slave");
try {
PathAddress pa = PathAddress.pathAddress(hostElement, PathElement.pathElement("server-config", "server-one"));
DomainTestUtils.executeForResult(Util.getUndefineAttributeOperation(pa, "auto-start"), client);
DomainTestUtils.executeForResult(Util.createEmptyOperation("start", pa), client);
} catch (IOException | MgmtOperationException e) {
throw new RuntimeException(e);
}
long timeout = TimeoutUtil.adjust(20000);
long expired = System.currentTimeMillis() + timeout;
ModelNode op = Util.getReadAttributeOperation(PathAddress.pathAddress(hostElement, PathElement.pathElement("server", "server-one")), "server-state");
do {
try {
ModelNode state = DomainTestUtils.executeForResult(op, client);
if ("running".equalsIgnoreCase(state.asString())) {
return;
}
} catch (IOException | MgmtOperationException e) {
// ignore and try again
}
try {
TimeUnit.MILLISECONDS.sleep(250L);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
Assert.fail();
}
} while (System.currentTimeMillis() < expired);
Assert.fail("Slave server-one did not start within " + timeout + " ms");
}
use of org.jboss.as.test.integration.management.util.MgmtOperationException in project wildfly by wildfly.
the class LegacyConfigTest method cleanTestServer.
private void cleanTestServer(ModelControllerClient client) {
try {
ModelNode op = Util.createEmptyOperation("stop", TEST_SERVER_CONFIG);
op.get("blocking").set(true);
DomainTestUtils.executeForResult(op, client);
} catch (MgmtOperationException | IOException e) {
e.printStackTrace();
} finally {
try {
DomainTestUtils.executeForResult(Util.createRemoveOperation(TEST_SERVER_CONFIG), client);
} catch (MgmtOperationException | IOException e) {
e.printStackTrace();
} finally {
try {
DomainTestUtils.executeForResult(Util.createRemoveOperation(TEST_SERVER_GROUP), client);
} catch (MgmtOperationException | IOException e) {
e.printStackTrace();
}
}
}
}
Aggregations