@Test
public void testGetMasterClusterNodeId() throws Exception {

	// Test 1, master to slave
	ClusterMasterExecutorImpl clusterMasterExecutorImpl =
		new ClusterMasterExecutorImpl();
	MockClusterExecutor mockClusterExecutor = new MockClusterExecutor(true);
	clusterMasterExecutorImpl.setClusterExecutorImpl(mockClusterExecutor);
	clusterMasterExecutorImpl.activate();
	Assert.assertEquals(
		mockClusterExecutor.getLocalClusterNodeId(),
		clusterMasterExecutorImpl.getMasterClusterNodeId(true));
	Assert.assertTrue(clusterMasterExecutorImpl.isMaster());
	mockClusterExecutor.addClusterNode(
		_TEST_ADDRESS,
		new ClusterNode(_TEST_CLUSTER_NODE_ID, InetAddress.getLocalHost()));
	MockClusterMasterTokenTransitionListener
		mockClusterMasterTokenTransitionListener =
			new MockClusterMasterTokenTransitionListener();
	clusterMasterExecutorImpl.addClusterMasterTokenTransitionListener(
		mockClusterMasterTokenTransitionListener);
	Address oldCoordinatorAddress =
		mockClusterExecutor.getCoordinatorAddress();
	mockClusterExecutor.setCoordinatorAddress(_TEST_ADDRESS);
	Assert.assertEquals(
		_TEST_CLUSTER_NODE_ID,
		clusterMasterExecutorImpl.getMasterClusterNodeId(true));
	Assert.assertFalse(clusterMasterExecutorImpl.isMaster());
	Assert.assertTrue(
		mockClusterMasterTokenTransitionListener.
			isMasterTokenReleasedNotified());
	// Test 2, slave to master
	mockClusterExecutor.setCoordinatorAddress(oldCoordinatorAddress);
	Assert.assertEquals(
		mockClusterExecutor.getLocalClusterNodeId(),
		clusterMasterExecutorImpl.getMasterClusterNodeId(true));
	Assert.assertTrue(clusterMasterExecutorImpl.isMaster());
	Assert.assertTrue(
		mockClusterMasterTokenTransitionListener.
			isMasterTokenAcquiredNotified());
}