@@ -0,0 +1,2816 @@
+package com.linkedin.helix.integration;%0A%0Aimport java.util.Date;%0A%0Aimport org.testng.Assert;%0Aimport org.testng.annotations.Test;%0A%0Aimport com.linkedin.helix.PropertyPathConfig;%0Aimport com.linkedin.helix.PropertyType;%0Aimport com.linkedin.helix.TestHelper;%0Aimport com.linkedin.helix.ZNRecord;%0Aimport com.linkedin.helix.controller.HelixControllerMain;%0Aimport com.linkedin.helix.mock.storage.MockParticipant;%0Aimport com.linkedin.helix.tools.ClusterStateVerifier;%0Aimport com.linkedin.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier;%0Aimport com.linkedin.helix.tools.ClusterStateVerifier.MasterNbInExtViewVerifier;%0A%0Apublic class TestCarryOverBadCurState extends ZkIntegrationTestBase%0A%7B%0A  @Test%0A  public void testCarryOverBadCurState() throws Exception%0A  %7B%0A    System.out.println(%22START testCarryOverBadCurState at %22%0A        + new Date(System.currentTimeMillis()));%0A%0A    String clusterName = getShortClassName();%0A    MockParticipant%5B%5D participants = new MockParticipant%5B5%5D;%0A%0A    TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port%0A                            %22localhost%22, // participant name prefix%0A                            %22TestDB%22, // resource name prefix%0A                            1, // resources%0A                            10, // partitions per resource%0A                            5, // number of nodes%0A                            3, // replicas%0A                            %22MasterSlave%22,%0A                            true); // do rebalance%0A%0A    // add a bad current state%0A    ZNRecord badCurState = new ZNRecord(%22TestDB0%22);%0A    String path = PropertyPathConfig.getPath(PropertyType.CURRENTSTATES, clusterName, %22localhost_12918%22, %22session_0%22, %22TestDB0%22);%0A    _gZkClient.createPersistent(path, true);%0A    _gZkClient.writeData(path, badCurState);%0A    %0A    %0A    TestHelper.startController(clusterName,%0A                               %22controller_0%22,%0A                               ZK_ADDR,%0A                               HelixControllerMain.STANDALONE);%0A    // start participants%0A    for (int i = 0; i %3C 5; i++)%0A    %7B%0A      String instanceName = %22localhost_%22 + (12918 + i);%0A%0A      participants%5Bi%5D = new MockParticipant(clusterName, instanceName, ZK_ADDR, null);%0A      participants%5Bi%5D.syncStart();%0A    %7D%0A%0A    boolean result =%0A        ClusterStateVerifier.verifyByZkCallback(new MasterNbInExtViewVerifier(ZK_ADDR,%0A                                                                              clusterName));%0A    Assert.assertTrue(result);%0A%0A    result =%0A        ClusterStateVerifier.verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR,%0A                                                                                 clusterName));%0A    Assert.assertTrue(result);%0A    %0A    System.out.println(%22END testCarryOverBadCurState at %22%0A        + new Date(System.currentTimeMillis()));%0A%0A  %7D%0A%7D%0A

add a test case for carrying over bad CurState (e.g. CurState without StateModelDef