Search in sources :

Example 6 with CLIOpResult

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);
}
Also used : CLIWrapper(org.jboss.as.test.integration.management.util.CLIWrapper) CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult)

Example 7 with CLIOpResult

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);
}
Also used : CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult)

Example 8 with CLIOpResult

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));
    }
}
Also used : CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult) ModelNode(org.jboss.dmr.ModelNode) Test(org.junit.Test)

Example 9 with CLIOpResult

use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.

the class DataSourceTestCase method testModifyDataSource.

private void testModifyDataSource() throws Exception {
    StringBuilder cmd = new StringBuilder("data-source --name=TestDS");
    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("/subsystem=datasources/data-source=TestDS:read-resource(recursive=true)");
    CLIOpResult result = cli.readAllAsOpResult();
    assertTrue(result.getResult().toString(), 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]));
}
Also used : CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult) Map(java.util.Map)

Example 10 with CLIOpResult

use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.

the class JsseTestCase method addMissingPassword.

@Test
public void addMissingPassword() throws IOException {
    cli.sendLine("/subsystem=security/security-domain=empty-jsse-missing-pwd/jsse=classic:add(server-alias=silent.planet,keystore={type=JKS})", true);
    CLIOpResult result = cli.readAllAsOpResult();
    assertThat(result, is(notNullValue()));
    assertThat(result.getFromResponse(OUTCOME).toString(), is("failed"));
}
Also used : CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult) Test(org.junit.Test)

Aggregations

CLIOpResult (org.jboss.as.test.integration.management.util.CLIOpResult)27 Test (org.junit.Test)13 Map (java.util.Map)6 RolloutPlanBuilder (org.jboss.as.test.integration.domain.management.util.RolloutPlanBuilder)3 CLIWrapper (org.jboss.as.test.integration.management.util.CLIWrapper)3 ModelNode (org.jboss.dmr.ModelNode)2 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)2 File (java.io.File)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 SocketPermission (java.net.SocketPermission)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 StandardCharsets (java.nio.charset.StandardCharsets)1 AllPermission (java.security.AllPermission)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1