Source:
<code>public void testController() throws Exception { System.out.println("START " + className + ".testController() at " + new Date(System.currentTimeMillis())); final String clusterName = CLUSTER_PREFIX + "_" + className + "_controller"; if (_gZkClient.exists("/" + clusterName)) { _gZkClient.deleteRecursively("/" + clusterName); } TestHelper.setupEmptyCluster(_gZkClient, clusterName); ZKHelixManager controller = new ZKHelixManager(clusterName, null, InstanceType.CONTROLLER, ZK_ADDR); <START> controller.connect(); <END> AssertJUnit.assertTrue(controller.isConnected()); controller.connect(); AssertJUnit.assertTrue(controller.isConnected()); MockListener listener = new MockListener(); listener.reset(); try { controller.addControllerListener(null); Assert.fail("Should throw HelixException"); } catch (HelixException e) { } Builder keyBuilder = new Builder(controller.getClusterName()); controller.addControllerListener(listener); AssertJUnit.assertTrue(listener.isControllerChangeListenerInvoked); controller.removeListener(keyBuilder.controller(), listener); ZkHelixPropertyStore<ZNRecord> store = controller.getHelixPropertyStore(); ZNRecord record = new ZNRecord("node_1"); int options = 0; store.set("/node_1", record, AccessOption.PERSISTENT); Stat stat = new Stat(); record = store.get("/node_1", stat, options); AssertJUnit.assertEquals("node_1", record.getId()); controller.getMessagingService(); controller.getClusterManagmentTool(); controller.handleNewSession(controller.getSessionId()); controller.disconnect(); AssertJUnit.assertFalse(controller.isConnected()); deleteCluster(clusterName); System.out.println("END " + className + ".testController() at " + new Date(System.currentTimeMillis())); }</code><technical_language>this test logic is removed? throw exceptions empty cluster structure anymore</technical_language>

Target:
public void testController() throws Exception { System.out.println("START " + className + ".testController() at " + new Date(System.currentTimeMillis())); final String clusterName = CLUSTER_PREFIX + "_" + className + "_controller"; if (_gZkClient.exists("/" + clusterName)) { _gZkClient.deleteRecursively("/" + clusterName); } ZKHelixManager controller = new ZKHelixManager(clusterName, null, InstanceType.CONTROLLER, ZK_ADDR); try { controller.connect(); Assert.fail("Should throw HelixException if initial cluster structure is not setup"); } catch (HelixException e) { } TestHelper.setupEmptyCluster(_gZkClient, clusterName); controller.connect(); AssertJUnit.assertTrue(controller.isConnected()); controller.connect(); AssertJUnit.assertTrue(controller.isConnected()); MockListener listener = new MockListener(); listener.reset(); try { controller.addControllerListener(null); Assert.fail("Should throw HelixException"); } catch (HelixException e) { } Builder keyBuilder = new Builder(controller.getClusterName()); controller.addControllerListener(listener); AssertJUnit.assertTrue(listener.isControllerChangeListenerInvoked); controller.removeListener(keyBuilder.controller(), listener); ZkHelixPropertyStore<ZNRecord> store = controller.getHelixPropertyStore(); ZNRecord record = new ZNRecord("node_1"); int options = 0; store.set("/node_1", record, AccessOption.PERSISTENT); Stat stat = new Stat(); record = store.get("/node_1", stat, options); AssertJUnit.assertEquals("node_1", record.getId()); controller.getMessagingService(); controller.getClusterManagmentTool(); controller.handleNewSession(controller.getSessionId()); controller.disconnect(); AssertJUnit.assertFalse(controller.isConnected()); deleteCluster(clusterName); System.out.println("END " + className + ".testController() at " + new Date(System.currentTimeMillis())); }