String rolloutPlan = planBuilder.buildAsString();
cli.sendLine("rollout-plan add --name=maxFailPercPlan --content=" + rolloutPlan);
// 1st scenario - server-one should fail, but the whole operation should succeed
checkURL("main-one", false, "/RolloutPlanTestCase/RolloutServlet?operation=bind&bindPort=" + TEST_PORT);
CLIOpResult ret = testAddConnector("maxFailPercPlan");
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("maxFailPercPlan");
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 should fail -> 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("maxFailPercPlan");
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));