use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.
the class DataSourceTestCase method testModifyXaDataSource.
private void testModifyXaDataSource() throws Exception {
StringBuilder cmd = new StringBuilder("xa-data-source --profile=" + profileNames[0] + " --name=java:jboss/datasources/TestXADS");
for (String[] props : DS_PROPS) {
cmd.append(" --");
cmd.append(props[0]);
cmd.append("=");
cmd.append(props[1]);
}
cli.sendLine(cmd.toString());
// check that datasource was modified
cli.sendLine("/profile=" + profileNames[0] + "/subsystem=datasources/xa-data-source=java\\:jboss\\/datasources\\/TestXADS:read-resource(recursive=true)");
CLIOpResult result = cli.readAllAsOpResult();
assertTrue(result.isIsOutcomeSuccess());
assertTrue(result.getResult() instanceof Map);
Map dsProps = (Map) result.getResult();
for (String[] props : DS_PROPS) assertTrue(dsProps.get(props[0]).equals(props[1]));
}
use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.
the class AbstractCredentialStoreTestCase method assertContainsAliases.
/**
* Asserts that a credential store with given name contains given aliases.
*
* @param cli connected {@link CLIWrapper} instance (not <code>null</code>)
* @param storeName credential store name (not <code>null</code>)
* @param aliases aliases to check
* @throws IOException
*/
protected void assertContainsAliases(CLIWrapper cli, String storeName, String... aliases) throws IOException {
if (aliases == null || aliases.length > 0) {
return;
}
cli.sendLine(String.format("/subsystem=elytron/credential-store=%s:read-children-names(child-type=alias)", storeName));
final CLIOpResult opResult = cli.readAllAsOpResult();
Set<String> set = opResult.getResponseNode().get(ModelDescriptionConstants.RESULT).asList().stream().map(n -> n.asString()).collect(Collectors.toSet());
for (String alias : aliases) {
if (!set.contains(alias)) {
fail(String.format("Credential store '%s' doesn't contain expected alias '%s'", storeName, alias));
}
}
}
use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.
the class CredentialStoreTestCase method testUnmodifiableInternally.
private void testUnmodifiableInternally(final String csName) throws IOException, Exception {
try (CLIWrapper cli = new CLIWrapper(true)) {
assertContainsAliases(cli, csName, ALIAS_PASSWORD, ALIAS_SECRET);
cli.sendLine(String.format("/subsystem=elytron/credential-store=%s/alias=%1$s:add(secret-value=%1$s)", csName), true);
final CLIOpResult opResult = cli.readAllAsOpResult();
assertFalse("Adding alias to non-modifiable credential store should fail.", opResult.isIsOutcomeSuccess());
}
assertCredentialValue(csName, ALIAS_PASSWORD, "password");
assertCredentialValue(csName, ALIAS_SECRET, "secret");
assertCredentialNotFound(csName, csName);
}
use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.
the class RolloutPlanTestCase method testCleanupConnector.
private void testCleanupConnector(String rolloutPlanId) throws Exception {
CLIOpResult ret = testRemoveConnector(rolloutPlanId);
Assert.assertTrue(ret.isIsOutcomeSuccess());
Assert.assertTrue(getServerStatus("test-one", ret));
boolean gotNoResponse = false;
for (String server : new String[] { "main-one", "main-two", "main-three" }) {
try {
Assert.assertFalse(getServerStatus(server, ret));
} catch (NoResponseException e) {
if (gotNoResponse) {
throw e;
}
gotNoResponse = true;
}
}
Assert.assertTrue("received no response from one server", gotNoResponse);
}
use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.
the class WildCardReadsTestCase method testLenientReadOperationDescription.
/**
* Tests WFLY-2527 added behavior of supporting read-operation-description for
* wildcard addresses where there is no generic resource registration for the type
*/
@Test
public void testLenientReadOperationDescription() throws IOException {
cli.sendLine(String.format(OP_PATTERN, EVICTION, ModelDescriptionConstants.READ_OPERATION_NAMES_OPERATION));
CLIOpResult opResult = cli.readAllAsOpResult();
Assert.assertTrue(opResult.isIsOutcomeSuccess());
for (ModelNode node : opResult.getResponseNode().get(ModelDescriptionConstants.RESULT).asList()) {
String opPart = String.format(READ_OP_DESC_OP, node.asString());
cli.sendLine(String.format(OP_PATTERN, EVICTION, opPart));
opResult = cli.readAllAsOpResult();
Assert.assertTrue(opResult.isIsOutcomeSuccess());
ModelNode specific = opResult.getResponseNode().get(ModelDescriptionConstants.RESULT);
cli.sendLine(String.format(OP_PATTERN, "*", opPart));
opResult = cli.readAllAsOpResult();
Assert.assertTrue(opResult.isIsOutcomeSuccess());
Assert.assertEquals("mismatch for " + node.asString(), specific, opResult.getResponseNode().get(ModelDescriptionConstants.RESULT));
}
}
Aggregations