Search in sources :

Example 11 with CLIOpResult

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

the class JsseTestCase method addEmpty.

@Test
public void addEmpty() throws Exception {
    cli.sendLine("/subsystem=security/security-domain=empty-jsse/jsse=classic:add()");
    CLIOpResult result = cli.readAllAsOpResult();
    assertThat(result, is(notNullValue()));
    assertThat(result.getFromResponse(OUTCOME).toString(), is("success"));
}
Also used : CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult) Test(org.junit.Test)

Example 12 with CLIOpResult

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

the class JsseTestCase method addValid.

@Test
public void addValid() throws Exception {
    cli.sendLine("/subsystem=security/security-domain=empty-jsse-valid/jsse=classic:add(server-alias=silent.planet)");
    CLIOpResult result = cli.readAllAsOpResult();
    assertThat(result, is(notNullValue()));
    assertThat(result.getFromResponse(OUTCOME).toString(), is("success"));
}
Also used : CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult) Test(org.junit.Test)

Example 13 with CLIOpResult

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

Example 14 with CLIOpResult

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

the class RolloutPlanTestCase method after.

@AfterClass
public static void after() throws Exception {
    if (warFile.exists()) {
        //noinspection ResultOfMethodCallIgnored
        warFile.delete();
    }
    // stop test-one
    cli.sendLine("/host=master/server-config=test-one:stop(blocking=true)");
    CLIOpResult res = cli.readAllAsOpResult();
    Assert.assertTrue(res.isIsOutcomeSuccess());
    waitUntilState("test-one", "STOPPED");
    // stop main-two
    cli.sendLine("/host=master/server-config=main-two:stop(blocking=true)");
    res = cli.readAllAsOpResult();
    Assert.assertTrue(res.isIsOutcomeSuccess());
    waitUntilState("main-two", "DISABLED");
    AbstractCliTestBase.closeCLI();
    CLITestSuite.stopSupport();
}
Also used : CLIOpResult(org.jboss.as.test.integration.management.util.CLIOpResult) AfterClass(org.junit.AfterClass)

Example 15 with CLIOpResult

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

the class RolloutPlanTestCase method testRollbackAcrossGroupsRolloutPlan.

/**
     * Tests rollout plan with RollbackAcrossGroups set to true.
     */
@Test
public void testRollbackAcrossGroupsRolloutPlan() throws Exception {
    // deploy helper servlets
    cli.sendLine("deploy " + warFile.getAbsolutePath() + " --all-server-groups");
    checkURL("main-one", false, "/RolloutPlanTestCase/RolloutServlet");
    checkURL("main-two", false, "/RolloutPlanTestCase/RolloutServlet");
    checkURL("main-three", false, "/RolloutPlanTestCase/RolloutServlet");
    checkURL("test-one", false, "/RolloutPlanTestCase/RolloutServlet");
    // prepare socket binding
    cli.sendLine("/socket-binding-group=standard-sockets/socket-binding=test-binding:add(interface=public,port=" + TEST_PORT + ")");
    // create plan with max fail server set to 1
    RolloutPlanBuilder planBuilder = new RolloutPlanBuilder();
    planBuilder.addGroup(serverGroups[0], new RolloutPlanBuilder.RolloutPolicy(true, null, 1));
    planBuilder.addGroup(serverGroups[1], new RolloutPlanBuilder.RolloutPolicy(true, null, 1));
    planBuilder.addGroup(serverGroups[2], new RolloutPlanBuilder.RolloutPolicy(true, null, 1));
    planBuilder.setRollBackAcrossGroups(true);
    String rolloutPlan = planBuilder.buildAsString();
    cli.sendLine("rollout-plan add --name=groupsRollbackPlan --content=" + rolloutPlan);
    // let the main-one ane main-three fail, main two rollback and then test-one rollback
    // let the helper server bind to test port to prevent successful subsequent add connector operation on main-one
    checkURL("main-one", false, "/RolloutPlanTestCase/RolloutServlet?operation=bind&bindPort=" + TEST_PORT);
    checkURL("main-three", false, "/RolloutPlanTestCase/RolloutServlet?operation=bind&bindPort=" + String.valueOf(TEST_PORT + CLITestSuite.portOffsets.get("main-three")));
    CLIOpResult ret = testAddConnector("groupsRollbackPlan");
    Assert.assertFalse(ret.isIsOutcomeSuccess());
    Assert.assertFalse(getServerStatus("main-one", ret));
    Assert.assertFalse(getServerStatus("main-two", ret));
    Assert.assertFalse(getServerStatus("main-three", ret));
    Assert.assertFalse(getServerStatus("test-one", ret));
    // remove rollout plan
    cli.sendLine("rollout-plan remove --name=groupsRollbackPlan");
}
Also used : RolloutPlanBuilder(org.jboss.as.test.integration.domain.management.util.RolloutPlanBuilder) 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