use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.
the class RolloutPlanTestCase method before.
@BeforeClass
public static void before() throws Exception {
CLITestSuite.createSupport(RolloutPlanTestCase.class.getSimpleName());
final WebArchive war = ShrinkWrap.create(WebArchive.class, "RolloutPlanTestCase.war");
war.addClass(RolloutPlanTestServlet.class);
war.addAsManifestResource(createPermissionsXmlAsset(// main-one
new SocketPermission(TestSuiteEnvironment.formatPossibleIpv6Address(CLITestSuite.hostAddresses.get("master")) + ":" + TEST_PORT, "listen,resolve"), // main-three
new SocketPermission(TestSuiteEnvironment.formatPossibleIpv6Address(CLITestSuite.hostAddresses.get("master")) + ":" + (TEST_PORT + 350), "listen,resolve")), "permissions.xml");
String tempDir = System.getProperty("java.io.tmpdir");
warFile = new File(tempDir + File.separator + "RolloutPlanTestCase.war");
new ZipExporterImpl(war).exportTo(warFile, true);
AbstractCliTestBase.initCLI(DomainTestSupport.masterAddress);
// add another server group to default profile
cli.sendLine("/server-group=test-server-group:add(profile=default,socket-binding-group=standard-sockets)");
// add a server to the group
cli.sendLine("/host=master/server-config=test-one:add(group=test-server-group,socket-binding-port-offset=700");
cli.sendLine("/host=master/server-config=test-one/interface=public:add(inet-address=" + CLITestSuite.hostAddresses.get("master") + ")");
CLITestSuite.addServer("test-one", "master", "test-server-group", "default", 700, true);
// start main-two
cli.sendLine("/host=master/server-config=main-two:start(blocking=true)");
CLIOpResult res = cli.readAllAsOpResult();
Assert.assertTrue(res.isIsOutcomeSuccess());
waitUntilState("main-two", "STARTED");
// start test-one
cli.sendLine("/host=master/server-config=test-one:start(blocking=true)");
res = cli.readAllAsOpResult();
Assert.assertTrue(res.isIsOutcomeSuccess());
waitUntilState("test-one", "STARTED");
}
use of org.jboss.as.test.integration.management.util.CLIOpResult in project wildfly by wildfly.
the class RolloutPlanTestCase method testMaxFailServersRolloutPlan.
/**
* Tests rollout plan with non-zero maxFailedServers attribute.
*/
@Test
public void testMaxFailServersRolloutPlan() 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));
String rolloutPlan = planBuilder.buildAsString();
cli.sendLine("rollout-plan add --name=maxFailOnePlan --content=" + rolloutPlan);
// 1st scenario - main-one should fail, but the whole operation should succeed
// 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);
CLIOpResult ret = testAddConnector("maxFailOnePlan");
Assert.assertTrue(ret.isIsOutcomeSuccess());
Assert.assertFalse(getServerStatus("main-one", ret));
Assert.assertTrue(getServerStatus("main-two", ret));
Assert.assertTrue(getServerStatus("main-three", ret));
Assert.assertTrue(getServerStatus("test-one", ret));
ret = testRemoveConnector("maxFailOnePlan");
Assert.assertTrue(ret.isIsOutcomeSuccess());
Assert.assertFalse(getServerStatus("main-one", ret));
Assert.assertTrue(getServerStatus("main-two", ret));
Assert.assertTrue(getServerStatus("main-three", ret));
Assert.assertTrue(getServerStatus("test-one", ret));
// 2nd scenario - main-one and main-three failures -> main-two should be rolled back but the operation succeed
checkURL("main-three", false, "/RolloutPlanTestCase/RolloutServlet?operation=bind&bindPort=" + String.valueOf(TEST_PORT + CLITestSuite.portOffsets.get("main-three")));
ret = testAddConnector("maxFailOnePlan");
Assert.assertTrue(ret.isIsOutcomeSuccess());
Assert.assertFalse(getServerStatus("main-one", ret));
Assert.assertFalse(getServerStatus("main-two", ret));
Assert.assertFalse(getServerStatus("main-three", ret));
Assert.assertTrue(getServerStatus("test-one", ret));
testCleanupConnector("maxFailOnePlan");
// remove rollout plan
cli.sendLine("rollout-plan remove --name=maxFailOnePlan");
}
Aggregations