diff --git a/.github/workflows/Helix-Manual-CI.yml b/.github/workflows/Helix-Manual-CI.yml index f349e3303a..8f648bf5b5 100644 --- a/.github/workflows/Helix-Manual-CI.yml +++ b/.github/workflows/Helix-Manual-CI.yml @@ -15,6 +15,8 @@ on: required: true default: -fae test +permissions: write-all + jobs: MANUAL_CI: @@ -24,16 +26,20 @@ jobs: - uses: actions/checkout@v2 with: ref: ${{ github.event.inputs.buildRef }} - - name: Set up JDK 1.8 + - name: Set up JDK 11 uses: actions/setup-java@v1 with: - java-version: 1.8 + java-version: 11 - name: Delete frontend-maven-plugin dir run: rm -rf .m2\repository\com\github\eirslett - name: Build with Maven run: mvn clean install -Dmaven.test.skip.exec=true -DretryFailedDeploymentCount=5 - name: Run All Tests run: mvn -B -V -e -ntp "-Dstyle.color=always" ${{ github.event.inputs.mvnOpts }} ${{ github.event.inputs.goals }} - - name: Print Tests Results - run: .github/scripts/printTestResult.sh - if: ${{ success() || failure() }} + - name: Test Report + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: Tests Results + path: './**/target/surefire-reports/TEST-TestSuite.xml' + reporter: java-junit \ No newline at end of file diff --git a/helix-core/src/main/java/org/apache/helix/examples/BootstrapHandler.java b/helix-core/src/main/java/org/apache/helix/examples/BootstrapHandler.java index 5cb147aaff..84bae6a3b5 100644 --- a/helix-core/src/main/java/org/apache/helix/examples/BootstrapHandler.java +++ b/helix-core/src/main/java/org/apache/helix/examples/BootstrapHandler.java @@ -33,9 +33,13 @@ import org.apache.helix.participant.statemachine.StateModelFactory; import org.apache.helix.participant.statemachine.StateModelInfo; import org.apache.helix.participant.statemachine.Transition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class BootstrapHandler extends StateModelFactory { + private static final Logger LOG = LoggerFactory.getLogger(BootstrapHandler.class); + @Override public StateModel createNewStateModel(String resourceName, String stateUnitKey) { return new BootstrapStateModel(stateUnitKey); @@ -58,7 +62,6 @@ public void masterToSlave(Message message, NotificationContext context) { @Transition(from = "OFFLINE", to = "SLAVE") public void offlineToSlave(Message message, NotificationContext context) { - System.out.println("BootstrapProcess.BootstrapStateModel.offlineToSlave()"); HelixManager manager = context.getManager(); ClusterMessagingService messagingService = manager.getMessagingService(); Message requestBackupUriRequest = @@ -81,8 +84,8 @@ public void offlineToSlave(Message message, NotificationContext context) { if (sentMessageCount == 0) { // could not find any other node hosting the partition } else if (responseHandler.getBootstrapUrl() != null) { - System.out.println("Got bootstrap url:" + responseHandler.getBootstrapUrl()); - System.out.println("Got backup time:" + responseHandler.getBootstrapTime()); + LOG.info("Got bootstrap url:" + responseHandler.getBootstrapUrl()); + LOG.info("Got backup time:" + responseHandler.getBootstrapTime()); // Got the url fetch it } else { // Either go to error state @@ -93,12 +96,12 @@ public void offlineToSlave(Message message, NotificationContext context) { @Transition(from = "SLAVE", to = "OFFLINE") public void slaveToOffline(Message message, NotificationContext context) { - System.out.println("BootstrapProcess.BootstrapStateModel.slaveToOffline()"); + LOG.info("BootstrapProcess.BootstrapStateModel.slaveToOffline()"); } @Transition(from = "SLAVE", to = "MASTER") public void slaveToMaster(Message message, NotificationContext context) { - System.out.println("BootstrapProcess.BootstrapStateModel.slaveToMaster()"); + LOG.info("BootstrapProcess.BootstrapStateModel.slaveToMaster()"); } } diff --git a/helix-core/src/main/java/org/apache/helix/examples/DummyParticipant.java b/helix-core/src/main/java/org/apache/helix/examples/DummyParticipant.java index 854508d91e..16f316ed89 100644 --- a/helix-core/src/main/java/org/apache/helix/examples/DummyParticipant.java +++ b/helix-core/src/main/java/org/apache/helix/examples/DummyParticipant.java @@ -29,8 +29,13 @@ import org.apache.helix.participant.statemachine.StateModelFactory; import org.apache.helix.participant.statemachine.StateModelInfo; import org.apache.helix.participant.statemachine.Transition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class DummyParticipant { + + private static final Logger LOG = LoggerFactory.getLogger(DummyParticipant.class); + // dummy master-slave state model @StateModelInfo(initialState = "OFFLINE", states = { "MASTER", "SLAVE", "ERROR" @@ -40,47 +45,47 @@ public static class DummyMSStateModel extends StateModel { public void onBecomeSlaveFromOffline(Message message, NotificationContext context) { String partitionName = message.getPartitionName(); String instanceName = message.getTgtName(); - System.out.println(instanceName + " becomes SLAVE from OFFLINE for " + partitionName); + LOG.info(instanceName + " becomes SLAVE from OFFLINE for " + partitionName); } @Transition(to = "MASTER", from = "SLAVE") public void onBecomeMasterFromSlave(Message message, NotificationContext context) { String partitionName = message.getPartitionName(); String instanceName = message.getTgtName(); - System.out.println(instanceName + " becomes MASTER from SLAVE for " + partitionName); + LOG.info(instanceName + " becomes MASTER from SLAVE for " + partitionName); } @Transition(to = "SLAVE", from = "MASTER") public void onBecomeSlaveFromMaster(Message message, NotificationContext context) { String partitionName = message.getPartitionName(); String instanceName = message.getTgtName(); - System.out.println(instanceName + " becomes SLAVE from MASTER for " + partitionName); + LOG.info(instanceName + " becomes SLAVE from MASTER for " + partitionName); } @Transition(to = "OFFLINE", from = "SLAVE") public void onBecomeOfflineFromSlave(Message message, NotificationContext context) { String partitionName = message.getPartitionName(); String instanceName = message.getTgtName(); - System.out.println(instanceName + " becomes OFFLINE from SLAVE for " + partitionName); + LOG.info(instanceName + " becomes OFFLINE from SLAVE for " + partitionName); } @Transition(to = "DROPPED", from = "OFFLINE") public void onBecomeDroppedFromOffline(Message message, NotificationContext context) { String partitionName = message.getPartitionName(); String instanceName = message.getTgtName(); - System.out.println(instanceName + " becomes DROPPED from OFFLINE for " + partitionName); + LOG.info(instanceName + " becomes DROPPED from OFFLINE for " + partitionName); } @Transition(to = "OFFLINE", from = "ERROR") public void onBecomeOfflineFromError(Message message, NotificationContext context) { String partitionName = message.getPartitionName(); String instanceName = message.getTgtName(); - System.out.println(instanceName + " becomes OFFLINE from ERROR for " + partitionName); + LOG.info(instanceName + " becomes OFFLINE from ERROR for " + partitionName); } @Override public void reset() { - System.out.println("Default MockMSStateModel.reset() invoked"); + LOG.info("Default MockMSStateModel.reset() invoked"); } } diff --git a/helix-core/src/main/java/org/apache/helix/examples/ExampleHelper.java b/helix-core/src/main/java/org/apache/helix/examples/ExampleHelper.java index ef4129256e..c61fa3b735 100644 --- a/helix-core/src/main/java/org/apache/helix/examples/ExampleHelper.java +++ b/helix-core/src/main/java/org/apache/helix/examples/ExampleHelper.java @@ -26,14 +26,14 @@ import org.apache.helix.zookeeper.zkclient.IDefaultNameSpace; import org.apache.helix.zookeeper.zkclient.ZkClient; import org.apache.helix.zookeeper.zkclient.ZkServer; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ExampleHelper { - public static ZkServer startZkServer(String zkAddr) { - System.out.println("Start zookeeper at " + zkAddr + " in thread " - + Thread.currentThread().getName()); + private static final Logger LOG = LoggerFactory.getLogger(ExampleHelper.class); + public static ZkServer startZkServer(String zkAddr) { String zkDir = zkAddr.replace(':', '_'); final String logDir = "/tmp/" + zkDir + "/logs"; final String dataDir = "/tmp/" + zkDir + "/dataDir"; @@ -41,8 +41,7 @@ public static ZkServer startZkServer(String zkAddr) { FileUtils.deleteDirectory(new File(dataDir)); FileUtils.deleteDirectory(new File(logDir)); } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + LOG.error("error while starting the ZK server", e); } IDefaultNameSpace defaultNameSpace = new IDefaultNameSpace() { @@ -62,7 +61,7 @@ public void createDefaultNameSpace(ZkClient zkClient) { public static void stopZkServer(ZkServer zkServer) { if (zkServer != null) { zkServer.shutdown(); - System.out.println("Shut down zookeeper at port " + zkServer.getPort() + " in thread " + LOG.info("Shut down zookeeper at port " + zkServer.getPort() + " in thread " + Thread.currentThread().getName()); } } diff --git a/helix-core/src/main/java/org/apache/helix/examples/LeaderStandbyStateModelFactory.java b/helix-core/src/main/java/org/apache/helix/examples/LeaderStandbyStateModelFactory.java index b235eaa9ea..67daa15c46 100644 --- a/helix-core/src/main/java/org/apache/helix/examples/LeaderStandbyStateModelFactory.java +++ b/helix-core/src/main/java/org/apache/helix/examples/LeaderStandbyStateModelFactory.java @@ -23,6 +23,8 @@ import org.apache.helix.model.Message; import org.apache.helix.participant.statemachine.StateModel; import org.apache.helix.participant.statemachine.StateModelFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class LeaderStandbyStateModelFactory extends StateModelFactory { int _delay; @@ -59,6 +61,9 @@ public void setInstanceName(String instanceName) { } public static class LeaderStandbyStateModel extends StateModel { + + private static final Logger LOG = LoggerFactory.getLogger(LeaderStandbyStateModel.class); + int _transDelay = 0; String partitionName; String _instanceName = ""; @@ -81,35 +86,35 @@ public void setDelay(int delay) { } public void onBecomeLeaderFromStandby(Message message, NotificationContext context) { - System.out.println("LeaderStandbyStateModel.onBecomeLeaderFromStandby():" + _instanceName + LOG.info("LeaderStandbyStateModel.onBecomeLeaderFromStandby():" + _instanceName + " transitioning from " + message.getFromState() + " to " + message.getToState() + " for " + message.getResourceName() + " " + message.getPartitionName()); sleep(); } public void onBecomeStandbyFromLeader(Message message, NotificationContext context) { - System.out.println("LeaderStandbyStateModel.onBecomeStandbyFromLeader():" + _instanceName + LOG.info("LeaderStandbyStateModel.onBecomeStandbyFromLeader():" + _instanceName + " transitioning from " + message.getFromState() + " to " + message.getToState() + " for " + message.getResourceName() + " " + message.getPartitionName()); sleep(); } public void onBecomeStandbyFromOffline(Message message, NotificationContext context) { - System.out.println("LeaderStandbyStateModel.onBecomeStandbyFromOffline():" + _instanceName + LOG.info("LeaderStandbyStateModel.onBecomeStandbyFromOffline():" + _instanceName + " transitioning from " + message.getFromState() + " to " + message.getToState() + " for " + message.getResourceName() + " " + message.getPartitionName()); sleep(); } public void onBecomeOfflineFromStandby(Message message, NotificationContext context) { - System.out.println("LeaderStandbyStateModel.onBecomeOfflineFromStandby():" + _instanceName + LOG.info("LeaderStandbyStateModel.onBecomeOfflineFromStandby():" + _instanceName + " transitioning from " + message.getFromState() + " to " + message.getToState() + " for " + message.getResourceName() + " " + message.getPartitionName()); sleep(); } public void onBecomeDroppedFromOffline(Message message, NotificationContext context) { - System.out.println("LeaderStandbyStateModel.onBecomeDroppedFromOffline():" + _instanceName + LOG.info("LeaderStandbyStateModel.onBecomeDroppedFromOffline():" + _instanceName + " transitioning from " + message.getFromState() + " to " + message.getToState() + " for " + message.getResourceName() + " " + message.getPartitionName()); sleep(); @@ -120,7 +125,7 @@ private void sleep() { try { Thread.sleep(_transDelay); } catch (Exception e) { - e.printStackTrace(); + LOG.error("Interrupted while Thread.sleep", e); } } } diff --git a/helix-core/src/main/java/org/apache/helix/examples/MasterSlaveStateModelFactory.java b/helix-core/src/main/java/org/apache/helix/examples/MasterSlaveStateModelFactory.java index 952b80542e..d579860606 100644 --- a/helix-core/src/main/java/org/apache/helix/examples/MasterSlaveStateModelFactory.java +++ b/helix-core/src/main/java/org/apache/helix/examples/MasterSlaveStateModelFactory.java @@ -23,6 +23,8 @@ import org.apache.helix.model.Message; import org.apache.helix.participant.statemachine.StateModel; import org.apache.helix.participant.statemachine.StateModelFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @SuppressWarnings("rawtypes") public class MasterSlaveStateModelFactory extends StateModelFactory { @@ -57,6 +59,9 @@ public StateModel createNewStateModel(String resourceName, String partitionName) } public static class MasterSlaveStateModel extends StateModel { + + private static final Logger LOG = LoggerFactory.getLogger(MasterSlaveStateModel.class); + int _transDelay = 0; String partitionName; String _instanceName = ""; @@ -78,7 +83,7 @@ public void setInstanceName(String instanceName) { } public void onBecomeSlaveFromOffline(Message message, NotificationContext context) { - System.out.println(_instanceName + " transitioning from " + message.getFromState() + " to " + LOG.info(_instanceName + " transitioning from " + message.getFromState() + " to " + message.getToState() + " for " + partitionName); sleep(); } @@ -87,35 +92,31 @@ private void sleep() { try { Thread.sleep(_transDelay); } catch (Exception e) { - e.printStackTrace(); + LOG.error("Interrupted while Thread.sleep", e); } } public void onBecomeSlaveFromMaster(Message message, NotificationContext context) { - System.out.println(_instanceName + " transitioning from " + message.getFromState() + " to " + LOG.info(_instanceName + " transitioning from " + message.getFromState() + " to " + message.getToState() + " for " + partitionName); sleep(); - } public void onBecomeMasterFromSlave(Message message, NotificationContext context) { - System.out.println(_instanceName + " transitioning from " + message.getFromState() + " to " + LOG.info(_instanceName + " transitioning from " + message.getFromState() + " to " + message.getToState() + " for " + partitionName); sleep(); - } public void onBecomeOfflineFromSlave(Message message, NotificationContext context) { - System.out.println(_instanceName + " transitioning from " + message.getFromState() + " to " + LOG.info(_instanceName + " transitioning from " + message.getFromState() + " to " + message.getToState() + " for " + partitionName); sleep(); - } public void onBecomeDroppedFromOffline(Message message, NotificationContext context) { - System.out.println(_instanceName + " Dropping partition " + partitionName); + LOG.info(_instanceName + " Dropping partition " + partitionName); sleep(); - } } diff --git a/helix-core/src/main/java/org/apache/helix/examples/OnlineOfflineStateModelFactory.java b/helix-core/src/main/java/org/apache/helix/examples/OnlineOfflineStateModelFactory.java index e4ad05813e..2750066936 100644 --- a/helix-core/src/main/java/org/apache/helix/examples/OnlineOfflineStateModelFactory.java +++ b/helix-core/src/main/java/org/apache/helix/examples/OnlineOfflineStateModelFactory.java @@ -23,6 +23,8 @@ import org.apache.helix.model.Message; import org.apache.helix.participant.statemachine.StateModel; import org.apache.helix.participant.statemachine.StateModelFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class OnlineOfflineStateModelFactory extends StateModelFactory { int _delay; @@ -55,6 +57,9 @@ public StateModel createNewStateModel(String resourceName, String stateUnitKey) } public static class OnlineOfflineStateModel extends StateModel { + + private static final Logger LOG = LoggerFactory.getLogger(OnlineOfflineStateModel.class); + int _transDelay = 0; String _instanceName = ""; @@ -67,7 +72,7 @@ public void setInstanceName(String instanceName) { } public void onBecomeOnlineFromOffline(Message message, NotificationContext context) { - System.out.println( + LOG.info( "OnlineOfflineStateModelFactory.onBecomeOnlineFromOffline():" + _instanceName + " transitioning from " + message.getFromState() + " to " + message.getToState() + " for " + message.getResourceName() + " " + message.getPartitionName()); @@ -75,7 +80,7 @@ public void onBecomeOnlineFromOffline(Message message, NotificationContext conte } public void onBecomeOfflineFromOnline(Message message, NotificationContext context) { - System.out.println( + LOG.info( "OnlineOfflineStateModelFactory.onBecomeOfflineFromOnline():" + _instanceName + " transitioning from " + message.getFromState() + " to " + message.getToState() + " for " + message.getResourceName() + " " + message.getPartitionName()); @@ -83,7 +88,7 @@ public void onBecomeOfflineFromOnline(Message message, NotificationContext conte } public void onBecomeDroppedFromOffline(Message message, NotificationContext context) { - System.out.println( + LOG.info( "OnlineOfflineStateModelFactory.onBecomeDroppedFromOffline():" + _instanceName + " transitioning from " + message.getFromState() + " to " + message.getToState() + " for " + message.getResourceName() + " " + message.getPartitionName()); @@ -94,7 +99,7 @@ private void sleep() { try { Thread.sleep(_transDelay); } catch (Exception e) { - e.printStackTrace(); + LOG.error("Interrupted while Thread.sleep", e); } } } diff --git a/helix-core/src/main/java/org/apache/helix/examples/WeightAwareRebalanceUtilExample.java b/helix-core/src/main/java/org/apache/helix/examples/WeightAwareRebalanceUtilExample.java index da1eafedc9..d213991db6 100644 --- a/helix-core/src/main/java/org/apache/helix/examples/WeightAwareRebalanceUtilExample.java +++ b/helix-core/src/main/java/org/apache/helix/examples/WeightAwareRebalanceUtilExample.java @@ -41,9 +41,13 @@ import org.apache.helix.model.ResourceConfig; import org.apache.helix.util.WeightAwareRebalanceUtil; import org.apache.helix.zookeeper.zkclient.ZkServer; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class WeightAwareRebalanceUtilExample { + + private static final Logger LOG = LoggerFactory.getLogger(WeightAwareRebalanceUtilExample.class); + private static String ZK_ADDRESS = "localhost:2199"; private static String CLUSTER_NAME = "RebalanceUtilExampleCluster"; private static HelixAdmin admin; @@ -65,10 +69,10 @@ public class WeightAwareRebalanceUtilExample { final static List instanceConfigs = new ArrayList<>(); private static void printAssignmentInfo(ResourcesStateMap assignment) { - System.out.println("The result assignment is: "); + LOG.info("The result assignment is: "); Map instanceLoad = new HashMap<>(); for (String resource : assignment.getResourceStatesMap().keySet()) { - System.out.println(resource + ": " + assignment.getPartitionStateMap(resource).toString()); + LOG.info(resource + ": " + assignment.getPartitionStateMap(resource).toString()); for (Map stateMap : assignment.getPartitionStateMap(resource).getStateMap().values()) { for (String instance : stateMap.keySet()) { if (!instanceLoad.containsKey(instance)) { @@ -78,11 +82,11 @@ private static void printAssignmentInfo(ResourcesStateMap assignment) { } } } - System.out.println("Instance load: " + instanceLoad + "\n"); + LOG.info("Instance load: " + instanceLoad + "\n"); } private static void rebalanceUtilUsage() { - System.out.println(String.format("Start rebalancing using WeightAwareRebalanceUtil for %d resources.", nResources)); + LOG.info(String.format("Start rebalancing using WeightAwareRebalanceUtil for %d resources.", nResources)); /** * Init providers with resource weight and participant capacity. @@ -139,12 +143,12 @@ public int getParticipantUsage(String participant) { ResourcesStateMap assignment = util.buildIncrementalRebalanceAssignment(resourceConfigs, null, Collections.singletonList(capacityConstraint), Collections.singletonList(evenConstraint)); - System.out.println(String.format("Finished rebalancing using WeightAwareRebalanceUtil for %d resources.", nResources)); + LOG.info(String.format("Finished rebalancing using WeightAwareRebalanceUtil for %d resources.", nResources)); printAssignmentInfo(assignment); } private static void rebalanceUtilUsageWithZkBasedDataProvider() { - System.out.println(String.format("Start rebalancing using WeightAwareRebalanceUtil and ZK based Capacity/Weight data providers for %d resources.", nResources)); + LOG.info(String.format("Start rebalancing using WeightAwareRebalanceUtil and ZK based Capacity/Weight data providers for %d resources.", nResources)); // Init a zkserver & cluster nodes for this example ZkServer zkServer = ExampleHelper.startZkServer(ZK_ADDRESS); @@ -219,12 +223,12 @@ private static void rebalanceUtilUsageWithZkBasedDataProvider() { ExampleHelper.stopZkServer(zkServer); - System.out.println(String.format("Finished rebalancing using WeightAwareRebalanceUtil and ZK based Capacity/Weight data providers for %d resources.", nResources)); + LOG.info(String.format("Finished rebalancing using WeightAwareRebalanceUtil and ZK based Capacity/Weight data providers for %d resources.", nResources)); printAssignmentInfo(assignment); } private static void rebalanceWithFaultZone() { - System.out.println(String.format("Start rebalancing using WeightAwareRebalanceUtil for %d resources in a topology aware cluster.", nResources)); + LOG.info(String.format("Start rebalancing using WeightAwareRebalanceUtil for %d resources in a topology aware cluster.", nResources)); /** * Setup cluster config and instance configs for topology information @@ -248,7 +252,7 @@ private static void rebalanceWithFaultZone() { String domainStr = String.format("Rack=%s,Host=%s", i % (nParticipants / 3), instance); config.setDomain(domainStr); instanceConfigs.add(config); - System.out.println(String.format("Set instance %s domain to be %s.", instance, domainStr)); + LOG.info(String.format("Set instance %s domain to be %s.", instance, domainStr)); } /** @@ -285,7 +289,7 @@ public int getParticipantUsage(String participant) { Collections.singletonList(capacityConstraint), Collections.singletonList(evenConstraint)); - System.out.println(String.format("Finished rebalancing using WeightAwareRebalanceUtil for %d resources in a topology aware cluster with %d fault zones.", nResources, nParticipants / 3)); + LOG.info(String.format("Finished rebalancing using WeightAwareRebalanceUtil for %d resources in a topology aware cluster with %d fault zones.", nResources, nParticipants / 3)); printAssignmentInfo(assignment); } diff --git a/helix-core/src/main/java/org/apache/helix/tools/IdealStateCalculatorForEspressoRelay.java b/helix-core/src/main/java/org/apache/helix/tools/IdealStateCalculatorForEspressoRelay.java index 11811bf569..82a7df4584 100644 --- a/helix-core/src/main/java/org/apache/helix/tools/IdealStateCalculatorForEspressoRelay.java +++ b/helix-core/src/main/java/org/apache/helix/tools/IdealStateCalculatorForEspressoRelay.java @@ -89,7 +89,7 @@ public static IdealState calculateRelayIdealState(List partitions, } result.getRecord().getMapFields().put(snName, mapField); } - System.out.println(); + return result; } diff --git a/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java b/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java index a4c6862574..d71f16ad7e 100644 --- a/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java +++ b/helix-core/src/test/java/org/apache/helix/TestConfigAccessor.java @@ -34,19 +34,21 @@ import org.apache.helix.model.builder.ConfigScopeBuilder; import org.apache.helix.model.builder.HelixConfigScopeBuilder; import org.apache.helix.tools.ClusterSetup; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; public class TestConfigAccessor extends ZkUnitTestBase { + + private static final Logger LOGGER = LoggerFactory.getLogger(TestConfigAccessor.class); @Test public void testBasic() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, "localhost", "TestDB", 1, 10, 5, 3, "MasterSlave", true); @@ -115,7 +117,7 @@ public void testBasic() throws Exception { Assert.assertEquals(keys.get(0), "clusterConfigKey"); keys = configAccessor.getKeys(ConfigScopeProperty.PARTICIPANT, clusterName, "localhost_12918"); - System.out.println((keys)); + LOGGER.info(keys.toString()); Assert.assertEquals(keys.size(), 3, "should be [HELIX_HOST, HELIX_PORT, participantConfigKey]"); Assert.assertEquals(keys.get(2), "participantConfigKey"); @@ -167,7 +169,6 @@ public void testBasic() throws Exception { configAccessor.close(); configAccessorZkAddr.close(); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } // HELIX-25: set participant Config should check existence of instance @@ -177,8 +178,6 @@ public void testSetNonexistentParticipantConfig() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - ZKHelixAdmin admin = new ZKHelixAdmin(_gZkClient); admin.addCluster(clusterName, true); ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient); @@ -206,7 +205,6 @@ public void testSetNonexistentParticipantConfig() throws Exception { admin.dropCluster(clusterName); configAccessor.close(); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test diff --git a/helix-core/src/test/java/org/apache/helix/TestEspressoStorageClusterIdealState.java b/helix-core/src/test/java/org/apache/helix/TestEspressoStorageClusterIdealState.java index 8eb0e00c5d..0c584327cc 100644 --- a/helix-core/src/test/java/org/apache/helix/TestEspressoStorageClusterIdealState.java +++ b/helix-core/src/test/java/org/apache/helix/TestEspressoStorageClusterIdealState.java @@ -30,6 +30,8 @@ import org.apache.helix.model.IdealState; import org.apache.helix.tools.DefaultIdealStateCalculator; import org.apache.helix.util.RebalanceUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.AssertJUnit; import org.testng.annotations.Test; @@ -37,6 +39,9 @@ public class TestEspressoStorageClusterIdealState { + + private static final Logger LOGGER = LoggerFactory.getLogger(TestEspressoStorageClusterIdealState.class); + @Test() public void testEspressoStorageClusterIdealState() throws Exception { List instanceNames = new ArrayList(); @@ -155,7 +160,7 @@ public static void Verify(Map result, int partitions, int replic } } // Master partition should be evenly distributed most of the time - System.out.println("Masters: max: " + maxMasters + " Min:" + minMasters); + LOGGER.info("Masters: max: " + maxMasters + " Min:" + minMasters); // Each master partition should occur only once for (int i = 0; i < partitions; i++) { AssertJUnit.assertTrue(masterCounterMap.get(i) == 1); @@ -259,7 +264,7 @@ public static double[] compareResult(Map result1, Map result1, Map static public ZkServer startZkServer(final String zkAddress, final List rootNamespaces, boolean overwrite) throws Exception { - System.out.println( - "Start zookeeper at " + zkAddress + " in thread " + Thread.currentThread().getName()); + LOG.info("Start zookeeper at " + zkAddress + " in thread " + Thread.currentThread().getName()); String zkDir = zkAddress.replace(':', '_'); final String logDir = "/tmp/" + zkDir + "/logs"; @@ -148,9 +147,7 @@ public void createDefaultNameSpace(ZkClient zkClient) { static public void stopZkServer(ZkServer zkServer) { if (zkServer != null) { zkServer.shutdown(); - System.out.println( - "Shut down zookeeper at port " + zkServer.getPort() + " in thread " + Thread - .currentThread().getName()); + LOG.info("Shut down zookeeper at port " + zkServer.getPort() + " in thread " + Thread.currentThread().getName()); } } @@ -530,7 +527,6 @@ public void run() { } public static void printCache(Map cache) { - System.out.println("START:Print cache"); TreeMap map = new TreeMap(); map.putAll(cache); @@ -538,11 +534,10 @@ public static void printCache(Map cache) { ZNode node = map.get(key); TreeSet childSet = new TreeSet(); childSet.addAll(node.getChildSet()); - System.out.print( + LOG.info( key + "=" + node.getData() + ", " + childSet + ", " + (node.getStat() == null ? "null\n" : node.getStat())); } - System.out.println("END:Print cache"); } public static void readZkRecursive(String path, Map map, HelixZkClient zkclient) { @@ -622,10 +617,10 @@ public static boolean verifyZkCache(List paths, List pathsExclud if (zkMap.size() != cache.size()) { System.err .println("size mismatch: cacheSize: " + cache.size() + ", zkMapSize: " + zkMap.size()); - System.out.println("cache: (" + cache.size() + ")"); + LOG.info("cache: (" + cache.size() + ")"); TestHelper.printCache(cache); - System.out.println("zkMap: (" + zkMap.size() + ")"); + LOG.info("zkMap: (" + zkMap.size() + ")"); TestHelper.printCache(zkMap); return false; @@ -842,26 +837,26 @@ public static void printZkListeners(HelixZkClient client) throws Exception { Map> datalisteners = ZkTestHelper.getZkDataListener(client); Map> childListeners = ZkTestHelper.getZkChildListener(client); - System.out.println("dataListeners {"); + LOG.info("dataListeners {"); for (String path : datalisteners.keySet()) { - System.out.println("\t" + path + ": "); + LOG.info("\t" + path + ": "); Set set = datalisteners.get(path); for (IZkDataListener listener : set) { CallbackHandler handler = (CallbackHandler) listener; - System.out.println("\t\t" + handler.getListener()); + LOG.info("\t\t" + handler.getListener()); } } - System.out.println("}"); + LOG.info("}"); - System.out.println("childListeners {"); + LOG.info("childListeners {"); for (String path : childListeners.keySet()) { - System.out.println("\t" + path + ": "); + LOG.info("\t" + path + ": "); Set set = childListeners.get(path); for (IZkChildListener listener : set) { CallbackHandler handler = (CallbackHandler) listener; - System.out.println("\t\t" + handler.getListener()); + LOG.info("\t\t" + handler.getListener()); } } - System.out.println("}"); + LOG.info("}"); } } diff --git a/helix-core/src/test/java/org/apache/helix/TestListenerCallback.java b/helix-core/src/test/java/org/apache/helix/TestListenerCallback.java index 3814b82e4a..685ac811d7 100644 --- a/helix-core/src/test/java/org/apache/helix/TestListenerCallback.java +++ b/helix-core/src/test/java/org/apache/helix/TestListenerCallback.java @@ -100,7 +100,6 @@ public void reset() { @BeforeClass public void beforeClass() throws Exception { _clusterName = TestHelper.getTestClassName(); - System.out.println("START " + _clusterName + " at " + new Date(System.currentTimeMillis())); TestHelper.setupCluster(_clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix @@ -123,7 +122,6 @@ public void afterClass() throws Exception { _manager.disconnect(); } TestHelper.dropCluster(_clusterName, _gZkClient); - System.out.println("END " + _clusterName + " at " + new Date(System.currentTimeMillis())); } @Test diff --git a/helix-core/src/test/java/org/apache/helix/TestListenerCallbackBatchMode.java b/helix-core/src/test/java/org/apache/helix/TestListenerCallbackBatchMode.java index 58ad0d5218..0aa9b93485 100644 --- a/helix-core/src/test/java/org/apache/helix/TestListenerCallbackBatchMode.java +++ b/helix-core/src/test/java/org/apache/helix/TestListenerCallbackBatchMode.java @@ -127,22 +127,17 @@ public void afterClass() @Test public void testNonBatchedListener() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + methodName + " at " + new Date(System.currentTimeMillis())); final Listener listener = new Listener(); addListeners(listener); updateConfigs(); verifyNonbatchedListeners(listener); removeListeners(listener); - - System.out.println("END " + methodName + " at " + new Date(System.currentTimeMillis())); } @Test (dependsOnMethods = {"testNonBatchedListener", "testBatchedListener", "testMixedListener"}) public void testEnableBatchedListenerByJavaProperty() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + methodName + " at " + new Date(System.currentTimeMillis())); - System.setProperty("isAsyncBatchModeEnabled", "true"); Listener listener = new Listener(); @@ -162,15 +157,11 @@ public void testEnableBatchedListenerByJavaProperty() throws Exception { System.setProperty("helix.callbackhandler.isAsyncBatchModeEnabled", "false"); removeListeners(listener); - - System.out.println("END " + methodName + " at " + new Date(System.currentTimeMillis())); } @Test (dependsOnMethods = {"testNonBatchedListener", "testBatchedListener", "testMixedListener"}) public void testDisableBatchedListenerByAnnotation() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + methodName + " at " + new Date(System.currentTimeMillis())); - System.setProperty("isAsyncBatchModeEnabled", "true"); final Listener listener = new BatchDisableddListener(); @@ -180,29 +171,22 @@ public void testDisableBatchedListenerByAnnotation() throws Exception { System.setProperty("isAsyncBatchModeEnabled", "false"); removeListeners(listener); - - System.out.println("END " + methodName + " at " + new Date(System.currentTimeMillis())); } @Test public void testBatchedListener() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + methodName + " at " + new Date(System.currentTimeMillis())); final BatchedListener batchListener = new BatchedListener(); addListeners(batchListener); updateConfigs(); verifyBatchedListeners(batchListener); removeListeners(batchListener); - - System.out.println("END " + methodName + " at " + new Date(System.currentTimeMillis())); } @Test public void testMixedListener() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + methodName + " at " + new Date(System.currentTimeMillis())); - final MixedListener mixedListener = new MixedListener(); addListeners(mixedListener); updateConfigs(); @@ -216,8 +200,6 @@ public void testMixedListener() throws Exception { + _numNode + ", idealstate counts: " + _numResource); removeListeners(mixedListener); - - System.out.println("END " + methodName + " at " + new Date(System.currentTimeMillis())); } private void verifyNonbatchedListeners(final Listener listener) throws Exception { diff --git a/helix-core/src/test/java/org/apache/helix/TestListenerCallbackPrefetch.java b/helix-core/src/test/java/org/apache/helix/TestListenerCallbackPrefetch.java index c1abdc6fc9..988bfad425 100644 --- a/helix-core/src/test/java/org/apache/helix/TestListenerCallbackPrefetch.java +++ b/helix-core/src/test/java/org/apache/helix/TestListenerCallbackPrefetch.java @@ -111,7 +111,6 @@ public void afterClass() @Test public void testPrefetch() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + methodName + " at " + new Date(System.currentTimeMillis())); PrefetchListener listener = new PrefetchListener(); _manager.addInstanceConfigChangeListener(listener); @@ -130,8 +129,6 @@ public void testPrefetch() throws Exception { Assert.assertTrue(listener._containInstanceConfig); Assert.assertTrue(listener._idealStateChanged); Assert.assertTrue(listener._containIdealStates); - - System.out.println("END " + methodName + " at " + new Date(System.currentTimeMillis())); } @@ -156,8 +153,6 @@ public void testNoPrefetch() throws Exception { Assert.assertFalse(listener._containInstanceConfig); Assert.assertTrue(listener._idealStateChanged); Assert.assertFalse(listener._containIdealStates); - - System.out.println("END " + methodName + " at " + new Date(System.currentTimeMillis())); } @@ -183,8 +178,6 @@ public void testMixed() throws Exception { Assert.assertTrue(listener._containInstanceConfig); Assert.assertTrue(listener._idealStateChanged); Assert.assertFalse(listener._containIdealStates); - - System.out.println("END " + methodName + " at " + new Date(System.currentTimeMillis())); } private void updateInstanceConfig() { diff --git a/helix-core/src/test/java/org/apache/helix/TestRelayIdealStateCalculator.java b/helix-core/src/test/java/org/apache/helix/TestRelayIdealStateCalculator.java index 852b379426..5038c32fcf 100644 --- a/helix-core/src/test/java/org/apache/helix/TestRelayIdealStateCalculator.java +++ b/helix-core/src/test/java/org/apache/helix/TestRelayIdealStateCalculator.java @@ -77,6 +77,5 @@ public void testEspressoStorageClusterIdealState(int partitions, int nodes, int Assert.assertTrue(countMap.get(nodeName) <= partitions * replica / nodes + 1); // System.out.println(nodeName + " " + countMap.get(nodeName)); } - System.out.println(); } } diff --git a/helix-core/src/test/java/org/apache/helix/TestShuffledIdealState.java b/helix-core/src/test/java/org/apache/helix/TestShuffledIdealState.java index 6b8a69cca9..958c5d31b7 100644 --- a/helix-core/src/test/java/org/apache/helix/TestShuffledIdealState.java +++ b/helix-core/src/test/java/org/apache/helix/TestShuffledIdealState.java @@ -33,12 +33,17 @@ import org.apache.helix.tools.IdealStateCalculatorByShuffling; import org.apache.helix.zookeeper.datamodel.ZNRecord; import org.apache.helix.zookeeper.introspect.CodehausJacksonIntrospector; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.AssertJUnit; import org.testng.annotations.Test; public class TestShuffledIdealState { + + private static final Logger LOGGER = LoggerFactory.getLogger(TestShuffledIdealState.class); + @Test() public void testInvocation() throws Exception { int partitions = 6, replicas = 2; @@ -65,38 +70,35 @@ public void testInvocation() throws Exception { IdealCalculatorByConsistentHashing.printIdealStateStats(result3, ""); IdealCalculatorByConsistentHashing.printNodeOfflineOverhead(result3); - // System.out.println(result); + // LOGGER.info(result); ObjectMapper mapper = new ObjectMapper().setAnnotationIntrospector(new CodehausJacksonIntrospector()); // ByteArrayOutputStream baos = new ByteArrayOutputStream(); StringWriter sw = new StringWriter(); mapper.writeValue(sw, result); - // System.out.println(sw.toString()); + // LOGGER.info(sw.toString()); ZNRecord zn = mapper.readValue(new StringReader(sw.toString()), ZNRecord.class); - System.out.println(result.toString()); - System.out.println(zn.toString()); + LOGGER.info(result.toString()); + LOGGER.info(zn.toString()); AssertJUnit.assertTrue(zn.toString().equalsIgnoreCase(result.toString())); - System.out.println(); sw = new StringWriter(); mapper.writeValue(sw, result2); ZNRecord zn2 = mapper.readValue(new StringReader(sw.toString()), ZNRecord.class); - System.out.println(result2.toString()); - System.out.println(zn2.toString()); + LOGGER.info(result2.toString()); + LOGGER.info(zn2.toString()); AssertJUnit.assertTrue(zn2.toString().equalsIgnoreCase(result2.toString())); sw = new StringWriter(); mapper.writeValue(sw, result3); - System.out.println(); ZNRecord zn3 = mapper.readValue(new StringReader(sw.toString()), ZNRecord.class); - System.out.println(result3.toString()); - System.out.println(zn3.toString()); + LOGGER.info(result3.toString()); + LOGGER.info(zn3.toString()); AssertJUnit.assertTrue(zn3.toString().equalsIgnoreCase(result3.toString())); - System.out.println(); } @Test diff --git a/helix-core/src/test/java/org/apache/helix/TestZKCallback.java b/helix-core/src/test/java/org/apache/helix/TestZKCallback.java index 5dc0171ff8..7fd79a8fff 100644 --- a/helix-core/src/test/java/org/apache/helix/TestZKCallback.java +++ b/helix-core/src/test/java/org/apache/helix/TestZKCallback.java @@ -19,7 +19,6 @@ * under the License. */ -import java.util.Arrays; import java.util.List; import java.util.UUID; @@ -52,9 +51,7 @@ public class TestZKCallback extends ZkUnitTestBase { private final String clusterName = CLUSTER_PREFIX + "_" + getShortClassName(); private static String[] createArgs(String str) { - String[] split = str.split("[ ]+"); - System.out.println(Arrays.toString(split)); - return split; + return str.split("[ ]+"); } public class TestCallbackListener implements MessageListener, LiveInstanceChangeListener, diff --git a/helix-core/src/test/java/org/apache/helix/TestZNRecordBucketizer.java b/helix-core/src/test/java/org/apache/helix/TestZNRecordBucketizer.java index a1ca09c97f..90e2400d19 100644 --- a/helix-core/src/test/java/org/apache/helix/TestZNRecordBucketizer.java +++ b/helix-core/src/test/java/org/apache/helix/TestZNRecordBucketizer.java @@ -36,7 +36,6 @@ public void testZNRecordBucketizer() { int startBucketNb = i / bucketSize * bucketSize; int endBucketNb = startBucketNb + bucketSize - 1; String expectBucketName = "TestDB_p" + startBucketNb + "-p" + endBucketNb; - System.out.println("Expect: " + expectBucketName + ", actual: " + bucketName); Assert.assertEquals(expectBucketName, bucketName); } diff --git a/helix-core/src/test/java/org/apache/helix/TestZkBasis.java b/helix-core/src/test/java/org/apache/helix/TestZkBasis.java index c3ebcf0800..5265345172 100644 --- a/helix-core/src/test/java/org/apache/helix/TestZkBasis.java +++ b/helix-core/src/test/java/org/apache/helix/TestZkBasis.java @@ -72,7 +72,6 @@ public void testZkSessionExpiry() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); ZkClient client = new ZkClient(ZK_ADDR, HelixZkClient.DEFAULT_SESSION_TIMEOUT, HelixZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer()); @@ -85,7 +84,6 @@ public void testZkSessionExpiry() throws Exception { Assert.assertNotSame(newSessionId, oldSessionId); Assert.assertFalse(client.exists(path), "Ephemeral znode should be gone after session expiry"); client.close(); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -93,7 +91,6 @@ public void testCloseZkClient() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); ZkClient client = new ZkClient(ZK_ADDR, HelixZkClient.DEFAULT_SESSION_TIMEOUT, HelixZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer()); @@ -103,7 +100,6 @@ public void testCloseZkClient() { client.close(); Assert.assertFalse(_gZkClient.exists(path), "Ephemeral node: " + path + " should be removed after ZkClient#close()"); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -111,7 +107,6 @@ public void testCloseZkClientInZkClientEventThread() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); final CountDownLatch waitCallback = new CountDownLatch(1); final ZkClient client = new ZkClient(ZK_ADDR, HelixZkClient.DEFAULT_SESSION_TIMEOUT, @@ -135,9 +130,6 @@ public void handleDataChange(String dataPath, Object data) { waitCallback.await(); Assert.assertFalse(_gZkClient.exists(path), "Ephemeral node: " + path + " should be removed after ZkClient#close() in its own event-thread"); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); - } /** diff --git a/helix-core/src/test/java/org/apache/helix/ZkTestHelper.java b/helix-core/src/test/java/org/apache/helix/ZkTestHelper.java index 74158bc458..b6b4f0025e 100644 --- a/helix-core/src/test/java/org/apache/helix/ZkTestHelper.java +++ b/helix-core/src/test/java/org/apache/helix/ZkTestHelper.java @@ -273,7 +273,7 @@ public static boolean verifyState(RealmAwareZkClient zkclient, String clusterNam String expectState = expectInstanceStateMap.get(expectInstance); boolean equals = expectState.equals(actualState); if (op.equals("==") && !equals || op.equals("!=") && equals) { - System.out.println( + LOG.info( partition + "/" + instance + " state mismatch. actual state: " + actualState + ", but expect: " + expectState + ", op: " + op); result = false; @@ -464,7 +464,7 @@ public static boolean tryWaitZkEventsCleaned(RealmAwareZkClient zkclient) throws return true; } Thread.sleep(100); - System.out.println("pending zk-events in queue: " + queue); + LOG.info("pending zk-events in queue: " + queue); } return false; } diff --git a/helix-core/src/test/java/org/apache/helix/cloud/event/MockCloudEventAwareHelixManager.java b/helix-core/src/test/java/org/apache/helix/cloud/event/MockCloudEventAwareHelixManager.java index de46257d39..3c598e5b2b 100644 --- a/helix-core/src/test/java/org/apache/helix/cloud/event/MockCloudEventAwareHelixManager.java +++ b/helix-core/src/test/java/org/apache/helix/cloud/event/MockCloudEventAwareHelixManager.java @@ -59,8 +59,12 @@ import org.apache.helix.participant.StateMachineEngine; import org.apache.helix.store.zk.ZkHelixPropertyStore; import org.apache.helix.zookeeper.datamodel.ZNRecord; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class MockCloudEventAwareHelixManager implements HelixManager { + + private static final Logger LOGGER = LoggerFactory.getLogger(MockCloudEventAwareHelixManager.class); private final HelixManagerProperty _helixManagerProperty; private CloudEventListener _cloudEventListener; @@ -83,7 +87,7 @@ public void connect() if (helixCloudProperty != null && helixCloudProperty.isCloudEventCallbackEnabled()) { _cloudEventListener = new HelixCloudEventListener(helixCloudProperty.getCloudEventCallbackProperty(), this); - System.out.println("Using handler: " + helixCloudProperty.getCloudEventHandlerClassName()); + LOGGER.info("Using handler: " + helixCloudProperty.getCloudEventHandlerClassName()); CloudEventHandlerFactory.getInstance( _helixManagerProperty.getHelixCloudProperty().getCloudEventHandlerClassName()) .registerCloudEventListener(_cloudEventListener); @@ -99,8 +103,7 @@ public void disconnect() { _helixManagerProperty.getHelixCloudProperty().getCloudEventHandlerClassName()) .unregisterCloudEventListener(_cloudEventListener); } catch (Exception e) { - System.out.println("Failed to unregister cloudEventListener." ); - e.printStackTrace(); + LOGGER.error("Failed to unregister cloudEventListener.", e); } } } diff --git a/helix-core/src/test/java/org/apache/helix/common/ZkTestBase.java b/helix-core/src/test/java/org/apache/helix/common/ZkTestBase.java index 0218c3ffcb..541bb8bcb0 100644 --- a/helix-core/src/test/java/org/apache/helix/common/ZkTestBase.java +++ b/helix-core/src/test/java/org/apache/helix/common/ZkTestBase.java @@ -122,20 +122,20 @@ static public void reportPhysicalMemory() { com.sun.management.OperatingSystemMXBean os = (com.sun.management.OperatingSystemMXBean) java.lang.management.ManagementFactory.getOperatingSystemMXBean(); long physicalMemorySize = os.getTotalPhysicalMemorySize(); - System.out.println("************ SYSTEM Physical Memory:" + physicalMemorySize); + LOG.info("************ SYSTEM Physical Memory:" + physicalMemorySize); long MB = 1024 * 1024; Runtime runtime = Runtime.getRuntime(); long free = runtime.freeMemory()/MB; long total = runtime.totalMemory()/MB; - System.out.println("************ total memory:" + total + " free memory:" + free); + LOG.info("************ total memory:" + total + " free memory:" + free); } @BeforeSuite public void beforeSuite() throws Exception { // TODO: use logging.properties file to config java.util.logging.Logger levels java.util.logging.Logger topJavaLogger = java.util.logging.Logger.getLogger(""); - topJavaLogger.setLevel(Level.WARNING); + topJavaLogger.setLevel(Level.INFO); // Due to ZOOKEEPER-2693 fix, we need to specify whitelist for execute zk commends System.setProperty("zookeeper.4lw.commands.whitelist", "*"); @@ -605,7 +605,6 @@ protected List setupIdealState(String clusterName, int[] nodes, Stri idealState.setNumPartitions(partitions); idealStates.add(idealState); - // System.out.println(idealState); accessor.setProperty(keyBuilder.idealStates(resourceName), idealState); } return idealStates; @@ -614,7 +613,7 @@ protected List setupIdealState(String clusterName, int[] nodes, Stri @AfterClass public void cleanupLiveInstanceOwners() throws InterruptedException { String testClassName = this.getShortClassName(); - System.out.println("AfterClass: " + testClassName + " called."); + LOG.info("AfterClass: " + testClassName + " called."); for (String cluster : _liveInstanceOwners.keySet()) { Map clientMap = _liveInstanceOwners.get(cluster); for (HelixZkClient client : clientMap.values()) { diff --git a/helix-core/src/test/java/org/apache/helix/controller/rebalancer/TestAbstractRebalancer.java b/helix-core/src/test/java/org/apache/helix/controller/rebalancer/TestAbstractRebalancer.java index 45c35f3605..876346e873 100644 --- a/helix-core/src/test/java/org/apache/helix/controller/rebalancer/TestAbstractRebalancer.java +++ b/helix-core/src/test/java/org/apache/helix/controller/rebalancer/TestAbstractRebalancer.java @@ -41,7 +41,6 @@ public class TestAbstractRebalancer { public void testComputeBestPossibleState(String comment, String stateModelName, List liveInstances, List preferenceList, Map currentStateMap, List disabledInstancesForPartition, Map expectedBestPossibleMap) { - System.out.println("Test case comment: " + comment); AutoRebalancer rebalancer = new AutoRebalancer(); Partition partition = new Partition("testPartition"); CurrentStateOutput currentStateOutput = new CurrentStateOutput(); diff --git a/helix-core/src/test/java/org/apache/helix/controller/stages/BaseStageTest.java b/helix-core/src/test/java/org/apache/helix/controller/stages/BaseStageTest.java index fe77383e02..a796942abc 100644 --- a/helix-core/src/test/java/org/apache/helix/controller/stages/BaseStageTest.java +++ b/helix-core/src/test/java/org/apache/helix/controller/stages/BaseStageTest.java @@ -49,6 +49,8 @@ import org.apache.helix.model.StateModelDefinition; import org.apache.helix.tools.StateModelConfigGenerator; import org.apache.helix.zookeeper.datamodel.ZNRecord; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.ITestContext; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; @@ -56,6 +58,9 @@ import org.testng.annotations.BeforeMethod; public class BaseStageTest { + + private static final Logger LOG = LoggerFactory.getLogger(BaseStageTest.class); + public final static String HOSTNAME_PREFIX = "localhost_"; public final static String SESSION_PREFIX = "session_"; private final static int MIN_ACTIVE_REPLICA_NOT_SET = -1; @@ -69,14 +74,14 @@ public class BaseStageTest { @BeforeClass() public void beforeClass() { String className = this.getClass().getName(); - System.out.println("START " + className.substring(className.lastIndexOf('.') + 1) + " at " + LOG.info("START " + className.substring(className.lastIndexOf('.') + 1) + " at " + new Date(System.currentTimeMillis())); } @AfterClass() public void afterClass() { String className = this.getClass().getName(); - System.out.println("END " + className.substring(className.lastIndexOf('.') + 1) + " at " + LOG.info("END " + className.substring(className.lastIndexOf('.') + 1) + " at " + new Date(System.currentTimeMillis())); } @@ -94,7 +99,7 @@ public void setup() { @BeforeMethod public void beforeTest(Method testMethod, ITestContext testContext){ long startTime = System.currentTimeMillis(); - System.out.println("START " + testMethod.getName() + " at " + new Date(startTime)); + LOG.info("START " + testMethod.getName() + " at " + new Date(startTime)); testContext.setAttribute("StartTime", System.currentTimeMillis()); setup(); } @@ -103,7 +108,7 @@ public void beforeTest(Method testMethod, ITestContext testContext){ public void endTest(Method testMethod, ITestContext testContext) { Long startTime = (Long) testContext.getAttribute("StartTime"); long endTime = System.currentTimeMillis(); - System.out.println("END " + testMethod.getName() + " at " + new Date(endTime) + ", took: " + (endTime - startTime) + "ms."); + LOG.info("END " + testMethod.getName() + " at " + new Date(endTime) + ", took: " + (endTime - startTime) + "ms."); } protected List setupIdealState(int nodes, String[] resources, int partitions, diff --git a/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleCalcStageCompatibility.java b/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleCalcStageCompatibility.java index 4d8fb8669f..dfe1b77e69 100644 --- a/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleCalcStageCompatibility.java +++ b/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleCalcStageCompatibility.java @@ -42,9 +42,6 @@ public class TestBestPossibleCalcStageCompatibility extends BaseStageTest { @Test public void testSemiAutoModeCompatibility() { - System.out.println("START TestBestPossibleStateCalcStage at " - + new Date(System.currentTimeMillis())); - String[] resources = new String[] { "testResourceName" }; @@ -72,15 +69,10 @@ public void testSemiAutoModeCompatibility() { AssertJUnit.assertEquals("MASTER", output.getInstanceStateMap("testResourceName", resource) .get("localhost_" + (p + 1) % 5)); } - System.out.println("END TestBestPossibleStateCalcStage at " - + new Date(System.currentTimeMillis())); } @Test public void testCustomModeCompatibility() { - System.out.println("START TestBestPossibleStateCalcStage at " - + new Date(System.currentTimeMillis())); - String[] resources = new String[] { "testResourceName" }; @@ -108,8 +100,6 @@ public void testCustomModeCompatibility() { AssertJUnit.assertNull(output.getInstanceStateMap("testResourceName", resource).get( "localhost_" + (p + 1) % 5)); } - System.out.println("END TestBestPossibleStateCalcStage at " - + new Date(System.currentTimeMillis())); } protected List setupIdealStateDeprecated(int nodes, String[] resources, diff --git a/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleStateCalcStage.java b/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleStateCalcStage.java index 7289dc3f8b..e09ad83021 100644 --- a/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleStateCalcStage.java +++ b/helix-core/src/test/java/org/apache/helix/controller/stages/TestBestPossibleStateCalcStage.java @@ -35,10 +35,6 @@ public class TestBestPossibleStateCalcStage extends BaseStageTest { @Test public void testSimple() { - System.out.println("START TestBestPossibleStateCalcStage at " - + new Date(System.currentTimeMillis())); - // List idealStates = new ArrayList(); - String[] resources = new String[] { "testResourceName" }; @@ -71,8 +67,6 @@ public void testSimple() { Assert.assertEquals("MASTER", output.getInstanceStateMap("testResourceName", resource) .get("localhost_" + (p + 1) % 5)); } - System.out.println("END TestBestPossibleStateCalcStage at " - + new Date(System.currentTimeMillis())); } /* diff --git a/helix-core/src/test/java/org/apache/helix/controller/stages/TestMessageThrottleStage.java b/helix-core/src/test/java/org/apache/helix/controller/stages/TestMessageThrottleStage.java index e7b9d342bb..f556e215fe 100644 --- a/helix-core/src/test/java/org/apache/helix/controller/stages/TestMessageThrottleStage.java +++ b/helix-core/src/test/java/org/apache/helix/controller/stages/TestMessageThrottleStage.java @@ -51,7 +51,6 @@ public class TestMessageThrottleStage extends ZkUnitTestBase { @Test public void testMsgThrottleBasic() throws Exception { String clusterName = "CLUSTER_" + _className + "_basic"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_gZkClient)); @@ -119,13 +118,11 @@ public void testMsgThrottleBasic() throws Exception { deleteLiveInstances(clusterName); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test() public void testMsgThrottleConstraints() throws Exception { String clusterName = "CLUSTER_" + _className + "_constraints"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_gZkClient)); @@ -303,7 +300,6 @@ public void testMsgThrottleConstraints() throws Exception { deleteLiveInstances(clusterName); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } private boolean containsConstraint(Set constraints, ConstraintItem constraint) { diff --git a/helix-core/src/test/java/org/apache/helix/controller/stages/TestMsgSelectionStage.java b/helix-core/src/test/java/org/apache/helix/controller/stages/TestMsgSelectionStage.java index 988b4994d2..1515026c08 100644 --- a/helix-core/src/test/java/org/apache/helix/controller/stages/TestMsgSelectionStage.java +++ b/helix-core/src/test/java/org/apache/helix/controller/stages/TestMsgSelectionStage.java @@ -59,8 +59,6 @@ private Message newMessage(String resourceName, String partitionName, String ins @Test public void testMasterXfer() { - System.out.println("START testMasterXfer at " + new Date(System.currentTimeMillis())); - Map liveInstances = new HashMap(); liveInstances.put("localhost_0", new LiveInstance("localhost_0")); liveInstances.put("localhost_1", new LiveInstance("localhost_1")); @@ -92,14 +90,10 @@ public void testMasterXfer() { Assert.assertEquals(selectedMsg.size(), 1); Assert.assertEquals(selectedMsg.get(0).getMsgId(), "msgId_1"); - System.out.println("END testMasterXfer at " + new Date(System.currentTimeMillis())); } @Test public void testMasterXferAfterMasterResume() { - System.out.println("START testMasterXferAfterMasterResume at " - + new Date(System.currentTimeMillis())); - Map liveInstances = new HashMap(); liveInstances.put("localhost_0", new LiveInstance("localhost_0")); liveInstances.put("localhost_1", new LiveInstance("localhost_1")); @@ -129,7 +123,5 @@ public void testMasterXferAfterMasterResume() { BuiltInStateModelDefinitions.MasterSlave.getStateModelDefinition(), false); Assert.assertEquals(selectedMsg.size(), 0); - System.out.println("END testMasterXferAfterMasterResume at " - + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/controller/stages/TestRebalancePipeline.java b/helix-core/src/test/java/org/apache/helix/controller/stages/TestRebalancePipeline.java index 40fa82030a..66d1285c70 100644 --- a/helix-core/src/test/java/org/apache/helix/controller/stages/TestRebalancePipeline.java +++ b/helix-core/src/test/java/org/apache/helix/controller/stages/TestRebalancePipeline.java @@ -57,7 +57,6 @@ public class TestRebalancePipeline extends ZkUnitTestBase { @Test public void testDuplicateMsg() throws Exception { String clusterName = "CLUSTER_" + _className + "_dup"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_gZkClient)); @@ -168,13 +167,11 @@ public void testDuplicateMsg() throws Exception { deleteLiveInstances(clusterName); deleteCluster(clusterName); executorService.shutdown(); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test public void testMsgTriggeredRebalance() throws Exception { String clusterName = "CLUSTER_" + _className + "_msgTrigger"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_gZkClient)); @@ -291,7 +288,6 @@ public void testMsgTriggeredRebalance() throws Exception { } deleteLiveInstances(clusterName); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -299,7 +295,6 @@ public void testChangeIdealStateWithPendingMsg() throws Exception { String clusterName = "CLUSTER_" + _className + "_pending"; HelixAdmin admin = new ZKHelixAdmin(_gZkClient); - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); admin.addCluster(clusterName); HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_gZkClient)); @@ -389,15 +384,12 @@ public void testChangeIdealStateWithPendingMsg() throws Exception { deleteLiveInstances(clusterName); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test public void testMasterXfer() throws Exception { String clusterName = "CLUSTER_" + _className + "_xfer"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_gZkClient)); HelixManager manager = @@ -468,15 +460,12 @@ public void testMasterXfer() throws Exception { deleteLiveInstances(clusterName); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test public void testNoDuplicatedMaster() throws Exception { String clusterName = "CLUSTER_" + _className + "_no_duplicated_master"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_gZkClient)); HelixManager manager = @@ -539,7 +528,6 @@ public void testNoDuplicatedMaster() throws Exception { deleteLiveInstances(clusterName); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } /* diff --git a/helix-core/src/test/java/org/apache/helix/controller/strategy/crushMapping/TestCardDealingAdjustmentAlgorithmV2.java b/helix-core/src/test/java/org/apache/helix/controller/strategy/crushMapping/TestCardDealingAdjustmentAlgorithmV2.java index e4f0cad23a..7c9c8c6a22 100644 --- a/helix-core/src/test/java/org/apache/helix/controller/strategy/crushMapping/TestCardDealingAdjustmentAlgorithmV2.java +++ b/helix-core/src/test/java/org/apache/helix/controller/strategy/crushMapping/TestCardDealingAdjustmentAlgorithmV2.java @@ -26,13 +26,17 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.logging.Level; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Sets; +import org.apache.helix.controller.rebalancer.TestConstraintRebalanceStrategy; import org.apache.helix.controller.rebalancer.strategy.crushMapping.CardDealingAdjustmentAlgorithmV2; import org.apache.helix.controller.rebalancer.topology.InstanceNode; import org.apache.helix.controller.rebalancer.topology.Node; import org.apache.helix.controller.rebalancer.topology.Topology; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.DataProvider; @@ -42,6 +46,9 @@ import static org.mockito.Mockito.when; public class TestCardDealingAdjustmentAlgorithmV2 { + + private static final Logger LOGGER = LoggerFactory.getLogger(TestCardDealingAdjustmentAlgorithmV2.class); + private static int DEFAULT_REPLICA_COUNT = 3; private static int DEFAULT_RANDOM_SEED = 10; private static int NUMS_ZONES = 3; @@ -63,8 +70,11 @@ public class TestCardDealingAdjustmentAlgorithmV2 { @BeforeClass public void setUpTopology() { + java.util.logging.Logger topJavaLogger = java.util.logging.Logger.getLogger(""); + topJavaLogger.setLevel(Level.INFO); + _topology = mock(Topology.class); - System.out.println("Default ZONES: " + Arrays.deepToString(DEFAULT_ZONES)); + LOGGER.info("Default ZONES: " + Arrays.deepToString(DEFAULT_ZONES)); when(_topology.getFaultZones()).thenReturn(createFaultZones(DEFAULT_ZONES)); } @@ -96,7 +106,6 @@ private List createFaultZones(int[][] instancesMap) { @Test(description = "Verify a few properties after algorithm object is created") public void testAlgorithmConstructor() { - System.out.println("START TestCardDealingAdjustmentAlgorithmV2.testAlgorithmConstructor"); CardDealingAdjustmentAlgorithmV2Accessor algorithm = new CardDealingAdjustmentAlgorithmV2Accessor(_topology, DEFAULT_REPLICA_COUNT, CardDealingAdjustmentAlgorithmV2.Mode.EVENNESS); @@ -142,7 +151,6 @@ public void testAlgorithmConstructor() { Assert.assertEquals(instanceNodes.size(), NUM_INSTANCES_PER_ZONE); Assert.assertEquals(actualInstanceIds, expectedInstanceIds); } - System.out.println("END TestCardDealingAdjustmentAlgorithmV2.testAlgorithmConstructor"); } @DataProvider @@ -193,7 +201,6 @@ public static Object[][] stableComputingVerification() { dependsOnMethods = "testAlgorithmConstructor") public void testStableComputeMappingForMultipleTimes(int replica, int repeatTimes, int seed, boolean isEvennessPreferred) { - System.out.println("START TestCardDealingAdjustmentAlgorithmV2.testStableComputeMappingForMultipleTimes"); CardDealingAdjustmentAlgorithmV2.Mode preference = isEvennessPreferred ? CardDealingAdjustmentAlgorithmV2.Mode.EVENNESS : CardDealingAdjustmentAlgorithmV2.Mode.MINIMIZE_MOVEMENT; @@ -210,8 +217,7 @@ public void testStableComputeMappingForMultipleTimes(int replica, int repeatTime Map> oldSimpleMapping = getSimpleMapping(nodeToPartitions); Map> lastCalculatedDifference = new HashMap<>(); while (repeatTimes > 0) { - System.out.println(String.format("Round %s replica %s algorithm seed: %s preference: %s ", - repeatTimes, replica, seed, preference)); + LOGGER.info("Round {} replica {} algorithm seed: {} preference: {}", repeatTimes, replica, seed, preference); // deep clone the original mapping Map> newMapping = new HashMap<>(); for (Map.Entry> entry : nodeToPartitions.entrySet()) { @@ -230,7 +236,6 @@ public void testStableComputeMappingForMultipleTimes(int replica, int repeatTime lastCalculatedDifference = newDifference; repeatTimes -= 1; } - System.out.println("END TestCardDealingAdjustmentAlgorithmV2.testStableComputeMappingForMultipleTimes"); } @DataProvider @@ -252,7 +257,6 @@ public static Object[][] replicas() { @Test(description = "Test performance given different replica count", dataProvider = "replicas", dependsOnMethods = "testStableComputeMappingForMultipleTimes") public void testComputeMappingForDifferentReplicas(int replica) { - System.out.println("SATRT TestCardDealingAdjustmentAlgorithmV2.testComputeMappingForDifferentReplicas"); CardDealingAdjustmentAlgorithmV2Accessor algorithm = new CardDealingAdjustmentAlgorithmV2Accessor(_topology, replica, CardDealingAdjustmentAlgorithmV2.Mode.EVENNESS); @@ -279,13 +283,10 @@ public void testComputeMappingForDifferentReplicas(int replica) { Assert.fail(String.format("Total movements: %s != expected %s, replica: %s", totalMovements, expected.get(replica), replica)); } - System.out.println("END TestCardDealingAdjustmentAlgorithmV2.testComputeMappingForDifferentReplicas"); - } @Test(description = "Test performance given different preference (evenness or less movements)", dependsOnMethods = "testComputeMappingForDifferentReplicas") public void testComputeMappingForDifferentPreference() { - System.out.println("START TestCardDealingAdjustmentAlgorithmV2.testComputeMappingForDifferentPreference"); CardDealingAdjustmentAlgorithmV2Accessor algorithm1 = new CardDealingAdjustmentAlgorithmV2Accessor(_topology, DEFAULT_REPLICA_COUNT, CardDealingAdjustmentAlgorithmV2.Mode.EVENNESS); @@ -311,17 +312,16 @@ public void testComputeMappingForDifferentPreference() { int movement1 = getTotalMovements(oldSimpleMapping, getSimpleMapping(nodeToPartitions)); int movement2 = getTotalMovements(oldSimpleMapping, getSimpleMapping(newMapping)); - System.out.println(String.format("Total movements: %s, isAllAssigned: %s, preference: %s", + LOGGER.info(String.format("Total movements: %s, isAllAssigned: %s, preference: %s", movement1, isAllAssigned1, CardDealingAdjustmentAlgorithmV2.Mode.EVENNESS)); - System.out.println(String.format("Total movements: %s, isAllAssigned: %s, preference: %s", + LOGGER.info(String.format("Total movements: %s, isAllAssigned: %s, preference: %s", movement2, isAllAssigned2, CardDealingAdjustmentAlgorithmV2.Mode.MINIMIZE_MOVEMENT)); Assert.assertTrue(movement1 >= movement2); - System.out.println("START TestCardDealingAdjustmentAlgorithmV2.testComputeMappingForDifferentPreference"); + LOGGER.info("START TestCardDealingAdjustmentAlgorithmV2.testComputeMappingForDifferentPreference"); } @Test (dependsOnMethods = "testComputeMappingForDifferentPreference") public void testComputeMappingWhenZeroWeightInstance() { - System.out.println("START TestCardDealingAdjustmentAlgorithmV2.testComputeMappingWhenZeroWeightInstance"); when(_topology.getFaultZones()).thenReturn(createFaultZones(new int[][] { { 0, 1 @@ -348,15 +348,13 @@ public void testComputeMappingWhenZeroWeightInstance() { boolean isAssigned = algorithm.computeMapping(nodeToPartitions, DEFAULT_RANDOM_SEED); Map> newSimpleMapping = getSimpleMapping(nodeToPartitions); - System.out.println("old mapping" + oldSimpleMapping); - System.out.println("new mapping" + newSimpleMapping); + LOGGER.info("old mapping" + oldSimpleMapping); + LOGGER.info("new mapping" + newSimpleMapping); Assert.assertTrue(newSimpleMapping.get(0L).isEmpty()); - System.out.println("END TestCardDealingAdjustmentAlgorithmV2.testComputeMappingWhenZeroWeightInstance"); } @Test (dependsOnMethods = "testComputeMappingWhenZeroWeightInstance") public void testComputeMappingWhenZeroWeightZone() { - System.out.println("START TestCardDealingAdjustmentAlgorithmV2.testComputeMappingWhenZeroWeightZone"); when(_topology.getFaultZones()).thenReturn(createFaultZones(new int[][] { { 0 @@ -382,10 +380,9 @@ public void testComputeMappingWhenZeroWeightZone() { boolean isAssigned = algorithm.computeMapping(nodeToPartitions, DEFAULT_RANDOM_SEED); Map> newSimpleMapping = getSimpleMapping(nodeToPartitions); - System.out.println("old mapping" + oldSimpleMapping); - System.out.println("new mapping" + newSimpleMapping); + LOGGER.info("old mapping" + oldSimpleMapping); + LOGGER.info("new mapping" + newSimpleMapping); Assert.assertTrue(newSimpleMapping.get(0L).isEmpty()); - System.out.println("START TestCardDealingAdjustmentAlgorithmV2.testComputeMappingWhenZeroWeightZone"); } private int getTotalMovements(Map> oldSimpleMapping, diff --git a/helix-core/src/test/java/org/apache/helix/integration/SinglePartitionLeaderStandByTest.java b/helix-core/src/test/java/org/apache/helix/integration/SinglePartitionLeaderStandByTest.java index b413c2a6ea..1f0318ffe2 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/SinglePartitionLeaderStandByTest.java +++ b/helix-core/src/test/java/org/apache/helix/integration/SinglePartitionLeaderStandByTest.java @@ -48,8 +48,6 @@ public void test() String clusterName = TestHelper.getTestMethodName(); int n = 4; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - // Thread.currentThread().join(); TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix @@ -100,6 +98,5 @@ public void test() participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestAddClusterV2.java b/helix-core/src/test/java/org/apache/helix/integration/TestAddClusterV2.java index d1dfee853f..0564107fad 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestAddClusterV2.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestAddClusterV2.java @@ -53,8 +53,6 @@ public class TestAddClusterV2 extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - // setup CONTROLLER_CLUSTER _gSetupTool.addCluster(CONTROLLER_CLUSTER, true); for (int i = 0; i < NODE_NR; i++) { @@ -104,8 +102,6 @@ public void Test() { @AfterClass public void afterClass() throws Exception { - System.out.println("AFTERCLASS " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - /** * shutdown order: * 1) pause the leader (optional) @@ -136,7 +132,6 @@ public void afterClass() throws Exception { deleteCluster(clusterName); } deleteCluster(CONTROLLER_CLUSTER); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } /** diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestAddNodeAfterControllerStart.java b/helix-core/src/test/java/org/apache/helix/integration/TestAddNodeAfterControllerStart.java index 985867d21e..d1e68c1226 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestAddNodeAfterControllerStart.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestAddNodeAfterControllerStart.java @@ -43,8 +43,6 @@ public class TestAddNodeAfterControllerStart extends ZkTestBase { @Test public void testStandalone() throws Exception { String clusterName = className + "_standalone"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - final int nodeNr = 5; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, "localhost", "TestDB", 1, 20, nodeNr - 1, @@ -87,14 +85,11 @@ public void testStandalone() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test public void testDistributed() throws Exception { String clusterName = className + "_distributed"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // setup grand cluster final String grandClusterName = "GRAND_" + clusterName; @@ -157,7 +152,6 @@ public void testDistributed() throws Exception { // check if controller_0 has message listener for localhost_12918 String msgPath = PropertyPathBuilder.instanceMessage(clusterName, "localhost_12918"); int numberOfListeners = ZkTestHelper.numberOfListeners(ZK_ADDR, msgPath); - // System.out.println("numberOfListeners(" + msgPath + "): " + numberOfListeners); Assert.assertEquals(numberOfListeners, 2); // 1 of participant, and 1 of controller _gSetupTool.addInstanceToCluster(clusterName, "localhost_12919"); @@ -170,7 +164,6 @@ public void testDistributed() throws Exception { // check if controller_0 has message listener for localhost_12919 msgPath = PropertyPathBuilder.instanceMessage(clusterName, "localhost_12919"); numberOfListeners = ZkTestHelper.numberOfListeners(ZK_ADDR, msgPath); - // System.out.println("numberOfListeners(" + msgPath + "): " + numberOfListeners); Assert.assertEquals(numberOfListeners, 2); // 1 of participant, and 1 of controller // clean up @@ -198,8 +191,6 @@ public void testDistributed() throws Exception { deleteCluster(clusterName); deleteCluster(grandClusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } private boolean checkHandlers(List handlers, String path) { diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestAddStateModelFactoryAfterConnect.java b/helix-core/src/test/java/org/apache/helix/integration/TestAddStateModelFactoryAfterConnect.java index a3ae96a19f..d319d43645 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestAddStateModelFactoryAfterConnect.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestAddStateModelFactoryAfterConnect.java @@ -48,8 +48,6 @@ public void testBasic() throws Exception { String clusterName = className + "_" + methodName; final int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -131,8 +129,5 @@ public void testBasic() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); - } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestAlertingRebalancerFailure.java b/helix-core/src/test/java/org/apache/helix/integration/TestAlertingRebalancerFailure.java index 2f1dee269f..0b0adaa232 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestAlertingRebalancerFailure.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestAlertingRebalancerFailure.java @@ -71,8 +71,6 @@ public class TestAlertingRebalancerFailure extends ZkStandAloneCMTestBase { @Override @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - // Clean up all JMX objects for (ObjectName mbean : _server.queryNames(null, null)) { try { diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestCMWithFailParticipant.java b/helix-core/src/test/java/org/apache/helix/integration/TestCMWithFailParticipant.java index c8e4fda2b9..0b83a0021d 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestCMWithFailParticipant.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestCMWithFailParticipant.java @@ -51,7 +51,6 @@ public void testCMWithFailParticipant() throws Exception { String uniqClusterName = "TestFail_" + "rg" + numResources + "_p" + numPartitionsPerResource + "_n" + numInstance + "_r" + replica; - System.out.println("START " + uniqClusterName + " at " + new Date(System.currentTimeMillis())); TestDriver.setupCluster(uniqClusterName, ZK_ADDR, numResources, numPartitionsPerResource, numInstance, replica); @@ -65,8 +64,5 @@ public void testCMWithFailParticipant() throws Exception { TestDriver.verifyCluster(uniqClusterName, 3000, 50 * 1000); TestDriver.stopCluster(uniqClusterName); deleteCluster(uniqClusterName); - - System.out.println("END " + uniqClusterName + " at " + new Date(System.currentTimeMillis())); - } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestCarryOverBadCurState.java b/helix-core/src/test/java/org/apache/helix/integration/TestCarryOverBadCurState.java index 640103f69c..8745c8a724 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestCarryOverBadCurState.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestCarryOverBadCurState.java @@ -36,8 +36,6 @@ public class TestCarryOverBadCurState extends ZkTestBase { @Test public void testCarryOverBadCurState() throws Exception { - System.out.println("START testCarryOverBadCurState at " + new Date(System.currentTimeMillis())); - String clusterName = getShortClassName(); MockParticipantManager[] participants = new MockParticipantManager[5]; @@ -84,6 +82,5 @@ public void testCarryOverBadCurState() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - System.out.println("END testCarryOverBadCurState at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestCleanupExternalView.java b/helix-core/src/test/java/org/apache/helix/integration/TestCleanupExternalView.java index c8b145078b..88844f7623 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestCleanupExternalView.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestCleanupExternalView.java @@ -51,8 +51,6 @@ public void test() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -123,8 +121,6 @@ public void test() throws Exception { participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestClusterStartsup.java b/helix-core/src/test/java/org/apache/helix/integration/TestClusterStartsup.java index b21d3c646e..1235b9906a 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestClusterStartsup.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestClusterStartsup.java @@ -34,8 +34,6 @@ public class TestClusterStartsup extends ZkStandAloneCMTestBase { void setupCluster() throws HelixException { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); _gSetupTool.addResourceToCluster(CLUSTER_NAME, TEST_DB, 20, STATE_MODEL); diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestComputeAndCleanupCustomizedView.java b/helix-core/src/test/java/org/apache/helix/integration/TestComputeAndCleanupCustomizedView.java index 061dfcf63b..2ede736475 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestComputeAndCleanupCustomizedView.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestComputeAndCleanupCustomizedView.java @@ -63,8 +63,6 @@ public void test() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -259,7 +257,6 @@ public boolean verify() { keyBuilder.currentState(INSTANCE_NAME2, CUSTOMIZED_STATE_NAME1, RESOURCE_NAME)); // re-enable controller shall remove orphan external view - // System.out.println("re-enabling controller"); admin.enableCluster(clusterName, true); result = TestHelper.verify(new TestHelper.Verifier() { @@ -285,7 +282,5 @@ public boolean verify() { participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } \ No newline at end of file diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestCustomizedViewAggregation.java b/helix-core/src/test/java/org/apache/helix/integration/TestCustomizedViewAggregation.java index f3d5df03a8..641e1f293a 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestCustomizedViewAggregation.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestCustomizedViewAggregation.java @@ -94,8 +94,6 @@ public void beforeClass() throws Exception { String clusterName = TestHelper.getTestClassName(); int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDisable.java b/helix-core/src/test/java/org/apache/helix/integration/TestDisable.java index 44dfd820bf..3a7fa60e3d 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDisable.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDisable.java @@ -53,8 +53,6 @@ public void testDisableNodeCustomIS() throws Exception { final int n = 5; String disableNode = "localhost_12918"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -126,7 +124,6 @@ public void testDisableNodeCustomIS() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -137,8 +134,6 @@ public void testDisableNodeAutoIS() throws Exception { final int n = 5; String disableNode = "localhost_12919"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -204,7 +199,6 @@ public void testDisableNodeAutoIS() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -215,8 +209,6 @@ public void testDisablePartitionCustomIS() throws Exception { String clusterName = className + "_" + methodName; final int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -293,7 +285,6 @@ public void testDisablePartitionCustomIS() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -304,8 +295,6 @@ public void testDisablePartitionAutoIS() throws Exception { String clusterName = className + "_" + methodName; final int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -372,6 +361,5 @@ public void testDisablePartitionAutoIS() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDisableCustomCodeRunner.java b/helix-core/src/test/java/org/apache/helix/integration/TestDisableCustomCodeRunner.java index a5416d4d13..77495b6b84 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDisableCustomCodeRunner.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDisableCustomCodeRunner.java @@ -85,8 +85,6 @@ public void test() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -222,7 +220,6 @@ public void test() throws Exception { deleteLiveInstances(clusterName); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } private String verifyCustomCodeInvoked(Map callbacks, diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDisableExternalView.java b/helix-core/src/test/java/org/apache/helix/integration/TestDisableExternalView.java index 1f460e7873..d68f0e5a57 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDisableExternalView.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDisableExternalView.java @@ -66,8 +66,6 @@ public class TestDisableExternalView extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _admin = new ZKHelixAdmin(_gZkClient); String namespace = "/" + CLUSTER_NAME; if (_gZkClient.exists(namespace)) { diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDisableResource.java b/helix-core/src/test/java/org/apache/helix/integration/TestDisableResource.java index 3a3824217e..70faa0bdd9 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDisableResource.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDisableResource.java @@ -54,8 +54,6 @@ public void testDisableResourceInSemiAutoMode() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -142,7 +140,6 @@ public void testDisableResourceInSemiAutoMode() throws Exception { Assert.assertTrue(result); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -151,8 +148,6 @@ public void testDisableResourceInFullAutoMode() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -236,8 +231,6 @@ public void testDisableResourceInFullAutoMode() throws Exception { Assert.assertTrue(result); TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -246,8 +239,6 @@ public void testDisableResourceInCustomMode() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -339,8 +330,6 @@ public void testDisableResourceInCustomMode() throws Exception { Assert.assertTrue(result); TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } private void enableResource(String clusterName, boolean enabled) { diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java b/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java index 178266057c..b7addc60a7 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDistributedCMMain.java @@ -161,8 +161,6 @@ public void testDistributedCMMain() throws Exception { } // clean up - // wait for all zk callbacks done - System.out.println("Cleaning up..."); for (int i = 0; i < 2 * n; i++) { if (controllers[i] != null && controllers[i].isConnected()) { controllers[i].syncStop(); @@ -178,7 +176,5 @@ public void testDistributedCMMain() throws Exception { for (String cluster : _clusters) { deleteCluster(cluster); } - - System.out.println("END " + clusterNamePrefix + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDistributedClusterController.java b/helix-core/src/test/java/org/apache/helix/integration/TestDistributedClusterController.java index c0bc5a9feb..115f1b3ea7 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDistributedClusterController.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDistributedClusterController.java @@ -130,8 +130,6 @@ public void testDistributedClusterController() throws Exception { Assert.assertTrue(result, "second cluster NOT in ideal state"); // clean up - // wait for all zk callbacks done - System.out.println("Cleaning up..."); for (int i = 0; i < 5; i++) { Assert.assertTrue(ClusterStateVerifier .verifyByZkCallback(new BestPossAndExtViewZkVerifier(ZK_ADDR, controllerClusterName))); diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java b/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java index d8bbcb4bf1..39a4412b3f 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDriver.java @@ -365,7 +365,7 @@ public static void setIdealState(String uniqClusterName, long beginTime, int per ZNRecord nextIS; int step = totalStep * percentage / 100; - System.out.println("Resource:" + dbName + ", totalSteps from initIS to destIS:" + totalStep + LOG.info("Resource:" + dbName + ", totalSteps from initIS to destIS:" + totalStep + ", walk " + step + " steps(" + percentage + "%)"); nextIS = nextIdealState(initIS, destIS, step); // testInfo._idealStateMap.put(dbName, nextIS); diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java b/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java index a759f2a97c..390d67ff95 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestDrop.java @@ -84,8 +84,6 @@ public void testBasic() throws Exception { String clusterName = className + "_" + methodName; final int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -126,7 +124,6 @@ public void testBasic() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -137,8 +134,6 @@ public void testDropErrorPartitionAutoIS() throws Exception { String clusterName = className + "_" + methodName; final int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -206,7 +201,6 @@ public void testDropErrorPartitionAutoIS() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -216,8 +210,6 @@ public void testDropErrorPartitionFailedAutoIS() throws Exception { String clusterName = className + "_" + methodName; final int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -310,7 +302,6 @@ public void testDropErrorPartitionFailedAutoIS() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -321,8 +312,6 @@ public void testDropErrorPartitionCustomIS() throws Exception { String clusterName = className + "_" + methodName; final int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -401,7 +390,6 @@ public void testDropErrorPartitionCustomIS() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -412,8 +400,6 @@ public void testDropSchemataResource() throws Exception { String clusterName = className + "_" + methodName; final int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -454,7 +440,6 @@ public void testDropSchemataResource() throws Exception { Assert.assertTrue(verifier.verifyByPolling()); // drop schemata resource group - // System.out.println("Dropping schemata resource group..."); command = "--zkSvr " + ZK_ADDR + " --dropResource " + clusterName + " schemata"; ClusterSetup.processCommandLineArgs(command.split("\\s+")); Assert.assertTrue(verifier.verifyByPolling()); @@ -470,6 +455,5 @@ public void testDropSchemataResource() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java b/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java index fcc94e9d86..579152f6cc 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestEnableCompression.java @@ -62,8 +62,6 @@ public void testEnableCompressionResource() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[5]; // ClusterSetup setupTool = new ClusterSetup(ZK_ADDR); int numNodes = 10; @@ -131,7 +129,6 @@ public void testEnableCompressionResource() throws Exception { List compressedPaths = new ArrayList<>(); findCompressedZNodes(zkClient, "/" + clusterName, compressedPaths); - System.out.println("compressed paths:" + compressedPaths); // ONLY IDEALSTATE and EXTERNAL VIEW must be compressed Assert.assertEquals(compressedPaths.size(), 2); String idealstatePath = PropertyPathBuilder.idealState(clusterName, resourceName); @@ -158,7 +155,6 @@ public void testEnableCompressionResource() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } private void findCompressedZNodes(HelixZkClient zkClient, String path, diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java b/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java index 496292e9e5..98e7427fdf 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestEnablePartitionDuringDisable.java @@ -81,8 +81,6 @@ public void testEnablePartitionDuringDisable() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -132,7 +130,6 @@ public void testEnablePartitionDuringDisable() throws Exception { Thread.sleep(100); } long endT = System.currentTimeMillis(); - System.out.println("1 disable and re-enable took: " + (endT - startT) + "ms"); Assert.assertEquals(transition.slaveToOfflineCnt, 1, "should get 1 slaveToOffline transition"); Assert.assertEquals(transition.offlineToSlave, 1, "should get 1 offlineToSlave transition"); @@ -143,7 +140,6 @@ public void testEnablePartitionDuringDisable() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestEntropyFreeNodeBounce.java b/helix-core/src/test/java/org/apache/helix/integration/TestEntropyFreeNodeBounce.java index bb5a3fb9b6..4fe562a8a0 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestEntropyFreeNodeBounce.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestEntropyFreeNodeBounce.java @@ -66,7 +66,6 @@ public void testBounceAll() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // Set up cluster TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -135,7 +134,6 @@ public void testBounceAll() throws Exception { participant.disconnect(); } TestHelper.dropCluster(clusterName, _gZkClient); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestErrorPartition.java b/helix-core/src/test/java/org/apache/helix/integration/TestErrorPartition.java index bd87a3c41b..b525cb4e4f 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestErrorPartition.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestErrorPartition.java @@ -41,7 +41,6 @@ public void testErrorPartition() throws Exception { String clusterName = getShortClassName(); MockParticipantManager[] participants = new MockParticipantManager[5]; - System.out.println("START testErrorPartition() at " + new Date(System.currentTimeMillis())); ZKHelixAdmin tool = new ZKHelixAdmin(_gZkClient); TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, "localhost", "TestDB", 1, 10, 5, 3, @@ -124,6 +123,5 @@ public void testErrorPartition() throws Exception { } deleteCluster(clusterName); - System.out.println("END testErrorPartition() at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestErrorReplicaPersist.java b/helix-core/src/test/java/org/apache/helix/integration/TestErrorReplicaPersist.java index 5c7fb867b6..910a251ba7 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestErrorReplicaPersist.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestErrorReplicaPersist.java @@ -51,9 +51,6 @@ public class TestErrorReplicaPersist extends ZkStandAloneCMTestBase { @BeforeClass public void beforeClass() throws Exception { - // Logger.getRootLogger().setLevel(Level.INFO); - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - int numNode = NODE_NR + 1; _participants = new MockParticipantManager[numNode]; // setup storage cluster @@ -103,7 +100,7 @@ public void testErrorReplicaPersist() throws InterruptedException { ClusterConfig clusterConfig = configAccessor.getClusterConfig(CLUSTER_NAME); clusterConfig.setErrorPartitionThresholdForLoadBalance(100000); configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig); - + for (int i = 0; i < (NODE_NR + 1) / 2; i++) { _participants[i].syncStop(); Thread.sleep(2000); diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestExternalCmd.java b/helix-core/src/test/java/org/apache/helix/integration/TestExternalCmd.java index 745449827e..75a0775a0c 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestExternalCmd.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestExternalCmd.java @@ -37,14 +37,9 @@ public void testExternalCmd() throws Exception { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - ExternalCommand cmd = ScriptTestHelper.runCommandLineTest("dummy.sh"); String output = cmd.getStringOutput("UTF8"); int idx = output.indexOf("this is a dummy test for verify ExternalCommand works"); Assert.assertNotSame(idx, -1); - - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); - } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestExternalViewUpdates.java b/helix-core/src/test/java/org/apache/helix/integration/TestExternalViewUpdates.java index 132f2598dd..11acecf694 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestExternalViewUpdates.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestExternalViewUpdates.java @@ -41,8 +41,6 @@ public class TestExternalViewUpdates extends ZkTestBase { @Test public void testExternalViewUpdates() throws Exception { - System.out.println("START testExternalViewUpdates at " + new Date(System.currentTimeMillis())); - String clusterName = getShortClassName(); int numResource = 10; int numPartition = 1; @@ -108,6 +106,5 @@ public void testExternalViewUpdates() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - System.out.println("END testExternalViewUpdates at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestFailOverPerf1kp.java b/helix-core/src/test/java/org/apache/helix/integration/TestFailOverPerf1kp.java index ae0ff86c0d..dce9b3b64c 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestFailOverPerf1kp.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestFailOverPerf1kp.java @@ -24,35 +24,36 @@ import org.apache.helix.ExternalCommand; import org.apache.helix.ScriptTestHelper; import org.apache.helix.TestHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; public class TestFailOverPerf1kp { + + private static final Logger LOG = LoggerFactory.getLogger(TestFailOverPerf1kp.class); + // TODO: renable this test. disable it because the script is not running properly on apache // jenkins // @Test public void testFailOverPerf1kp() throws Exception { - // Logger.getRootLogger().setLevel(Level.INFO); - String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - ExternalCommand cmd = ScriptTestHelper.runCommandLineTest("helix_random_kill_local_startzk.sh"); String output = cmd.getStringOutput("UTF8"); int i = getStateTransitionLatency(0, output); int j = output.indexOf("ms", i); long latency = Long.parseLong(output.substring(i, j)); - System.out.println("startup latency: " + latency); + LOG.info("startup latency: " + latency); i = getStateTransitionLatency(i, output); j = output.indexOf("ms", i); latency = Long.parseLong(output.substring(i, j)); - System.out.println("failover latency: " + latency); + LOG.info("failover latency: " + latency); Assert.assertTrue(latency < 800, "failover latency for 1k partition test should < 800ms"); - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); + LOG.info("END " + testName + " at " + new Date(System.currentTimeMillis())); } @@ -60,7 +61,7 @@ int getStateTransitionLatency(int start, String output) { final String pattern = "state transition latency: "; int i = output.indexOf(pattern, start) + pattern.length(); // String latencyStr = output.substring(i, j); - // System.out.println(latencyStr); + // LOG.info(latencyStr); return i; } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestHelixCustomCodeRunner.java b/helix-core/src/test/java/org/apache/helix/integration/TestHelixCustomCodeRunner.java index f0453435fb..c92f3efe72 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestHelixCustomCodeRunner.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestHelixCustomCodeRunner.java @@ -48,7 +48,6 @@ class MockCallback implements CustomCodeCallbackHandler { @Override public void onCallback(NotificationContext context) { _isCallbackInvoked = true; - // System.out.println(type + ": TestCallback invoked on " + manager.getInstanceName()); } } @@ -71,8 +70,6 @@ private void registerCustomCodeRunner(HelixManager manager) { @Test public void testCustomCodeRunner() throws Exception { - System.out.println("START " + _clusterName + " at " + new Date(System.currentTimeMillis())); - int nodeNb = 5; int startPort = 12918; TestHelper.setupCluster(_clusterName, ZK_ADDR, startPort, "localhost", // participant name @@ -121,7 +118,5 @@ public void testCustomCodeRunner() throws Exception { } deleteLiveInstances(_clusterName); deleteCluster(_clusterName); - - System.out.println("END " + _clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestHelixUsingDifferentParams.java b/helix-core/src/test/java/org/apache/helix/integration/TestHelixUsingDifferentParams.java index 0317ae03a5..d52e818103 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestHelixUsingDifferentParams.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestHelixUsingDifferentParams.java @@ -53,8 +53,6 @@ public void testCMUsingDifferentParams() throws Exception { for (int replica : replicas) { String uniqClusterName = "TestDiffParam_" + "rg" + numResources + "_p" + numPartitionsPerResource + "_n" + numInstance + "_r" + replica; - System.out.println( - "START " + uniqClusterName + " at " + new Date(System.currentTimeMillis())); TestDriver.setupCluster(uniqClusterName, ZK_ADDR, numResources, numPartitionsPerResource, numInstance, replica); @@ -67,14 +65,9 @@ public void testCMUsingDifferentParams() throws Exception { TestDriver.verifyCluster(uniqClusterName, 1000, 50 * 1000); TestDriver.stopCluster(uniqClusterName); deleteCluster(uniqClusterName); - System.out - .println("END " + uniqClusterName + " at " + new Date(System.currentTimeMillis())); } } } } - - System.out - .println("END " + getShortClassName() + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java b/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java index 55f8d65eb6..2c3ae1a547 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestInvalidResourceRebalance.java @@ -50,7 +50,6 @@ public void testResourceRebalanceSkipped() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // Set up cluster TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java b/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java index cd9ff0c63a..9494b5db09 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestNullReplica.java @@ -42,8 +42,6 @@ public void testNullReplica() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[5]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -83,7 +81,5 @@ public void testNullReplica() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java b/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java index c4c37fe386..67ee9230b8 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestPartitionLevelTransitionConstraint.java @@ -108,8 +108,6 @@ public void test() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -197,8 +195,6 @@ public void test() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } private static void assertMessage(Message msg, String fromState, String toState, String instance) { diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestPartitionMovementThrottle.java b/helix-core/src/test/java/org/apache/helix/integration/TestPartitionMovementThrottle.java index 6300a1356c..bfba7cc872 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestPartitionMovementThrottle.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestPartitionMovementThrottle.java @@ -51,6 +51,8 @@ import org.apache.helix.model.Message; import org.apache.helix.tools.ClusterVerifiers.BestPossibleExternalViewVerifier; import org.apache.helix.tools.ClusterVerifiers.ClusterLiveNodesVerifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; @@ -58,14 +60,14 @@ public class TestPartitionMovementThrottle extends ZkStandAloneCMTestBase { + private static final Logger LOG = LoggerFactory.getLogger(TestPartitionMovementThrottle.class); + private ConfigAccessor _configAccessor; private Set _dbs = new HashSet<>(); @Override @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); @@ -304,8 +306,7 @@ public void cleanupTest() throws InterruptedException { try { Assert.assertTrue(TestHelper.verify(() -> dataAccessor.getChildNames(dataAccessor.keyBuilder().liveInstances()).isEmpty(), 1000)); } catch (Exception e) { - e.printStackTrace(); - System.out.println("There're live instances not cleaned up yet"); + LOG.error("There're live instances not cleaned up yet", e); assert false; } DelayedTransition.clearThrottleRecord(); @@ -359,7 +360,7 @@ public void testResourceThrottleWithDelayRebalancer() { for (String db : _dbs) { int maxInParallel = getMaxParallelTransitionCount(DelayedTransition.getResourcePatitionTransitionTimes(), db); - System.out.println("MaxInParallel: " + maxInParallel + " maxPendingTransition: " + 2); + LOG.info("MaxInParallel: " + maxInParallel + " maxPendingTransition: " + 2); Assert.assertTrue(maxInParallel <= 2, "Throttle condition does not meet for " + db); } } @@ -374,7 +375,7 @@ private int getMaxParallelTransitionCount( List startEndPoints = new ArrayList<>(); if (pTimeList == null) { - System.out.println("no throttle result for :" + throttledItemName); + LOG.info("no throttle result for :" + throttledItemName); return -1; } pTimeList.sort((o1, o2) -> (int) (o1.start - o2.start)); @@ -411,8 +412,7 @@ private int getMaxParallelTransitionCount( } } - System.out - .println("Max number of ST in parallel: " + maxInParallel + " for " + throttledItemName); + LOG.info("Max number of ST in parallel: " + maxInParallel + " for " + throttledItemName); return maxInParallel; } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java b/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java index fdb440331e..f2db51c624 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestPauseSignal.java @@ -42,8 +42,6 @@ public void testPauseSignal() throws Exception { String methodName = TestHelper.getTestMethodName(); final String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[5]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -112,6 +110,5 @@ public void testPauseSignal() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestRebalancerPersistAssignments.java b/helix-core/src/test/java/org/apache/helix/integration/TestRebalancerPersistAssignments.java index 5e4b89cc46..352a1a3f35 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestRebalancerPersistAssignments.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestRebalancerPersistAssignments.java @@ -48,8 +48,6 @@ public class TestRebalancerPersistAssignments extends ZkStandAloneCMTestBase { @Override @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java b/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java index d8758d2408..ed28d847be 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestReelectedPipelineCorrectness.java @@ -55,7 +55,6 @@ public void testReelection() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); ClusterSetup setupTool = new ClusterSetup(ZK_ADDR); @@ -159,6 +158,5 @@ public void testReelection() throws Exception { } TestHelper.dropCluster(clusterName, _gZkClient); deleteCluster(controllerCluster); - System.out.println("STOP " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java b/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java index 01ddce17b6..c5e40ff8c5 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestRenamePartition.java @@ -50,7 +50,6 @@ public class TestRenamePartition extends ZkTestBase { @Test() public void testRenamePartitionAutoIS() throws Exception { String clusterName = "CLUSTER_" + getShortClassName() + "_auto"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant start port "localhost", // participant name prefix @@ -79,14 +78,11 @@ public void testRenamePartitionAutoIS() throws Exception { Assert.assertTrue(result); stop(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test() public void testRenamePartitionCustomIS() throws Exception { - String clusterName = "CLUSTER_" + getShortClassName() + "_custom"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant start port "localhost", // participant name prefix @@ -124,7 +120,6 @@ public void testRenamePartitionCustomIS() throws Exception { Assert.assertTrue(result); stop(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } private void startAndVerify(String clusterName) { diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java b/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java index fe31fa1cc3..749e900eb3 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestResetInstance.java @@ -43,8 +43,6 @@ public void testResetInstance() throws Exception { String clusterName = className + "_" + methodName; final int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -109,7 +107,5 @@ public void testResetInstance() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); - } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java b/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java index a053d2e864..cfde057b7f 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestResetPartitionState.java @@ -69,8 +69,6 @@ public void testResetPartitionState() throws Exception { String clusterName = className + "_" + methodName; final int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -176,9 +174,6 @@ public void testResetPartitionState() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); - } private void clearStatusUpdate(String clusterName, String instance, String resource, diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java b/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java index 0a5b97f8d2..41b8cd371e 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestResetResource.java @@ -42,8 +42,6 @@ public void testResetNode() throws Exception { String clusterName = className + "_" + methodName; final int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -107,8 +105,5 @@ public void testResetNode() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); - } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestResourceWithSamePartitionKey.java b/helix-core/src/test/java/org/apache/helix/integration/TestResourceWithSamePartitionKey.java index ed976b3a46..b7b4002f08 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestResourceWithSamePartitionKey.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestResourceWithSamePartitionKey.java @@ -51,8 +51,6 @@ public void test() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -120,8 +118,6 @@ public void test() throws Exception { participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java b/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java index 1a689d8eea..b6ecef3e49 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestSchemataSM.java @@ -47,8 +47,6 @@ public void testSchemataSM() throws Exception { MockParticipantManager[] participants = new MockParticipantManager[n]; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant start port "localhost", // participant name prefix "TestSchemata", // resource name prefix @@ -111,6 +109,5 @@ public void testSchemataSM() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java b/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java index 9c888fcec0..7f725c673f 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestSessionExpiryInTransition.java @@ -67,8 +67,6 @@ public void testSessionExpiryInTransition() throws Exception { String methodName = TestHelper.getTestMethodName(); final String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[5]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -104,6 +102,5 @@ public void testSessionExpiryInTransition() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestStandAloneCMSessionExpiry.java b/helix-core/src/test/java/org/apache/helix/integration/TestStandAloneCMSessionExpiry.java index 74230c48e8..2788a4bed9 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestStandAloneCMSessionExpiry.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestStandAloneCMSessionExpiry.java @@ -38,8 +38,6 @@ public void testStandAloneCMSessionExpiry() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, PARTICIPANT_PREFIX, "TestDB", 1, 20, 5, 3, "MasterSlave", true); @@ -62,12 +60,11 @@ public void testStandAloneCMSessionExpiry() throws Exception { // participant session expiry MockParticipantManager participantToExpire = participants[1]; - // System.out.println("Expire participant session"); String oldSessionId = participantToExpire.getSessionId(); ZkTestHelper.expireSession(participantToExpire.getZkClient()); String newSessionId = participantToExpire.getSessionId(); - // System.out.println("oldSessionId: " + oldSessionId + ", newSessionId: " + newSessionId); + Assert.assertTrue(newSessionId.compareTo(oldSessionId) > 0, "Session id should be increased after expiry"); @@ -80,11 +77,9 @@ public void testStandAloneCMSessionExpiry() throws Exception { Assert.assertTrue(result); // controller session expiry - // System.out.println("Expire controller session"); oldSessionId = controller.getSessionId(); ZkTestHelper.expireSession(controller.getZkClient()); newSessionId = controller.getSessionId(); - // System.out.println("oldSessionId: " + oldSessionId + ", newSessionId: " + newSessionId); Assert.assertTrue(newSessionId.compareTo(oldSessionId) > 0, "Session id should be increased after expiry"); @@ -96,13 +91,11 @@ public void testStandAloneCMSessionExpiry() throws Exception { Assert.assertTrue(result); // clean up - System.out.println("Clean up ..."); controller.syncStop(); for (int i = 0; i < 5; i++) { participants[i].syncStop(); } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestStartMultipleControllersWithSameName.java b/helix-core/src/test/java/org/apache/helix/integration/TestStartMultipleControllersWithSameName.java index bad9c19848..e8405aeb8d 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestStartMultipleControllersWithSameName.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestStartMultipleControllersWithSameName.java @@ -38,8 +38,6 @@ public void test() throws Exception { String clusterName = className + "_" + methodName; final int n = 3; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -60,7 +58,6 @@ public void test() throws Exception { Thread.sleep(500); // wait leader election finishes String liPath = PropertyPathBuilder.liveInstance(clusterName); int listenerNb = ZkTestHelper.numberOfListeners(ZK_ADDR, liPath); - // System.out.println("listenerNb: " + listenerNb); Assert.assertEquals(listenerNb, 1, "Only one controller should succeed in becoming leader"); // clean up @@ -68,9 +65,6 @@ public void test() throws Exception { controllers[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); - } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionThrottle.java b/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionThrottle.java index 52cc624010..dceef14e90 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionThrottle.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestStateTransitionThrottle.java @@ -55,8 +55,6 @@ public void testTransitionThrottleOnRecoveryPartition() throws Exception { String clusterName = getShortClassName() + "testRecoveryPartition"; MockParticipantManager[] participants = new MockParticipantManager[participantCount]; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - final ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_gZkClient)); setupCluster(clusterName, accessor); @@ -112,8 +110,6 @@ public void doTransition(Message message, NotificationContext context) participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -121,8 +117,6 @@ public void testTransitionThrottleOnErrorPartition() throws Exception { String clusterName = getShortClassName() + "testMaxErrorPartition"; MockParticipantManager[] participants = new MockParticipantManager[participantCount]; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - final ZKHelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_gZkClient)); setupCluster(clusterName, accessor); @@ -189,8 +183,6 @@ public void testTransitionThrottleOnErrorPartition() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } private void setupCluster(String clusterName, ZKHelixDataAccessor accessor) throws Exception { diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestWeightBasedRebalanceUtil.java b/helix-core/src/test/java/org/apache/helix/integration/TestWeightBasedRebalanceUtil.java index ea4d974945..fda824f2da 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestWeightBasedRebalanceUtil.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestWeightBasedRebalanceUtil.java @@ -79,9 +79,6 @@ public class TestWeightBasedRebalanceUtil extends ZkTestBase { @BeforeClass public void beforeClass() { - System.out.println( - "START " + getClass().getSimpleName() + " at " + new Date(System.currentTimeMillis())); - CLUSTER_NAME = "MockCluster" + getShortClassName(); for (int i = 0; i < nParticipants; i++) { diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java b/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java index c09fbed15b..5be3eff458 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestZkCallbackHandlerLeak.java @@ -62,8 +62,6 @@ public void testCbHandlerLeakOnParticipantSessionExpiry() throws Exception { final int r = 2; final int taskResourceCount = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -130,14 +128,12 @@ public void testCbHandlerLeakOnParticipantSessionExpiry() throws Exception { "HelixParticipant should have 1 (msg->HelixTaskExecutor) callback handlers"); // expire the session of participant - System.out.println("Expiring participant session..."); + LOG.info("Expiring participant session..."); String oldSessionId = participantManagerToExpire.getSessionId(); ZkTestHelper.expireSession(participantManagerToExpire.getZkClient()); String newSessionId = participantManagerToExpire.getSessionId(); - System.out.println( - "Expired participant session. oldSessionId: " + oldSessionId + ", newSessionId: " - + newSessionId); + LOG.info("Expired participant session. oldSessionId: " + oldSessionId + ", newSessionId: " + newSessionId); result = ClusterStateVerifier.verifyByPolling(new ClusterStateVerifier.BestPossAndExtViewZkVerifier( @@ -179,8 +175,6 @@ public void testCbHandlerLeakOnParticipantSessionExpiry() throws Exception { participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -192,8 +186,6 @@ public void testCbHandlerLeakOnControllerSessionExpiry() throws Exception { final int r = 1; final int taskResourceCount = 1; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -250,12 +242,11 @@ public void testCbHandlerLeakOnControllerSessionExpiry() throws Exception { + particHandlerNb + ", " + printHandlers(participantManager)); // expire controller - System.out.println("Expiring controller session..."); String oldSessionId = controller.getSessionId(); ZkTestHelper.expireSession(controller.getZkClient()); String newSessionId = controller.getSessionId(); - System.out.println( + LOG.info( "Expired controller session. oldSessionId: " + oldSessionId + ", newSessionId: " + newSessionId); @@ -300,8 +291,6 @@ public void testCbHandlerLeakOnControllerSessionExpiry() throws Exception { participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -311,8 +300,6 @@ public void testDanglingCallbackHandler() throws Exception { String clusterName = className + "_" + methodName; final int n = 3; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, "localhost", "TestDB", 1, // resource 32, // partitions n, // nodes @@ -388,8 +375,6 @@ public void testDanglingCallbackHandler() throws Exception { participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -401,8 +386,6 @@ public void testCurrentStatePathLeakingByAsycRemoval() throws Exception { final String zkAddr = ZK_ADDR; final int mJobUpdateCnt = 500; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, zkAddr, 12918, "localhost", "TestDB", 1, // resource 32, // partitions n, // nodes @@ -484,8 +467,6 @@ public void testCurrentStatePathLeakingByAsycRemoval() throws Exception { rpManager.syncStop(); TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -495,7 +476,6 @@ public void testRemoveUserCbHandlerOnPathRemoval() throws Exception { String clusterName = className + "_" + methodName; final int n = 3; final String zkAddr = ZK_ADDR; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); TestHelper.setupCluster(clusterName, zkAddr, 12918, "localhost", "TestDB", 1, // resource 32, // partitions @@ -570,12 +550,12 @@ public void testRemoveUserCbHandlerOnPathRemoval() throws Exception { "Should have 2 child-watches: MESSAGES, and CURRENTSTATE/{sessionId}"); // expire localhost_12918 - System.out.println( + LOG.info( "Expire participant: " + participantToExpire.getInstanceName() + ", session: " + participantToExpire.getSessionId()); ZkTestHelper.expireSession(participantToExpire.getZkClient()); String newSessionId = participantToExpire.getSessionId(); - System.out.println(participantToExpire.getInstanceName() + " oldSessionId: " + oldSessionId + LOG.info(participantToExpire.getInstanceName() + " oldSessionId: " + oldSessionId + ", newSessionId: " + newSessionId); verifier = new BestPossibleExternalViewVerifier.Builder(clusterName).setZkClient(_gZkClient) @@ -636,7 +616,7 @@ public void testRemoveUserCbHandlerOnPathRemoval() throws Exception { // another session expiry on localhost_12918 should clear the two exist-watches on // CURRENTSTATE/{oldSessionId} - System.out.println( + LOG.info( "Expire participant: " + participantToExpire.getInstanceName() + ", session: " + participantToExpire.getSessionId()); ZkTestHelper.expireSession(participantToExpire.getZkClient()); @@ -661,8 +641,6 @@ public void testRemoveUserCbHandlerOnPathRemoval() throws Exception { participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } // debug code diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java b/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java index f141766abd..2bd83e1c9a 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestZkConnectionLost.java @@ -227,10 +227,10 @@ private void restartZkServer() throws ExecutionException, InterruptedException { Executors.newSingleThreadExecutor().submit(() -> { try { Thread.sleep(300); - System.out.println(System.currentTimeMillis() + ": Shutdown ZK server."); + LOG.info(System.currentTimeMillis() + ": Shutdown ZK server."); TestHelper.stopZkServer(_zkServerRef.get()); Thread.sleep(300); - System.out.println("Restart ZK server"); + LOG.info("Restart ZK server"); _zkServerRef.set(TestHelper.startZkServer(_zkAddr, null, false)); } catch (Exception e) { LOG.error(e.getMessage(), e); diff --git a/helix-core/src/test/java/org/apache/helix/integration/TestZkSessionExpiry.java b/helix-core/src/test/java/org/apache/helix/integration/TestZkSessionExpiry.java index e264920793..c021c3b08b 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/TestZkSessionExpiry.java +++ b/helix-core/src/test/java/org/apache/helix/integration/TestZkSessionExpiry.java @@ -80,7 +80,7 @@ static class DummyMessageHandlerFactory implements MultiTypeMessageHandlerFactor public MessageHandler createHandler(Message message, NotificationContext context) { return new DummyMessageHandler(message, context, _handledMsgSet); } - + @Override public List getMessageTypes() { return ImmutableList.of(DUMMY_MSG_TYPE); @@ -100,8 +100,6 @@ public void testMsgHdlrFtyReRegistration() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -150,7 +148,6 @@ public void testMsgHdlrFtyReRegistration() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } /** diff --git a/helix-core/src/test/java/org/apache/helix/integration/common/ZkStandAloneCMTestBase.java b/helix-core/src/test/java/org/apache/helix/integration/common/ZkStandAloneCMTestBase.java index e632a4c84d..1a6170d01f 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/common/ZkStandAloneCMTestBase.java +++ b/helix-core/src/test/java/org/apache/helix/integration/common/ZkStandAloneCMTestBase.java @@ -59,7 +59,6 @@ public class ZkStandAloneCMTestBase extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { super.beforeClass(); - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); @@ -114,6 +113,5 @@ public void afterClass() throws Exception { } deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/controller/TestControllerLiveLock.java b/helix-core/src/test/java/org/apache/helix/integration/controller/TestControllerLiveLock.java index d9e7356ce4..0c4d2bd943 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/controller/TestControllerLiveLock.java +++ b/helix-core/src/test/java/org/apache/helix/integration/controller/TestControllerLiveLock.java @@ -60,8 +60,6 @@ public void test() throws Exception { final HelixDataAccessor accessor = new ZKHelixDataAccessor(clusterName, baseAccessor); final PropertyKey.Builder keyBuilder = accessor.keyBuilder(); - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -131,7 +129,5 @@ public boolean verify() throws Exception { participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/controller/TestGenericHelixControllerThreading.java b/helix-core/src/test/java/org/apache/helix/integration/controller/TestGenericHelixControllerThreading.java index b2d1484d2b..cac4cc2fba 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/controller/TestGenericHelixControllerThreading.java +++ b/helix-core/src/test/java/org/apache/helix/integration/controller/TestGenericHelixControllerThreading.java @@ -37,7 +37,6 @@ public class TestGenericHelixControllerThreading extends ZkUnitTestBase { // shutdown @Test(enabled = false) public void testGenericHelixControllerThreadCount() throws Exception { - System.out.println("testGenericHelixControllerThreadCount STARTs"); final int numControllers = 100; ArrayList controllers = createHelixControllers(numControllers); Assert.assertEquals(getThreadCountByNamePrefix(EVENT_PROCESS_THREAD_NAME_PREFIX), numControllers * 2); @@ -49,7 +48,6 @@ public void testGenericHelixControllerThreadCount() throws Exception { Assert.assertEquals(getThreadCountByNamePrefix(EVENT_PROCESS_THREAD_NAME_PREFIX), remainingExpectedEventProcessThreadsCount); } - System.out.println("testGenericHelixControllerThreadCount ENDs"); } private ArrayList createHelixControllers(int count) { diff --git a/helix-core/src/test/java/org/apache/helix/integration/controller/TestPipelinePerformance.java b/helix-core/src/test/java/org/apache/helix/integration/controller/TestPipelinePerformance.java index d5932d7b61..e5f9868799 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/controller/TestPipelinePerformance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/controller/TestPipelinePerformance.java @@ -36,6 +36,8 @@ import org.apache.helix.model.IdealState; import org.apache.helix.tools.ClusterVerifiers.StrictMatchExternalViewVerifier; import org.apache.helix.tools.ClusterVerifiers.ZkHelixClusterVerifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -46,6 +48,8 @@ public class TestPipelinePerformance extends ZkTestBase { + private static final Logger LOG = LoggerFactory.getLogger(TestPipelinePerformance.class); + private static final int NUM_NODE = 6; private static final int START_PORT = 12918; private static final int REPLICA = 3; @@ -136,7 +140,7 @@ public void testWagedInstanceCapacityCalculationPerformance() throws Exception { long withoutComputationValue = (Long) _server.getAttribute(currentStateMbeanObjectName, "TotalDurationCounter"); long durationWithoutComputation = withoutComputationValue - durationWithComputation; double pctDecrease = (durationWithComputation - durationWithoutComputation) * 100 / durationWithComputation; - System.out.println(String.format("durationWithComputation: %s, durationWithoutComputation: %s, pctDecrease: %s", + LOG.info(String.format("durationWithComputation: %s, durationWithoutComputation: %s, pctDecrease: %s", durationWithComputation, durationWithoutComputation, pctDecrease)); Assert.assertTrue(durationWithComputation > durationWithoutComputation); diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java b/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java index fd7d5caefb..82c9cc6113 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java +++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestConsecutiveZkSessionExpiry.java @@ -85,8 +85,6 @@ public void testParticipant() throws Exception { String clusterName = className + "_" + methodName; final int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -157,7 +155,6 @@ public void testParticipant() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -168,8 +165,6 @@ public void testDistributedController() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -259,7 +254,6 @@ public void testDistributedController() throws Exception { false)); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestControllerManager.java b/helix-core/src/test/java/org/apache/helix/integration/manager/TestControllerManager.java index b7ad56e582..af370b3657 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestControllerManager.java +++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestControllerManager.java @@ -40,8 +40,6 @@ public void testMultipleControllersOfSameName() throws Exception { String clusterName = className + "_" + methodName; int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -94,7 +92,6 @@ public void testMultipleControllersOfSameName() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -106,8 +103,6 @@ public void simpleSessionExpiryTest() throws Exception { final String clusterName = className + "_" + methodName; int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -157,6 +152,5 @@ public void simpleSessionExpiryTest() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java b/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java index 81dbdad15c..61922324a5 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java +++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestDistributedControllerManager.java @@ -52,8 +52,6 @@ public void simpleIntegrationTest() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -101,7 +99,6 @@ public void simpleIntegrationTest() throws Exception { Assert.assertNull(accessor.getProperty(keyBuilder.controllerLeader())); deleteCluster(clusterName); - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); } /** @@ -154,8 +151,6 @@ public void simpleSessionExpiryTest() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -199,6 +194,5 @@ public void simpleSessionExpiryTest() throws Exception { Assert.assertNull(accessor.getProperty(keyBuilder.controllerLeader())); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/manager/TestStateModelLeak.java b/helix-core/src/test/java/org/apache/helix/integration/manager/TestStateModelLeak.java index 320c35431e..9795fd3c12 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/manager/TestStateModelLeak.java +++ b/helix-core/src/test/java/org/apache/helix/integration/manager/TestStateModelLeak.java @@ -59,8 +59,6 @@ public void testDrop() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -118,8 +116,6 @@ public void testDrop() throws Exception { participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } /** @@ -134,8 +130,6 @@ public void testDropErrorPartition() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -204,8 +198,6 @@ public void testDropErrorPartition() throws Exception { participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } /** diff --git a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestBatchMessage.java b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestBatchMessage.java index ddc9fb1e40..ce57336ea3 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestBatchMessage.java +++ b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestBatchMessage.java @@ -41,11 +41,15 @@ import org.apache.helix.tools.ClusterStateVerifier; import org.apache.helix.tools.ClusterStateVerifier.BestPossAndExtViewZkVerifier; import org.apache.helix.zookeeper.zkclient.IZkChildListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; public class TestBatchMessage extends ZkTestBase { class TestZkChildListener implements IZkChildListener { + private final Logger LOG = LoggerFactory.getLogger(TestZkChildListener.class); + int _maxNumberOfChildren = 0; @Override @@ -53,7 +57,7 @@ public void handleChildChange(String parentPath, List currentChildren) { if (currentChildren == null) { return; } - System.out.println(parentPath + " has " + currentChildren.size() + " messages"); + LOG.info(parentPath + " has " + currentChildren.size() + " messages"); if (currentChildren.size() > _maxNumberOfChildren) { _maxNumberOfChildren = currentChildren.size(); } @@ -63,14 +67,11 @@ public void handleChildChange(String parentPath, List currentChildren) { @Test public void testBasic() throws Exception { - // Logger.getRootLogger().setLevel(Level.INFO); String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -125,8 +126,6 @@ public void testBasic() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } // a non-batch-message run followed by a batch-message-enabled run @@ -138,8 +137,6 @@ public void testChangeBatchMessageMode() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -215,8 +212,6 @@ public void testChangeBatchMessageMode() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -228,8 +223,6 @@ public void testSubMsgExecutionFail() throws Exception { final int n = 5; MockParticipantManager[] participants = new MockParticipantManager[n]; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, "localhost", "TestDB", 1, // resource# 6, // partition# n, // nodes# @@ -298,8 +291,6 @@ public void testSubMsgExecutionFail() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -310,8 +301,6 @@ public void testParticipantIncompatibleWithBatchMsg() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -384,7 +373,5 @@ public void testParticipantIncompatibleWithBatchMsg() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestBatchMessageWrapper.java b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestBatchMessageWrapper.java index b1317931c2..b40664e8e1 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestBatchMessageWrapper.java +++ b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestBatchMessageWrapper.java @@ -40,19 +40,18 @@ import org.testng.annotations.Test; public class TestBatchMessageWrapper extends ZkUnitTestBase { + class MockBatchMsgWrapper extends BatchMessageWrapper { int _startCount = 0; int _endCount = 0; @Override public void start(Message batchMsg, NotificationContext context) { - // System.out.println("test batchMsg.start() invoked, " + batchMsg.getTgtName()); _startCount++; } @Override public void end(Message batchMsg, NotificationContext context) { - // System.out.println("test batchMsg.end() invoked, " + batchMsg.getTgtName()); _endCount++; } } @@ -71,8 +70,6 @@ public void testBasic() throws Exception { String clusterName = className + "_" + methodName; final int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // startPort "localhost", // participantNamePrefix "TestDB", // resourceNamePrefix @@ -121,18 +118,15 @@ public void testBasic() throws Exception { // check batch-msg-wrapper counts MockBatchMsgWrapper wrapper = (MockBatchMsgWrapper) ftys[0].getBatchMessageWrapper("TestDB0"); - // System.out.println("startCount: " + wrapper._startCount); + Assert.assertEquals(wrapper._startCount, 3, "Expect 3 batch.start: O->S, S->M, and M->S for 1st participant"); - // System.out.println("endCount: " + wrapper._endCount); Assert.assertEquals(wrapper._endCount, 3, "Expect 3 batch.end: O->S, S->M, and M->S for 1st participant"); wrapper = (MockBatchMsgWrapper) ftys[1].getBatchMessageWrapper("TestDB0"); - // System.out.println("startCount: " + wrapper._startCount); Assert.assertEquals(wrapper._startCount, 2, "Expect 2 batch.start: O->S and S->M for 2nd participant"); - // System.out.println("endCount: " + wrapper._endCount); Assert.assertEquals(wrapper._startCount, 2, "Expect 2 batch.end: O->S and S->M for 2nd participant"); @@ -142,8 +136,6 @@ public void testBasic() throws Exception { participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestGroupCommitAddBackData.java b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestGroupCommitAddBackData.java index 4cd4083808..51fc02b5b0 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestGroupCommitAddBackData.java +++ b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestGroupCommitAddBackData.java @@ -50,9 +50,6 @@ public class TestGroupCommitAddBackData extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - // Logger.getRootLogger().setLevel(Level.INFO); - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); String storageNodeName = PARTICIPANT_PREFIX + "_" + START_PORT; @@ -86,8 +83,6 @@ public void afterClass() throws Exception { _gSetupTool.deleteCluster(CLUSTER_NAME); } } - - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } @Test diff --git a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestMessageThrottle.java b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestMessageThrottle.java index 9374b0aba0..bf62f27bd4 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestMessageThrottle.java +++ b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestMessageThrottle.java @@ -51,8 +51,6 @@ public void testMessageThrottle() throws Exception { String clusterName = getShortClassName(); MockParticipantManager[] participants = new MockParticipantManager[5]; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant start // port "localhost", // participant name prefix @@ -143,7 +141,5 @@ public void handleChildChange(String parentPath, List currentChilds) participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestMessageThrottle2.java b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestMessageThrottle2.java index b37493101e..799a0d8ba1 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestMessageThrottle2.java +++ b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestMessageThrottle2.java @@ -75,8 +75,6 @@ public class TestMessageThrottle2 extends ZkTestBase { @Test public void test() throws Exception { - System.out.println("START " + _clusterName + " at " + new Date(System.currentTimeMillis())); - // Keep mock participant references so that they could be shut down after testing Set participants = new HashSet<>(); @@ -118,13 +116,10 @@ public void test() throws Exception { _helixController.disconnect(); participants.forEach(MyProcess::stop); deleteCluster(_clusterName); - System.out.println("END " + _clusterName + " at " + new Date(System.currentTimeMillis())); } private void startController() throws Exception { // start _helixController - System.out.println(String.format("Starting Controller{Cluster:%s, Port:%s, Zookeeper:%s}", - _clusterName, 12000, ZK_ADDR)); _helixController = HelixControllerMain.startHelixController(ZK_ADDR, _clusterName, "localhost_" + 12000, HelixControllerMain.STANDALONE); @@ -136,7 +131,6 @@ private void startAdmin() { HelixAdmin admin = new ZKHelixAdmin(ZK_ADDR); // create cluster - System.out.println("Creating cluster: " + _clusterName); admin.addCluster(_clusterName, true); // add MasterSlave state mode definition diff --git a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestP2PMessageSemiAuto.java b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestP2PMessageSemiAuto.java index a324a33000..19cdf661bf 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestP2PMessageSemiAuto.java +++ b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestP2PMessageSemiAuto.java @@ -68,8 +68,6 @@ public class TestP2PMessageSemiAuto extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { super.beforeClass(); - System.out - .println("START " + getShortClassName() + " at " + new Date(System.currentTimeMillis())); // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); @@ -116,7 +114,6 @@ public void afterClass() throws Exception { p.syncStop(); } deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } @Test diff --git a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestP2PNoDuplicatedMessage.java b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestP2PNoDuplicatedMessage.java index 67d02a421b..8a4e5b92af 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestP2PNoDuplicatedMessage.java +++ b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestP2PNoDuplicatedMessage.java @@ -83,9 +83,6 @@ public class TestP2PNoDuplicatedMessage extends ZkTestBase { @BeforeClass public void beforeClass() { - System.out.println( - "START " + getShortClassName() + " at " + new Date(System.currentTimeMillis())); - // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); @@ -133,7 +130,6 @@ public void afterClass() throws Exception { p.syncStop(); } deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } @Test diff --git a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestP2PSingleTopState.java b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestP2PSingleTopState.java index c3507bb810..b688b67698 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/messaging/TestP2PSingleTopState.java +++ b/helix-core/src/test/java/org/apache/helix/integration/messaging/TestP2PSingleTopState.java @@ -73,9 +73,6 @@ public class TestP2PSingleTopState extends ZkTestBase { @BeforeClass public void beforeClass() { - System.out - .println("START " + getShortClassName() + " at " + new Date(System.currentTimeMillis())); - // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); @@ -127,17 +124,15 @@ public void afterClass() throws Exception { p.syncStop(); } deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } @Test public void testRollingUpgrade() throws InterruptedException { // rolling upgrade the cluster for (String ins : _instances) { - System.out.println("Disable " + ins); _gSetupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, ins, false); Assert.assertTrue(_clusterVerifier.verifyByPolling()); - System.out.println("Enable " + ins); + _gSetupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, ins, true); Assert.assertTrue(_clusterVerifier.verifyByPolling()); } diff --git a/helix-core/src/test/java/org/apache/helix/integration/multizk/TestMultiInMultiZk.java b/helix-core/src/test/java/org/apache/helix/integration/multizk/TestMultiInMultiZk.java index 6eea2a9b92..95e7409713 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/multizk/TestMultiInMultiZk.java +++ b/helix-core/src/test/java/org/apache/helix/integration/multizk/TestMultiInMultiZk.java @@ -28,6 +28,8 @@ import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.Op; import org.apache.zookeeper.ZooDefs; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -42,6 +44,8 @@ */ public class TestMultiInMultiZk extends MultiZkTestBase { + private static final Logger LOG = LoggerFactory.getLogger(TestMultiInMultiZk.class); + private static final String _className = TestHelper.getTestClassName(); @BeforeClass @@ -59,9 +63,7 @@ public void beforeClass() throws Exception { new RealmAwareZkClient.RealmAwareZkClientConfig()); _zkClient.setZkSerializer(new ZNRecordSerializer()); } catch (Exception ex) { - for (StackTraceElement elm : ex.getStackTrace()) { - System.out.println(elm); - } + LOG.info("exception while creating client", ex); } } @@ -72,7 +74,6 @@ public void beforeClass() throws Exception { @Test public void testMultiDiffRealm() { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); List ops = Arrays.asList( Op.create(CLUSTER_LIST.get(0), new byte[0], @@ -92,6 +93,5 @@ public void testMultiDiffRealm() { boolean pathExists = _zkClient.exists("/" + CLUSTER_LIST.get(0) + "/test"); Assert.assertFalse(pathExists, "Path should not have been created."); } - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/multizk/TestMultiZkConnectionConfig.java b/helix-core/src/test/java/org/apache/helix/integration/multizk/TestMultiZkConnectionConfig.java index 06d8f94f30..127a7605ec 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/multizk/TestMultiZkConnectionConfig.java +++ b/helix-core/src/test/java/org/apache/helix/integration/multizk/TestMultiZkConnectionConfig.java @@ -85,6 +85,8 @@ import org.apache.helix.zookeeper.impl.client.FederatedZkClient; import org.apache.helix.zookeeper.impl.factory.SharedZkClientFactory; import org.apache.helix.zookeeper.routing.RoutingDataManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -98,6 +100,9 @@ * in system property */ public class TestMultiZkConnectionConfig extends MultiZkTestBase { + + private static final Logger LOG = LoggerFactory.getLogger(TestMultiZkConnectionConfig.class); + protected ClusterSetup _clusterSetupZkAddr; protected ClusterSetup _clusterSetupBuilder; protected RealmAwareZkClient.RealmAwareZkConnectionConfig _invalidZkConnectionConfig; @@ -120,7 +125,6 @@ public void beforeClass() throws Exception { .setRoutingDataSourceType(RoutingDataReaderType.HTTP_ZK_FALLBACK.name()).build(), new RealmAwareZkClient.RealmAwareZkClientConfig()); _zkClient.setZkSerializer(new ZNRecordSerializer()); - System.out.println("end start"); } public void beforeApiClass() throws Exception { @@ -134,7 +138,6 @@ public void beforeApiClass() throws Exception { _zkClient = new FederatedZkClient(new RealmAwareZkClient.RealmAwareZkConnectionConfig.Builder().build(), new RealmAwareZkClient.RealmAwareZkClientConfig()); - System.out.println("end start"); } /** @@ -144,7 +147,6 @@ public void beforeApiClass() throws Exception { @Test public void testCreateClusters() { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); setupCluster(); @@ -159,8 +161,6 @@ public void testCreateClusters() { _clusterSetupZkAddr.close(); _clusterSetupBuilder.close(); - - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } public void setupCluster() { @@ -207,7 +207,6 @@ public void verifyClusterCreation(ClusterSetup clusterSetup) { @Test(dependsOnMethods = "testCreateClusters") public void testCreateParticipants() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); // Create two ClusterSetups using two different constructors // Note: ZK Address here could be anything because multiZk mode is on (it will be ignored) @@ -267,8 +266,6 @@ public void testCreateParticipants() throws Exception { } helixAdminBuilder.close(); - - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } protected void createParticipantsAndVerify(HelixAdmin admin, int numParticipants, @@ -312,7 +309,6 @@ protected void createParticipantsAndVerify(HelixAdmin admin, int numParticipants @Test(dependsOnMethods = "testCreateParticipants") public void testZKHelixManager() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); String clusterName = "CLUSTER_1"; String participantName = "HelixManager"; @@ -356,8 +352,6 @@ public void testZKHelixManager() throws Exception { managerParticipant.disconnect(); managerAdministrator.disconnect(); _zkHelixAdmin.dropInstance(clusterName, instanceConfig); - - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } protected void createZkConnectionConfigs(String clusterName) { @@ -379,7 +373,6 @@ protected void createZkConnectionConfigs(String clusterName) { @Test(dependsOnMethods = "testZKHelixManager") public void testZKHelixManagerCloudConfig() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); String clusterName = "CLUSTER_1"; String participantName = "HelixManager"; @@ -445,8 +438,6 @@ public HelixManagerProperty getHelixManagerProperty() { // Clean up managerParticipant.disconnect(); _zkHelixAdmin.dropInstance(clusterName, instanceConfig); - - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } private void setupApiCluster() { @@ -467,7 +458,6 @@ private void createApiZkConnectionConfigs(String clusterName) { @Test (dependsOnMethods = "testZKHelixManagerCloudConfig") public void testApiCreateClusters() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); super.afterClass(); beforeApiClass(); @@ -484,46 +474,35 @@ public void testApiCreateClusters() throws Exception { _clusterSetupZkAddr.close(); _clusterSetupBuilder.close(); - - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } @Test(dependsOnMethods = "testApiCreateClusters") public void testApiCreateParticipants() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); testCreateParticipants(); - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } @Test(dependsOnMethods = "testApiCreateParticipants") public void testApiZKHelixManager() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); testZKHelixManager(); - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } @Test(dependsOnMethods = "testApiZKHelixManager") public void testApiZKHelixManagerCloudConfig() throws Exception { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); //todo testZKHelixManagerCloudConfig(); - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } @Test(dependsOnMethods = "testApiZKHelixManager") public void testZkUtil() { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); CLUSTER_LIST.forEach(cluster -> { _zkHelixAdmin.getInstancesInCluster(cluster).forEach(instance -> ZKUtil .isInstanceSetup("DummyZk", cluster, instance, InstanceType.PARTICIPANT)); }); - - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } /** @@ -535,7 +514,6 @@ public void testZkUtil() { @Test(dependsOnMethods = "testZkUtil") public void testCreateAndRebalanceResources() { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); BaseDataAccessor dataAccessorZkAddr = new ZkBaseDataAccessor<>("DummyZk"); BaseDataAccessor dataAccessorBuilder = @@ -597,8 +575,6 @@ public void testCreateAndRebalanceResources() { dataAccessorZkAddr.close(); dataAccessorBuilder.close(); - - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } /** @@ -607,7 +583,6 @@ public void testCreateAndRebalanceResources() { @Test(dependsOnMethods = "testCreateAndRebalanceResources") public void testConfigAccessor() { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); // Build two ConfigAccessors to read and write: // 1. ConfigAccessor using a deprecated constructor @@ -620,8 +595,6 @@ public void testConfigAccessor() { configAccessorZkAddr.close(); configAccessorBuilder.close(); - - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } private void setClusterConfigAndVerify(ConfigAccessor configAccessorMultiZk) { @@ -658,7 +631,6 @@ private void setClusterConfigAndVerify(ConfigAccessor configAccessorMultiZk) { @Test(dependsOnMethods = "testConfigAccessor") public void testTaskFramework() throws InterruptedException { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); // Note: TaskDriver is like HelixManager - it only operates on one designated // Create TaskDrivers for all clusters @@ -690,8 +662,6 @@ public void testTaskFramework() throws InterruptedException { // Compare the workflow state read from PropertyStore and TaskDriver Assert.assertEquals(context.getWorkflowState(), wfStateFromTaskDriver); } - - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } /** @@ -700,11 +670,8 @@ public void testTaskFramework() throws InterruptedException { @Test(dependsOnMethods = "testTaskFramework") public void testGetAllClusters() { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); Assert.assertEquals(new HashSet<>(_zkHelixAdmin.getClusters()), new HashSet<>(CLUSTER_LIST)); - - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } /** @@ -729,7 +696,6 @@ public void testGetAllClusters() { @Test(dependsOnMethods = "testGetAllClusters") public void testGenericBaseDataAccessorBuilder() { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); // Custom session timeout value is used to count active connections in SharedZkClientFactory int customSessionTimeout = 10000; @@ -896,8 +862,6 @@ public void testGenericBaseDataAccessorBuilder() { } catch (NoSuchElementException e) { // Expected because the sharding key wouldn't be found } - - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } /** @@ -913,7 +877,6 @@ public void testGenericBaseDataAccessorBuilder() { @Test(dependsOnMethods = "testGenericBaseDataAccessorBuilder") public void testDifferentMsdsEndpointConfigs() throws IOException, InvalidRoutingDataException { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); final String zkAddress = ZK_SERVER_MAP.keySet().iterator().next(); final Map> secondRoutingData = @@ -951,12 +914,9 @@ public void testDifferentMsdsEndpointConfigs() throws IOException, InvalidRoutin zkClient.close(); secondMsds.stopServer(); } - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } private void verifyHelixManagerMsdsEndpoint() { - System.out.println("Start " + TestHelper.getTestMethodName()); - // Mock participants are already created and started in the previous test. // The mock participant only connects to MSDS configured in system property, // but not the other. @@ -967,13 +927,12 @@ private void verifyHelixManagerMsdsEndpoint() { verifyMsdsZkRealm(CLUSTER_ONE, true, () -> manager.getZkClient().exists(formPath(manager.getClusterName()))); if (manager.getZkClient() != null) { - System.out.println("zk client is not yet null2"); + LOG.error("zk client is not yet null2"); } } private void verifyBaseDataAccessorMsdsEndpoint( RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig) { - System.out.println("Start " + TestHelper.getTestMethodName()); // MSDS endpoint is not configured in builder, so config in system property is used. BaseDataAccessor firstDataAccessor = new ZkBaseDataAccessor.Builder().build(); @@ -1015,8 +974,6 @@ private void verifyBaseDataAccessorMsdsEndpoint( private void verifyClusterSetupMsdsEndpoint( RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig) { - System.out.println("Start " + TestHelper.getTestMethodName()); - ClusterSetup firstClusterSetup = new ClusterSetup.Builder().build(); ClusterSetup secondClusterSetup = new ClusterSetup.Builder().setRealmAwareZkConnectionConfig(connectionConfig).build(); @@ -1037,7 +994,6 @@ private void verifyClusterSetupMsdsEndpoint( } private void verifyZkUtilMsdsEndpoint() { - System.out.println("Start " + TestHelper.getTestMethodName()); String dummyZkAddress = "dummyZkAddress"; // MSDS endpoint 1 @@ -1050,8 +1006,6 @@ private void verifyZkUtilMsdsEndpoint() { private void verifyHelixAdminMsdsEndpoint( RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig) { - System.out.println("Start " + TestHelper.getTestMethodName()); - HelixAdmin firstHelixAdmin = new ZKHelixAdmin.Builder().build(); HelixAdmin secondHelixAdmin = new ZKHelixAdmin.Builder().setRealmAwareZkConnectionConfig(connectionConfig).build(); @@ -1073,8 +1027,6 @@ private void verifyHelixAdminMsdsEndpoint( private void verifyConfigAccessorMsdsEndpoint( RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig) { - System.out.println("Start " + TestHelper.getTestMethodName()); - ConfigAccessor firstConfigAccessor = new ConfigAccessor.Builder().build(); ConfigAccessor secondConfigAccessor = new ConfigAccessor.Builder().setRealmAwareZkConnectionConfig(connectionConfig).build(); @@ -1132,7 +1084,7 @@ private void verifyMsdsZkRealm(String cluster, boolean shouldSucceed, Operation e.getMessage()); } } catch (IllegalStateException e) { - System.out.println("Exception: " + e); + LOG.error("Exception: " , e); } } @@ -1152,7 +1104,6 @@ private String formPath(String... pathNames) { @Test(dependsOnMethods = "testDifferentMsdsEndpointConfigs") public void testZkRoutingDataSourceConfigs() { String methodName = TestHelper.getTestMethodName(); - System.out.println("START " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); // Set up routing data in ZK by connecting directly to ZK BaseDataAccessor accessor = @@ -1210,7 +1161,5 @@ public void testZkRoutingDataSourceConfigs() { accessor.close(); zkBasedAccessor.close(); httpZkFallbackBasedAccessor.close(); - - System.out.println("END " + _className + "_" + methodName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestNonOfflineInitState.java b/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestNonOfflineInitState.java index 9a2323db20..be623f570f 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestNonOfflineInitState.java +++ b/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestNonOfflineInitState.java @@ -39,7 +39,6 @@ public class TestNonOfflineInitState extends ZkTestBase { @Test public void testNonOfflineInitState() throws Exception { - System.out.println("START testNonOfflineInitState at " + new Date(System.currentTimeMillis())); String clusterName = getShortClassName(); setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -81,8 +80,6 @@ public void testNonOfflineInitState() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END testNonOfflineInitState at " + new Date(System.currentTimeMillis())); } private static void setupCluster(String clusterName, String ZkAddr, int startPort, diff --git a/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestRestartParticipant.java b/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestRestartParticipant.java index 15a4515df1..502a50a8dd 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestRestartParticipant.java +++ b/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestRestartParticipant.java @@ -55,9 +55,6 @@ public void doTransition(Message message, NotificationContext context) { @Test() public void testRestartParticipant() throws Exception { - // Logger.getRootLogger().setLevel(Level.INFO); - System.out.println("START testRestartParticipant at " + new Date(System.currentTimeMillis())); - String clusterName = getShortClassName(); MockParticipantManager[] participants = new MockParticipantManager[5]; @@ -112,8 +109,5 @@ public void testRestartParticipant() throws Exception { } participant.syncStop(); deleteCluster(clusterName); - - System.out.println("START testRestartParticipant at " + new Date(System.currentTimeMillis())); - } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestStateTransitionTimeout.java b/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestStateTransitionTimeout.java index 4474594778..07ab349a2b 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestStateTransitionTimeout.java +++ b/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestStateTransitionTimeout.java @@ -59,8 +59,6 @@ public class TestStateTransitionTimeout extends ZkStandAloneCMTestBase { @Override @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); _gSetupTool.addResourceToCluster(CLUSTER_NAME, TEST_DB, _PARTITIONS, STATE_MODEL); diff --git a/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestStateTransitionTimeoutWithResource.java b/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestStateTransitionTimeoutWithResource.java index 42823be780..244f4d9582 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestStateTransitionTimeoutWithResource.java +++ b/helix-core/src/test/java/org/apache/helix/integration/paticipant/TestStateTransitionTimeoutWithResource.java @@ -67,8 +67,6 @@ public class TestStateTransitionTimeoutWithResource extends ZkStandAloneCMTestBa @Override @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestCrushAutoRebalance.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestCrushAutoRebalance.java index 4750a83746..676d708db0 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestCrushAutoRebalance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestCrushAutoRebalance.java @@ -72,8 +72,6 @@ public class TestCrushAutoRebalance extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NUM_NODE; i++) { @@ -120,7 +118,6 @@ public static Object[][] rebalanceStrategies() { @Test(dataProvider = "rebalanceStrategies") public void testZoneIsolation(String rebalanceStrategyName, String rebalanceStrategyClass) throws Exception { - System.out.println("testZoneIsolation " + rebalanceStrategyName); int i = 0; for (String stateModel : _testModels) { String db = "Test-DB-" + rebalanceStrategyName + "-" + i++; @@ -184,7 +181,6 @@ public void testZoneIsolationWithInstanceTag(String rebalanceStrategyName, "testZoneIsolation", "testZoneIsolationWithInstanceTag" }) public void testLackEnoughLiveRacks() throws Exception { - System.out.println("TestLackEnoughInstances"); enablePersistBestPossibleAssignment(_gZkClient, CLUSTER_NAME, true); // shutdown participants within one zone @@ -224,7 +220,6 @@ public void testLackEnoughLiveRacks() throws Exception { "testLackEnoughLiveRacks" }) public void testLackEnoughRacks() throws Exception { - System.out.println("TestLackEnoughInstances "); enablePersistBestPossibleAssignment(_gZkClient, CLUSTER_NAME, true); // shutdown participants within one zone @@ -328,6 +323,5 @@ public void afterClass() throws Exception { } } deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestCrushAutoRebalanceNonRack.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestCrushAutoRebalanceNonRack.java index 3812ec04d6..21a2d09b6d 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestCrushAutoRebalanceNonRack.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestCrushAutoRebalanceNonRack.java @@ -76,8 +76,6 @@ public class TestCrushAutoRebalanceNonRack extends ZkStandAloneCMTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient); @@ -141,7 +139,6 @@ public static String[][] rebalanceStrategies() { @Test(dataProvider = "rebalanceStrategies", enabled = true) public void test(String rebalanceStrategyName, String rebalanceStrategyClass) throws Exception { - System.out.println("Test " + rebalanceStrategyName); int i = 0; for (String stateModel : _testModels) { String db = "Test-DB-" + rebalanceStrategyName + "-" + i++; @@ -212,7 +209,6 @@ public void testWithInstanceTag(String rebalanceStrategyName, String rebalanceSt }) public void testLackEnoughLiveInstances(String rebalanceStrategyName, String rebalanceStrategyClass) throws Exception { - System.out.println("TestLackEnoughLiveInstances " + rebalanceStrategyName); enablePersistBestPossibleAssignment(_gZkClient, CLUSTER_NAME, true); // shutdown participants, keep only two left @@ -260,7 +256,6 @@ public void testLackEnoughLiveInstances(String rebalanceStrategyName, }) public void testLackEnoughInstances(String rebalanceStrategyName, String rebalanceStrategyClass) throws Exception { - System.out.println("TestLackEnoughInstances " + rebalanceStrategyName); enablePersistBestPossibleAssignment(_gZkClient, CLUSTER_NAME, true); // Drop instance from admin tools and controller sending message to the same instance are diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestCrushAutoRebalanceTopoplogyAwareDisabled.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestCrushAutoRebalanceTopoplogyAwareDisabled.java index 6c5e28e402..022ed1f324 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestCrushAutoRebalanceTopoplogyAwareDisabled.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestCrushAutoRebalanceTopoplogyAwareDisabled.java @@ -31,8 +31,6 @@ public class TestCrushAutoRebalanceTopoplogyAwareDisabled extends TestCrushAutoR @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NUM_NODE; i++) { diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestNodeSwap.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestNodeSwap.java index 3b13868507..fcfcdb3991 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestNodeSwap.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/CrushRebalancers/TestNodeSwap.java @@ -69,8 +69,6 @@ public class TestNodeSwap extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient); @@ -135,8 +133,6 @@ public static Object[][] rebalanceStrategies() { @Test(dataProvider = "rebalanceStrategies") public void testNodeSwap(String rebalanceStrategyName, String rebalanceStrategyClass) throws Exception { - System.out.println("Test testNodeSwap for " + rebalanceStrategyName); - int i = 0; for (String stateModel : _testModels) { String db = "Test-DB-" + rebalanceStrategyName + "-" + i++; diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/DelayedAutoRebalancer/TestDelayedAutoRebalance.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/DelayedAutoRebalancer/TestDelayedAutoRebalance.java index d5e8239504..fba0c4b562 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/DelayedAutoRebalancer/TestDelayedAutoRebalance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/DelayedAutoRebalancer/TestDelayedAutoRebalance.java @@ -70,8 +70,6 @@ public class TestDelayedAutoRebalance extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NUM_NODE; i++) { @@ -475,6 +473,5 @@ public void afterClass() throws Exception { participant.syncStop(); } deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/DelayedAutoRebalancer/TestDelayedAutoRebalanceWithRackaware.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/DelayedAutoRebalancer/TestDelayedAutoRebalanceWithRackaware.java index 4af45320dc..14a80ce97e 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/DelayedAutoRebalancer/TestDelayedAutoRebalanceWithRackaware.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/DelayedAutoRebalancer/TestDelayedAutoRebalanceWithRackaware.java @@ -35,8 +35,6 @@ public class TestDelayedAutoRebalanceWithRackaware extends TestDelayedAutoRebala @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NUM_NODE; i++) { diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/PartitionMigration/TestPartitionMigrationBase.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/PartitionMigration/TestPartitionMigrationBase.java index 92ba4375f0..3e2d27f890 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/PartitionMigration/TestPartitionMigrationBase.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/PartitionMigration/TestPartitionMigrationBase.java @@ -71,8 +71,6 @@ public class TestPartitionMigrationBase extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NUM_NODE; i++) { @@ -206,9 +204,6 @@ public void onExternalViewChange(List externalViewList, private void verifyPartitionCount(String resource, String partition, Map stateMap, int replica, String warningPrefix, int minActiveReplica) { if (stateMap.size() < replica) { -// System.out.println( -// "resource " + resource + ", partition " + partition + " has " + stateMap.size() -// + " replicas in " + warningPrefix); _hasLessReplica = true; } @@ -256,6 +251,5 @@ public void afterClass() throws Exception { } _manager.disconnect(); deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoIsWithEmptyMap.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoIsWithEmptyMap.java index 682c4837c5..02f63f8e72 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoIsWithEmptyMap.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoIsWithEmptyMap.java @@ -42,7 +42,6 @@ public void testAutoIsWithEmptyMap() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix @@ -65,7 +64,7 @@ public void testAutoIsWithEmptyMap() throws Exception { ZNRecord idealState = DefaultIdealStateCalculator.calculateIdealState(instanceNames, 10, 2, "TestDB0", "LEADER", "STANDBY"); - // System.out.println(idealState); + // curIdealState.setSimpleField(IdealState.IdealStateProperty.IDEAL_STATE_MODE.toString(), // "CUSTOMIZED"); curIdealState.setSimpleField(IdealState.IdealStateProperty.REPLICAS.toString(), "3"); @@ -98,8 +97,5 @@ public void testAutoIsWithEmptyMap() throws Exception { participants[i].syncStop(); } deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); - } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalance.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalance.java index f668d16038..40e4a1759f 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalance.java @@ -61,8 +61,6 @@ public class TestAutoRebalance extends ZkStandAloneCMTestBase { @Override @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - // Cache references to mock participants for teardown _extraParticipants = new HashSet<>(); diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalancePartitionLimit.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalancePartitionLimit.java index 0fb203e316..ce72b15d61 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalancePartitionLimit.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestAutoRebalancePartitionLimit.java @@ -53,8 +53,6 @@ public class TestAutoRebalancePartitionLimit extends ZkStandAloneCMTestBase { @Override @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestClusterInMaintenanceModeWhenReachingMaxPartition.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestClusterInMaintenanceModeWhenReachingMaxPartition.java index b265e08b78..c49717cc64 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestClusterInMaintenanceModeWhenReachingMaxPartition.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestClusterInMaintenanceModeWhenReachingMaxPartition.java @@ -56,8 +56,6 @@ public class TestClusterInMaintenanceModeWhenReachingMaxPartition extends ZkTest @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NUM_NODE; i++) { @@ -134,6 +132,5 @@ public void afterClass() throws Exception { participant.syncStop(); } deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestClusterInMaintenanceModeWhenReachingOfflineInstancesLimit.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestClusterInMaintenanceModeWhenReachingOfflineInstancesLimit.java index dfc98a878c..8ae7e4e808 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestClusterInMaintenanceModeWhenReachingOfflineInstancesLimit.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestClusterInMaintenanceModeWhenReachingOfflineInstancesLimit.java @@ -68,8 +68,6 @@ public class TestClusterInMaintenanceModeWhenReachingOfflineInstancesLimit exten @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NUM_NODE; i++) { @@ -206,7 +204,6 @@ public void afterClass() throws Exception { participant.syncStop(); } deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } private void checkForRebalanceError(final boolean expectError) throws Exception { diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestCustomIdealState.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestCustomIdealState.java index cd04ef56e6..ce93c28130 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestCustomIdealState.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestCustomIdealState.java @@ -38,7 +38,6 @@ public void testBasic() throws Exception { String uniqClusterName = "TestCustomIS_" + "rg" + numResources + "_p" + numPartitionsPerResource + "_n" + numInstance + "_r" + replica + "_basic"; - System.out.println("START " + uniqClusterName + " at " + new Date(System.currentTimeMillis())); TestDriver.setupClusterWithoutRebalance(uniqClusterName, ZK_ADDR, numResources, numPartitionsPerResource, numInstance, replica); @@ -54,7 +53,6 @@ public void testBasic() throws Exception { TestDriver.stopCluster(uniqClusterName); deleteCluster(uniqClusterName); - System.out.println("STOP " + uniqClusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -66,7 +64,6 @@ public void testNonAliveInstances() throws Exception { String uniqClusterName = "TestCustomIS_" + "rg" + numResources + "_p" + numPartitionsPerResource + "_n" + numInstance + "_r" + replica + "_nonalive"; - System.out.println("START " + uniqClusterName + " at " + new Date(System.currentTimeMillis())); TestDriver.setupClusterWithoutRebalance(uniqClusterName, ZK_ADDR, numResources, numPartitionsPerResource, numInstance, replica); @@ -91,7 +88,6 @@ public void testNonAliveInstances() throws Exception { TestDriver.stopCluster(uniqClusterName); deleteCluster(uniqClusterName); - System.out.println("STOP " + uniqClusterName + " at " + new Date(System.currentTimeMillis())); } @Test() @@ -104,7 +100,6 @@ public void testDrop() throws Exception { String uniqClusterName = "TestCustomIS_" + "rg" + numResources + "_p" + numPartitionsPerResource + "_n" + numInstance + "_r" + replica + "_drop"; - System.out.println("START " + uniqClusterName + " at " + new Date(System.currentTimeMillis())); TestDriver.setupClusterWithoutRebalance(uniqClusterName, ZK_ADDR, numResources, numPartitionsPerResource, numInstance, replica); @@ -126,6 +121,5 @@ public void testDrop() throws Exception { TestDriver.stopCluster(uniqClusterName); deleteCluster(uniqClusterName); - System.out.println("STOP " + uniqClusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestFullAutoNodeTagging.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestFullAutoNodeTagging.java index 63e6e4022b..4584b3bba8 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestFullAutoNodeTagging.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestFullAutoNodeTagging.java @@ -71,7 +71,6 @@ public void testUntag() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); final String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // Set up cluster TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -169,8 +168,6 @@ public boolean verify() throws Exception { participants[i].syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } /** @@ -187,7 +184,6 @@ public void testResourceTaggedFirst() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // Set up cluster TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -255,8 +251,6 @@ public void testSafeAssignment() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - // Set up cluster TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix @@ -324,7 +318,6 @@ public void testSafeAssignment() throws Exception { } controller.syncStop(); TestHelper.dropCluster(clusterName, _gZkClient); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } /** diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java index 10cd662cb2..61373f320f 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestInstanceOperation.java @@ -66,8 +66,6 @@ public class TestInstanceOperation extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NUM_NODE; i++) { @@ -103,7 +101,6 @@ public void beforeClass() throws Exception { @Test public void testEvacuate() throws Exception { - System.out.println("START TestInstanceOperation.testEvacuate() at " + new Date(System.currentTimeMillis())); // EV should contain all participants, check resources one by one Map assignment = getEV(); for (String resource : _allDBs) { @@ -134,7 +131,6 @@ public void testEvacuate() throws Exception { @Test(dependsOnMethods = "testEvacuate") public void testRevertEvacuation() throws Exception { - System.out.println("START TestInstanceOperation.testRevertEvacuation() at " + new Date(System.currentTimeMillis())); // revert an evacuate instance String instanceToEvacuate = _participants.get(0).getInstanceName(); _gSetupTool.getClusterManagementTool() @@ -152,7 +148,6 @@ public void testRevertEvacuation() throws Exception { @Test(dependsOnMethods = "testRevertEvacuation") public void testAddingNodeWithEvacuationTag() throws Exception { - System.out.println("START TestInstanceOperation.testAddingNodeWithEvacuationTag() at " + new Date(System.currentTimeMillis())); // first disable and instance, and wait for all replicas to be moved out String mockNewInstance = _participants.get(0).getInstanceName(); _gSetupTool.getClusterManagementTool() @@ -202,7 +197,6 @@ public void testAddingNodeWithEvacuationTag() throws Exception { @Test(dependsOnMethods = "testAddingNodeWithEvacuationTag") public void testEvacuateAndCancelBeforeBootstrapFinish() throws Exception { - System.out.println("START TestInstanceOperation.testEvacuateAndCancelBeforeBootstrapFinish() at " + new Date(System.currentTimeMillis())); // add a resource where downward state transition is slow createResourceWithDelayedRebalance(CLUSTER_NAME, "TEST_DB3_DELAYED_CRUSHED", "MasterSlave", PARTITIONS, REPLICA, REPLICA - 1, 200000, CrushEdRebalanceStrategy.class.getName()); @@ -264,8 +258,6 @@ public void testEvacuateAndCancelBeforeBootstrapFinish() throws Exception { @Test(dependsOnMethods = "testEvacuateAndCancelBeforeBootstrapFinish") public void testEvacuateAndCancelBeforeDropFinish() throws Exception { - System.out.println("START TestInstanceOperation.testEvacuateAndCancelBeforeDropFinish() at " + new Date(System.currentTimeMillis())); - // set DROP ST delay to a large number _stateModelDelay = 10000L; @@ -301,7 +293,6 @@ public void testEvacuateAndCancelBeforeDropFinish() throws Exception { @Test(dependsOnMethods = "testEvacuateAndCancelBeforeDropFinish") public void testMarkEvacuationAfterEMM() throws Exception { - System.out.println("START TestInstanceOperation.testMarkEvacuationAfterEMM() at " + new Date(System.currentTimeMillis())); _stateModelDelay = 1000L; Assert.assertFalse(_gSetupTool.getClusterManagementTool().isInMaintenanceMode(CLUSTER_NAME)); _gSetupTool.getClusterManagementTool().manuallyEnableMaintenanceMode(CLUSTER_NAME, true, null, @@ -346,7 +337,6 @@ public void testMarkEvacuationAfterEMM() throws Exception { @Test(dependsOnMethods = "testMarkEvacuationAfterEMM") public void testEvacuationWithOfflineInstancesInCluster() throws Exception { - System.out.println("START TestInstanceOperation.testEvacuationWithOfflineInstancesInCluster() at " + new Date(System.currentTimeMillis())); _participants.get(1).syncStop(); _participants.get(2).syncStop(); @@ -430,7 +420,6 @@ private boolean verifyIS(String evacuateInstanceName) { for (String partition : is.getPartitionSet()) { List newPAssignedParticipants = is.getPreferenceList(partition); if (newPAssignedParticipants.contains(evacuateInstanceName)) { - System.out.println("partition " + partition + " assignment " + newPAssignedParticipants + " ev " + evacuateInstanceName); return false; } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestMixedModeAutoRebalance.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestMixedModeAutoRebalance.java index ce806b02e3..13de887ee5 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestMixedModeAutoRebalance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestMixedModeAutoRebalance.java @@ -68,8 +68,6 @@ public class TestMixedModeAutoRebalance extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NUM_NODE; i++) { @@ -280,7 +278,6 @@ public void afterClass() throws Exception { participant.syncStop(); } deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } public static class TestMockParticipantManager extends MockParticipantManager { diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestSemiAutoRebalance.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestSemiAutoRebalance.java index f3993c8472..4fb8ad56f8 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestSemiAutoRebalance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestSemiAutoRebalance.java @@ -62,9 +62,6 @@ public class TestSemiAutoRebalance extends ZkTestBase { @BeforeClass public void beforeClass() throws InterruptedException { - System.out - .println("START " + getShortClassName() + " at " + new Date(System.currentTimeMillis())); - // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); _gSetupTool.addResourceToCluster(CLUSTER_NAME, DB_NAME, PARTITION_NUMBER, STATE_MODEL, @@ -109,7 +106,6 @@ public void afterClass() throws Exception { p.syncStop(); } deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } @Test diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestZeroReplicaAvoidance.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestZeroReplicaAvoidance.java index 6f0b8478a8..7e584b863d 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestZeroReplicaAvoidance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/TestZeroReplicaAvoidance.java @@ -107,7 +107,6 @@ public void afterMethod() { @Test public void testDelayedRebalancer() throws Exception { - System.out.println("START testDelayedRebalancer at " + new Date(System.currentTimeMillis())); HelixManager manager = HelixManagerFactory.getZKHelixManager(CLUSTER_NAME, null, InstanceType.SPECTATOR, ZK_ADDR); manager.connect(); @@ -143,12 +142,10 @@ public void testDelayedRebalancer() throws Exception { if (manager.isConnected()) { manager.disconnect(); } - System.out.println("END testDelayedRebalancer at " + new Date(System.currentTimeMillis())); } @Test public void testWagedRebalancer() throws Exception { - System.out.println("START testWagedRebalancer at " + new Date(System.currentTimeMillis())); HelixManager manager = HelixManagerFactory.getZKHelixManager(CLUSTER_NAME, null, InstanceType.SPECTATOR, ZK_ADDR); manager.connect(); @@ -184,7 +181,6 @@ public void testWagedRebalancer() throws Exception { if (manager.isConnected()) { manager.disconnect(); } - System.out.println("END testWagedRebalancer at " + new Date(System.currentTimeMillis())); } /** diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/WagedRebalancer/TestWagedRebalance.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/WagedRebalancer/TestWagedRebalance.java index a7250d4804..749ddf99d4 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/WagedRebalancer/TestWagedRebalance.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/WagedRebalancer/TestWagedRebalance.java @@ -85,8 +85,6 @@ public class TestWagedRebalance extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NUM_NODE; i++) { diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/WagedRebalancer/TestWagedRebalanceFaultZone.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/WagedRebalancer/TestWagedRebalanceFaultZone.java index 8590a78e0a..8d05bcaa88 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/WagedRebalancer/TestWagedRebalanceFaultZone.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/WagedRebalancer/TestWagedRebalanceFaultZone.java @@ -71,8 +71,6 @@ public class TestWagedRebalanceFaultZone extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); for (int i = 0; i < NUM_NODE; i++) { @@ -371,6 +369,5 @@ public void afterClass() throws Exception { } } deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/WagedRebalancer/TestWagedRebalanceTopologyAware.java b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/WagedRebalancer/TestWagedRebalanceTopologyAware.java index f71642e2de..e2e90c3670 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/rebalancer/WagedRebalancer/TestWagedRebalanceTopologyAware.java +++ b/helix-core/src/test/java/org/apache/helix/integration/rebalancer/WagedRebalancer/TestWagedRebalanceTopologyAware.java @@ -39,8 +39,6 @@ public class TestWagedRebalanceTopologyAware extends TestWagedRebalanceFaultZone @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _gSetupTool.addCluster(CLUSTER_NAME, true); ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient); diff --git a/helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProvider.java b/helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProvider.java index d79ca0be1b..e3d7d5d3e9 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProvider.java +++ b/helix-core/src/test/java/org/apache/helix/integration/spectator/TestRoutingTableProvider.java @@ -109,9 +109,6 @@ public void onRoutingTableChange(RoutingTableSnapshot routingTableSnapshot, Obje @BeforeClass public void beforeClass() throws Exception { - System.out.println( - "START " + getShortClassName() + " at " + new Date(System.currentTimeMillis())); - // setup storage cluster _gSetupTool.addCluster(CLUSTER_NAME, true); diff --git a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailure.java b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailure.java index f5a7f10738..bd26b0efb9 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailure.java +++ b/helix-core/src/test/java/org/apache/helix/integration/task/TestJobFailure.java @@ -77,7 +77,6 @@ public void testNormalJobFailure(String comment, List taskStates, String expectedWorkflowEndingStates) throws Exception { final String JOB_NAME = "test_job"; final String WORKFLOW_NAME = TestHelper.getTestMethodName() + testNum++; - System.out.println("Test case comment: " + comment); Map> targetPartitionConfigs = createPartitionConfig(taskStates, expectedTaskEndingStates); diff --git a/helix-core/src/test/java/org/apache/helix/integration/task/TestRebalanceRunningTask.java b/helix-core/src/test/java/org/apache/helix/integration/task/TestRebalanceRunningTask.java index 425d6e83dc..7b8377c140 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/task/TestRebalanceRunningTask.java +++ b/helix-core/src/test/java/org/apache/helix/integration/task/TestRebalanceRunningTask.java @@ -257,7 +257,6 @@ public void testFixedTargetTaskAndDisabledRebalanceAndNodeAdded() throws Excepti // All tasks stuck on the same instance Assert.assertTrue(checkTasksOnSameInstances()); // Add a new instance, partition is rebalanced - System.out.println("Start new participant"); startParticipant(_initialNumNodes); ZkHelixClusterVerifier clusterVerifier = new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkClient(_gZkClient) diff --git a/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskRebalancerStopResume.java b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskRebalancerStopResume.java index 18c6390f7f..a79ab640e4 100644 --- a/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskRebalancerStopResume.java +++ b/helix-core/src/test/java/org/apache/helix/integration/task/TestTaskRebalancerStopResume.java @@ -411,7 +411,6 @@ public void stopAndDeleteQueue() throws Exception { final String queueName = TestHelper.getTestMethodName(); // Create a queue - System.out.println("START " + queueName + " at " + new Date(System.currentTimeMillis())); WorkflowConfig wfCfg = new WorkflowConfig.Builder(queueName).setExpiry(2, TimeUnit.MINUTES).build(); JobQueue qCfg = new JobQueue.Builder(queueName).fromMap(wfCfg.getResourceConfigMap()).build(); @@ -474,8 +473,6 @@ public boolean verify() throws Exception { } }, 30 * 1000); Assert.assertTrue(result); - - System.out.println("END " + queueName + " at " + new Date(System.currentTimeMillis())); } @Test diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestAddBuiltInStateModelDef.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestAddBuiltInStateModelDef.java index 794e166eb0..c3f4204512 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestAddBuiltInStateModelDef.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestAddBuiltInStateModelDef.java @@ -41,7 +41,6 @@ public void test() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); HelixAdmin admin = new ZKHelixAdmin(_gZkClient); admin.addCluster(clusterName); admin.addStateModelDef(clusterName, BuiltInStateModelDefinitions.MasterSlave.getStateModelDefinition().getId(), @@ -78,6 +77,5 @@ public boolean verify() throws Exception { Assert.assertTrue(ret); controller.syncStop(); admin.dropCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestDefaultControllerMsgHandlerFactory.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestDefaultControllerMsgHandlerFactory.java index 94604b23c1..8a41eea03c 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestDefaultControllerMsgHandlerFactory.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestDefaultControllerMsgHandlerFactory.java @@ -39,9 +39,6 @@ public class TestDefaultControllerMsgHandlerFactory { @Test() public void testDefaultControllerMsgHandlerFactory() { - System.out.println("START TestDefaultControllerMsgHandlerFactory at " - + new Date(System.currentTimeMillis())); - DefaultControllerMessageHandlerFactory facotry = new DefaultControllerMessageHandlerFactory(); Message message = new Message(MessageType.NO_OP, "0"); @@ -88,8 +85,6 @@ public void testDefaultControllerMsgHandlerFactory() { LOG.error("Interrupted handling message", e); } AssertJUnit.assertFalse(exceptionCaught); - System.out.println("END TestDefaultControllerMsgHandlerFactory at " - + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestHandleSession.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestHandleSession.java index ee2f215ca1..03f786a071 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestHandleSession.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestHandleSession.java @@ -57,8 +57,6 @@ public void testHandleNewSession() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = _className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -91,11 +89,8 @@ public void testHandleNewSession() throws Exception { } // Logger.getRootLogger().setLevel(Level.INFO); - System.out.println("Disconnecting ..."); participant.syncStop(); deleteCluster(clusterName); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test(dependsOnMethods = "testHandleNewSession") diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestWtCacheAsyncOpMultiThread.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestWtCacheAsyncOpMultiThread.java index 262bd630df..111a74a821 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestWtCacheAsyncOpMultiThread.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestWtCacheAsyncOpMultiThread.java @@ -189,7 +189,6 @@ public void testHappyPathZkCacheBaseDataAccessor() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // init zkCacheDataAccessor String curStatePath = PropertyPathBuilder.instanceCurrentState(clusterName, "localhost_8901"); @@ -244,6 +243,5 @@ public void testHappyPathZkCacheBaseDataAccessor() { Assert.assertTrue(ret, "wtCache doesn't match data on Zk"); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestWtCacheAsyncOpSingleThread.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestWtCacheAsyncOpSingleThread.java index 801a269c75..9171c16d8d 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestWtCacheAsyncOpSingleThread.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestWtCacheAsyncOpSingleThread.java @@ -40,7 +40,6 @@ public void testHappyPathZkCacheBaseDataAccessor() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // init zkCacheDataAccessor String curStatePath = PropertyPathBuilder.instanceCurrentState(clusterName, "localhost_8901"); @@ -157,7 +156,6 @@ public void testHappyPathZkCacheBaseDataAccessor() { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -165,7 +163,6 @@ public void testCreateFailZkCacheBaseAccessor() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // init zkCacheDataAccessor String curStatePath = PropertyPathBuilder.instanceCurrentState(clusterName, "localhost_8901"); @@ -201,12 +198,10 @@ public void testCreateFailZkCacheBaseAccessor() { // create same 10 current states again, should fail on NodeExists success = accessor.createChildren(paths, records, AccessOption.PERSISTENT); - // System.out.println(Arrays.toString(success)); for (int i = 0; i < 10; i++) { Assert.assertFalse(success[i], "Should fail on create: " + paths.get(i)); } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestWtCacheSyncOpSingleThread.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestWtCacheSyncOpSingleThread.java index 47e7c2cb24..68eccdea55 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestWtCacheSyncOpSingleThread.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestWtCacheSyncOpSingleThread.java @@ -40,7 +40,6 @@ public void testHappyPathZkCacheBaseDataAccessor() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // init zkCacheDataAccessor String curStatePath = PropertyPathBuilder.instanceCurrentState(clusterName, "localhost_8901"); @@ -108,7 +107,7 @@ public void testHappyPathZkCacheBaseDataAccessor() { // getChildNames List childNames = accessor.getChildNames(extViewPath, 0); - // System.out.println(childNames); + Assert.assertEquals(childNames.size(), 10, "Should contain only: TestDB0-9"); for (int i = 0; i < 10; i++) { Assert.assertTrue(childNames.contains("TestDB" + i)); @@ -123,7 +122,6 @@ public void testHappyPathZkCacheBaseDataAccessor() { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -131,7 +129,6 @@ public void testCreateFailZkCacheBaseDataAccessor() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // init zkCacheDataAccessor String curStatePath = PropertyPathBuilder.instanceCurrentState(clusterName, "localhost_8901"); @@ -158,6 +155,5 @@ public void testCreateFailZkCacheBaseDataAccessor() { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordSerializer.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordSerializer.java index f02007bd0e..7b4bb5f85e 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordSerializer.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordSerializer.java @@ -47,6 +47,9 @@ import org.testng.annotations.Test; public class TestZNRecordSerializer { + + private static final Logger LOG = LoggerFactory.getLogger(TestZNRecordSerializer.class); + /** * Test the normal case of serialize/deserialize where ZNRecord is well-formed */ @@ -96,27 +99,27 @@ public void testPerformance() { for (int i = 0; i < loop; i++) { serializer1.serialize(record); } - System.out.println("ZNRecordSerializer serialize took " + (System.currentTimeMillis() - start) + " ms"); + LOG.info("ZNRecordSerializer serialize took " + (System.currentTimeMillis() - start) + " ms"); byte[] data = serializer1.serialize(record); start = System.currentTimeMillis(); for (int i = 0; i < loop; i++) { serializer1.deserialize(data); } - System.out.println("ZNRecordSerializer deserialize took " + (System.currentTimeMillis() - start) + " ms"); + LOG.info("ZNRecordSerializer deserialize took " + (System.currentTimeMillis() - start) + " ms"); start = System.currentTimeMillis(); for (int i = 0; i < loop; i++) { data = serializer2.serialize(record); } - System.out.println("ZNRecordStreamingSerializer serialize took " + (System.currentTimeMillis() - start) + " ms"); + LOG.info("ZNRecordStreamingSerializer serialize took " + (System.currentTimeMillis() - start) + " ms"); start = System.currentTimeMillis(); for (int i = 0; i < loop; i++) { ZNRecord result = (ZNRecord) serializer2.deserialize(data); } - System.out.println("ZNRecordStreamingSerializer deserialize took " + (System.currentTimeMillis() - start) + " ms"); + LOG.info("ZNRecordStreamingSerializer deserialize took " + (System.currentTimeMillis() - start) + " ms"); } @@ -150,25 +153,25 @@ public void testParallelPerformance() throws ExecutionException, InterruptedExce long start = System.currentTimeMillis(); batchSerialize(serializer1, executorService, loop, record); - System.out.println("ZNRecordSerializer serialize took " + (System.currentTimeMillis() - start) + " ms"); + LOG.info("ZNRecordSerializer serialize took " + (System.currentTimeMillis() - start) + " ms"); byte[] data = serializer1.serialize(record); start = System.currentTimeMillis(); batchSerialize(serializer2, executorService, loop, record); - System.out.println("ZNRecordSerializer deserialize took " + (System.currentTimeMillis() - start) + " ms"); + LOG.info("ZNRecordSerializer deserialize took " + (System.currentTimeMillis() - start) + " ms"); start = System.currentTimeMillis(); for (int i = 0; i < loop; i++) { data = serializer2.serialize(record); } - System.out.println("ZNRecordStreamingSerializer serialize took " + (System.currentTimeMillis() - start) + " ms"); + LOG.info("ZNRecordStreamingSerializer serialize took " + (System.currentTimeMillis() - start) + " ms"); start = System.currentTimeMillis(); for (int i = 0; i < loop; i++) { ZNRecord result = (ZNRecord) serializer2.deserialize(data); } - System.out.println("ZNRecordStreamingSerializer deserialize took " + (System.currentTimeMillis() - start) + " ms"); + LOG.info("ZNRecordStreamingSerializer deserialize took " + (System.currentTimeMillis() - start) + " ms"); } @@ -241,12 +244,12 @@ public void testBasicCompression() { byte[] serializedBytes; serializedBytes = serializer.serialize(record); int uncompressedSize = serializedBytes.length; - System.out.println("raw serialized data length = " + serializedBytes.length); + LOG.info("raw serialized data length = " + serializedBytes.length); record.setSimpleField("enableCompression", "true"); serializedBytes = serializer.serialize(record); int compressedSize = serializedBytes.length; - System.out.println("compressed serialized data length = " + serializedBytes.length); - System.out.printf("compression ratio: %.2f \n", (uncompressedSize * 1.0 / compressedSize)); + LOG.info("compressed serialized data length = " + serializedBytes.length); + LOG.info("compression ratio: %.2f \n", (uncompressedSize * 1.0 / compressedSize)); ZNRecord result = (ZNRecord) serializer.deserialize(serializedBytes); Assert.assertEquals(result, record); } @@ -260,7 +263,7 @@ public void testCompression() { int numNodes = 100; Random random = new Random(); ZNRecord record = new ZNRecord("testId"); - System.out.println("Partitions:" + numPartitions); + LOG.info("Partitions:" + numPartitions); for (int p = 0; p < numPartitions; p++) { Map map = new HashMap(); for (int r = 0; r < replicas; r++) { @@ -273,7 +276,7 @@ public void testCompression() { record.setSimpleField("enableCompression", "true"); serializedBytes = serializer.serialize(record); int compressedSize = serializedBytes.length; - System.out.println("compressed serialized data length = " + compressedSize); + LOG.info("compressed serialized data length = " + compressedSize); ZNRecord result = (ZNRecord) serializer.deserialize(serializedBytes); Assert.assertEquals(result, record); runId = runId + 1; diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordSizeLimit.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordSizeLimit.java index 0193738f5d..1a61e85c4a 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordSizeLimit.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordSizeLimit.java @@ -50,8 +50,6 @@ public class TestZNRecordSizeLimit extends ZkUnitTestBase { @Test public void testZNRecordSizeLimitUseZNRecordSerializer() { String className = getShortClassName(); - System.out.println("START testZNRecordSizeLimitUseZNRecordSerializer at " + new Date( - System.currentTimeMillis())); ZNRecordSerializer serializer = new ZNRecordSerializer(); @@ -162,7 +160,7 @@ record = accessor.getProperty(keyBuilder.idealStates("TestDB1")).getRecord(); for (int i = 900; i < 1024; i++) { idealState.getRecord().setSimpleField(i + "", bufStr); } - // System.out.println("record: " + idealState.getRecord()); + succeed = accessor.updateProperty(keyBuilder.idealStates("TestDB1"), idealState); Assert.assertTrue(succeed); recordNew = accessor.getProperty(keyBuilder.idealStates("TestDB1")).getRecord(); @@ -173,16 +171,11 @@ record = accessor.getProperty(keyBuilder.idealStates("TestDB1")).getRecord(); } catch (ZkMarshallingError e) { Assert.fail(ASSERTION_MESSAGE + e); } - - System.out.println("END testZNRecordSizeLimitUseZNRecordSerializer at " + new Date( - System.currentTimeMillis())); } @Test(dependsOnMethods = "testZNRecordSizeLimitUseZNRecordSerializer") public void testZNRecordSizeLimitUseZNRecordStreamingSerializer() { String className = getShortClassName(); - System.out.println("START testZNRecordSizeLimitUseZNRecordStreamingSerializer at " + new Date( - System.currentTimeMillis())); ZNRecordStreamingSerializer serializer = new ZNRecordStreamingSerializer(); HelixZkClient zkClient = SharedZkClientFactory.getInstance() @@ -298,7 +291,7 @@ record = accessor.getProperty(keyBuilder.idealStates("TestDB_2")).getRecord(); for (int i = 900; i < 1024; i++) { idealState.getRecord().setSimpleField(i + "", bufStr); } - // System.out.println("record: " + idealState.getRecord()); + succeed = accessor.updateProperty(keyBuilder.idealStates("TestDB_2"), idealState); Assert.assertTrue(succeed); recordNew = accessor.getProperty(keyBuilder.idealStates("TestDB_2")).getRecord(); @@ -312,9 +305,6 @@ record = accessor.getProperty(keyBuilder.idealStates("TestDB_2")).getRecord(); } finally { zkClient.close(); } - - System.out.println("END testZNRecordSizeLimitUseZNRecordStreamingSerializer at " + new Date( - System.currentTimeMillis())); } /* diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordStreamingSerializer.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordStreamingSerializer.java index 16f0764a32..1fbdd32a11 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordStreamingSerializer.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZNRecordStreamingSerializer.java @@ -7,6 +7,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import org.apache.helix.zookeeper.datamodel.ZNRecord; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; @@ -30,6 +32,9 @@ */ public class TestZNRecordStreamingSerializer { + + private static final Logger LOG = LoggerFactory.getLogger(TestZNRecordStreamingSerializer.class); + /** * Test the normal case of serialize/deserialize where ZNRecord is well-formed */ @@ -129,12 +134,12 @@ public void testBasicCompression() { byte[] serializedBytes; serializedBytes = serializer.serialize(record); int uncompressedSize = serializedBytes.length; - System.out.println("raw serialized data length = " + serializedBytes.length); + LOG.info("raw serialized data length = " + serializedBytes.length); record.setSimpleField("enableCompression", "true"); serializedBytes = serializer.serialize(record); int compressedSize = serializedBytes.length; - System.out.println("compressed serialized data length = " + serializedBytes.length); - System.out.printf("compression ratio: %.2f \n", (uncompressedSize * 1.0 / compressedSize)); + LOG.info("compressed serialized data length = " + serializedBytes.length); + LOG.info("compression ratio: %.2f \n", (uncompressedSize * 1.0 / compressedSize)); ZNRecord result = (ZNRecord) serializer.deserialize(serializedBytes); Assert.assertEquals(result, record); } @@ -148,7 +153,7 @@ public void testCompression() { int numNodes = 100; Random random = new Random(); ZNRecord record = new ZNRecord("testId"); - System.out.println("Partitions:" + numPartitions); + LOG.info("Partitions:" + numPartitions); for (int p = 0; p < numPartitions; p++) { Map map = new HashMap(); for (int r = 0; r < replicas; r++) { @@ -161,7 +166,7 @@ public void testCompression() { record.setSimpleField("enableCompression", "true"); serializedBytes = serializer.serialize(record); int compressedSize = serializedBytes.length; - System.out.println("compressed serialized data length = " + compressedSize); + LOG.info("compressed serialized data length = " + compressedSize); ZNRecord result = (ZNRecord) serializer.deserialize(serializedBytes); Assert.assertEquals(result, record); runId = runId + 1; diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java index 8d9cd29d97..ee830761bd 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBaseDataAccessor.java @@ -85,8 +85,6 @@ public void testSyncSet() { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - String path = String.format("/%s/%s", _rootPath, "msg_0"); ZNRecord record = new ZNRecord("msg_0"); BaseDataAccessor accessor = new ZkBaseDataAccessor(_gZkClient); @@ -96,8 +94,6 @@ public void testSyncSet() { ZNRecord getRecord = _gZkClient.readData(path); Assert.assertNotNull(getRecord); Assert.assertEquals(getRecord.getId(), "msg_0"); - - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -106,8 +102,6 @@ public void testSyncSetWithVersion() { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - String path = String.format("/%s/%s", _rootPath, "msg_0"); ZNRecord record = new ZNRecord("msg_0"); BaseDataAccessor accessor = new ZkBaseDataAccessor(_gZkClient); @@ -154,8 +148,6 @@ record = new ZNRecord("msg_1"); Assert.assertEquals(getRecord.getSimpleFields().size(), 1); Assert.assertNotNull(getRecord.getSimpleField("key0")); Assert.assertEquals(getRecord.getSimpleField("key0"), "value0"); - - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -164,8 +156,6 @@ public void testSyncDoSet() { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - String path = String.format("/%s/%s/%s", _rootPath, "msg_0", "submsg_0"); ZNRecord record = new ZNRecord("submsg_0"); ZkBaseDataAccessor accessor = new ZkBaseDataAccessor(_gZkClient); @@ -180,8 +170,6 @@ public void testSyncDoSet() { ZNRecord getRecord = _gZkClient.readData(path); Assert.assertNotNull(getRecord); Assert.assertEquals(getRecord.getId(), "submsg_0"); - - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -190,8 +178,6 @@ public void testDoSetWithException() { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - String path = String.format("/%s/%s/%s", _rootPath, "msg_0", "submsg_0"); ZNRecord record = new ZNRecord("submsg_0"); ZkBaseDataAccessor accessor = new ZkBaseDataAccessor(_gZkClient); @@ -210,7 +196,6 @@ public void testDoSetWithException() { } catch (ZkBadVersionException e) { // OK } - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -219,8 +204,6 @@ public void testSyncCreate() { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - String path = String.format("/%s/%s", _rootPath, "msg_0"); ZNRecord record = new ZNRecord("msg_0"); ZkBaseDataAccessor accessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -237,8 +220,6 @@ public void testSyncCreate() { getRecord = _gZkClient.readData(path); Assert.assertNotNull(getRecord); Assert.assertEquals(getRecord.getSimpleFields().size(), 0); - - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -248,8 +229,6 @@ public void testSyncCreateWithTTL() { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - String path = String.format("/%s/%s", _rootPath, "msg_0"); ZNRecord record = new ZNRecord("msg_0"); ZkBaseDataAccessor accessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -271,7 +250,6 @@ public void testSyncCreateWithTTL() { Assert.assertEquals(getRecord.getSimpleFields().size(), 0); System.clearProperty("zookeeper.extendedTypesEnabled"); - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -281,8 +259,6 @@ public void testSyncCreateContainer() { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - String path = String.format("/%s/%s", _rootPath, "msg_0"); ZNRecord record = new ZNRecord("msg_0"); ZkBaseDataAccessor accessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -301,7 +277,6 @@ public void testSyncCreateContainer() { Assert.assertEquals(getRecord.getSimpleFields().size(), 0); System.clearProperty("zookeeper.extendedTypesEnabled"); - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -309,10 +284,8 @@ public void testDefaultAccessorCreateCustomData() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); String path = String.format("/%s/%s", _rootPath, "msg_0"); - ZkBaseDataAccessor defaultAccessor = new ZkBaseDataAccessor(ZK_ADDR); List l0 = ImmutableList.of(1, 2, 3); @@ -324,7 +297,6 @@ public void testDefaultAccessorCreateCustomData() { Assert.assertTrue(createResult); defaultAccessor.close(); - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -332,7 +304,6 @@ public void testCustomAccessorCreateZnRecord() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); String path = String.format("/%s/%s", _rootPath, "msg_0"); @@ -345,7 +316,6 @@ public void testCustomAccessorCreateZnRecord() { Assert.assertTrue(createResult); customDataAccessor.close(); - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -353,7 +323,6 @@ public void testSyncCreateWithCustomSerializer() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); String path = String.format("/%s/%s", _rootPath, "msg_0"); @@ -373,7 +342,6 @@ public void testSyncCreateWithCustomSerializer() { Assert.assertEquals(data, l1); accessor.close(); - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -382,8 +350,6 @@ public void testSyncUpdate() { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - String path = String.format("/%s/%s", _rootPath, "msg_0"); ZNRecord record = new ZNRecord("msg_0"); ZkBaseDataAccessor accessor = new ZkBaseDataAccessor(_gZkClient); @@ -415,8 +381,6 @@ public ZNRecord update(ZNRecord currentData) { getRecord = _gZkClient.readData(path); Assert.assertNotNull(getRecord); Assert.assertEquals(getRecord.getSimpleFields().size(), 1); - - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -425,8 +389,6 @@ public void testSyncRemove() { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - String path = String.format("/%s/%s", _rootPath, "msg_0"); ZNRecord record = new ZNRecord("msg_0"); ZkBaseDataAccessor accessor = new ZkBaseDataAccessor(_gZkClient); @@ -460,8 +422,6 @@ public void testSyncRemove() { success = accessor.remove(path, 0); Assert.assertTrue(success); Assert.assertFalse(_gZkClient.exists(path)); - - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -500,8 +460,6 @@ public void testSyncGet() { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - String path = String.format("/%s/%s", _rootPath, "msg_0"); ZNRecord record = new ZNRecord("msg_0"); ZkBaseDataAccessor accessor = new ZkBaseDataAccessor(_gZkClient); @@ -549,8 +507,6 @@ public void testSyncGet() { Assert.assertNotNull(getRecord.getSimpleField("key1")); Assert.assertEquals(getRecord.getSimpleField("key1"), "value1"); Assert.assertEquals(stat.getVersion(), 2); - - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -559,8 +515,6 @@ public void testSyncExist() { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - String path = String.format("/%s/%s", _rootPath, "msg_0"); ZNRecord record = new ZNRecord("msg_0"); ZkBaseDataAccessor accessor = new ZkBaseDataAccessor(_gZkClient); @@ -573,9 +527,6 @@ public void testSyncExist() { success = accessor.exists(path, 0); Assert.assertTrue(success); - - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); - } @Test @@ -584,8 +535,6 @@ public void testSyncGetStat() { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); - String path = String.format("/%s/%s", _rootPath, "msg_0"); ZNRecord record = new ZNRecord("msg_0"); ZkBaseDataAccessor accessor = new ZkBaseDataAccessor(_gZkClient); @@ -601,15 +550,10 @@ public void testSyncGetStat() { Assert.assertEquals(stat.getVersion(), 0); Assert.assertNotSame(stat.getEphemeralOwner(), 0); - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); - } @Test public void testAsyncZkBaseDataAccessor() { - System.out.println( - "START TestZkBaseDataAccessor.async at " + new Date(System.currentTimeMillis())); - String root = _rootPath; _gZkClient.deleteRecursively("/" + root); @@ -791,9 +735,6 @@ public void testAsyncZkBaseDataAccessor() { boolean pathExists = _gZkClient.exists(path); Assert.assertFalse(pathExists, "Should be removed " + msgId); } - - System.out.println("END TestZkBaseDataAccessor.async at " - + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBucketDataAccessor.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBucketDataAccessor.java index 8d6b83fc04..600c411062 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBucketDataAccessor.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkBucketDataAccessor.java @@ -40,12 +40,17 @@ import org.apache.helix.zookeeper.impl.factory.DedicatedZkClientFactory; import org.apache.helix.zookeeper.zkclient.exception.ZkMarshallingError; import org.apache.helix.zookeeper.zkclient.serialize.ZkSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class TestZkBucketDataAccessor extends ZkTestBase { + + private static final Logger LOG = LoggerFactory.getLogger(TestZkBucketDataAccessor.class); + private static final String PATH = "/" + TestHelper.getTestClassName(); private static final String NAME_KEY = TestHelper.getTestClassName(); private static final String LAST_SUCCESSFUL_WRITE_KEY = "LAST_SUCCESSFUL_WRITE"; @@ -180,14 +185,14 @@ public void testLargeWriteAndRead() throws IOException { long before = System.currentTimeMillis(); _bucketDataAccessor.compressedBucketWrite("/" + name, property); long after = System.currentTimeMillis(); - System.out.println("Write took " + (after - before) + " ms"); + LOG.info("Write took " + (after - before) + " ms"); // Read it back before = System.currentTimeMillis(); HelixProperty readRecord = _bucketDataAccessor.compressedBucketRead("/" + name, HelixProperty.class); after = System.currentTimeMillis(); - System.out.println("Read took " + (after - before) + " ms"); + LOG.info("Read took " + (after - before) + " ms"); // Check against the original HelixProperty Assert.assertEquals(readRecord, property); diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheAsyncOpSingleThread.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheAsyncOpSingleThread.java index 36ac89e47b..4dabcc7232 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheAsyncOpSingleThread.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheAsyncOpSingleThread.java @@ -130,7 +130,6 @@ public void testHappyPathExtOpZkCacheBaseDataAccessor() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // init external base data accessor HelixZkClient extZkclient = SharedZkClientFactory.getInstance() @@ -254,7 +253,6 @@ public void testHappyPathExtOpZkCacheBaseDataAccessor() throws Exception { // clean up extZkclient.close(); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -262,7 +260,6 @@ public void testHappyPathSelfOpZkCacheBaseDataAccessor() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // init zkCacheDataAccessor String curStatePath = PropertyPathBuilder.instanceCurrentState(clusterName, "localhost_8901"); @@ -327,8 +324,6 @@ public void testHappyPathSelfOpZkCacheBaseDataAccessor() { // TestHelper.printCache(accessor._zkCache._cache); ret = TestHelper.verifyZkCache(zkCacheInitPaths, zkCacheInitPaths, accessor._zkCache._cache, _gZkClient, true); - // ret = TestHelper.verifyZkCache(zkCacheInitPaths, accessor, _gZkClient, true); - // System.out.println("ret: " + ret); Assert.assertTrue(ret, "zkCache doesn't match data on Zk"); // set 10 external views 10 times by this accessor @@ -352,7 +347,6 @@ public void testHappyPathSelfOpZkCacheBaseDataAccessor() { // verify cache // TestHelper.printCache(accessor._zkCache._cache); ret = TestHelper.verifyZkCache(zkCacheInitPaths, accessor._zkCache._cache, _gZkClient, true); - // System.out.println("ret: " + ret); Assert.assertTrue(ret, "zkCache doesn't match data on Zk"); // get 10 external views @@ -392,6 +386,5 @@ public void testHappyPathSelfOpZkCacheBaseDataAccessor() { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheSyncOpSingleThread.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheSyncOpSingleThread.java index bd2b381de3..4593d1d557 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheSyncOpSingleThread.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkCacheSyncOpSingleThread.java @@ -37,10 +37,15 @@ import org.apache.helix.zookeeper.api.client.HelixZkClient; import org.apache.helix.zookeeper.impl.factory.SharedZkClientFactory; import org.apache.helix.store.HelixPropertyListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; public class TestZkCacheSyncOpSingleThread extends ZkUnitTestBase { + + private static final Logger LOG = LoggerFactory.getLogger(TestZkCacheSyncOpSingleThread.class); + class TestListener implements HelixPropertyListener { ConcurrentLinkedQueue _deletePathQueue = new ConcurrentLinkedQueue<>(); ConcurrentLinkedQueue _createPathQueue = new ConcurrentLinkedQueue<>(); @@ -48,19 +53,16 @@ class TestListener implements HelixPropertyListener { @Override public void onDataDelete(String path) { - // System.out.println(Thread.currentThread().getName() + ", onDelete: " + path); _deletePathQueue.add(path); } @Override public void onDataCreate(String path) { - // System.out.println(Thread.currentThread().getName() + ", onCreate: " + path); _createPathQueue.add(path); } @Override public void onDataChange(String path) { - // System.out.println(Thread.currentThread().getName() + ", onChange: " + path); _changePathQueue.add(path); } @@ -76,7 +78,6 @@ public void testZkCacheCallbackExternalOpNoChroot() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // init external base data accessor HelixZkClient zkclient = SharedZkClientFactory.getInstance() @@ -114,9 +115,9 @@ public void testZkCacheCallbackExternalOpNoChroot() throws Exception { // verify cache // TestHelper.printCache(accessor._zkCache._cache); boolean ret = TestHelper.verifyZkCache(cachePaths, accessor._zkCache._cache, _gZkClient, true); - // System.out.println("ret: " + ret); Assert.assertTrue(ret, "zkCache doesn't match data on Zk"); - System.out.println("createCnt: " + listener._createPathQueue.size()); + + LOG.info("createCnt: " + listener._createPathQueue.size()); Assert.assertEquals(listener._createPathQueue.size(), 11, "Shall get 11 onCreate callbacks."); // verify each callback path @@ -124,7 +125,6 @@ public void testZkCacheCallbackExternalOpNoChroot() throws Exception { List createCallbackPaths = new ArrayList<>(listener._createPathQueue); Collections.sort(createPaths); Collections.sort(createCallbackPaths); - // System.out.println("createCallbackPaths: " + createCallbackPaths); Assert.assertEquals(createCallbackPaths, createPaths, "Should get create callbacks at " + createPaths + ", but was " + createCallbackPaths); @@ -147,9 +147,9 @@ public void testZkCacheCallbackExternalOpNoChroot() throws Exception { // verify cache // TestHelper.printCache(accessor._zkCache._cache); ret = TestHelper.verifyZkCache(cachePaths, accessor._zkCache._cache, _gZkClient, true); - // System.out.println("ret: " + ret); Assert.assertTrue(ret, "zkCache doesn't match data on Zk"); - System.out.println("changeCnt: " + listener._changePathQueue.size()); + + LOG.info("changeCnt: " + listener._changePathQueue.size()); Assert.assertEquals(listener._changePathQueue.size(), 100, "Shall get 100 onChange callbacks."); // verify each callback path @@ -173,9 +173,9 @@ public void testZkCacheCallbackExternalOpNoChroot() throws Exception { // verify cache // TestHelper.printCache(accessor._zkCache._cache); ret = TestHelper.verifyZkCache(cachePaths, accessor._zkCache._cache, _gZkClient, true); - // System.out.println("ret: " + ret); Assert.assertTrue(ret, "zkCache doesn't match data on Zk"); - System.out.println("deleteCnt: " + listener._deletePathQueue.size()); + + LOG.info("deleteCnt: " + listener._deletePathQueue.size()); Assert.assertTrue(listener._deletePathQueue.size() >= 10, "Shall get at least 10 onDelete callbacks."); @@ -185,6 +185,5 @@ public void testZkCacheCallbackExternalOpNoChroot() throws Exception { "Should get remove callbacks at " + removePaths + ", but was " + removeCallbackPaths); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java index 6fa4bfa8f4..05bdc0f0e8 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkClusterManager.java @@ -54,8 +54,6 @@ public class TestZkClusterManager extends ZkUnitTestBase { @Test() public void testController() throws Exception { - System.out.println("START " + className + ".testController() at " - + new Date(System.currentTimeMillis())); final String clusterName = CLUSTER_PREFIX + "_" + className + "_controller"; // basic test @@ -111,15 +109,10 @@ record = store.get("/node_1", stat, options); AssertJUnit.assertFalse(controller.isConnected()); deleteCluster(clusterName); - - System.out.println("END " + className + ".testController() at " - + new Date(System.currentTimeMillis())); } @Test public void testLiveInstanceInfoProvider() throws Exception { - System.out.println("START " + className + ".testLiveInstanceInfoProvider() at " - + new Date(System.currentTimeMillis())); final String clusterName = CLUSTER_PREFIX + "_" + className + "_liveInstanceInfoProvider"; class provider implements LiveInstanceInfoProvider { boolean _flag = false; @@ -227,15 +220,10 @@ public ZNRecord getAdditionalLiveInstanceInfo() { manager.disconnect(); manager2.disconnect(); deleteCluster(clusterName); - - System.out.println("END " + className + ".testLiveInstanceInfoProvider() at " - + new Date(System.currentTimeMillis())); } @Test() public void testAdministrator() throws Exception { - System.out.println("START " + className + ".testAdministrator() at " - + new Date(System.currentTimeMillis())); final String clusterName = CLUSTER_PREFIX + "_" + className + "_admin"; // basic test @@ -270,8 +258,5 @@ public void testAdministrator() throws Exception { AssertJUnit.assertFalse(admin.isConnected()); deleteCluster(clusterName); - - System.out.println("END " + className + ".testAdministrator() at " - + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkFlapping.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkFlapping.java index 83b0bcb360..857e3e1add 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkFlapping.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkFlapping.java @@ -69,8 +69,6 @@ public void testParticipantFlapping() throws Exception { new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_gZkClient)); final PropertyKey.Builder keyBuilder = accessor.keyBuilder(); - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - System.setProperty(SystemPropertyKeys.MAX_DISCONNECT_THRESHOLD, Integer.toString(_disconnectThreshold)); @@ -130,7 +128,6 @@ public void testParticipantFlapping() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -142,8 +139,6 @@ public void testControllerFlapping() throws Exception { new ZKHelixDataAccessor(clusterName, new ZkBaseDataAccessor<>(_gZkClient)); final PropertyKey.Builder keyBuilder = accessor.keyBuilder(); - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - System.setProperty(SystemPropertyKeys.MAX_DISCONNECT_THRESHOLD, Integer.toString(_disconnectThreshold)); @@ -203,6 +198,5 @@ public void testControllerFlapping() throws Exception { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java index e1ffbb646c..e28c79df93 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkHelixAdmin.java @@ -85,12 +85,17 @@ import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.data.Stat; import org.mockito.Mockito; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.AssertJUnit; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; public class TestZkHelixAdmin extends ZkUnitTestBase { + + private static final Logger LOG = LoggerFactory.getLogger(TestZkHelixAdmin.class); + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); @BeforeClass @@ -100,7 +105,6 @@ public void beforeClass() { @Test() public void testZkHelixAdmin() { // TODO refactor this test into small test cases and use @before annotations - System.out.println("START testZkHelixAdmin at " + new Date(System.currentTimeMillis())); final String clusterName = getShortClassName(); String rootPath = "/" + clusterName; @@ -345,7 +349,6 @@ public void testZkHelixAdmin() { } deleteCluster(clusterName); - System.out.println("END testZkHelixAdmin at " + new Date(System.currentTimeMillis())); } private HelixManager initializeHelixManager(String clusterName, String instanceName) { @@ -366,8 +369,6 @@ public void testDropResource() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - HelixAdmin tool = new ZKHelixAdmin(_gZkClient); tool.addCluster(clusterName, true); Assert.assertTrue(ZKUtil.isClusterSetup(clusterName, _gZkClient), "Cluster should be setup"); @@ -393,7 +394,6 @@ public void testDropResource() { "test-db resource config should be dropped"); tool.dropCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } // test add/remove message constraint @@ -403,8 +403,6 @@ public void testAddRemoveMsgConstraint() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - HelixAdmin tool = new ZKHelixAdmin(_gZkClient); tool.addCluster(clusterName, true); Assert.assertTrue(ZKUtil.isClusterSetup(clusterName, _gZkClient), "Cluster should be setup"); @@ -457,7 +455,6 @@ public void testAddRemoveMsgConstraint() { Assert.assertNull(item, "message-constraint for constraint1 should NOT exist"); tool.dropCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -465,7 +462,7 @@ public void testDisableResource() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); + HelixAdmin admin = new ZKHelixAdmin(_gZkClient); admin.addCluster(clusterName, true); Assert.assertTrue(ZKUtil.isClusterSetup(clusterName, _gZkClient), "Cluster should be setup"); @@ -484,7 +481,6 @@ public void testDisableResource() { Assert.assertTrue(idealState.isEnabled()); admin.dropCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -546,7 +542,7 @@ public void testEnableDisablePartitions() { String clusterName = className + "_" + methodName; String instanceName = "TestInstance"; String testResourcePrefix = "TestResource"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); + HelixAdmin admin = new ZKHelixAdmin(_gZkClient); admin.addCluster(clusterName, true); admin.addInstance(clusterName, new InstanceConfig(instanceName)); @@ -598,7 +594,7 @@ public void testResetPartition() throws Exception { String testResource = "TestResource"; String wrongTestInstance = "WrongTestInstance"; String wrongTestResource = "WrongTestResource"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); + HelixAdmin admin = new ZKHelixAdmin(_gZkClient); admin.addCluster(clusterName, true); admin.addInstance(clusterName, new InstanceConfig(instanceName)); @@ -673,16 +669,14 @@ public void testResetPartition() throws Exception { try { Assert.assertTrue(TestHelper.verify(() -> dataAccessor.getChildNames(dataAccessor.keyBuilder().liveInstances()).isEmpty(), 1000)); } catch (Exception e) { - e.printStackTrace(); - System.out.println("There're live instances not cleaned up yet"); + LOG.error("There're live instances not cleaned up yet", e); assert false; } try { Assert.assertTrue(TestHelper.verify(() -> dataAccessor.getChildNames(dataAccessor.keyBuilder().clusterConfig()).isEmpty(), 1000)); } catch (Exception e) { - e.printStackTrace(); - System.out.println("The cluster is not cleaned up yet"); + LOG.error("The cluster is not cleaned up yet", e); assert false; } } @@ -1035,8 +1029,6 @@ public void testPurgeOfflineInstances() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - HelixAdmin tool = new ZKHelixAdmin(_gZkClient); tool.addCluster(clusterName, true); @@ -1096,7 +1088,6 @@ public void testPurgeOfflineInstances() { "Instance should still be there"); tool.dropCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } private void assertInstanceDropped(PropertyKey.Builder keyBuilder, String instanceName) { diff --git a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkReconnect.java b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkReconnect.java index b1bbf22722..7c4b316c5d 100644 --- a/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkReconnect.java +++ b/helix-core/src/test/java/org/apache/helix/manager/zk/TestZkReconnect.java @@ -128,8 +128,7 @@ public boolean verify() throws Exception { try { controller.getHelixPropertyStore(); } catch (HelixException e) { - // Expected exception - System.out.println(e.getMessage()); + LOG.error(e.getMessage(), e); } } finally { controller.disconnect(); diff --git a/helix-core/src/test/java/org/apache/helix/messaging/TestAsyncCallback.java b/helix-core/src/test/java/org/apache/helix/messaging/TestAsyncCallback.java index ef54e6d89c..2f47b67392 100644 --- a/helix-core/src/test/java/org/apache/helix/messaging/TestAsyncCallback.java +++ b/helix-core/src/test/java/org/apache/helix/messaging/TestAsyncCallback.java @@ -25,10 +25,15 @@ import java.util.UUID; import org.apache.helix.model.Message; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.AssertJUnit; import org.testng.annotations.Test; public class TestAsyncCallback { + + private static final Logger LOG = LoggerFactory.getLogger(TestAsyncCallback.class); + class AsyncCallbackSample extends AsyncCallback { int _onTimeOutCalled = 0; int _onReplyMessageCalled = 0; @@ -47,7 +52,6 @@ public void onReplyMessage(Message message) { @Test() public void testAsyncCallback() throws Exception { - System.out.println("START TestAsyncCallback at " + new Date(System.currentTimeMillis())); AsyncCallbackSample callback = new AsyncCallbackSample(); AssertJUnit.assertFalse(callback.isInterrupted()); AssertJUnit.assertFalse(callback.isTimedOut()); @@ -104,14 +108,13 @@ public void testAsyncCallback() throws Exception { sleep(1300); AssertJUnit.assertFalse(callback.isTimedOut()); AssertJUnit.assertTrue(callback._onTimeOutCalled == 0); - System.out.println("END TestAsyncCallback at " + new Date(System.currentTimeMillis())); } void sleep(int time) { try { Thread.sleep(time); } catch (Exception e) { - System.out.println(e); + LOG.info(e.getMessage(), e); } } } diff --git a/helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java index 5ce7c55ae0..10c0a36909 100644 --- a/helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java +++ b/helix-core/src/test/java/org/apache/helix/messaging/handling/TestHelixTaskExecutor.java @@ -68,15 +68,6 @@ public class TestHelixTaskExecutor { - @BeforeClass - public void beforeClass() { - System.out.println("START " + TestHelper.getTestClassName()); - } - - @AfterClass - public void afterClass() { - System.out.println("End " + TestHelper.getTestClassName()); - } public static class MockClusterManager extends MockManager { @Override @@ -259,7 +250,6 @@ public HelixTaskResult handleMessage() { HelixTaskResult result = new HelixTaskResult(); _processedMsgIds.put(_message.getMsgId(), _message.getMsgId()); if (_delay > 0) { - System.out.println("Sleeping..." + _delay); try { Thread.sleep(_delay); } catch (Exception e) { @@ -306,7 +296,6 @@ public void reset() { @Test() public void testNormalMsgExecution() throws InterruptedException { - System.out.println("START TestCMTaskExecutor.testNormalMsgExecution()"); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); @@ -357,14 +346,11 @@ public void testNormalMsgExecution() throws InterruptedException { || factory2._processedMsgIds.containsKey(record.getId())); AssertJUnit.assertFalse(factory._processedMsgIds.containsKey(record.getId()) && factory2._processedMsgIds.containsKey(record.getId())); - } - System.out.println("END TestCMTaskExecutor.testNormalMsgExecution()"); } @Test() public void testDuplicatedMessage() throws InterruptedException { - System.out.println("START TestHelixTaskExecutor.testDuplicatedMessage()"); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); HelixDataAccessor dataAccessor = manager.getHelixDataAccessor(); @@ -423,12 +409,10 @@ public void testDuplicatedMessage() throws InterruptedException { Thread.sleep(1000); Assert.assertEquals(dataAccessor.getChildValues(keyBuilder.messages(instanceName), true).size(), 0); - System.out.println("END TestHelixTaskExecutor.testDuplicatedMessage()"); } @Test() public void testStaledMessage() throws InterruptedException { - System.out.println("START TestHelixTaskExecutor.testStaledMessage()"); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); HelixDataAccessor dataAccessor = manager.getHelixDataAccessor(); @@ -471,13 +455,10 @@ public void testStaledMessage() throws InterruptedException { // The message should be ignored since toState is the same as current state. Assert.assertEquals(dataAccessor.getChildValues(keyBuilder.messages(instanceName), true).size(), 0); - - System.out.println("END TestHelixTaskExecutor.testStaledMessage()"); } @Test() public void testUnknownTypeMsgExecution() throws InterruptedException { - System.out.println("START " + TestHelper.getTestMethodName()); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); @@ -523,12 +504,10 @@ public void testUnknownTypeMsgExecution() throws InterruptedException { AssertJUnit.assertTrue(factory._processedMsgIds.containsKey(message.getId())); } } - System.out.println("END " + TestHelper.getTestMethodName()); } @Test() public void testMsgSessionId() throws InterruptedException { - System.out.println("START " + TestHelper.getTestMethodName()); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); @@ -575,12 +554,10 @@ public void testMsgSessionId() throws InterruptedException { AssertJUnit.assertTrue(factory._processedMsgIds.containsKey(message.getId())); } } - System.out.println("END " + TestHelper.getTestMethodName()); } @Test() public void testCreateHandlerException() throws Exception { - System.out.println("START TestCMTaskExecutor.testCreateHandlerException()"); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); HelixDataAccessor dataAccessor = manager.getHelixDataAccessor(); @@ -655,13 +632,10 @@ public void testCreateHandlerException() throws Exception { }, TestHelper.WAIT_DURATION), "The normal messages should be all processed normally."); Assert.assertEquals(factory._processedMsgIds.size(), nMsgs1); Assert.assertEquals(factory._handlersCreated, nMsgs1); - - System.out.println("END TestCMTaskExecutor.testCreateHandlerException()"); } @Test() public void testTaskCancellation() throws InterruptedException { - System.out.println("START " + TestHelper.getTestMethodName()); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); @@ -711,12 +685,10 @@ public void testTaskCancellation() throws InterruptedException { AssertJUnit.assertTrue(factory._processingMsgIds.containsKey(message.getId())); } } - System.out.println("END " + TestHelper.getTestMethodName()); } @Test() public void testShutdown() throws InterruptedException { - System.out.println("START TestCMTaskExecutor.testShutdown()"); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); @@ -773,12 +745,10 @@ public void testShutdown() throws InterruptedException { for (ExecutorService svc : executor._executorMap.values()) { Assert.assertTrue(svc.isShutdown()); } - System.out.println("END TestCMTaskExecutor.testShutdown()"); } @Test(dependsOnMethods = "testShutdown") public void testHandlerResetTimeout() throws Exception { - System.out.println("START TestCMTaskExecutor.testHandlerResetTimeout()"); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); @@ -824,8 +794,6 @@ public void testHandlerResetTimeout() throws Exception { } Assert.assertEquals(factory._completedMsgIds.size(), 1); Assert.assertTrue(factory._completedMsgIds.contains(msg2.getMsgId())); - - System.out.println("END TestCMTaskExecutor.testHandlerResetTimeout()"); } @Test @@ -853,7 +821,6 @@ public void testMsgHandlerRegistryAndShutdown() { @Test() public void testNoRetry() throws InterruptedException { - System.out.println("START " + TestHelper.getTestMethodName()); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); @@ -889,12 +856,10 @@ public void testNoRetry() throws InterruptedException { AssertJUnit.assertTrue(factory._timedOutMsgIds.containsKey(msgList.get(i).getId())); } } - System.out.println("END " + TestHelper.getTestMethodName()); } @Test() public void testRetryOnce() throws InterruptedException { - System.out.println("START " + TestHelper.getTestMethodName()); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); @@ -925,12 +890,10 @@ public void testRetryOnce() throws InterruptedException { AssertJUnit.assertTrue(msgList.get(1).getRecord().getSimpleField("Cancelcount").equals("1")); AssertJUnit.assertEquals(factory._timedOutMsgIds.size(), 2); AssertJUnit.assertTrue(executor._taskMap.size() == 0); - System.out.println("END " + TestHelper.getTestMethodName()); } @Test public void testStateTransitionCancellationMsg() throws InterruptedException { - System.out.println("START " + TestHelper.getTestMethodName()); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); @@ -970,12 +933,10 @@ public void testStateTransitionCancellationMsg() throws InterruptedException { Thread.sleep(3000); AssertJUnit.assertEquals(cancelFactory._processedMsgIds.size(), 0); AssertJUnit.assertEquals(stateTransitionFactory._processedMsgIds.size(), 0); - System.out.println("END " + TestHelper.getTestMethodName()); } @Test public void testMessageReadOptimization() throws InterruptedException { - System.out.println("START " + TestHelper.getTestMethodName()); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); @@ -1015,13 +976,11 @@ public void testMessageReadOptimization() throws InterruptedException { AssertJUnit.assertEquals(nMsgs1, factory._processedMsgIds.size()); // After all messages are processed, _knownMessageIds should be empty. Assert.assertTrue(executor._knownMessageIds.isEmpty()); - System.out.println("END " + TestHelper.getTestMethodName()); } @Test public void testNoWriteReadStateForRemovedMessage() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { - System.out.println("START " + TestHelper.getTestMethodName()); HelixTaskExecutor executor = new HelixTaskExecutor(); HelixManager manager = new MockClusterManager(); TestMessageHandlerFactory factory = new TestMessageHandlerFactory(); @@ -1060,7 +1019,6 @@ public void testNoWriteReadStateForRemovedMessage() Assert.assertEquals(accessor.getChildNames(keyBuilder.messages(instanceName)).size(), nMsgs1); accessor.removeProperty(keyBuilder.message(instanceName, messageIds.get(0))); - System.out.println(accessor.getChildNames(keyBuilder.messages(instanceName)).size()); for (Message message : messages) { // Mock a change to ensure there will be some delta on the message node after update @@ -1069,13 +1027,10 @@ public void testNoWriteReadStateForRemovedMessage() updateMessageState.invoke(executor, messages, accessor, instanceName); Assert .assertEquals(accessor.getChildNames(keyBuilder.messages(instanceName)).size(), nMsgs1 - 1); - System.out.println("END " + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testStateTransitionCancellationMsg") public void testStateTransitionMsgScheduleFailure() { - System.out.println("START " + TestHelper.getTestMethodName()); - // Create a mock executor that fails the task scheduling. HelixTaskExecutor executor = new HelixTaskExecutor() { @Override @@ -1117,7 +1072,6 @@ public boolean scheduleTask(MessageTask task) { Assert.assertNotNull(currentState); Assert.assertEquals(currentState.getState(msg.getPartitionName()), HelixDefinedState.ERROR.toString()); - System.out.println("END " + TestHelper.getTestMethodName()); } @Test @@ -1154,7 +1108,6 @@ public CustomizedExecutorService getExecutorService(Message.MessageInfo msgInfo) } } - System.out.println("START " + TestHelper.getTestMethodName()); String sessionId = UUID.randomUUID().toString(); String resourceName = "testDB"; String msgId = "testMsgId"; @@ -1196,7 +1149,6 @@ public CustomizedExecutorService getExecutorService(Message.MessageInfo msgInfo) Assert.assertTrue(TestHelper.verify(() -> { return executor1.getTaskCount() == 1; }, TestHelper.WAIT_DURATION)); - System.out.println(TestHelper.getTestMethodName() + ": State transition based test passed."); // Resource name based executor = new HelixTaskExecutor(); // Re-initialize it because if the message exists in _taskMap, it won't be assigned again @@ -1211,7 +1163,6 @@ public CustomizedExecutorService getExecutorService(Message.MessageInfo msgInfo) Assert.assertTrue(TestHelper.verify(() -> { return executor0.getTaskCount() == 1; }, TestHelper.WAIT_DURATION)); - System.out.println(TestHelper.getTestMethodName() + ": Resource name based test passed."); // Message Info based executor = new HelixTaskExecutor(); @@ -1226,8 +1177,5 @@ public CustomizedExecutorService getExecutorService(Message.MessageInfo msgInfo) Assert.assertTrue(TestHelper.verify(() -> { return executor2.getTaskCount() == 1; }, TestHelper.WAIT_DURATION)); - System.out.println(TestHelper.getTestMethodName() + ": Message Info based test passed."); - - System.out.println("END " + TestHelper.getTestMethodName()); } } diff --git a/helix-core/src/test/java/org/apache/helix/messaging/p2pMessage/TestP2PMessages.java b/helix-core/src/test/java/org/apache/helix/messaging/p2pMessage/TestP2PMessages.java index 649ff7ec13..081c658105 100644 --- a/helix-core/src/test/java/org/apache/helix/messaging/p2pMessage/TestP2PMessages.java +++ b/helix-core/src/test/java/org/apache/helix/messaging/p2pMessage/TestP2PMessages.java @@ -123,8 +123,6 @@ public void beforeClass() { @BeforeMethod // just to overide the per-test setup in base class. public void beforeTest(Method testMethod, ITestContext testContext) { - long startTime = System.currentTimeMillis(); - System.out.println("START " + testMethod.getName() + " at " + new Date(startTime)); testContext.setAttribute("StartTime", System.currentTimeMillis()); } diff --git a/helix-core/src/test/java/org/apache/helix/mock/MockBaseDataAccessor.java b/helix-core/src/test/java/org/apache/helix/mock/MockBaseDataAccessor.java index 1567b98cc8..85debd8631 100644 --- a/helix-core/src/test/java/org/apache/helix/mock/MockBaseDataAccessor.java +++ b/helix-core/src/test/java/org/apache/helix/mock/MockBaseDataAccessor.java @@ -32,9 +32,13 @@ import org.apache.helix.zookeeper.zkclient.IZkChildListener; import org.apache.helix.zookeeper.zkclient.IZkDataListener; import org.apache.zookeeper.data.Stat; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class MockBaseDataAccessor implements BaseDataAccessor { + private static final Logger LOG = LoggerFactory.getLogger(MockBaseDataAccessor.class); + class ZNode { private ZNRecord _record; private Stat _stat; @@ -84,7 +88,7 @@ public boolean set(String path, ZNRecord record, int options) { try { Thread.sleep(50); } catch (InterruptedException e) { - e.printStackTrace(); + LOG.info(e.getMessage(), e); } return true; } @@ -106,7 +110,7 @@ public boolean remove(String path, int options) { try { Thread.sleep(50); } catch (InterruptedException e) { - e.printStackTrace(); + LOG.info(e.getMessage(), e); } return true; } @@ -198,8 +202,8 @@ public List getChildren(String parentPath, List stats, int optio children.add(record); } } else { - System.out.println("keySplit:" + Arrays.toString(keySplit)); - System.out.println("pathSplit:" + Arrays.toString(pathSplit)); + LOG.info("keySplit:" + Arrays.toString(keySplit)); + LOG.info("pathSplit:" + Arrays.toString(pathSplit)); } } } diff --git a/helix-core/src/test/java/org/apache/helix/mock/controller/MockController.java b/helix-core/src/test/java/org/apache/helix/mock/controller/MockController.java index 43b03829f9..42f09fabf3 100644 --- a/helix-core/src/test/java/org/apache/helix/mock/controller/MockController.java +++ b/helix-core/src/test/java/org/apache/helix/mock/controller/MockController.java @@ -77,7 +77,7 @@ void sendMessage(String msgId, String instanceName, String fromState, String toS ObjectMapper mapper = new ObjectMapper(); StringWriter sw = new StringWriter(); mapper.writeValue(sw, message); - System.out.println(sw.toString()); + client.delete(path); Thread.sleep(10000); diff --git a/helix-core/src/test/java/org/apache/helix/mock/participant/MockHelixTaskExecutor.java b/helix-core/src/test/java/org/apache/helix/mock/participant/MockHelixTaskExecutor.java index 757b8822fc..55b4cc09e9 100644 --- a/helix-core/src/test/java/org/apache/helix/mock/participant/MockHelixTaskExecutor.java +++ b/helix-core/src/test/java/org/apache/helix/mock/participant/MockHelixTaskExecutor.java @@ -29,7 +29,6 @@ public class MockHelixTaskExecutor extends HelixTaskExecutor { boolean completionInvoked = false; @Override public void finishTask(MessageTask task) { - System.out.println("Mocks.MockCMTaskExecutor.finishTask()"); completionInvoked = true; } diff --git a/helix-core/src/test/java/org/apache/helix/mock/spectator/MockSpectatorProcess.java b/helix-core/src/test/java/org/apache/helix/mock/spectator/MockSpectatorProcess.java index 636036ce5d..e447e19320 100644 --- a/helix-core/src/test/java/org/apache/helix/mock/spectator/MockSpectatorProcess.java +++ b/helix-core/src/test/java/org/apache/helix/mock/spectator/MockSpectatorProcess.java @@ -33,13 +33,17 @@ import org.apache.helix.zookeeper.zkclient.IDefaultNameSpace; import org.apache.helix.zookeeper.zkclient.ZkClient; import org.apache.helix.zookeeper.zkclient.ZkServer; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * A MockSpectatorProcess to demonstrate the integration with cluster manager. * This uses Zookeeper in local mode and runs at port 2188 */ public class MockSpectatorProcess { + + private static final Logger LOG = LoggerFactory.getLogger(MockSpectatorProcess.class); + private static final int port = 2188; static long runId = System.currentTimeMillis(); private static final String dataDir = "/tmp/zkDataDir-" + runId; @@ -102,21 +106,21 @@ public void routeRequest(String database, String partition) { List slaves; masters = _routingTableProvider.getInstances(database, partition, "MASTER"); if (masters != null && !masters.isEmpty()) { - System.out.println("Available masters to route request"); + LOG.info("Available masters to route request"); for (InstanceConfig config : masters) { - System.out.println("HostName:" + config.getHostName() + " Port:" + config.getPort()); + LOG.info("HostName:" + config.getHostName() + " Port:" + config.getPort()); } } else { - System.out.println("No masters available to route request"); + LOG.info("No masters available to route request"); } slaves = _routingTableProvider.getInstances(database, partition, "SLAVE"); if (slaves != null && !slaves.isEmpty()) { - System.out.println("Available slaves to route request"); + LOG.info("Available slaves to route request"); for (InstanceConfig config : slaves) { - System.out.println("HostName:" + config.getHostName() + " Port:" + config.getPort()); + LOG.info("HostName:" + config.getHostName() + " Port:" + config.getPort()); } } else { - System.out.println("No slaves available to route request"); + LOG.info("No slaves available to route request"); } } diff --git a/helix-core/src/test/java/org/apache/helix/model/TestConstraint.java b/helix-core/src/test/java/org/apache/helix/model/TestConstraint.java index 08da086319..243f616cf5 100644 --- a/helix-core/src/test/java/org/apache/helix/model/TestConstraint.java +++ b/helix-core/src/test/java/org/apache/helix/model/TestConstraint.java @@ -42,7 +42,6 @@ public class TestConstraint extends ZkUnitTestBase { @Test public void testMsgConstraint() { String className = getShortClassName(); - System.out.println("START testMsgConstraint() at " + new Date(System.currentTimeMillis())); String clusterName = "CLUSTER_" + className + "_msg"; TestHelper.setupEmptyCluster(_gZkClient, clusterName); @@ -114,7 +113,6 @@ record = accessor.getProperty(keyBuilder.constraint(ConstraintType.MESSAGE_CONSTRAINT.toString())) .getRecord(); ClusterConstraints constraint = new ClusterConstraints(record); - // System.out.println("constraint: " + constraint); // message1 Message msg1 = @@ -123,7 +121,7 @@ record = Map msgAttr = ClusterConstraints.toConstraintAttributes(msg1); Set matches = constraint.match(msgAttr); - System.out.println(msg1 + " matches(" + matches.size() + "): " + matches); + Assert.assertEquals(matches.size(), 5); Assert.assertTrue(contains(matches, constraint0)); Assert.assertTrue(contains(matches, constraint1)); @@ -138,21 +136,18 @@ record = msgAttr = ClusterConstraints.toConstraintAttributes(msg2); matches = constraint.match(msgAttr); - System.out.println(msg2 + " matches(" + matches.size() + "): " + matches); + Assert.assertEquals(matches.size(), 5); Assert.assertTrue(contains(matches, constraint0)); Assert.assertTrue(contains(matches, constraint1)); Assert.assertTrue(contains(matches, constraint2)); Assert.assertTrue(contains(matches, constraint3)); Assert.assertTrue(contains(matches, constraint4)); - - System.out.println("END testMsgConstraint() at " + new Date(System.currentTimeMillis())); } @Test public void testStateConstraint() { String className = getShortClassName(); - System.out.println("START testStateConstraint() at " + new Date(System.currentTimeMillis())); String clusterName = "CLUSTER_" + className + "_state"; TestHelper.setupEmptyCluster(_gZkClient, clusterName); @@ -192,7 +187,6 @@ record = accessor.getProperty(keyBuilder.constraint(ConstraintType.STATE_CONSTRAINT.toString())) .getRecord(); ClusterConstraints constraint = new ClusterConstraints(record); - // System.out.println("constraint: " + constraint); // state1: hit rule2 Map stateAttr1 = new HashMap(); @@ -200,7 +194,6 @@ record = stateAttr1.put(ConstraintAttribute.RESOURCE, "TestDB"); Set matches = constraint.match(stateAttr1); - System.out.println(stateAttr1 + " matches(" + matches.size() + "): " + matches); Assert.assertEquals(matches.size(), 3); Assert.assertTrue(contains(matches, constraint0)); Assert.assertTrue(contains(matches, constraint1)); @@ -218,7 +211,6 @@ record = stateAttr2.put(ConstraintAttribute.RESOURCE, "MyDB"); matches = constraint.match(stateAttr2); - System.out.println(stateAttr2 + " matches(" + matches.size() + "): " + matches); Assert.assertEquals(matches.size(), 2); Assert.assertTrue(contains(matches, constraint0)); Assert.assertTrue(contains(matches, constraint2)); @@ -230,7 +222,6 @@ record = // Assert.assertTrue(contains(matches, constraint2)); deleteCluster(clusterName); - System.out.println("END testStateConstraint() at " + new Date(System.currentTimeMillis())); } private boolean contains(Set constraints, ConstraintItem constraint) { diff --git a/helix-core/src/test/java/org/apache/helix/model/TestIdealState.java b/helix-core/src/test/java/org/apache/helix/model/TestIdealState.java index 42927bac87..5240fbfedd 100644 --- a/helix-core/src/test/java/org/apache/helix/model/TestIdealState.java +++ b/helix-core/src/test/java/org/apache/helix/model/TestIdealState.java @@ -41,7 +41,6 @@ public void testGetInstanceSet() { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); IdealState idealState = new IdealState("idealState"); idealState.getRecord().setListField("TestDB_0", Arrays.asList("node_1", "node_2")); @@ -71,8 +70,6 @@ public void testGetInstanceSet() { instances = idealState.getInstanceSet("TestDB_nonExist_custom"); Assert.assertEquals(instances, Collections.emptySet(), "Should get empty set"); - - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } @Test diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterEventStatusMonitor.java b/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterEventStatusMonitor.java index 3abf2f424a..8899b19b66 100644 --- a/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterEventStatusMonitor.java +++ b/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterEventStatusMonitor.java @@ -39,10 +39,14 @@ import org.apache.helix.controller.stages.resource.ResourceMessageDispatchStage; import org.apache.helix.monitoring.mbeans.ClusterEventMonitor; import org.apache.helix.monitoring.mbeans.ClusterStatusMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; public class TestClusterEventStatusMonitor { + + private static final Logger LOG = LoggerFactory.getLogger(TestClusterEventStatusMonitor.class); private static final int TEST_SLIDING_WINDOW_MS = 2000; // 2s window for testing private class ClusterStatusMonitorForTest extends ClusterStatusMonitor { @@ -60,7 +64,6 @@ public void test() throws InstanceNotFoundException, MalformedObjectNameException, NullPointerException, IOException, InterruptedException, MBeanException, AttributeNotFoundException, ReflectionException{ - System.out.println("START TestClusterEventStatusMonitor"); String clusterName = "TestCluster"; ClusterStatusMonitorForTest monitor = new ClusterStatusMonitorForTest(clusterName); @@ -119,7 +122,7 @@ public void test() Assert.assertTrue(Math.abs(stddev - 158.0) < 0.2); } - System.out.println("\nWaiting for time window to expire\n"); + LOG.info("Waiting for time window to expire"); Thread.sleep(TEST_SLIDING_WINDOW_MS); // Since sliding window has expired, just make sure histograms have its values reset @@ -144,8 +147,6 @@ public void test() _server.queryMBeans( new ObjectName("ClusterStatus:cluster=TestCluster,eventName=ClusterEvent,*"), null); Assert.assertEquals(mbeans.size(), 0); - - System.out.println("END TestParticipantMonitor"); } private void addTestEventMonitor(ClusterStatusMonitorForTest monitor, String phaseName) throws diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterStatusMonitorLifecycle.java b/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterStatusMonitorLifecycle.java index 61b2f58bb6..08c229d555 100644 --- a/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterStatusMonitorLifecycle.java +++ b/helix-core/src/test/java/org/apache/helix/monitoring/TestClusterStatusMonitorLifecycle.java @@ -135,7 +135,6 @@ public void beforeClass() throws Exception { @AfterClass public void afterClass() throws Exception { - System.out.println("Cleaning up..."); cleanupControllers(); for (MockParticipantManager participant : _participants) { if (participant != null) { @@ -147,8 +146,6 @@ public void afterClass() throws Exception { for (String cluster : _clusters) { TestHelper.dropCluster(cluster, _gZkClient); } - - System.out.println("END " + _clusterNamePrefix + " at " + new Date(System.currentTimeMillis())); } /** @@ -165,9 +162,6 @@ private void cleanupControllers() { .build(); Assert.assertTrue(controllerClusterVerifier.verifyByPolling(), "Controller cluster NOT in ideal state"); - System.out.println(String.format("Disconnecting controller %s from cluster %s at %s", - controller.getInstanceName(), controller.getClusterName(), - new Date(System.currentTimeMillis()))); controller.syncStop(); _controllers[i] = null; } diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/TestParticipantMonitor.java b/helix-core/src/test/java/org/apache/helix/monitoring/TestParticipantMonitor.java index b761573865..a29bb58d5b 100644 --- a/helix-core/src/test/java/org/apache/helix/monitoring/TestParticipantMonitor.java +++ b/helix-core/src/test/java/org/apache/helix/monitoring/TestParticipantMonitor.java @@ -114,7 +114,6 @@ public void testReportStateTransitionData() throws InstanceNotFoundException, MalformedObjectNameException, NullPointerException, IOException, InterruptedException, MBeanException, AttributeNotFoundException, ReflectionException { - System.out.println("START TestParticipantStateTransitionMonitor"); ParticipantStatusMonitor monitor = new ParticipantStatusMonitor(false, null); int monitorNum = 0; @@ -172,8 +171,6 @@ public void testReportStateTransitionData() monitorListener2.disconnect(); monitorListener.disconnect(); - - System.out.println("END TestParticipantStateTransitionMonitor"); } @Test() @@ -181,7 +178,6 @@ public void testReportMessageData() throws InstanceNotFoundException, MalformedObjectNameException, NullPointerException, IOException, InterruptedException, MBeanException, AttributeNotFoundException, ReflectionException { - System.out.println("START TestParticipantMessageMonitor"); ParticipantStatusMonitor monitor = new ParticipantStatusMonitor(true, PARTICIPANT_NAME); Message message = new Message(Message.MessageType.NO_OP, "0"); @@ -240,7 +236,5 @@ public void testReportMessageData() .toString()).get("PendingMessages"), 0L); monitorListener.disconnect(); - - System.out.println("END TestParticipantMessageMonitor"); } } diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/TestWorkflowMonitor.java b/helix-core/src/test/java/org/apache/helix/monitoring/TestWorkflowMonitor.java index 55dea1b929..c71aaa85bd 100644 --- a/helix-core/src/test/java/org/apache/helix/monitoring/TestWorkflowMonitor.java +++ b/helix-core/src/test/java/org/apache/helix/monitoring/TestWorkflowMonitor.java @@ -32,10 +32,14 @@ import org.apache.helix.monitoring.mbeans.MonitorDomainNames; import org.apache.helix.monitoring.mbeans.WorkflowMonitor; import org.apache.helix.task.TaskState; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; public class TestWorkflowMonitor { + + private static final Logger LOG = LoggerFactory.getLogger(TestWorkflowMonitor.class); private static final String TEST_CLUSTER_NAME = "TestCluster"; private static final String TEST_WORKFLOW_TYPE = "WorkflowTestType"; private static final String TEST_WORKFLOW_MBEAN_NAME = String @@ -139,10 +143,9 @@ private void registerMbean(Object bean, ObjectName name) { } try { - System.out.println("Register MBean: " + name); beanServer.registerMBean(bean, name); } catch (Exception e) { - System.out.println("Could not register MBean: " + name + e.toString()); + LOG.info("Could not register MBean: " + name, e); } } diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/TestZKPathDataDumpTask.java b/helix-core/src/test/java/org/apache/helix/monitoring/TestZKPathDataDumpTask.java index 97456ea905..345d31e0d8 100644 --- a/helix-core/src/test/java/org/apache/helix/monitoring/TestZKPathDataDumpTask.java +++ b/helix-core/src/test/java/org/apache/helix/monitoring/TestZKPathDataDumpTask.java @@ -47,8 +47,6 @@ public void test() throws Exception { String clusterName = className + "_" + methodName; int n = 1; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -110,7 +108,6 @@ public void test() throws Exception { errorKey = keyBuilder.stateTransitionErrors("localhost_12918"); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -120,8 +117,6 @@ public void testCapacityReached() throws Exception { String clusterName = className + "_" + methodName; int n = 1; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAggregateMetrics.java b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAggregateMetrics.java index 1cb3860acb..c6467d0cf4 100644 --- a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAggregateMetrics.java +++ b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterAggregateMetrics.java @@ -83,8 +83,6 @@ public class TestClusterAggregateMetrics extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); - _setupTool = new ClusterSetup(ZK_ADDR); // setup storage cluster _setupTool.addCluster(CLUSTER_NAME, true); @@ -139,7 +137,6 @@ public void afterClass() { _manager.disconnect(); } deleteCluster(CLUSTER_NAME); - System.out.println("END " + CLASS_NAME + " at " + new Date(System.currentTimeMillis())); } @Test diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterStatusMonitor.java b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterStatusMonitor.java index b0837869a9..8696ad770b 100644 --- a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterStatusMonitor.java +++ b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestClusterStatusMonitor.java @@ -81,8 +81,6 @@ public void testReportData() throws Exception { String clusterName = className + "_" + methodName; int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - ClusterStatusMonitor monitor = new ClusterStatusMonitor(clusterName); monitor.active(); ObjectName clusterMonitorObjName = monitor.getObjectName(monitor.clusterBeanName()); @@ -172,8 +170,6 @@ public void testReportData() throws Exception { Assert.assertFalse(_server.isRegistered(clusterMonitorObjName), "Failed to unregister ClusterStatusMonitor."); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test() @@ -183,8 +179,6 @@ public void testMessageMetrics() throws Exception { String clusterName = className + "_" + methodName; int n = 5; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - ClusterStatusMonitor monitor = new ClusterStatusMonitor(clusterName); monitor.active(); ObjectName clusterMonitorObjName = monitor.getObjectName(monitor.clusterBeanName()); @@ -251,8 +245,6 @@ public void testMessageMetrics() throws Exception { Assert.assertTrue(pastdueMsgCount instanceof Long); Assert.assertEquals((long) pastdueMsgCount, 15L); } - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -261,8 +253,6 @@ public void testResourceAggregation() throws JMException, IOException { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - ClusterStatusMonitor monitor = new ClusterStatusMonitor(clusterName); monitor.active(); ObjectName clusterMonitorObjName = monitor.getObjectName(monitor.clusterBeanName()); diff --git a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDisableResourceMbean.java b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDisableResourceMbean.java index 63e1a81b08..5b05704c95 100644 --- a/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDisableResourceMbean.java +++ b/helix-core/src/test/java/org/apache/helix/monitoring/mbeans/TestDisableResourceMbean.java @@ -46,7 +46,6 @@ public class TestDisableResourceMbean extends ZkUnitTestBase { public void testDisableResourceMonitoring() throws Exception { final int NUM_PARTICIPANTS = 2; String clusterName = TestHelper.getTestClassName() + "_" + TestHelper.getTestMethodName(); - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); // Set up cluster TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port @@ -100,7 +99,6 @@ public void testDisableResourceMonitoring() throws Exception { participant.syncStop(); } TestHelper.dropCluster(clusterName, _gZkClient); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } private void pollForMBeanExistance(final ObjectName objectName, boolean expectation) diff --git a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java index 01711d9c6d..adf9e2d240 100644 --- a/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java +++ b/helix-core/src/test/java/org/apache/helix/participant/TestDistControllerElection.java @@ -52,8 +52,6 @@ public class TestDistControllerElection extends ZkUnitTestBase { @Test() public void testController() throws Exception { - System.out.println("START TestDistControllerElection at " - + new Date(System.currentTimeMillis())); String className = getShortClassName(); final String clusterName = CLUSTER_PREFIX + "_" + className + "_" + "testController"; @@ -107,8 +105,6 @@ public void testController() throws Exception { accessor.removeProperty(keyBuilder.controllerLeader()); TestHelper.dropCluster(clusterName, _gZkClient); } - - System.out.println("END TestDistControllerElection at " + new Date(System.currentTimeMillis())); } @Test(dependsOnMethods = "testController") diff --git a/helix-core/src/test/java/org/apache/helix/store/TestJsonComparator.java b/helix-core/src/test/java/org/apache/helix/store/TestJsonComparator.java index 12efa20742..619145e2df 100644 --- a/helix-core/src/test/java/org/apache/helix/store/TestJsonComparator.java +++ b/helix-core/src/test/java/org/apache/helix/store/TestJsonComparator.java @@ -30,14 +30,10 @@ public class TestJsonComparator { "unitTest" }) public void testJsonComparator() { - System.out.println("START TestJsonComparator at " + new Date(System.currentTimeMillis())); - ZNRecord record = new ZNRecord("id1"); - PropertyJsonComparator comparator = - new PropertyJsonComparator(ZNRecord.class); + PropertyJsonComparator comparator = new PropertyJsonComparator(ZNRecord.class); AssertJUnit.assertTrue(comparator.compare(null, null) == 0); AssertJUnit.assertTrue(comparator.compare(null, record) == -1); AssertJUnit.assertTrue(comparator.compare(record, null) == 1); - System.out.println("END TestJsonComparator at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/store/zk/TestAutoFallbackPropertyStore.java b/helix-core/src/test/java/org/apache/helix/store/zk/TestAutoFallbackPropertyStore.java index c1017ad14f..29220d99b7 100644 --- a/helix-core/src/test/java/org/apache/helix/store/zk/TestAutoFallbackPropertyStore.java +++ b/helix-core/src/test/java/org/apache/helix/store/zk/TestAutoFallbackPropertyStore.java @@ -59,7 +59,6 @@ public void testSingleUpdateUsingFallbackPath() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); String root = String.format("/%s/%s", clusterName, PropertyType.PROPERTYSTORE.name()); String fallbackRoot = String.format("/%s/%s", clusterName, "HELIX_PROPERTYSTORE"); ZkBaseDataAccessor baseAccessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -96,7 +95,6 @@ record = baseAccessor.get(String.format("%s%s", root, path), null, 0); Assert.assertEquals(record.getSimpleField("key"), "value"); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -105,7 +103,6 @@ public void testSingleUpdateUsingNewPath() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); String root = String.format("/%s/%s", clusterName, PropertyType.PROPERTYSTORE.name()); String fallbackRoot = String.format("/%s/%s", clusterName, "HELIX_PROPERTYSTORE"); ZkBaseDataAccessor baseAccessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -143,7 +140,6 @@ record = baseAccessor.get(String.format("%s%s", root, path), null, 0); Assert.assertEquals(record.getSimpleField("key"), "value"); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -152,7 +148,6 @@ public void testMultiUpdateUsingFallbackPath() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); String root = String.format("/%s/%s", clusterName, PropertyType.PROPERTYSTORE.name()); String fallbackRoot = String.format("/%s/%s", clusterName, "HELIX_PROPERTYSTORE"); ZkBaseDataAccessor baseAccessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -198,7 +193,6 @@ record = baseAccessor.get(String.format("%s%s", root, path), null, 0); } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -207,7 +201,6 @@ public void testMultiUpdateUsingNewath() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); String root = String.format("/%s/%s", clusterName, PropertyType.PROPERTYSTORE.name()); String fallbackRoot = String.format("/%s/%s", clusterName, "HELIX_PROPERTYSTORE"); ZkBaseDataAccessor baseAccessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -265,7 +258,6 @@ public void testMultiUpdateUsingNewath() { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -274,7 +266,6 @@ public void testSingleSet() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); String root = String.format("/%s/%s", clusterName, PropertyType.PROPERTYSTORE.name()); String fallbackRoot = String.format("/%s/%s", clusterName, "HELIX_PROPERTYSTORE"); ZkBaseDataAccessor baseAccessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -306,7 +297,6 @@ record = baseAccessor.get(String.format("%s%s", root, path), null, 0); Assert.assertEquals(record.getId(), "new0"); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -315,7 +305,6 @@ public void testMultiSet() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); String root = String.format("/%s/%s", clusterName, PropertyType.PROPERTYSTORE.name()); String fallbackRoot = String.format("/%s/%s", clusterName, "HELIX_PROPERTYSTORE"); ZkBaseDataAccessor baseAccessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -356,7 +345,6 @@ record = baseAccessor.get(String.format("%s%s", root, path), null, 0); } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -365,7 +353,6 @@ public void testSingleGetOnFallbackPath() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); String root = String.format("/%s/%s", clusterName, PropertyType.PROPERTYSTORE.name()); String fallbackRoot = String.format("/%s/%s", clusterName, "HELIX_PROPERTYSTORE"); ZkBaseDataAccessor baseAccessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -401,7 +388,6 @@ public void testSingleGetOnFallbackPath() { "Should not exist under new location after get"); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -410,7 +396,6 @@ void testMultiGetOnFallbackPath() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); String root = String.format("/%s/%s", clusterName, PropertyType.PROPERTYSTORE.name()); String fallbackRoot = String.format("/%s/%s", clusterName, "HELIX_PROPERTYSTORE"); ZkBaseDataAccessor baseAccessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -460,7 +445,6 @@ void testMultiGetOnFallbackPath() { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -469,7 +453,6 @@ public void testFailOnSingleGet() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); String root = String.format("/%s/%s", clusterName, PropertyType.PROPERTYSTORE.name()); String fallbackRoot = String.format("/%s/%s", clusterName, "HELIX_PROPERTYSTORE"); ZkBaseDataAccessor baseAccessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -496,7 +479,6 @@ public void testFailOnSingleGet() { Assert.assertNull(record); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -505,7 +487,6 @@ public void testFailOnMultiGet() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); String root = String.format("/%s/%s", clusterName, PropertyType.PROPERTYSTORE.name()); String fallbackRoot = String.format("/%s/%s", clusterName, "HELIX_PROPERTYSTORE"); ZkBaseDataAccessor baseAccessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -572,7 +553,6 @@ public void testFailOnMultiGet() { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -581,7 +561,6 @@ public void testGetChildren() { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); String root = String.format("/%s/%s", clusterName, PropertyType.PROPERTYSTORE.name()); String fallbackRoot = String.format("/%s/%s", clusterName, "HELIX_PROPERTYSTORE"); ZkBaseDataAccessor baseAccessor = new ZkBaseDataAccessor<>(_gZkClient); @@ -639,6 +618,5 @@ public void testGetChildren() { } deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/store/zk/TestZkHelixPropertyStore.java b/helix-core/src/test/java/org/apache/helix/store/zk/TestZkHelixPropertyStore.java index 13054681b8..d2cccb51b3 100644 --- a/helix-core/src/test/java/org/apache/helix/store/zk/TestZkHelixPropertyStore.java +++ b/helix-core/src/test/java/org/apache/helix/store/zk/TestZkHelixPropertyStore.java @@ -43,11 +43,16 @@ import org.apache.helix.store.HelixPropertyListener; import org.apache.helix.zookeeper.zkclient.exception.ZkNoNodeException; import org.apache.helix.zookeeper.zkclient.serialize.SerializableSerializer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; public class TestZkHelixPropertyStore extends ZkUnitTestBase { + + private static final Logger LOG = LoggerFactory.getLogger(TestZkHelixPropertyStore.class); + final String _root = "/" + getShortClassName(); final int bufSize = 128; final int mapNr = 10; @@ -90,10 +95,6 @@ public void afterClass() { @Test public void testSet() { - // Logger.getRootLogger().setLevel(Level.INFO); - - System.out.println("START testSet() at " + new Date(System.currentTimeMillis())); - String subRoot = _root + "/" + "set"; List subscribedPaths = new ArrayList<>(); subscribedPaths.add(subRoot); @@ -118,13 +119,11 @@ public void testSet() { Assert.assertNotNull(record); } long endT = System.currentTimeMillis(); - System.out.println("1000 Get() time used: " + (endT - startT) + "ms"); long latency = endT - startT; Assert.assertTrue(latency < 200, "1000 Gets should be finished within 200ms, but was " + latency + " ms"); store.stop(); - System.out.println("END testSet() at " + new Date(System.currentTimeMillis())); } @Test @@ -145,9 +144,6 @@ public void testSetInvalidPath() { @Test public void testLocalTriggeredCallback() throws Exception { - System.out - .println("START testLocalTriggeredCallback() at " + new Date(System.currentTimeMillis())); - String subRoot = _root + "/" + "localCallback"; List subscribedPaths = new ArrayList<>(); subscribedPaths.add(subRoot); @@ -166,7 +162,7 @@ public void testLocalTriggeredCallback() throws Exception { // wait until all callbacks have been received Thread.sleep(500); int expectCreateNodes = 1 + firstLevelNr + firstLevelNr * secondLevelNr; - System.out.println("createKey#:" + listener._createKeys.size() + ", changeKey#:" + LOG.info("createKey#:" + listener._createKeys.size() + ", changeKey#:" + listener._changeKeys.size() + ", deleteKey#:" + listener._deleteKeys.size()); Assert.assertEquals(expectCreateNodes, listener._createKeys.size(), "Should receive " + expectCreateNodes + " create callbacks"); @@ -178,7 +174,7 @@ public void testLocalTriggeredCallback() throws Exception { // wait until all callbacks have been received Thread.sleep(500); int expectChangeNodes = firstLevelNr * secondLevelNr; - System.out.println("createKey#:" + listener._createKeys.size() + ", changeKey#:" + LOG.info("createKey#:" + listener._createKeys.size() + ", changeKey#:" + listener._changeKeys.size() + ", deleteKey#:" + listener._deleteKeys.size()); Assert.assertTrue(listener._changeKeys.size() >= expectChangeNodes, "Should receive at least " + expectChangeNodes + " change callbacks"); @@ -194,21 +190,16 @@ public void testLocalTriggeredCallback() throws Exception { Thread.sleep(500); } - System.out.println("createKey#:" + listener._createKeys.size() + ", changeKey#:" + LOG.info("createKey#:" + listener._createKeys.size() + ", changeKey#:" + listener._changeKeys.size() + ", deleteKey#:" + listener._deleteKeys.size()); Assert.assertEquals(expectDeleteNodes, listener._deleteKeys.size(), "Should receive " + expectDeleteNodes + " delete callbacks"); store.stop(); - System.out - .println("END testLocalTriggeredCallback() at " + new Date(System.currentTimeMillis())); } @Test public void testZkTriggeredCallback() throws Exception { - System.out - .println("START testZkTriggeredCallback() at " + new Date(System.currentTimeMillis())); - String subRoot = _root + "/" + "zkCallback"; List subscribedPaths = Collections.singletonList(subRoot); ZkHelixPropertyStore store = @@ -225,7 +216,7 @@ public void testZkTriggeredCallback() throws Exception { int expectCreateNodes = 1 + firstLevelNr + firstLevelNr * secondLevelNr; Thread.sleep(500); - System.out.println("createKey#:" + listener._createKeys.size() + ", changeKey#:" + LOG.info("createKey#:" + listener._createKeys.size() + ", changeKey#:" + listener._changeKeys.size() + ", deleteKey#:" + listener._deleteKeys.size()); Assert.assertEquals(expectCreateNodes, listener._createKeys.size(), "Should receive " + expectCreateNodes + " create callbacks"); @@ -240,7 +231,7 @@ public void testZkTriggeredCallback() throws Exception { Thread.sleep(500); } - System.out.println("createKey#:" + listener._createKeys.size() + ", changeKey#:" + LOG.info("createKey#:" + listener._createKeys.size() + ", changeKey#:" + listener._changeKeys.size() + ", deleteKey#:" + listener._deleteKeys.size()); Assert.assertTrue(listener._changeKeys.size() >= expectChangeNodes, "Should receive at least " + expectChangeNodes + " change callbacks"); @@ -251,20 +242,16 @@ public void testZkTriggeredCallback() throws Exception { _gZkClient.deleteRecursively(subRoot); Thread.sleep(1000); - System.out.println("createKey#:" + listener._createKeys.size() + ", changeKey#:" + LOG.info("createKey#:" + listener._createKeys.size() + ", changeKey#:" + listener._changeKeys.size() + ", deleteKey#:" + listener._deleteKeys.size()); Assert.assertEquals(expectDeleteNodes, listener._deleteKeys.size(), "Should receive " + expectDeleteNodes + " delete callbacks"); store.stop(); - System.out.println("END testZkTriggeredCallback() at " + new Date(System.currentTimeMillis())); } @Test public void testBackToBackRemoveAndSet() throws Exception { - System.out - .println("START testBackToBackRemoveAndSet() at " + new Date(System.currentTimeMillis())); - String subRoot = _root + "/" + "backToBackRemoveAndSet"; List subscribedPaths = new ArrayList<>(); subscribedPaths.add(subRoot); @@ -275,7 +262,6 @@ public void testBackToBackRemoveAndSet() throws Exception { ZNRecord record = store.get("/child0", null, 0); // will put the record in cache Assert.assertEquals(record.getId(), "child0"); - // System.out.println("1:get:" + record); String child0Path = subRoot + "/child0"; for (int i = 0; i < 2; i++) { @@ -287,7 +273,6 @@ public void testBackToBackRemoveAndSet() throws Exception { record = store.get("/child0", null, 0); Assert.assertEquals(record.getId(), "child0-new-1", "Cache shoulde be updated to latest create"); - // System.out.println("2:get:" + record); _gZkClient.delete(child0Path); Thread.sleep(500); // should wait for zk callback to remove "/child0" from cache @@ -297,11 +282,8 @@ record = store.get("/child0", null, AccessOption.THROW_EXCEPTION_IFNOTEXIST); } catch (ZkNoNodeException e) { // OK. } - // System.out.println("3:get:" + record); store.stop(); - System.out - .println("END testBackToBackRemoveAndSet() at " + new Date(System.currentTimeMillis())); } private String getNodeId(int i, int j) { diff --git a/helix-core/src/test/java/org/apache/helix/store/zk/TestZkManagerWithAutoFallbackStore.java b/helix-core/src/test/java/org/apache/helix/store/zk/TestZkManagerWithAutoFallbackStore.java index 04ce1115e6..e14560f686 100644 --- a/helix-core/src/test/java/org/apache/helix/store/zk/TestZkManagerWithAutoFallbackStore.java +++ b/helix-core/src/test/java/org/apache/helix/store/zk/TestZkManagerWithAutoFallbackStore.java @@ -38,8 +38,6 @@ public void testBasic() throws Exception { String clusterName = className + "_" + methodName; int n = 2; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -121,6 +119,5 @@ public void testBasic() throws Exception { participants[0].syncStop(); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/task/TestAssignableInstanceManager.java b/helix-core/src/test/java/org/apache/helix/task/TestAssignableInstanceManager.java index 3669ae706f..4de29e0018 100644 --- a/helix-core/src/test/java/org/apache/helix/task/TestAssignableInstanceManager.java +++ b/helix-core/src/test/java/org/apache/helix/task/TestAssignableInstanceManager.java @@ -56,8 +56,6 @@ public class TestAssignableInstanceManager { @BeforeClass public void beforeClass() { - System.out.println( - "START " + this.getClass().getSimpleName() + " at " + new Date(System.currentTimeMillis())); _clusterConfig = new ClusterConfig(CLUSTER_NAME); _taskDataCache = new MockTaskDataCache(CLUSTER_NAME); _liveInstances = new HashMap<>(); diff --git a/helix-core/src/test/java/org/apache/helix/task/assigner/TestThreadCountBasedTaskAssigner.java b/helix-core/src/test/java/org/apache/helix/task/assigner/TestThreadCountBasedTaskAssigner.java index 86d6c5e8b2..d0e642d9ad 100644 --- a/helix-core/src/test/java/org/apache/helix/task/assigner/TestThreadCountBasedTaskAssigner.java +++ b/helix-core/src/test/java/org/apache/helix/task/assigner/TestThreadCountBasedTaskAssigner.java @@ -34,11 +34,15 @@ import org.apache.helix.model.LiveInstance; import org.apache.helix.task.AssignableInstanceManager; import org.apache.helix.task.TaskConfig; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; public class TestThreadCountBasedTaskAssigner extends AssignerTestBase { + private static final Logger LOG = LoggerFactory.getLogger(TestThreadCountBasedTaskAssigner.class); + @Test public void testSuccessfulAssignment() { TaskAssigner assigner = new ThreadCountBasedTaskAssigner(); @@ -143,7 +147,6 @@ public void testAssignerProfiling() { int instanceCount = 1000; int taskCount = 50000; for (int batchSize : new int[] {10000, 5000, 2000, 1000, 500, 100}) { - System.out.println("testing batch size: " + batchSize); profileAssigner(batchSize, instanceCount, taskCount); } } @@ -214,7 +217,7 @@ private void profileAssigner(int assignBatchSize, int instanceCount, int taskCou } } } - System.out.println("Average time: " + totalTime / trail + "ms"); + LOG.info("Average time: " + totalTime / trail + "ms"); } private void assertAssignmentResults(Iterable results, boolean expected) { diff --git a/helix-core/src/test/java/org/apache/helix/tools/ClusterVerifiers/TestStrictMatchExternalViewVerifier.java b/helix-core/src/test/java/org/apache/helix/tools/ClusterVerifiers/TestStrictMatchExternalViewVerifier.java index 592c8689e3..b1a06f6dc5 100644 --- a/helix-core/src/test/java/org/apache/helix/tools/ClusterVerifiers/TestStrictMatchExternalViewVerifier.java +++ b/helix-core/src/test/java/org/apache/helix/tools/ClusterVerifiers/TestStrictMatchExternalViewVerifier.java @@ -36,7 +36,6 @@ public class TestStrictMatchExternalViewVerifier { public void testComputeIdealMapping(String comment, String stateModelName, List preferenceList, List liveAndEnabledInstances, Map expectedIdealMapping) { - System.out.println("Test case comment: " + comment); Map idealMapping = HelixUtil.computeIdealMapping(preferenceList, BuiltInStateModelDefinitions.valueOf(stateModelName).getStateModelDefinition(), new HashSet<>(liveAndEnabledInstances)); diff --git a/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java b/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java index 8d0135fbd1..2bdc575236 100644 --- a/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java +++ b/helix-core/src/test/java/org/apache/helix/tools/TestClusterSetup.java @@ -47,6 +47,8 @@ import org.apache.helix.model.HelixConfigScope.ConfigScopeProperty; import org.apache.helix.model.IdealState; import org.apache.helix.model.LiveInstance; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.AssertJUnit; import org.testng.annotations.AfterClass; @@ -60,6 +62,8 @@ import static org.mockito.Mockito.when; public class TestClusterSetup extends ZkUnitTestBase { + + private static final Logger LOG = LoggerFactory.getLogger(TestClusterSetup.class); protected static final String CLUSTER_NAME = "TestClusterSetup"; protected static final String TEST_DB = "TestDB"; protected static final String INSTANCE_PREFIX = "instance_"; @@ -69,15 +73,11 @@ public class TestClusterSetup extends ZkUnitTestBase { private ClusterSetup _clusterSetup; private static String[] createArgs(String str) { - String[] split = str.split("[ ]+"); - System.out.println(Arrays.toString(split)); - return split; + return str.split("[ ]+"); } @BeforeClass() public void beforeClass() throws Exception { - System.out - .println("START TestClusterSetup.beforeClass() " + new Date(System.currentTimeMillis())); _clusterSetup = new ClusterSetup(ZK_ADDR); } @@ -85,7 +85,6 @@ public void beforeClass() throws Exception { public void afterClass() { deleteCluster(CLUSTER_NAME); _clusterSetup.close(); - System.out.println("END TestClusterSetup.afterClass() " + new Date(System.currentTimeMillis())); } @BeforeMethod() @@ -94,7 +93,7 @@ public void setup() { _gZkClient.deleteRecursively("/" + CLUSTER_NAME); _clusterSetup.addCluster(CLUSTER_NAME, true); } catch (Exception e) { - System.out.println("@BeforeMethod TestClusterSetup exception:" + e); + LOG.info("@BeforeMethod TestClusterSetup exception:", e); } } @@ -282,8 +281,6 @@ public void testSetGetRemoveParticipantConfig() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - _clusterSetup.addCluster(clusterName, true); _clusterSetup.addInstanceToCluster(clusterName, "localhost_0"); @@ -313,7 +310,6 @@ record = (ZNRecord) serializer.deserialize(valuesStr.getBytes()); Assert.assertNull(record.getSimpleField("key2")); deleteCluster(clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test(dependsOnMethods = "testAddClusterWithValidCloudConfig") @@ -323,8 +319,6 @@ public void testEnableCluster() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -353,8 +347,6 @@ public void testEnableCluster() throws Exception { // clean up TestHelper.dropCluster(clusterName, _gZkClient); - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test(dependsOnMethods = "testAddClusterWithValidCloudConfig") @@ -366,8 +358,6 @@ public void testDropInstance() throws Exception { String instanceAddress = "localhost:12918"; String instanceName = "localhost_12918"; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -437,8 +427,6 @@ public void testDropInstance() throws Exception { return true; }, TestHelper.WAIT_DURATION)); } - - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test(dependsOnMethods = "testAddClusterWithValidCloudConfig") @@ -446,7 +434,7 @@ public void testDisableResource() throws Exception { String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); + TestHelper.setupCluster(clusterName, ZK_ADDR, 12918, // participant port "localhost", // participant name prefix "TestDB", // resource name prefix @@ -472,7 +460,6 @@ public void testDisableResource() throws Exception { Assert.assertTrue(idealState.isEnabled()); TestHelper.dropCluster(clusterName, _gZkClient); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test(expectedExceptions = HelixException.class) diff --git a/helix-core/src/test/java/org/apache/helix/tools/TestClusterVerifier.java b/helix-core/src/test/java/org/apache/helix/tools/TestClusterVerifier.java index bbafe22ffa..40a435a8fe 100644 --- a/helix-core/src/test/java/org/apache/helix/tools/TestClusterVerifier.java +++ b/helix-core/src/test/java/org/apache/helix/tools/TestClusterVerifier.java @@ -173,7 +173,6 @@ public void testDisablePartitionAndStopInstance() throws Exception { // Semi-Auto ExternalView matching for (String resource : SEMI_AUTO_RESOURCES) { - System.out.println("Verify resource: " + resource); strictMatchVerifier = new StrictMatchExternalViewVerifier.Builder(_clusterName).setZkClient(_gZkClient) .setResources(Sets.newHashSet(resource)).setDeactivatedNodeAwareness(true) diff --git a/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminCli.java b/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminCli.java index ed270df090..8ecd8e3c57 100644 --- a/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminCli.java +++ b/helix-core/src/test/java/org/apache/helix/tools/TestHelixAdminCli.java @@ -489,8 +489,6 @@ public void testInstanceOperations() throws Exception { public void testExpandCluster() throws Exception { final int n = 6; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; ClusterDistributedController[] controllers = new ClusterDistributedController[2]; setupCluster(clusterName, grandClusterName, n, participants, controllers); @@ -549,8 +547,6 @@ public void testExpandCluster() throws Exception { public void testDeactivateCluster() throws Exception { final int n = 6; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); - MockParticipantManager[] participants = new MockParticipantManager[n]; ClusterDistributedController[] controllers = new ClusterDistributedController[2]; setupCluster(clusterName, grandClusterName, n, participants, controllers); diff --git a/helix-core/src/test/java/org/apache/helix/tools/TestZkCopy.java b/helix-core/src/test/java/org/apache/helix/tools/TestZkCopy.java index dae2ab0837..eb7f14eab4 100644 --- a/helix-core/src/test/java/org/apache/helix/tools/TestZkCopy.java +++ b/helix-core/src/test/java/org/apache/helix/tools/TestZkCopy.java @@ -38,7 +38,6 @@ public void test() throws Exception { String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; - System.out.println("START " + clusterName + " at " + new Date(System.currentTimeMillis())); String fromPath = "/" + clusterName + "/from"; _gZkClient.createPersistent(fromPath, true); for (int i = 0; i < 5; i++) { @@ -67,7 +66,6 @@ public void test() throws Exception { } _gZkClient.deleteRecursively("/" + clusterName); - System.out.println("END " + clusterName + " at " + new Date(System.currentTimeMillis())); } @Test @@ -76,7 +74,6 @@ public void testSkipCopyExistZnode() throws Exception { String methodName = TestHelper.getTestMethodName(); String testName = className + "_" + methodName; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); String srcClusterName = testName + "_src"; String dstClusterName = testName + "_dst"; int n = 5; @@ -114,6 +111,5 @@ public void testSkipCopyExistZnode() throws Exception { TestHelper.dropCluster(srcClusterName, _gZkClient); TestHelper.dropCluster(dstClusterName, _gZkClient); - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-core/src/test/java/org/apache/helix/util/TestZKClientPool.java b/helix-core/src/test/java/org/apache/helix/util/TestZKClientPool.java index 8a6b747cd5..369f369342 100644 --- a/helix-core/src/test/java/org/apache/helix/util/TestZKClientPool.java +++ b/helix-core/src/test/java/org/apache/helix/util/TestZKClientPool.java @@ -34,7 +34,6 @@ public class TestZKClientPool { @Test public void test() throws Exception { String testName = "TestZKClientPool"; - System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis())); String zkAddr = "localhost:21891"; ZkServer zkServer = TestHelper.startZkServer(zkAddr); @@ -64,6 +63,5 @@ record = zkClient.readData("/" + testName); zkClient.close(); TestHelper.stopZkServer(zkServer); - System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis())); } } diff --git a/helix-lock/src/test/java/org/apache/helix/lock/helix/TestZKHelixNonblockingLock.java b/helix-lock/src/test/java/org/apache/helix/lock/helix/TestZKHelixNonblockingLock.java index abc9ad90a5..3958633a8b 100644 --- a/helix-lock/src/test/java/org/apache/helix/lock/helix/TestZKHelixNonblockingLock.java +++ b/helix-lock/src/test/java/org/apache/helix/lock/helix/TestZKHelixNonblockingLock.java @@ -51,8 +51,6 @@ public class TestZKHelixNonblockingLock extends ZkTestBase { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + _clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(_clusterName, ZK_ADDR, 12918, "localhost", "TestDB", 1, 10, 5, 3, "MasterSlave", true); _userId = UUID.randomUUID().toString(); diff --git a/helix-lock/src/test/java/org/apache/helix/lock/helix/TestZKHelixNonblockingLockWithPriority.java b/helix-lock/src/test/java/org/apache/helix/lock/helix/TestZKHelixNonblockingLockWithPriority.java index 443baa8715..ec664eb9f2 100644 --- a/helix-lock/src/test/java/org/apache/helix/lock/helix/TestZKHelixNonblockingLockWithPriority.java +++ b/helix-lock/src/test/java/org/apache/helix/lock/helix/TestZKHelixNonblockingLockWithPriority.java @@ -56,8 +56,6 @@ public void onCleanupNotification() { @BeforeClass public void beforeClass() throws Exception { - System.out.println("START " + _clusterName + " at " + new Date(System.currentTimeMillis())); - TestHelper.setupCluster(_clusterName, ZK_ADDR, 12918, "localhost", "TestDB", 1, 10, 5, 3, "MasterSlave", true); diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java index a81799df24..4b6ca41d63 100644 --- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java +++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestClusterAccessor.java @@ -89,8 +89,6 @@ public void beforeClass() { @Test public void testGetClusters() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - _auditLogger.clearupLogs(); String body = get("clusters", null, Response.Status.OK.getStatusCode(), true); JsonNode node = OBJECT_MAPPER.readTree(body); @@ -106,12 +104,10 @@ public void testGetClusters() throws IOException { AuditLog auditLog = _auditLogger.getAuditLogs().get(0); validateAuditLog(auditLog, HTTPMethods.GET.name(), "clusters", Response.Status.OK.getStatusCode(), body); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetClusters") public void testGetClusterTopology() { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = "TestCluster_1"; String instance = cluster + "localhost_12920"; // set the fake zone id in instance configuration @@ -129,12 +125,10 @@ public void testGetClusterTopology() { + "\"allInstances\":[\"TestCluster_1localhost_12918\",\"TestCluster_1localhost_12919\",\"TestCluster_1localhost_12924\"," + "\"TestCluster_1localhost_12925\",\"TestCluster_1localhost_12926\",\"TestCluster_1localhost_12927\",\"TestCluster_1localhost_12920\"," + "\"TestCluster_1localhost_12921\",\"TestCluster_1localhost_12922\",\"TestCluster_1localhost_12923\"]}"); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetClusterTopology") public void testGetClusterTopologyAndFaultZoneMap() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String topologyMapUrlBase = "clusters/TestCluster_1/topologymap/"; String faultZoneUrlBase = "clusters/TestCluster_1/faultzonemap/"; @@ -326,7 +320,6 @@ private void setupClusterForVirtualTopology(String clusterName) { @Test(dependsOnMethods = "testGetClusterTopologyAndFaultZoneMap") public void testAddConfigFields() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); //Need to use TestCluster_1 here since other test may add unwanted key to listField. issue-1336 String cluster = "TestCluster_1"; ClusterConfig oldConfig = getClusterConfigFromRest(cluster); @@ -347,12 +340,10 @@ public void testAddConfigFields() throws IOException { oldConfig.getRecord().update(configDelta.getRecord()); Assert.assertEquals(newConfig, oldConfig, "cluster config from response: " + newConfig + " vs cluster config actually: " + oldConfig); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testAddConfigFields") public void testUpdateConfigFields() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = "TestCluster_1"; ClusterConfig config = getClusterConfigFromRest(cluster); @@ -386,12 +377,10 @@ public void testUpdateConfigFields() throws IOException { prevConfig.getRecord().update(config.getRecord()); Assert.assertEquals(newConfig, prevConfig, "cluster config from response: " + newConfig + " vs cluster config actually: " + prevConfig); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testUpdateConfigFields") public void testDeleteConfigFields() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = _clusters.iterator().next(); ClusterConfig config = getClusterConfigFromRest(cluster); @@ -426,12 +415,10 @@ public void testDeleteConfigFields() throws IOException { prevConfig.getRecord().subtract(config.getRecord()); Assert.assertEquals(newConfig, prevConfig, "cluster config from response: " + newConfig + " vs cluster config actually: " + prevConfig); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testDeleteConfigFields") public void testCreateDeleteCluster() { - System.out.println("Start test :" + TestHelper.getTestMethodName()); // create an existing cluster should fail. _auditLogger.clearupLogs(); String cluster = _clusters.iterator().next(); @@ -452,12 +439,10 @@ public void testCreateDeleteCluster() { // verify the cluster has been deleted. Assert.assertFalse(_baseAccessor.exists("/" + cluster, 0)); validateAuditLogSize(3); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testCreateDeleteCluster") public void testEnableDisableCluster() { - System.out.println("Start test :" + TestHelper.getTestMethodName()); // disable a cluster. String cluster = _clusters.iterator().next(); _auditLogger.clearupLogs(); @@ -477,22 +462,18 @@ public void testEnableDisableCluster() { // verify the cluster is paused. Assert.assertFalse(_baseAccessor.exists(keyBuilder.pause().getPath(), 0)); validateAuditLogSize(2); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testEnableDisableCluster") public void testGetClusterConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); Response response = target("clusters/fakeCluster/configs").request().get(); Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); String cluster = _clusters.iterator().next(); getClusterConfigFromRest(cluster); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetClusterConfig") public void testEnableDisableMaintenanceMode() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = _clusters.iterator().next(); String reasonValue = "Test reason"; String reasonJSONString = "{\"reason\":\"" + reasonValue + "\"}"; @@ -520,12 +501,10 @@ public void testEnableDisableMaintenanceMode() throws IOException { get("clusters/" + cluster + "/controller/maintenanceSignal", null, Response.Status.NOT_FOUND.getStatusCode(), false); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testEnableDisableMaintenanceMode") public void testEmptyMaintenanceSignal() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = _clusters.iterator().next(); // Create empty maintenance znode @@ -546,13 +525,11 @@ public void testEmptyMaintenanceSignal() throws IOException { Assert.assertFalse(isMaintenanceModeEnabled(cluster)); get("clusters/" + cluster + "/controller/maintenanceSignal", null, Response.Status.NOT_FOUND.getStatusCode(), false); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testEmptyMaintenanceSignal") public void testGetControllerLeadershipHistory() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = _clusters.iterator().next(); // Get the leader controller name for the cluster @@ -578,12 +555,10 @@ public void testGetControllerLeadershipHistory() throws IOException { // Check that the last entry contains the current leader name Assert.assertTrue(lastLeaderEntry.contains(leader)); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetControllerLeadershipHistory") public void testGetMaintenanceHistory() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = _clusters.iterator().next(); String reason = TestHelper.getTestMethodName(); @@ -603,12 +578,10 @@ public void testGetMaintenanceHistory() throws IOException { // Check that the last entry contains the reason string Assert.assertTrue(lastMaintenanceEntry.contains(reason)); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetMaintenanceHistory") public void testEnableDisableMaintenanceModeWithCustomFields() { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = _clusters.iterator().next(); HelixDataAccessor accessor = new ZKHelixDataAccessor(cluster, _baseAccessor); @@ -629,12 +602,10 @@ public void testEnableDisableMaintenanceModeWithCustomFields() { Entity.entity("", MediaType.APPLICATION_JSON_TYPE), Response.Status.OK.getStatusCode()); Assert.assertFalse( accessor.getBaseDataAccessor().exists(accessor.keyBuilder().maintenance().getPath(), 0)); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testEnableDisableMaintenanceModeWithCustomFields") public void testPurgeOfflineParticipants() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = _clusters.iterator().next(); HelixDataAccessor accessor = new ZKHelixDataAccessor(cluster, _baseAccessor); @@ -674,13 +645,10 @@ public void testPurgeOfflineParticipants() throws IOException { _gSetupTool.addInstanceToCluster(cluster, instance1); _gSetupTool.addInstanceToCluster(cluster, instance2); _gSetupTool.addInstanceToCluster(cluster, instance3); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testEnableDisableMaintenanceModeWithCustomFields") public void testGetStateModelDef() throws IOException { - - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = "TestCluster_1"; String urlBase = "clusters/TestCluster_1/statemodeldefs/"; Map defMap = getMapResponseFromRest(urlBase); @@ -741,12 +709,10 @@ public void testGetStateModelDef() throws IOException { String oneResult3 = get(oneModelUri, null, Response.Status.OK.getStatusCode(), true); ZNRecord oneRecord3 = toZNRecord(oneResult3); Assert.assertEquals(oneRecord3, oneRecord); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetStateModelDef") public void testActivateSuperCluster() throws Exception { - System.out.println("Start test :" + TestHelper.getTestMethodName()); final String ACTIVATE_SUPER_CLUSTER = "RestSuperClusterActivationTest_SuperCluster"; final String ACTIVATE_NORM_CLUSTER = "RestSuperClusterActivationTest_NormalCluster"; @@ -833,7 +799,6 @@ public void testActivateSuperCluster() throws Exception { } _gSetupTool.deleteCluster(ACTIVATE_NORM_CLUSTER); _gSetupTool.deleteCluster(ACTIVATE_SUPER_CLUSTER); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testActivateSuperCluster") @@ -850,7 +815,6 @@ public void testEnableWagedRebalanceForAllResources() { @Test(dependsOnMethods = "testEnableWagedRebalanceForAllResources") public void testCreateRESTConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = _clusters.iterator().next(); RESTConfig restConfigRest = new RESTConfig(cluster); restConfigRest.set(RESTConfig.SimpleFields.CUSTOMIZED_HEALTH_URL, "http://*:00"); @@ -861,12 +825,10 @@ public void testCreateRESTConfig() throws IOException { Assert.assertEquals(restConfigZK, restConfigRest, "rest config from response: " + restConfigRest + " vs rest config actually: " + restConfigZK); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testCreateRESTConfig") public void testUpdateRESTConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = _clusters.iterator().next(); RESTConfig restConfigRest = new RESTConfig(cluster); // Update an entry @@ -900,17 +862,14 @@ public void testUpdateRESTConfig() throws IOException { post("clusters/" + wrongClusterId + "/restconfig", ImmutableMap.of("command", Command.update.name()), entity, Response.Status.NOT_FOUND.getStatusCode()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testUpdateRESTConfig") public void testDeleteRESTConfig() { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String cluster = _clusters.iterator().next(); delete("clusters/" + cluster + "/restconfig", Response.Status.OK.getStatusCode()); get("clusters/" + cluster + "/restconfig", null, Response.Status.NOT_FOUND.getStatusCode(), true); delete("clusters/" + cluster + "/restconfig", Response.Status.OK.getStatusCode()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testActivateSuperCluster") @@ -1053,7 +1012,6 @@ public void testAddClusterWithCloudConfigDisabledCloud() throws Exception { @Test(dependsOnMethods = "testAddClusterWithCloudConfigDisabledCloud") public void testAddCloudConfigNonExistedCluster() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String urlBase = "clusters/TestCloud/cloudconfig/"; ZNRecord record = new ZNRecord("TestCloud"); record.setBooleanField(CloudConfig.CloudConfigProperty.CLOUD_ENABLED.name(), true); @@ -1070,12 +1028,10 @@ public void testAddCloudConfigNonExistedCluster() throws IOException { put(urlBase, null, Entity.entity(OBJECT_MAPPER.writeValueAsString(record), MediaType.APPLICATION_JSON_TYPE), Response.Status.NOT_FOUND.getStatusCode()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testAddCloudConfigNonExistedCluster") public void testAddCloudConfig() throws Exception { - System.out.println("Start test :" + TestHelper.getTestMethodName()); _gSetupTool.addCluster("TestCloud", true); String urlBase = "clusters/TestCloud/cloudconfig/"; @@ -1128,13 +1084,10 @@ public void testAddCloudConfig() throws Exception { List listUrlFromRest = cloudConfigRest.getCloudInfoSources(); Assert.assertEquals(listUrlFromRest.get(0), "TestURL"); Assert.assertEquals(cloudConfigRest.getCloudInfoProcessorName(), "TestProcessorName"); - - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testAddCloudConfig") public void testDeleteCloudConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; @@ -1161,14 +1114,11 @@ public void testDeleteCloudConfig() throws IOException { _configAccessor = new ConfigAccessor(ZK_ADDR); cloudConfigFromZk = _configAccessor.getCloudConfig(clusterName); Assert.assertNull(cloudConfigFromZk); - - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testDeleteCloudConfig") public void testPartialDeleteCloudConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String className = TestHelper.getTestClassName(); String methodName = TestHelper.getTestMethodName(); String clusterName = className + "_" + methodName; @@ -1208,13 +1158,10 @@ record = new ZNRecord(clusterName); Assert.assertNull(cloudConfigFromZk.getCloudProvider()); Assert.assertTrue(cloudConfigFromZk.isCloudEnabled()); Assert.assertEquals(cloudConfigFromZk.getCloudInfoProcessorName(),"TestProcessor"); - - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testPartialDeleteCloudConfig") public void testUpdateCloudConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); _gSetupTool.addCluster("TestCloud", true); String urlBase = "clusters/TestCloud/cloudconfig/"; @@ -1267,13 +1214,10 @@ public void testUpdateCloudConfig() throws IOException { List listUrlFromRest = cloudConfigRest.getCloudInfoSources(); Assert.assertEquals(listUrlFromRest.get(0), "TestURL"); Assert.assertEquals(cloudConfigRest.getCloudInfoProcessorName(), "TestProcessorName"); - - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testUpdateCloudConfig") public void testAddCustomizedConfigNonExistedCluster() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String urlBase = "clusters/TestCluster/customizedstateconfig/"; ZNRecord record = new ZNRecord("TestCustomizedStateConfig"); List testList = new ArrayList(); @@ -1287,12 +1231,10 @@ public void testAddCustomizedConfigNonExistedCluster() throws IOException { put(urlBase, null, Entity.entity(OBJECT_MAPPER.writeValueAsString(record), MediaType.APPLICATION_JSON_TYPE), Response.Status.NOT_FOUND.getStatusCode()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testAddCustomizedConfigNonExistedCluster") public void testAddCustomizedConfig() throws Exception { - System.out.println("Start test :" + TestHelper.getTestMethodName()); _gSetupTool.addCluster("TestClusterCustomized", true); String urlBase = "clusters/TestClusterCustomized/customized-state-config/"; ZNRecord record = new ZNRecord("TestCustomizedStateConfig"); @@ -1329,13 +1271,10 @@ public void testAddCustomizedConfig() throws Exception { List listUrlFromRest = customizedConfigRest.getAggregationEnabledTypes(); Assert.assertEquals(listUrlFromRest.get(0), "mockType1"); Assert.assertEquals(listUrlFromRest.get(1), "mockType2"); - - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testAddCustomizedConfig") public void testDeleteCustomizedConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); _gSetupTool.addCluster("TestClusterCustomized", true); String urlBase = "clusters/TestClusterCustomized/customized-state-config/"; ZNRecord record = new ZNRecord("TestCustomizedStateConfig"); @@ -1359,13 +1298,10 @@ public void testDeleteCustomizedConfig() throws IOException { customizedConfigFromZk = _configAccessor.getCustomizedStateConfig("TestClusterCustomized"); Assert.assertNull(customizedConfigFromZk); - - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testDeleteCustomizedConfig") public void testUpdateCustomizedConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); _gSetupTool.addCluster("TestClusterCustomized", true); String urlBase = "clusters/TestClusterCustomized/customized-state-config/"; ZNRecord record = new ZNRecord("TestCustomizedStateConfig"); @@ -1412,12 +1348,10 @@ public void testUpdateCustomizedConfig() throws IOException { listTypesFromZk = customizedConfigFromZk.getAggregationEnabledTypes(); Assert.assertEquals(listTypesFromZk.get(0), "mockType2"); Assert.assertFalse(listTypesFromZk.contains("mockType1")); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testUpdateCustomizedConfig") public void testOnDemandRebalance() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); long currentTime = System.currentTimeMillis(); String cluster = "TestCluster_1"; new JerseyUriRequestBuilder("clusters/{}?command=onDemandRebalance").format(cluster) @@ -1432,7 +1366,6 @@ public void testOnDemandRebalance() throws IOException { lastOnDemandRebalanceTime, currentTime)); // restore the state config.setLastOnDemandRebalanceTimestamp(-1L); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestDefaultMonitoringMbeans.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestDefaultMonitoringMbeans.java index 49dfee3f48..0cc96baebb 100644 --- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestDefaultMonitoringMbeans.java +++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestDefaultMonitoringMbeans.java @@ -50,7 +50,6 @@ public class TestDefaultMonitoringMbeans extends AbstractTestClass { @Test (enabled = false) public void testDefaultMonitoringMbeans() throws MBeanException, ReflectionException, InstanceNotFoundException, InterruptedException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); int listClusters = new Random().nextInt(10); for (int i = 0; i < listClusters; i++) { get("clusters", null, Response.Status.OK.getStatusCode(), true); @@ -78,7 +77,6 @@ public void testDefaultMonitoringMbeans() } Assert.assertTrue(correctReports); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestHelixRestServer.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestHelixRestServer.java index 3583990571..960b45ee0d 100644 --- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestHelixRestServer.java +++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestHelixRestServer.java @@ -33,7 +33,6 @@ public class TestHelixRestServer extends AbstractTestClass { @Test public void testInvalidHelixRestServerInitialization() { - System.out.println("Start test :" + TestHelper.getTestMethodName()); // Namespace manifests has invalid metadata store type should generate failure try { List invalidManifest1 = new ArrayList<>(); @@ -84,7 +83,6 @@ public void testDefaultNamespaceFail() throws InterruptedException { new HelixRestNamespace("test4-2", HelixRestNamespace.HelixMetadataStoreType.ZOOKEEPER, ZK_ADDR, true)); HelixRestServer svr = new HelixRestServer(invalidManifest4, 10250, "/", Collections.emptyList()); svr.start(); - System.out.println("End test :" + TestHelper.getTestMethodName()); } } diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestInstancesAccessor.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestInstancesAccessor.java index 01701a4864..73bc29cfac 100644 --- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestInstancesAccessor.java +++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestInstancesAccessor.java @@ -47,7 +47,6 @@ public class TestInstancesAccessor extends AbstractTestClass { @Test public void testInstanceStoppable_zoneBased_zoneOrder() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); // Select instances with zone based String content = String.format( "{\"%s\":\"%s\",\"%s\":[\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\", \"%s\"], \"%s\":[\"%s\",\"%s\"]}", @@ -70,12 +69,10 @@ public void testInstanceStoppable_zoneBased_zoneOrder() throws IOException { "HELIX:INSTANCE_NOT_STABLE")); Assert.assertEquals(getStringSet(nonStoppableInstances, "invalidInstance"), ImmutableSet.of("HELIX:INSTANCE_NOT_EXIST")); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testInstanceStoppable_zoneBased_zoneOrder") public void testInstancesStoppable_zoneBased() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); // Select instances with zone based String content = String.format("{\"%s\":\"%s\",\"%s\":[\"%s\",\"%s\",\"%s\",\"%s\",\"%s\",\"%s\", \"%s\"]}", @@ -105,7 +102,6 @@ public void testInstancesStoppable_zoneBased() throws IOException { ImmutableSet.of("HELIX:EMPTY_RESOURCE_ASSIGNMENT", "HELIX:INSTANCE_NOT_ALIVE", "HELIX:INSTANCE_NOT_STABLE")); Assert.assertEquals(getStringSet(nonStoppableInstances, "invalidInstance"), ImmutableSet.of("HELIX:INSTANCE_NOT_EXIST")); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testInstancesStoppable_zoneBased") @@ -143,12 +139,10 @@ public void testInstancesStoppable_disableOneInstance() throws IOException { Assert.assertFalse(jsonResult.get("stoppable").asBoolean()); Assert.assertEquals(getStringSet(jsonResult, "failedChecks"), ImmutableSet.of("HELIX:MIN_ACTIVE_REPLICA_CHECK_FAILED")); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testInstancesStoppable_disableOneInstance") public void testGetAllInstances() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String body = new JerseyUriRequestBuilder("clusters/{}/instances").isBodyReturnExpected(true) .format(CLUSTER_NAME).get(this); @@ -161,7 +155,6 @@ public void testGetAllInstances() throws IOException { OBJECT_MAPPER.getTypeFactory().constructCollectionType(Set.class, String.class)); Assert.assertEquals(instances, _instancesMap.get(CLUSTER_NAME), "Instances from response: " + instances + " vs instances actually: " + _instancesMap.get(CLUSTER_NAME)); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(enabled = false) @@ -210,13 +203,10 @@ public void testUpdateInstances() throws IOException { "INSTANCE_NOT_DISABLED"); Assert .assertNull(clusterConfig.getInstanceHelixDisabledReason(CLUSTER_NAME + "localhost_12918")); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetAllInstances") public void testValidateWeightForAllInstances() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - // Empty out ClusterConfig's weight key setting and InstanceConfig's capacity maps for testing ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME); clusterConfig.getRecord().setListField( @@ -265,8 +255,6 @@ public void testValidateWeightForAllInstances() throws IOException { // Must have the results saying they are all valid (true) because capacity keys are set // in ClusterConfig node.iterator().forEachRemaining(child -> Assert.assertTrue(child.booleanValue())); - - System.out.println("End test :" + TestHelper.getTestMethodName()); } private Set getStringSet(JsonNode jsonNode, String key) { diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestJobAccessor.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestJobAccessor.java index b75a4f88ac..6c0a5e9186 100644 --- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestJobAccessor.java +++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestJobAccessor.java @@ -56,8 +56,6 @@ public class TestJobAccessor extends AbstractTestClass { @Test public void testGetJobs() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String body = get("clusters/" + CLUSTER_NAME + "/workflows/" + WORKFLOW_NAME + "/jobs", null, Response.Status.OK.getStatusCode(), true); JsonNode node = OBJECT_MAPPER.readTree(body); @@ -67,13 +65,10 @@ public void testGetJobs() throws IOException { Assert.assertEquals(jobs, _workflowMap.get(CLUSTER_NAME).get(WORKFLOW_NAME).getWorkflowConfig().getJobDag() .getAllNodes()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetJobs") public void testGetJob() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String body = get("clusters/" + CLUSTER_NAME + "/workflows/" + WORKFLOW_NAME + "/jobs/" + JOB_NAME, null, Response.Status.OK.getStatusCode(), true); @@ -84,39 +79,30 @@ public void testGetJob() throws IOException { node.get(JobAccessor.JobProperties.JobConfig.name()).get("simpleFields").get("WorkflowID") .textValue(); Assert.assertEquals(workflowId, WORKFLOW_NAME); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetJob") public void testGetJobConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String body = get("clusters/" + CLUSTER_NAME + "/workflows/" + WORKFLOW_NAME + "/jobs/" + JOB_NAME + "/configs", null, Response.Status.OK.getStatusCode(), true); JsonNode node = OBJECT_MAPPER.readTree(body); String workflowId = node.get("simpleFields").get("WorkflowID").textValue(); Assert.assertEquals(workflowId, WORKFLOW_NAME); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetJobConfig") public void testGetJobContext() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String body = get("clusters/" + CLUSTER_NAME + "/workflows/" + WORKFLOW_NAME + "/jobs/" + JOB_NAME + "/context", null, Response.Status.OK.getStatusCode(), true); JsonNode node = OBJECT_MAPPER.readTree(body); Assert.assertEquals(node.get("mapFields").get("0").get("STATE").textValue(), TaskPartitionState.COMPLETED.name()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetJobContext") public void testCreateJob() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - TaskDriver driver = getTaskDriver(CLUSTER_NAME); // Create JobQueue JobQueue.Builder jobQueue = new JobQueue.Builder(TEST_QUEUE_NAME) @@ -139,12 +125,10 @@ public void testCreateJob() throws IOException { WorkflowConfig workflowConfig = driver.getWorkflowConfig(TEST_QUEUE_NAME); Assert.assertTrue(workflowConfig.getJobDag().getAllNodes().contains(jobName)); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testCreateJob") public void testGetAddJobContent() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String uri = "clusters/" + CLUSTER_NAME + "/workflows/Workflow_0/jobs/JOB0/userContent"; // Empty user content @@ -172,12 +156,10 @@ public void testGetAddJobContent() throws IOException { body = get(uri, null, Response.Status.OK.getStatusCode(), true); contentStore = OBJECT_MAPPER.readValue(body, new TypeReference>() {}); Assert.assertEquals(contentStore, map1); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetAddJobContent") public void testInvalidGetAndUpdateJobContentStore() { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String validURI = "clusters/" + CLUSTER_NAME + "/workflows/Workflow_0/jobs/JOB0/userContent"; String invalidURI1 = "clusters/" + CLUSTER_NAME + "/workflows/xxx/jobs/JOB0/userContent"; // workflow not exist String invalidURI2 = "clusters/" + CLUSTER_NAME + "/workflows/Workflow_0/jobs/xxx/userContent"; // job not exist @@ -196,12 +178,10 @@ public void testInvalidGetAndUpdateJobContentStore() { post(validURI, invalidCmd, validEntity, Response.Status.BAD_REQUEST.getStatusCode()); post(validURI, validCmd, invalidEntity, Response.Status.BAD_REQUEST.getStatusCode()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testInvalidGetAndUpdateJobContentStore") public void testDeleteJob() throws InterruptedException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); TaskDriver driver = getTaskDriver(CLUSTER_NAME); driver.waitToStop(TEST_QUEUE_NAME, 5000); delete("clusters/" + CLUSTER_NAME + "/workflows/" + TEST_QUEUE_NAME + "/jobs/" + TEST_JOB_NAME, @@ -214,6 +194,5 @@ public void testDeleteJob() throws InterruptedException { WorkflowConfig workflowConfig = driver.getWorkflowConfig(TEST_QUEUE_NAME); Assert.assertTrue(!workflowConfig.getJobDag().getAllNodes().contains(jobName)); - System.out.println("End test :" + TestHelper.getTestMethodName()); } } diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestPerInstanceAccessor.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestPerInstanceAccessor.java index 273019bd3f..f9d0a5778c 100644 --- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestPerInstanceAccessor.java +++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestPerInstanceAccessor.java @@ -58,7 +58,6 @@ public class TestPerInstanceAccessor extends AbstractTestClass { @Test public void testIsInstanceStoppable() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); Map params = ImmutableMap.of("client", "espresso"); Entity entity = Entity.entity(OBJECT_MAPPER.writeValueAsString(params), MediaType.APPLICATION_JSON_TYPE); @@ -73,21 +72,17 @@ public void testIsInstanceStoppable() throws IOException { Map expectedMap = ImmutableMap.of("stoppable", false, "failedChecks", failedChecks); Assert.assertEquals(actualMap, expectedMap); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testIsInstanceStoppable") public void testTakeInstanceNegInput() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); post("clusters/TestCluster_0/instances/instance1/takeInstance", null, Entity.entity("", MediaType.APPLICATION_JSON_TYPE), Response.Status.BAD_REQUEST.getStatusCode(), true); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testTakeInstanceNegInput") public void testTakeInstanceNegInput2() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); Response response = new JerseyUriRequestBuilder("clusters/{}/instances/{}/takeInstance") .format(STOPPABLE_CLUSTER, "instance1").post(this, Entity.entity("{}", MediaType.APPLICATION_JSON_TYPE)); String takeInstanceResult = response.readEntity(String.class); @@ -97,12 +92,10 @@ public void testTakeInstanceNegInput2() throws IOException { Map expectedMap = ImmutableMap.of("successful", false, "messages", errorMsg, "operationResult", ""); Assert.assertEquals(actualMap, expectedMap); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testTakeInstanceNegInput2") public void testTakeInstanceHealthCheck() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String payload = "{ \"health_check_list\" : [\"HelixInstanceStoppableCheck\", \"CustomInstanceStoppableCheck\"]," + "\"health_check_config\" : { \"client\" : \"espresso\" }} "; Response response = new JerseyUriRequestBuilder("clusters/{}/instances/{}/takeInstance") @@ -116,12 +109,10 @@ public void testTakeInstanceHealthCheck() throws IOException { Map expectedMap = ImmutableMap.of("successful", false, "messages", errorMsg, "operationResult", ""); Assert.assertEquals(actualMap, expectedMap); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testTakeInstanceNegInput2") public void testTakeInstanceNonBlockingCheck() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String payload = "{ \"health_check_list\" : [\"HelixInstanceStoppableCheck\"]," + "\"health_check_config\" : { \"client\" : \"espresso\" , " + "\"continueOnFailures\" : [\"HELIX:EMPTY_RESOURCE_ASSIGNMENT\", \"HELIX:INSTANCE_NOT_ENABLED\"," @@ -137,12 +128,10 @@ public void testTakeInstanceNonBlockingCheck() throws IOException { Map expectedMap = ImmutableMap.of("successful", true, "messages", errorMsg, "operationResult", ""); Assert.assertEquals(actualMap, expectedMap); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testTakeInstanceHealthCheck") public void testTakeInstanceOperationSuccess() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String payload = "{ \"operation_list\" : [\"org.apache.helix.rest.server.TestOperationImpl\"]} "; Response response = new JerseyUriRequestBuilder("clusters/{}/instances/{}/takeInstance") @@ -154,12 +143,10 @@ public void testTakeInstanceOperationSuccess() throws IOException { Map expectedMap = ImmutableMap .of("successful", true, "messages", new ArrayList<>(), "operationResult", "DummyTakeOperationResult"); Assert.assertEquals(actualMap, expectedMap); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testTakeInstanceOperationSuccess") public void testFreeInstanceOperationSuccess() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String payload = "{ \"operation_list\" : [\"org.apache.helix.rest.server.TestOperationImpl\"]} "; Response response = new JerseyUriRequestBuilder("clusters/{}/instances/{}/freeInstance") @@ -172,12 +159,10 @@ public void testFreeInstanceOperationSuccess() throws IOException { .of("successful", true, "messages", new ArrayList<>(), "operationResult", "DummyFreeOperationResult"); Assert.assertEquals(actualMap, expectedMap); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testFreeInstanceOperationSuccess") public void testTakeInstanceOperationCheckFailure() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String payload = "{ \"operation_list\" : [\"org.apache.helix.rest.server.TestOperationImpl\"]," + "\"operation_config\": { \"org.apache.helix.rest.server.TestOperationImpl\" :" + " {\"instance0\": true, \"instance2\": true, " @@ -190,12 +175,10 @@ public void testTakeInstanceOperationCheckFailure() throws IOException { Map actualMap = OBJECT_MAPPER.readValue(takeInstanceResult, Map.class); Assert.assertFalse((boolean)actualMap.get("successful")); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testTakeInstanceOperationCheckFailure") public void testTakeInstanceOperationCheckFailureCommonInput() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String payload = "{ \"operation_list\" : [\"org.apache.helix.rest.server.TestOperationImpl\"]," + "\"operation_config\": { \"OperationConfigSharedInput\" :" + " {\"instance0\": true, \"instance2\": true, " @@ -208,12 +191,10 @@ public void testTakeInstanceOperationCheckFailureCommonInput() throws IOExceptio Map actualMap = OBJECT_MAPPER.readValue(takeInstanceResult, Map.class); Assert.assertFalse((boolean)actualMap.get("successful")); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testTakeInstanceOperationCheckFailureCommonInput") public void testTakeInstanceOperationCheckFailureNonBlocking() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String payload = "{ \"operation_list\" : [\"org.apache.helix.rest.server.TestOperationImpl\"]," + "\"operation_config\": { \"org.apache.helix.rest.server.TestOperationImpl\" : " + "{\"instance0\": true, \"instance2\": true, " @@ -224,19 +205,16 @@ public void testTakeInstanceOperationCheckFailureNonBlocking() throws IOExceptio .format(STOPPABLE_CLUSTER, "instance0") .post(this, Entity.entity(payload, MediaType.APPLICATION_JSON_TYPE)); String takeInstanceResult = response.readEntity(String.class); - System.out.println("testTakeInstanceOperationCheckFailureNonBlocking" + takeInstanceResult); Map actualMap = OBJECT_MAPPER.readValue(takeInstanceResult, Map.class); Assert.assertTrue((boolean)actualMap.get("successful")); Assert.assertEquals(actualMap.get("operationResult"), "DummyTakeOperationResult"); // The non blocking test should generate msg but won't return failure status Assert.assertFalse(actualMap.get("messages").equals("[]")); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testTakeInstanceOperationCheckFailureNonBlocking") public void testTakeInstanceCheckOnly() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String payload = "{ \"operation_list\" : [\"org.apache.helix.rest.server.TestOperationImpl\"]," + "\"operation_config\": {\"performOperation\": false} } "; Response response = new JerseyUriRequestBuilder("clusters/{}/instances/{}/takeInstance") @@ -247,12 +225,10 @@ public void testTakeInstanceCheckOnly() throws IOException { Map actualMap = OBJECT_MAPPER.readValue(takeInstanceResult, Map.class); Assert.assertTrue((boolean)actualMap.get("successful")); Assert.assertTrue(actualMap.get("operationResult").equals("")); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testTakeInstanceCheckOnly") public void testGetAllMessages() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String testInstance = CLUSTER_NAME + "localhost_12926"; //Non-live instance String messageId = "msg1"; @@ -273,13 +249,10 @@ public void testGetAllMessages() throws IOException { node.get(PerInstanceAccessor.PerInstanceProperties.total_message_count.name()).intValue(); Assert.assertEquals(newMessageCount, 1); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetAllMessages") public void testGetMessagesByStateModelDef() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String testInstance = CLUSTER_NAME + "localhost_12926"; //Non-live instance String messageId = "msg1"; Message message = new Message(Message.MessageType.STATE_TRANSITION, messageId); @@ -311,12 +284,10 @@ public void testGetMessagesByStateModelDef() throws IOException { node.get(PerInstanceAccessor.PerInstanceProperties.total_message_count.name()).intValue(); Assert.assertEquals(newMessageCount, 0); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetMessagesByStateModelDef") public void testGetAllInstances() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String body = new JerseyUriRequestBuilder("clusters/{}/instances").isBodyReturnExpected(true) .format(CLUSTER_NAME).get(this); @@ -328,12 +299,10 @@ public void testGetAllInstances() throws IOException { OBJECT_MAPPER.getTypeFactory().constructCollectionType(Set.class, String.class)); Assert.assertEquals(instances, _instancesMap.get(CLUSTER_NAME), "Instances from response: " + instances + " vs instances actually: " + _instancesMap.get(CLUSTER_NAME)); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetAllInstances") public void testGetInstanceById() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String body = new JerseyUriRequestBuilder("clusters/{}/instances/{}").isBodyReturnExpected(true) .format(CLUSTER_NAME, INSTANCE_NAME).get(this); JsonNode node = OBJECT_MAPPER.readTree(body); @@ -345,12 +314,10 @@ public void testGetInstanceById() throws IOException { InstanceConfig instanceConfig = new InstanceConfig(toZNRecord(instancesCfg)); Assert.assertEquals(instanceConfig, _configAccessor.getInstanceConfig(CLUSTER_NAME, INSTANCE_NAME)); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetInstanceById") public void testAddInstance() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); InstanceConfig instanceConfig = new InstanceConfig(INSTANCE_NAME + "TEST"); Entity entity = Entity.entity(OBJECT_MAPPER.writeValueAsString(instanceConfig.getRecord()), MediaType.APPLICATION_JSON_TYPE); @@ -360,21 +327,17 @@ public void testAddInstance() throws IOException { Assert.assertEquals(instanceConfig, _configAccessor.getInstanceConfig(CLUSTER_NAME, INSTANCE_NAME + "TEST")); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testAddInstance", expectedExceptions = HelixException.class) public void testDeleteInstance() { - System.out.println("Start test :" + TestHelper.getTestMethodName()); delete("clusters/" + CLUSTER_NAME + "/instances/" + INSTANCE_NAME + "TEST", Response.Status.OK.getStatusCode()); _configAccessor.getInstanceConfig(CLUSTER_NAME, INSTANCE_NAME + "TEST"); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testDeleteInstance") public void updateInstance() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); // Disable instance Entity entity = Entity.entity("", MediaType.APPLICATION_JSON_TYPE); @@ -501,7 +464,6 @@ public void updateInstance() throws IOException { instanceConfig = _configAccessor.getInstanceConfig(CLUSTER_NAME, INSTANCE_NAME); Assert.assertEquals( instanceConfig.getInstanceOperation(), ""); - System.out.println("End test :" + TestHelper.getTestMethodName()); } /** @@ -510,7 +472,6 @@ public void updateInstance() throws IOException { */ @Test(dependsOnMethods = "updateInstance") public void updateInstanceConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String instanceName = CLUSTER_NAME + "localhost_12918"; InstanceConfig instanceConfig = _configAccessor.getInstanceConfig(CLUSTER_NAME, instanceName); ZNRecord record = instanceConfig.getRecord(); @@ -559,7 +520,6 @@ public void updateInstanceConfig() throws IOException { _configAccessor.getInstanceConfig(CLUSTER_NAME, instanceName).getRecord().getListFields()); Assert.assertEquals(record.getMapFields(), _configAccessor.getInstanceConfig(CLUSTER_NAME, instanceName).getRecord().getMapFields()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } /** @@ -568,7 +528,6 @@ public void updateInstanceConfig() throws IOException { */ @Test(dependsOnMethods = "updateInstanceConfig") public void deleteInstanceConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String instanceName = CLUSTER_NAME + "localhost_12918"; ZNRecord record = new ZNRecord(instanceName); @@ -606,7 +565,6 @@ public void deleteInstanceConfig() throws IOException { Assert.assertFalse(_configAccessor.getInstanceConfig(CLUSTER_NAME, instanceName).getRecord() .getMapFields().containsKey(key)); } - System.out.println("End test :" + TestHelper.getTestMethodName()); } /** @@ -616,7 +574,6 @@ public void deleteInstanceConfig() throws IOException { */ @Test(dependsOnMethods = "deleteInstanceConfig") public void checkUpdateFails() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String instanceName = CLUSTER_NAME + "non_existent_instance"; InstanceConfig instanceConfig = new InstanceConfig(INSTANCE_NAME + "TEST"); ZNRecord record = instanceConfig.getRecord(); @@ -629,7 +586,6 @@ public void checkUpdateFails() throws IOException { new JerseyUriRequestBuilder("clusters/{}/instances/{}/configs") .expectedReturnStatusCode(Response.Status.NOT_FOUND.getStatusCode()) .format(CLUSTER_NAME, instanceName).post(this, entity); - System.out.println("End test :" + TestHelper.getTestMethodName()); } /** @@ -641,7 +597,6 @@ public void checkUpdateFails() throws IOException { @Test(dependsOnMethods = "checkUpdateFails") public void testValidateWeightForInstance() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); // Empty out ClusterConfig's weight key setting and InstanceConfig's capacity maps for testing ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME); clusterConfig.getRecord() @@ -695,7 +650,6 @@ public void testValidateWeightForInstance() // Must have the results saying they are all valid (true) because capacity keys are set // in ClusterConfig node.iterator().forEachRemaining(child -> Assert.assertTrue(child.booleanValue())); - System.out.println("End test :" + TestHelper.getTestMethodName()); } /** @@ -704,7 +658,6 @@ public void testValidateWeightForInstance() */ @Test(dependsOnMethods = "testValidateWeightForInstance") public void testValidateDeltaInstanceConfigForUpdate() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); // Enable Topology aware for the cluster ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME); clusterConfig.getRecord() @@ -745,13 +698,10 @@ public void testValidateDeltaInstanceConfigForUpdate() throws IOException { "clusters/{}/instances/{}/configs?command=update&doSanityCheck=true") .expectedReturnStatusCode(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode()) .format(CLUSTER_NAME, INSTANCE_NAME).post(this, entity); - - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testValidateDeltaInstanceConfigForUpdate") - public void testGetResourcesOnInstance() throws JsonProcessingException, InterruptedException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); + public void testGetResourcesOnInstance() throws JsonProcessingException { String body = new JerseyUriRequestBuilder("clusters/{}/instances/{}/resources") .isBodyReturnExpected(true).format(CLUSTER_NAME, INSTANCE_NAME).get(this); JsonNode node = OBJECT_MAPPER.readTree(body); @@ -763,6 +713,5 @@ public void testGetResourcesOnInstance() throws JsonProcessingException, Interru // The below calls should successfully return body = new JerseyUriRequestBuilder("clusters/{}/instances/{}/resources/{}") .isBodyReturnExpected(true).format(CLUSTER_NAME, INSTANCE_NAME, dbName).get(this); - System.out.println("End test :" + TestHelper.getTestMethodName()); } } diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestResourceAccessor.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestResourceAccessor.java index ce11b2f1b9..a03f79e259 100644 --- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestResourceAccessor.java +++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestResourceAccessor.java @@ -63,8 +63,6 @@ public class TestResourceAccessor extends AbstractTestClass { @Test public void testGetResources() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String body = get("clusters/" + CLUSTER_NAME + "/resources", null, Response.Status.OK.getStatusCode(), true); @@ -77,12 +75,10 @@ public void testGetResources() throws IOException { OBJECT_MAPPER.getTypeFactory().constructCollectionType(Set.class, String.class)); Assert.assertEquals(resources, _resourcesMap.get("TestCluster_0"), "Resources from response: " + resources + " vs clusters actually: " + _resourcesMap.get("TestCluster_0")); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetResources") public void testGetResource() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String body = get("clusters/" + CLUSTER_NAME + "/resources/" + RESOURCE_NAME, null, Response.Status.OK.getStatusCode(), true); @@ -93,12 +89,10 @@ public void testGetResource() throws IOException { IdealState originIdealState = _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, RESOURCE_NAME); Assert.assertEquals(idealState, originIdealState); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetResource") public void testAddResources() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String newResourceName = "newResource"; IdealState idealState = new IdealState(newResourceName); idealState.getRecord().getSimpleFields().putAll(_gSetupTool.getClusterManagementTool() @@ -125,48 +119,37 @@ public void testAddResources() throws IOException { .setRebalanceStrategy("DEFAULT").build(); Assert.assertEquals(queryIdealState, _gSetupTool.getClusterManagementTool() .getResourceIdealState(CLUSTER_NAME, newResourceName + "0")); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testAddResources") public void testResourceConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String body = get("clusters/" + CLUSTER_NAME + "/resources/" + RESOURCE_NAME + "/configs", null, Response.Status.OK.getStatusCode(), true); ResourceConfig resourceConfig = new ResourceConfig(toZNRecord(body)); Assert.assertEquals(resourceConfig, _configAccessor.getResourceConfig(CLUSTER_NAME, RESOURCE_NAME)); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testResourceConfig") public void testIdealState() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String body = get("clusters/" + CLUSTER_NAME + "/resources/" + RESOURCE_NAME + "/idealState", null, Response.Status.OK.getStatusCode(), true); IdealState idealState = new IdealState(toZNRecord(body)); Assert.assertEquals(idealState, _gSetupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, RESOURCE_NAME)); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testIdealState") public void testExternalView() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String body = get("clusters/" + CLUSTER_NAME + "/resources/" + RESOURCE_NAME + "/externalView", null, Response.Status.OK.getStatusCode(), true); ExternalView externalView = new ExternalView(toZNRecord(body)); Assert.assertEquals(externalView, _gSetupTool.getClusterManagementTool() .getResourceExternalView(CLUSTER_NAME, RESOURCE_NAME)); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testExternalView") public void testCustomizedView() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); ZNRecord znRecord = new ZNRecord("test_customizedView"); _baseAccessor .set(PropertyPathBuilder.customizedView(CLUSTER_NAME, CUSTOMIZED_STATE_TYPE, RESOURCE_NAME), @@ -177,13 +160,10 @@ public void testCustomizedView() throws IOException { CustomizedView customizedView = new CustomizedView(toZNRecord(body)); Assert.assertEquals(customizedView, _gSetupTool.getClusterManagementTool() .getResourceCustomizedView(CLUSTER_NAME, RESOURCE_NAME, CUSTOMIZED_STATE_TYPE)); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testExternalView") public void testPartitionHealth() throws Exception { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String clusterName = "TestCluster_1"; String resourceName = clusterName + "_db_0"; @@ -227,7 +207,6 @@ public void testPartitionHealth() throws Exception { Assert.assertEquals(healthStatus.get("p0"), "HEALTHY"); Assert.assertEquals(healthStatus.get("p1"), "PARTIAL_HEALTHY"); Assert.assertEquals(healthStatus.get("p2"), "UNHEALTHY"); - System.out.println("End test :" + TestHelper.getTestMethodName()); // Re-enable the cluster _gSetupTool.getClusterManagementTool().enableCluster(clusterName, true); @@ -235,8 +214,6 @@ public void testPartitionHealth() throws Exception { @Test(dependsOnMethods = "testPartitionHealth") public void testResourceHealth() throws Exception { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String clusterName = "TestCluster_1"; Map idealStateParams = new HashMap<>(); idealStateParams.put("MinActiveReplicas", "2"); @@ -316,7 +293,6 @@ public void testResourceHealth() throws Exception { Assert.assertEquals(healthStatus.get(resourceNameHealthy), "HEALTHY"); Assert.assertEquals(healthStatus.get(resourceNamePartiallyHealthy), "PARTIAL_HEALTHY"); Assert.assertEquals(healthStatus.get(resourceNameUnhealthy), "UNHEALTHY"); - System.out.println("End test :" + TestHelper.getTestMethodName()); // Re-enable the cluster _gSetupTool.getClusterManagementTool().enableCluster(clusterName, true); @@ -372,7 +348,6 @@ public void updateResourceConfig() throws Exception { Assert.assertEquals(record.getSimpleFields(), updatedConfig.getRecord().getSimpleFields()); Assert.assertEquals(record.getListFields(), updatedConfig.getRecord().getListFields()); Assert.assertEquals(record.getMapFields(), updatedConfig.getRecord().getMapFields()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } /** @@ -381,7 +356,6 @@ public void updateResourceConfig() throws Exception { */ @Test(dependsOnMethods = "updateResourceConfig") public void updateResourceConfigIDMissing() throws Exception { - System.out.println("Start test :" + TestHelper.getTestMethodName()); // An invalid input which does not have any ID String dummyInput = "{\"simpleFields\":{}}"; @@ -395,7 +369,6 @@ public void updateResourceConfigIDMissing() throws Exception { _configAccessor.getResourceConfig(CLUSTER_NAME, dummyResourceName); // Since the id is missing in the input, the znode should not get created. Assert.assertNull(resourceConfig); - System.out.println("End test :" + TestHelper.getTestMethodName()); } /** @@ -437,7 +410,6 @@ public void deleteFromResourceConfig() throws Exception { Assert.assertFalse(configAfterDelete.getRecord().getListFields().containsKey(key)); Assert.assertFalse(configAfterDelete.getRecord().getMapFields().containsKey(key)); } - System.out.println("End test :" + TestHelper.getTestMethodName()); } /** @@ -481,7 +453,6 @@ public void updateResourceIdealState() throws Exception { Assert.assertEquals(record.getSimpleFields(), newRecord.getSimpleFields()); Assert.assertEquals(record.getListFields(), newRecord.getListFields()); Assert.assertEquals(record.getMapFields(), newRecord.getMapFields()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } /** @@ -543,7 +514,6 @@ public void deleteFromResourceIdealState() throws Exception { Assert.assertFalse(recordAfterDelete.getListFields().containsKey(key)); Assert.assertFalse(recordAfterDelete.getMapFields().containsKey(key)); } - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "deleteFromResourceIdealState") @@ -696,6 +666,5 @@ private void createDummyMapping(String clusterName, String resourceName, HelixDataAccessor helixDataAccessor = helixManager.getHelixDataAccessor(); helixDataAccessor.setProperty(helixDataAccessor.keyBuilder().externalView(resourceName), externalView); - System.out.println("End test :" + TestHelper.getTestMethodName()); } } diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestResourceAssignmentOptimizerAccessor.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestResourceAssignmentOptimizerAccessor.java index 63afe8a243..60bb0e6c98 100644 --- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestResourceAssignmentOptimizerAccessor.java +++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestResourceAssignmentOptimizerAccessor.java @@ -100,8 +100,6 @@ public void afterClass() { @Test public void testComputePartitionAssignment() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - // Test AddInstances, RemoveInstances and SwapInstances String payload = "{\"InstanceChange\" : { \"ActivateInstances\" : [\"" + toEnabledInstance + "\"]," + "\"DeactivateInstances\" : [ \"" + toDeactivatedInstance + "\"] }} "; @@ -219,14 +217,10 @@ public void testComputePartitionAssignment() throws IOException { "{instanceFilter=[], resourceFilter=[" + resources.get(1) + ", " + resources.get(0) + "], returnFormat=CurrentStateFormat}"), partitionAssignmentMetadata4.get(0).toString()); - - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testComputePartitionAssignment") public void testComputePartitionAssignmentWaged() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - // Use Waged for following tests for (String resource : resources) { IdealState idealState = @@ -311,13 +305,10 @@ public void testComputePartitionAssignmentWaged() throws IOException { Assert.assertEquals(resourceAssignments3.size(), 2); Assert.assertTrue(resourceAssignments3.containsKey(resources.get(0))); Assert.assertTrue(resourceAssignments3.containsKey(resources.get(1))); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testComputePartitionAssignmentWaged") public void testComputePartitionAssignmentNegativeInput() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - // Test negative input String payload4 = "{\"InstanceChange\" : { \"ActivateInstances\" : [\" nonExistInstanceName \"] }} "; post(urlBase, null, Entity.entity(payload4, MediaType.APPLICATION_JSON_TYPE), @@ -335,7 +326,5 @@ public void testComputePartitionAssignmentNegativeInput() throws IOException { String payload6 = "{}"; post(urlBase, null, Entity.entity(payload6, MediaType.APPLICATION_JSON_TYPE), Response.Status.BAD_REQUEST.getStatusCode(), true); - - System.out.println("End test :" + TestHelper.getTestMethodName()); } } \ No newline at end of file diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestTaskAccessor.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestTaskAccessor.java index c4f5ed3718..fe48a769dc 100644 --- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestTaskAccessor.java +++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestTaskAccessor.java @@ -37,7 +37,6 @@ public class TestTaskAccessor extends AbstractTestClass { @Test public void testGetAddTaskUserContent() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String uri = "clusters/" + CLUSTER_NAME + "/workflows/Workflow_0/jobs/JOB0/tasks/0/userContent"; String uriTaskDoesNotExist = "clusters/" + CLUSTER_NAME + "/workflows/Workflow_0/jobs/JOB0/tasks/xxx/userContent"; @@ -76,12 +75,10 @@ public void testGetAddTaskUserContent() throws IOException { contentStore = OBJECT_MAPPER.readValue(body, new TypeReference>() { }); Assert.assertEquals(contentStore, map1); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetAddTaskUserContent") public void testInvalidGetAddTaskUserContent() { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String validURI = "clusters/" + CLUSTER_NAME + "/workflows/Workflow_0/jobs/Job_0/tasks/0/userContent"; String invalidURI1 = "clusters/" + CLUSTER_NAME + "/workflows/xxx/jobs/Job_0/tasks/0/userContent"; // workflow not exist String invalidURI2 = "clusters/" + CLUSTER_NAME + "/workflows/Workflow_0/jobs/xxx/tasks/0/userContent"; // job not exist @@ -102,6 +99,5 @@ public void testInvalidGetAddTaskUserContent() { post(validURI, invalidCmd, validEntity, Response.Status.BAD_REQUEST.getStatusCode()); post(validURI, validCmd, invalidEntity, Response.Status.BAD_REQUEST.getStatusCode()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } } diff --git a/helix-rest/src/test/java/org/apache/helix/rest/server/TestWorkflowAccessor.java b/helix-rest/src/test/java/org/apache/helix/rest/server/TestWorkflowAccessor.java index e5364da840..cfd66d2606 100644 --- a/helix-rest/src/test/java/org/apache/helix/rest/server/TestWorkflowAccessor.java +++ b/helix-rest/src/test/java/org/apache/helix/rest/server/TestWorkflowAccessor.java @@ -59,8 +59,6 @@ public class TestWorkflowAccessor extends AbstractTestClass { @Test public void testGetWorkflows() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String body = get("clusters/" + CLUSTER_NAME + "/workflows", null, Response.Status.OK.getStatusCode(), true); JsonNode node = OBJECT_MAPPER.readTree(body); @@ -68,12 +66,10 @@ public void testGetWorkflows() throws IOException { Set workflows = OBJECT_MAPPER.readValue(workflowsStr, OBJECT_MAPPER.getTypeFactory().constructCollectionType(Set.class, String.class)); Assert.assertEquals(workflows, _workflowMap.get(CLUSTER_NAME).keySet()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetWorkflows") public void testGetWorkflow() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String body = get("clusters/" + CLUSTER_NAME + "/workflows/" + WORKFLOW_NAME, null, Response.Status.OK.getStatusCode(), true); JsonNode node = OBJECT_MAPPER.readTree(body); @@ -89,36 +85,27 @@ public void testGetWorkflow() throws IOException { node.get(WorkflowAccessor.WorkflowProperties.WorkflowConfig.name()).get("WorkflowID") .textValue(); Assert.assertEquals(workflowId, WORKFLOW_NAME); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetWorkflow") public void testGetWorkflowConfig() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String body = get("clusters/" + CLUSTER_NAME + "/workflows/" + WORKFLOW_NAME + "/configs", null, Response.Status.OK.getStatusCode(), true); JsonNode node = OBJECT_MAPPER.readTree(body); String workflowId = node.get("WorkflowID").textValue(); Assert.assertEquals(workflowId, WORKFLOW_NAME); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetWorkflowConfig") public void testGetWorkflowContext() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); - String body = get("clusters/" + CLUSTER_NAME + "/workflows/" + WORKFLOW_NAME + "/context", null, Response.Status.OK.getStatusCode(), true); JsonNode node = OBJECT_MAPPER.readTree(body); - Assert.assertEquals(node.get("STATE").textValue(), - TaskState.FAILED.name()); - System.out.println("End test :" + TestHelper.getTestMethodName()); + Assert.assertEquals(node.get("STATE").textValue(), TaskState.FAILED.name()); } @Test(dependsOnMethods = "testGetWorkflowContext") public void testCreateWorkflow() throws IOException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); TaskDriver driver = getTaskDriver(CLUSTER_NAME); // Create one time workflow @@ -144,12 +131,10 @@ public void testCreateWorkflow() throws IOException { Assert.assertNotNull(workflowConfig); Assert.assertTrue(workflowConfig.isJobQueue()); Assert.assertEquals(workflowConfig.getJobDag().getAllNodes().size(), 0); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testCreateWorkflow") public void testUpdateWorkflow() { - System.out.println("Start test :" + TestHelper.getTestMethodName()); TaskDriver driver = getTaskDriver(CLUSTER_NAME); Entity entity = Entity.entity("", MediaType.APPLICATION_JSON_TYPE); @@ -162,12 +147,10 @@ public void testUpdateWorkflow() { ImmutableMap.of("command", "resume"), entity, Response.Status.OK.getStatusCode()); Assert.assertEquals(driver.getWorkflowConfig(TEST_QUEUE_NAME).getTargetState(), TargetState.START); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testUpdateWorkflow") public void testGetAndUpdateWorkflowContentStore() throws IOException, InterruptedException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String workflowName = "Workflow_0"; TaskDriver driver = getTaskDriver(CLUSTER_NAME); // Wait for workflow to start processing @@ -197,12 +180,10 @@ public void testGetAndUpdateWorkflowContentStore() throws IOException, Interrupt body = get(uri, null, Response.Status.OK.getStatusCode(), true); contentStore = OBJECT_MAPPER.readValue(body, new TypeReference>() {}); Assert.assertEquals(contentStore, map1); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testGetAndUpdateWorkflowContentStore") public void testInvalidGetAndUpdateWorkflowContentStore() { - System.out.println("Start test :" + TestHelper.getTestMethodName()); String validURI = "clusters/" + CLUSTER_NAME + "/workflows/Workflow_0/userContent"; String invalidURI = "clusters/" + CLUSTER_NAME + "/workflows/xxx/userContent"; // workflow not exist Entity validEntity = Entity.entity("{\"k1\":\"v1\"}", MediaType.APPLICATION_JSON_TYPE); @@ -216,12 +197,10 @@ public void testInvalidGetAndUpdateWorkflowContentStore() { post(validURI, invalidCmd, validEntity, Response.Status.BAD_REQUEST.getStatusCode()); post(validURI, validCmd, invalidEntity, Response.Status.BAD_REQUEST.getStatusCode()); - System.out.println("End test :" + TestHelper.getTestMethodName()); } @Test(dependsOnMethods = "testInvalidGetAndUpdateWorkflowContentStore") public void testDeleteWorkflow() throws InterruptedException { - System.out.println("Start test :" + TestHelper.getTestMethodName()); TaskDriver driver = getTaskDriver(CLUSTER_NAME); int currentWorkflowNumbers = driver.getWorkflows().size(); @@ -233,6 +212,5 @@ public void testDeleteWorkflow() throws InterruptedException { Thread.sleep(500); Assert.assertEquals(driver.getWorkflows().size(), currentWorkflowNumbers - 2); - System.out.println("End test :" + TestHelper.getTestMethodName()); } } diff --git a/helix-view-aggregator/src/test/java/org/apache/helix/view/integration/TestHelixViewAggregator.java b/helix-view-aggregator/src/test/java/org/apache/helix/view/integration/TestHelixViewAggregator.java index d1b3bb55d0..1a04189bf8 100644 --- a/helix-view-aggregator/src/test/java/org/apache/helix/view/integration/TestHelixViewAggregator.java +++ b/helix-view-aggregator/src/test/java/org/apache/helix/view/integration/TestHelixViewAggregator.java @@ -297,7 +297,6 @@ private Predicate hasLiveInstanceChanges() { * Create same sets of resources for each cluster */ private void createResources() { - System.out.println("Creating resources ..."); for (String sourceClusterName : _allSourceClusters) { for (int i = 0; i < numResourcePerSourceCluster; i++) { String resourceName = resourceNamePrefix + i; @@ -312,7 +311,6 @@ private void createResources() { * Rebalance all resources on each cluster */ private void rebalanceResources() { - System.out.println("Rebalancing resources ..."); for (String sourceClusterName : _allSourceClusters) { for (String resourceName : _allResources) { // We always rebalance all resources, even if it would be deleted during test diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestConnectStateChangeListenerAndRetry.java b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestConnectStateChangeListenerAndRetry.java index f088140c6e..20381f54bd 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestConnectStateChangeListenerAndRetry.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestConnectStateChangeListenerAndRetry.java @@ -59,14 +59,12 @@ public class TestConnectStateChangeListenerAndRetry { @BeforeTest public void prepare() { - System.out.println("START TestConnectStateChangeListenerAndRetry at " + new Date(System.currentTimeMillis())); // start local zookeeper server _zkServer = ZkMetaClientTestBase.startZkServer(ZK_ADDR); } @Test public void testConnectState() { - System.out.println("STARTING TestConnectStateChangeListenerAndRetry.testConnectState at " + new Date(System.currentTimeMillis())); try (ZkMetaClient zkMetaClient = createZkMetaClientReconnectTest()) { zkMetaClient.connect(); zkMetaClient.connect(); @@ -75,13 +73,11 @@ public void testConnectState() { Assert.assertTrue(ex instanceof IllegalStateException); Assert.assertEquals(ex.getMessage(), "ZkClient is not in init state. connect() has already been called."); } - System.out.println("END TestConnectStateChangeListenerAndRetry.testConnectState at " + new Date(System.currentTimeMillis())); } // test mock zkclient event @Test(dependsOnMethods = "testConnectState") public void testReConnectSucceed() throws InterruptedException { - System.out.println("STARTING TestConnectStateChangeListenerAndRetry.testReConnectSucceed at " + new Date(System.currentTimeMillis())); try (ZkMetaClient zkMetaClient = createZkMetaClientReconnectTest()) { CountDownLatch countDownLatch = new CountDownLatch(1); @@ -106,12 +102,10 @@ public void run() { zkMetaClient.create("/key", "value"); Assert.assertEquals(zkMetaClient.get("/key"), "value"); } - System.out.println("END TestConnectStateChangeListenerAndRetry.testReConnectSucceed at " + new Date(System.currentTimeMillis())); } @Test(dependsOnMethods = "testReConnectSucceed") public void testConnectStateChangeListener() throws Exception { - System.out.println("START TestConnectStateChangeListenerAndRetry.testConnectStateChangeListener at " + new Date(System.currentTimeMillis())); try (ZkMetaClient zkMetaClient = createZkMetaClientReconnectTest()) { CountDownLatch countDownLatch = new CountDownLatch(1); final MetaClientInterface.ConnectState[] connectState = @@ -149,7 +143,6 @@ public void handleConnectionEstablishmentError(Throwable error) throws Exception } zkMetaClient.unsubscribeConnectStateChanges(listener); } - System.out.println("END TestConnectStateChangeListenerAndRetry.testConnectStateChangeListener at " + new Date(System.currentTimeMillis())); } static ZkMetaClient createZkMetaClientReconnectTest() { diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/CreatePuppy.java b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/CreatePuppy.java index 3940f79ab4..96221b7661 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/CreatePuppy.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/CreatePuppy.java @@ -23,11 +23,15 @@ import org.apache.helix.metaclient.exception.MetaClientNodeExistsException; import org.apache.helix.metaclient.puppy.AbstractPuppy; import org.apache.helix.metaclient.puppy.PuppySpec; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Random; public class CreatePuppy extends AbstractPuppy { + private static final Logger LOG = LoggerFactory.getLogger(CreatePuppy.class); + private final Random _random; private final String _parentPath = "/test"; @@ -45,19 +49,19 @@ protected void bark() { // Simulate an error by creating an invalid path _metaclient.create("invalid", "test"); } catch (IllegalArgumentException e) { // Catch invalid exception - System.out.println(Thread.currentThread().getName() + " tried to create an invalid path" + " at time: " + System.currentTimeMillis()); + LOG.info(Thread.currentThread().getName() + " tried to create an invalid path" + " at time: " + System.currentTimeMillis()); // Expected exception } } else { // Normal behavior - create a new node try { - System.out.println(Thread.currentThread().getName() + " is attempting to create node: " + randomNumber + " at time: " + System.currentTimeMillis()); + LOG.info(Thread.currentThread().getName() + " is attempting to create node: " + randomNumber + " at time: " + System.currentTimeMillis()); _metaclient.create(_parentPath + "/" + randomNumber,"test"); - System.out.println(Thread.currentThread().getName() + " successfully created node " + randomNumber + " at time: " + System.currentTimeMillis()); + LOG.info(Thread.currentThread().getName() + " successfully created node " + randomNumber + " at time: " + System.currentTimeMillis()); _eventChangeCounterMap.put(String.valueOf(randomNumber), _eventChangeCounterMap.getOrDefault(String.valueOf(randomNumber), 0) + 1); } catch (MetaClientNodeExistsException e) { // Expected exception - System.out.println(Thread.currentThread().getName() + " failed to create node " + randomNumber + " at time: " + System.currentTimeMillis() + ", it already exists"); + LOG.info(Thread.currentThread().getName() + " failed to create node " + randomNumber + " at time: " + System.currentTimeMillis() + ", it already exists"); } } } diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/DeletePuppy.java b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/DeletePuppy.java index 1aa9d4d729..c72e84b9b3 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/DeletePuppy.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/DeletePuppy.java @@ -22,11 +22,15 @@ import org.apache.helix.metaclient.api.MetaClientInterface; import org.apache.helix.metaclient.puppy.AbstractPuppy; import org.apache.helix.metaclient.puppy.PuppySpec; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Random; public class DeletePuppy extends AbstractPuppy { + private static final Logger LOG = LoggerFactory.getLogger(DeletePuppy.class); + private final Random _random; private final String _parentPath = "/test"; @@ -43,15 +47,15 @@ protected void bark() { _metaclient.delete("invalid"); _unhandledErrorCounter++; } catch (IllegalArgumentException e) { - System.out.println(Thread.currentThread().getName() + " intentionally deleted an invalid path" + " at time: " + System.currentTimeMillis() ); + LOG.info(Thread.currentThread().getName() + " intentionally deleted an invalid path" + " at time: " + System.currentTimeMillis() ); } } else { - System.out.println(Thread.currentThread().getName() + " is attempting to delete node: " + randomNumber + " at time: " + System.currentTimeMillis()); + LOG.info(Thread.currentThread().getName() + " is attempting to delete node: " + randomNumber + " at time: " + System.currentTimeMillis()); if (_metaclient.delete(_parentPath + "/" + randomNumber)) { - System.out.println(Thread.currentThread().getName() + " successfully deleted node " + randomNumber + " at time: " + System.currentTimeMillis()); + LOG.info(Thread.currentThread().getName() + " successfully deleted node " + randomNumber + " at time: " + System.currentTimeMillis()); _eventChangeCounterMap.put(String.valueOf(randomNumber), _eventChangeCounterMap.getOrDefault(String.valueOf(randomNumber), 0) + 1); } else { - System.out.println(Thread.currentThread().getName() + " failed to delete node " + randomNumber + " at time: " + System.currentTimeMillis() + ", it does not exist"); + LOG.info(Thread.currentThread().getName() + " failed to delete node " + randomNumber + " at time: " + System.currentTimeMillis() + ", it does not exist"); } } } diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/GetPuppy.java b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/GetPuppy.java index 4af1c4df32..1fe2689d99 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/GetPuppy.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/GetPuppy.java @@ -22,12 +22,16 @@ import org.apache.helix.metaclient.api.MetaClientInterface; import org.apache.helix.metaclient.puppy.AbstractPuppy; import org.apache.helix.metaclient.puppy.PuppySpec; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Objects; import java.util.Random; public class GetPuppy extends AbstractPuppy { + private static final Logger LOG = LoggerFactory.getLogger(GetPuppy.class); + private final Random _random; private final String _parentPath = "/test"; @@ -44,15 +48,15 @@ protected void bark() { _metaclient.get("invalid"); _unhandledErrorCounter++; } catch (IllegalArgumentException e) { - System.out.println(Thread.currentThread().getName() + " intentionally tried to read an invalid path" + " at time: " + System.currentTimeMillis()); + LOG.info(Thread.currentThread().getName() + " intentionally tried to read an invalid path" + " at time: " + System.currentTimeMillis()); } } else { - System.out.println(Thread.currentThread().getName() + " is attempting to read node: " + randomNumber + " at time: " + System.currentTimeMillis()); + LOG.info(Thread.currentThread().getName() + " is attempting to read node: " + randomNumber + " at time: " + System.currentTimeMillis()); String nodeValue = _metaclient.get(_parentPath + "/" + randomNumber); if (Objects.equals(nodeValue, null)) { - System.out.println(Thread.currentThread().getName() + " failed to read node " + randomNumber + " at time: " + System.currentTimeMillis() + ", it does not exist"); + LOG.info(Thread.currentThread().getName() + " failed to read node " + randomNumber + " at time: " + System.currentTimeMillis() + ", it does not exist"); } else { - System.out.println(Thread.currentThread().getName() + " successfully read node " + randomNumber + " at time: " + System.currentTimeMillis()); + LOG.info(Thread.currentThread().getName() + " successfully read node " + randomNumber + " at time: " + System.currentTimeMillis()); } } } diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/SetPuppy.java b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/SetPuppy.java index 3385b8673b..abb547f3aa 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/SetPuppy.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/SetPuppy.java @@ -23,11 +23,15 @@ import org.apache.helix.metaclient.exception.MetaClientNoNodeException; import org.apache.helix.metaclient.puppy.AbstractPuppy; import org.apache.helix.metaclient.puppy.PuppySpec; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Random; public class SetPuppy extends AbstractPuppy { + private static final Logger LOG = LoggerFactory.getLogger(SetPuppy.class); + private final Random _random; private final String _parentPath = "/test"; @@ -43,18 +47,18 @@ protected void bark() { try { _metaclient.set("invalid", "test", -1); } catch (IllegalArgumentException e) { - System.out.println(Thread.currentThread().getName() + " intentionally called set on an invalid path" + " at time: " + System.currentTimeMillis()); + LOG.info(Thread.currentThread().getName() + " intentionally called set on an invalid path" + " at time: " + System.currentTimeMillis()); } } else { try { - System.out.println(Thread.currentThread().getName() + " is attempting to set node: " + randomNumber + " at time: " + System.currentTimeMillis()); + LOG.info(Thread.currentThread().getName() + " is attempting to set node: " + randomNumber + " at time: " + System.currentTimeMillis()); _metaclient.set(_parentPath + "/" + randomNumber, "test", -1); _eventChangeCounterMap.put(String.valueOf(randomNumber), _eventChangeCounterMap.getOrDefault(String.valueOf(randomNumber), 0) + 1); - System.out.println( + LOG.info( Thread.currentThread().getName() + " successfully set node " + randomNumber + " at time: " + System.currentTimeMillis()); } catch (MetaClientNoNodeException e) { - System.out.println(Thread.currentThread().getName() + " failed to set node " + randomNumber + " at time: " + System.currentTimeMillis() + ", it does not exist"); + LOG.info(Thread.currentThread().getName() + " failed to set node " + randomNumber + " at time: " + System.currentTimeMillis() + ", it does not exist"); } } } diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/TestMultiThreadStressZKClient.java b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/TestMultiThreadStressZKClient.java index 6a01fffa79..4b39da2d27 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/TestMultiThreadStressZKClient.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/TestMultiThreadStressZKClient.java @@ -27,6 +27,8 @@ import org.apache.helix.metaclient.puppy.PuppyMode; import org.apache.helix.metaclient.puppy.PuppySpec; import org.apache.helix.metaclient.puppy.AbstractPuppy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; @@ -37,6 +39,8 @@ public class TestMultiThreadStressZKClient extends ZkMetaClientTestBase { + private static final Logger LOG = LoggerFactory.getLogger(TestMultiThreadStressZKClient.class); + private ZkMetaClient _zkMetaClient; private final String zkParentKey = "/test"; @@ -189,7 +193,7 @@ public void testBasicParentListenerPuppy() { AtomicInteger globalChildChangeCounter = new AtomicInteger(); ChildChangeListener childChangeListener = (changedPath, changeType) -> { globalChildChangeCounter.addAndGet(1); - System.out.println("-------------- Child change detected: " + changeType + " at path: " + changedPath + ". Number of total changes: " + globalChildChangeCounter.get()); + LOG.info("-------------- Child change detected: " + changeType + " at path: " + changedPath + ". Number of total changes: " + globalChildChangeCounter.get()); }; _zkMetaClient.subscribeChildChanges(zkParentKey, childChangeListener, false); @@ -217,7 +221,7 @@ public void testComplexParentListenerPuppy() { AtomicInteger globalChildChangeCounter = new AtomicInteger(); ChildChangeListener childChangeListener = (changedPath, changeType) -> { globalChildChangeCounter.addAndGet(1); - System.out.println("-------------- Child change detected: " + changeType + " at path: " + changedPath + " number of changes: " + globalChildChangeCounter.get()); + LOG.info("-------------- Child change detected: " + changeType + " at path: " + changedPath + " number of changes: " + globalChildChangeCounter.get()); }; _zkMetaClient.subscribeChildChanges(zkParentKey, childChangeListener, false); @@ -270,21 +274,21 @@ public void testChildListenerPuppy() { AtomicInteger childChangeCounter0 = new AtomicInteger(); ChildChangeListener childChangeListener0 = (changedPath, changeType) -> { childChangeCounter0.addAndGet(1); - System.out.println("-------------- Child change detected: " + changeType + " at path: " + changedPath + " number of changes: " + childChangeCounter0.get()); + LOG.info("-------------- Child change detected: " + changeType + " at path: " + changedPath + " number of changes: " + childChangeCounter0.get()); }; _zkMetaClient.subscribeChildChanges("/test/0", childChangeListener0, false); AtomicInteger childChangeCounter1 = new AtomicInteger(); ChildChangeListener childChangeListener1 = (changedPath, changeType) -> { childChangeCounter1.addAndGet(1); - System.out.println("-------------- Child change detected: " + changeType + " at path: " + changedPath + " number of changes: " + childChangeCounter1.get()); + LOG.info("-------------- Child change detected: " + changeType + " at path: " + changedPath + " number of changes: " + childChangeCounter1.get()); }; _zkMetaClient.subscribeChildChanges("/test/1", childChangeListener1, false); AtomicInteger childChangeCounter2 = new AtomicInteger(); ChildChangeListener childChangeListener2 = (changedPath, changeType) -> { childChangeCounter2.addAndGet(1); - System.out.println("-------------- Child change detected: " + changeType + " at path: " + changedPath + " number of changes: " + childChangeCounter2.get()); + LOG.info("-------------- Child change detected: " + changeType + " at path: " + changedPath + " number of changes: " + childChangeCounter2.get()); }; _zkMetaClient.subscribeChildChanges("/test/2", childChangeListener2, false); @@ -305,10 +309,10 @@ public void testChildListenerPuppy() { }); } - System.out.println("Merged event change counter map: " + mergedEventChangeCounterMap); - System.out.println("Child change counter 0: " + childChangeCounter0); - System.out.println("Child change counter 1: " + childChangeCounter1); - System.out.println("Child change counter 2: " + childChangeCounter2); + LOG.info("Merged event change counter map: " + mergedEventChangeCounterMap); + LOG.info("Child change counter 0: " + childChangeCounter0); + LOG.info("Child change counter 1: " + childChangeCounter1); + LOG.info("Child change counter 2: " + childChangeCounter2); Assert.assertEquals(childChangeCounter0.get(), mergedEventChangeCounterMap.getOrDefault("0", 0).intValue()); Assert.assertEquals(childChangeCounter1.get(), mergedEventChangeCounterMap.getOrDefault("1", 0).intValue()); Assert.assertEquals(childChangeCounter2.get(), mergedEventChangeCounterMap.getOrDefault("2", 0).intValue()); @@ -332,8 +336,8 @@ private void assertNoExceptions(PuppyManager puppyManager, AtomicInteger globalC totalHandledErrors.addAndGet(value); }); - System.out.println("Change counter: " + totalHandledErrors + " for " + puppy.getClass()); - System.out.println("Error counter: " + puppy._unhandledErrorCounter + " for " + puppy.getClass()); + LOG.info("Change counter: " + totalHandledErrors + " for " + puppy.getClass()); + LOG.info("Error counter: " + puppy._unhandledErrorCounter + " for " + puppy.getClass()); totalUnhandledErrors += puppy._unhandledErrorCounter; totalEventChanges += totalHandledErrors.get(); } diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/UpdatePuppy.java b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/UpdatePuppy.java index 5af055f741..e0d90db3d1 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/UpdatePuppy.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestMultiThreadStressTest/UpdatePuppy.java @@ -23,11 +23,15 @@ import org.apache.helix.metaclient.exception.MetaClientNoNodeException; import org.apache.helix.metaclient.puppy.AbstractPuppy; import org.apache.helix.metaclient.puppy.PuppySpec; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.Random; public class UpdatePuppy extends AbstractPuppy { + private static final Logger LOG = LoggerFactory.getLogger(UpdatePuppy.class); + private final Random _random; private final String _parentPath = "/test"; @@ -43,17 +47,17 @@ protected void bark() throws Exception { try { _metaclient.update("invalid", (data) -> "foo"); } catch (IllegalArgumentException e) { - System.out.println(Thread.currentThread().getName() + " intentionally tried to update an invalid path" + " at time: " + System.currentTimeMillis()); + LOG.info(Thread.currentThread().getName() + " intentionally tried to update an invalid path" + " at time: " + System.currentTimeMillis()); } } else { try { - System.out.println(Thread.currentThread().getName() + " is attempting to update node: " + randomNumber + " at time: " + System.currentTimeMillis()); + LOG.info(Thread.currentThread().getName() + " is attempting to update node: " + randomNumber + " at time: " + System.currentTimeMillis()); _metaclient.update(_parentPath + "/" + randomNumber, (data) -> "foo"); _eventChangeCounterMap.put(String.valueOf(randomNumber), _eventChangeCounterMap.getOrDefault(String.valueOf(randomNumber), 0) + 1); - System.out.println(Thread.currentThread().getName() + " successfully updated node " + randomNumber + " at time: " + LOG.info(Thread.currentThread().getName() + " successfully updated node " + randomNumber + " at time: " + System.currentTimeMillis()); } catch (MetaClientNoNodeException e) { - System.out.println(Thread.currentThread().getName() + " failed to update node " + randomNumber + " at time: " + System.currentTimeMillis() + ", it does not exist"); + LOG.info(Thread.currentThread().getName() + " failed to update node " + randomNumber + " at time: " + System.currentTimeMillis() + ", it does not exist"); } catch (IllegalArgumentException e) { if (!e.getMessage().equals("Can not subscribe one time watcher when ZkClient is using PersistWatcher")) { throw e; diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestZkMetaClient.java b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestZkMetaClient.java index a5da69f2f1..37c58b2ce6 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestZkMetaClient.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/TestZkMetaClient.java @@ -125,7 +125,6 @@ public void testRecursiveCreate() { Assert.fail("Should have failed due to node already created"); } catch (MetaClientException e) { Assert.assertEquals(e.getMessage(), "org.apache.helix.zookeeper.zkclient.exception.ZkNodeExistsException: org.apache.zookeeper.KeeperException$NodeExistsException: KeeperErrorCode = NodeExists for /Test/ZkMetaClient/_fullPath"); - System.out.println(e.getMessage()); } } diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/ZkMetaClientTestBase.java b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/ZkMetaClientTestBase.java index eade017c15..89a2f45941 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/ZkMetaClientTestBase.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/impl/zk/ZkMetaClientTestBase.java @@ -26,12 +26,16 @@ import org.apache.helix.metaclient.impl.zk.factory.ZkMetaClientConfig; import org.apache.helix.zookeeper.zkclient.IDefaultNameSpace; import org.apache.helix.zookeeper.zkclient.ZkServer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeSuite; public abstract class ZkMetaClientTestBase { + private static final Logger LOG = LoggerFactory.getLogger(ZkMetaClientTestBase.class); + protected static final String ZK_ADDR = "localhost:2183"; protected static final int DEFAULT_TIMEOUT_MS = 1000; protected static final String ENTRY_STRING_VALUE = "test-value"; @@ -49,7 +53,6 @@ public abstract class ZkMetaClientTestBase { */ @BeforeSuite public void prepare() { - System.out.println("ZkMetaClientTestBase start "); // Enable extended types and create a ZkClient System.setProperty("zookeeper.extendedTypesEnabled", "true"); // start local zookeeper server @@ -58,7 +61,6 @@ public void prepare() { @AfterSuite public void cleanUp() { - System.out.println("ZkMetaClientTestBase shut down"); _zkServer.shutdown(); } @@ -87,7 +89,7 @@ public static ZkServer startZkServer(final String zkAddress) { }; int port = Integer.parseInt(zkAddress.substring(zkAddress.lastIndexOf(':') + 1)); - System.out.println("Starting ZK server at " + zkAddress); + LOG.info("Starting ZK server at " + zkAddress); ZkServer zkServer = new ZkServer(dataDir, logDir, defaultNameSpace, port); zkServer.start(); return zkServer; diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/recipes/leaderelection/LeaderElectionPuppy.java b/meta-client/src/test/java/org/apache/helix/metaclient/recipes/leaderelection/LeaderElectionPuppy.java index 3f123d3ac8..56027344bf 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/recipes/leaderelection/LeaderElectionPuppy.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/recipes/leaderelection/LeaderElectionPuppy.java @@ -26,10 +26,15 @@ import org.apache.helix.metaclient.exception.MetaClientException; import org.apache.helix.metaclient.puppy.AbstractPuppy; import org.apache.helix.metaclient.puppy.PuppySpec; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; public class LeaderElectionPuppy extends AbstractPuppy { + + private static final Logger LOG = LoggerFactory.getLogger(LeaderElectionPuppy.class); + String _leaderGroup; String _participant; private final Random _random; @@ -52,7 +57,7 @@ public LeaderElectionPuppy(LeaderElectionClient leaderElectionClient, PuppySpec @Override protected void bark() throws Exception { int randomNumber = _random.nextInt((int) TimeUnit.SECONDS.toMillis(5)); - System.out.println("LeaderElectionPuppy " + _participant + " Joining"); + LOG.info("LeaderElectionPuppy " + _participant + " Joining"); _leaderElectionClient.joinLeaderElectionParticipantPool(_leaderGroup); Assert.assertTrue(MetaClientTestUtil.verify(() -> { @@ -66,7 +71,7 @@ protected void bark() throws Exception { }, MetaClientTestUtil.WAIT_DURATION)); Thread.sleep(randomNumber); - System.out.println("LeaderElectionPuppy " + _participant + " Leaving"); + LOG.info("LeaderElectionPuppy " + _participant + " Leaving"); _leaderElectionClient.exitLeaderElectionParticipantPool(_leaderGroup); Assert.assertTrue(MetaClientTestUtil.verify(() -> { return (_leaderElectionClient.getParticipantInfo(_leaderGroup, _participant) == null); @@ -78,7 +83,7 @@ protected void bark() throws Exception { @Override protected void cleanup() { try { - System.out.println("Cleaning - LeaderElectionPuppy " + _participant + " Leaving"); + LOG.info("Cleaning - LeaderElectionPuppy " + _participant + " Leaving"); _leaderElectionClient.exitLeaderElectionParticipantPool(_leaderGroup); } catch (MetaClientException ignore) { // already leave the pool. OK to throw exception. @@ -86,6 +91,7 @@ protected void cleanup() { try { _leaderElectionClient.close(); } catch (Exception e) { + LOG.error(e.getMessage(), e); } } } diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/recipes/leaderelection/TestLeaderElection.java b/meta-client/src/test/java/org/apache/helix/metaclient/recipes/leaderelection/TestLeaderElection.java index 75917623c7..f7bf2bed8f 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/recipes/leaderelection/TestLeaderElection.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/recipes/leaderelection/TestLeaderElection.java @@ -10,6 +10,8 @@ import org.apache.helix.metaclient.impl.zk.ZkMetaClientTestBase; import org.apache.helix.metaclient.impl.zk.factory.ZkMetaClientConfig; import org.apache.helix.zookeeper.datamodel.ZNRecord; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.AfterTest; import org.testng.annotations.Test; @@ -19,6 +21,8 @@ public class TestLeaderElection extends ZkMetaClientTestBase { + private static final Logger LOG = LoggerFactory.getLogger(TestLeaderElection.class); + private static final String PARTICIPANT_NAME1 = "participant_1"; private static final String PARTICIPANT_NAME2 = "participant_2"; private static final String LEADER_PATH = "/LEADER_ELECTION_GROUP_1"; @@ -43,7 +47,6 @@ public void cleanUp() { @Test public void testAcquireLeadership() throws Exception { - System.out.println("START TestLeaderElection.testAcquireLeadership"); String leaderPath = LEADER_PATH + "/testAcquireLeadership"; // create 2 clients representing 2 participants @@ -86,12 +89,10 @@ public void testAcquireLeadership() throws Exception { clt1.close(); clt2.close(); - System.out.println("END TestLeaderElection.testAcquireLeadership"); } @Test(dependsOnMethods = "testAcquireLeadership") public void testElectionPoolMembership() throws Exception { - System.out.println("START TestLeaderElection.testElectionPoolMembership"); String leaderPath = LEADER_PATH + "/_testElectionPoolMembership"; LeaderInfo participantInfo = new LeaderInfo(PARTICIPANT_NAME1); participantInfo.setSimpleField("Key1", "value1"); @@ -127,12 +128,10 @@ public void testElectionPoolMembership() throws Exception { Assert.assertNull(clt2.getParticipantInfo(leaderPath, PARTICIPANT_NAME2)); clt1.close(); clt2.close(); - System.out.println("END TestLeaderElection.testElectionPoolMembership"); } @Test(dependsOnMethods = "testElectionPoolMembership") public void testLeadershipListener() throws Exception { - System.out.println("START TestLeaderElection.testLeadershipListener"); String leaderPath = LEADER_PATH + "/testLeadershipListener"; // create 2 clients representing 2 participants LeaderElectionClient clt1 = createLeaderElectionClient(PARTICIPANT_NAME1); @@ -185,12 +184,10 @@ public void onLeadershipChange(String leaderPath, ChangeType type, String curLea clt1.close(); clt2.close(); clt3.close(); - System.out.println("END TestLeaderElection.testLeadershipListener"); } @Test(dependsOnMethods = "testLeadershipListener") public void testRelinquishLeadership() throws Exception { - System.out.println("START TestLeaderElection.testRelinquishLeadership"); String leaderPath = LEADER_PATH + "/testRelinquishLeadership"; LeaderElectionClient clt1 = createLeaderElectionClient(PARTICIPANT_NAME1); LeaderElectionClient clt2 = createLeaderElectionClient(PARTICIPANT_NAME2); @@ -240,12 +237,10 @@ public void onLeadershipChange(String leaderPath, ChangeType type, String curLea clt1.close(); clt2.close(); clt3.close(); - System.out.println("END TestLeaderElection.testRelinquishLeadership"); } @Test(dependsOnMethods = "testAcquireLeadership") public void testSessionExpire() throws Exception { - System.out.println("START TestLeaderElection.testSessionExpire"); String leaderPath = LEADER_PATH + "/_testSessionExpire"; LeaderInfo participantInfo = new LeaderInfo(PARTICIPANT_NAME1); participantInfo.setSimpleField("Key1", "value1"); @@ -282,12 +277,10 @@ public void testSessionExpire() throws Exception { Assert.assertEquals(clt2.getParticipantInfo(leaderPath, PARTICIPANT_NAME2).getSimpleField("Key2"), "value2"); clt1.close(); clt2.close(); - System.out.println("END TestLeaderElection.testSessionExpire"); } @Test(dependsOnMethods = "testSessionExpire") public void testClientDisconnectAndReconnectBeforeExpire() throws Exception { - System.out.println("START TestLeaderElection.testClientDisconnectAndReconnectBeforeExpire"); String leaderPath = LEADER_PATH + "/testClientDisconnectAndReconnectBeforeExpire"; LeaderElectionClient clt1 = createLeaderElectionClient(PARTICIPANT_NAME1); LeaderElectionClient clt2 = createLeaderElectionClient(PARTICIPANT_NAME2); @@ -303,11 +296,11 @@ public void onLeadershipChange(String leaderPath, ChangeType type, String curLea if (type == ChangeType.LEADER_LOST) { countDownLatchLeaderGone.countDown(); Assert.assertEquals(curLeader.length(), 0); - System.out.println("gone leader"); + LOG.info("gone leader"); } else if (type == ChangeType.LEADER_ACQUIRED) { countDownLatchNewLeader.countDown(); Assert.assertTrue(curLeader.length() != 0); - System.out.println("new leader"); + LOG.info("new leader"); } else { Assert.fail(); } @@ -322,7 +315,7 @@ public void onLeadershipChange(String leaderPath, ChangeType type, String curLea return (clt1.getLeader(leaderPath) != null); }, MetaClientTestUtil.WAIT_DURATION)); int leaderNodeVersion = ((ZkMetaClient) clt1.getMetaClient()).exists(leaderPath + "/LEADER").getVersion(); - System.out.println("version " + leaderNodeVersion); + LOG.info("version " + leaderNodeVersion); // clt1 disconnected and reconnected before session expire simulateZkStateReconnected((ZkMetaClient) clt1.getMetaClient()); @@ -331,13 +324,12 @@ public void onLeadershipChange(String leaderPath, ChangeType type, String curLea Assert.assertTrue(countDownLatchLeaderGone.await(MetaClientTestUtil.WAIT_DURATION, TimeUnit.MILLISECONDS)); leaderNodeVersion = ((ZkMetaClient) clt2.getMetaClient()).exists(leaderPath + "/LEADER").getVersion(); - System.out.println("version " + leaderNodeVersion); + LOG.info("version " + leaderNodeVersion); clt1.exitLeaderElectionParticipantPool(leaderPath); clt2.exitLeaderElectionParticipantPool(leaderPath); clt1.close(); clt2.close(); - System.out.println("END TestLeaderElection.testClientDisconnectAndReconnectBeforeExpire"); } private void joinPoolTestHelper(String leaderPath, LeaderElectionClient clt1, LeaderElectionClient clt2) diff --git a/meta-client/src/test/java/org/apache/helix/metaclient/recipes/leaderelection/TestMultiClientLeaderElection.java b/meta-client/src/test/java/org/apache/helix/metaclient/recipes/leaderelection/TestMultiClientLeaderElection.java index 4fb508790f..0571d5ca72 100644 --- a/meta-client/src/test/java/org/apache/helix/metaclient/recipes/leaderelection/TestMultiClientLeaderElection.java +++ b/meta-client/src/test/java/org/apache/helix/metaclient/recipes/leaderelection/TestMultiClientLeaderElection.java @@ -44,7 +44,6 @@ public class TestMultiClientLeaderElection extends ZkMetaClientTestBase { @BeforeTest private void setUp() { - System.out.println("STARTING TestMultiClientLeaderElection"); this._zkMetaClient = createZkMetaClient(); this._zkMetaClient.connect(); _zkMetaClient.create("/Parent", ""); @@ -64,7 +63,6 @@ public void cleanUp() { @Test public void testLeaderElectionPuppy() { - System.out.println("Starting TestMultiClientLeaderElection.testLeaderElectionPuppy"); PuppySpec puppySpec = new org.apache.helix.metaclient.puppy.PuppySpec(PuppyMode.REPEAT, 0.2f, new ExecDelay(5000, 0.1f), 5); LeaderElectionPuppy leaderElectionPuppy1 = @@ -79,7 +77,5 @@ public void testLeaderElectionPuppy() { puppyManager.addPuppy(leaderElectionPuppy2); puppyManager.start(60); - System.out.println("Ending TestMultiClientLeaderElection.testLeaderElectionPuppy"); - } } diff --git a/recipes/distributed-lock-manager/src/main/java/org/apache/helix/lockmanager/Lock.java b/recipes/distributed-lock-manager/src/main/java/org/apache/helix/lockmanager/Lock.java index f80371c928..8f91d913dd 100644 --- a/recipes/distributed-lock-manager/src/main/java/org/apache/helix/lockmanager/Lock.java +++ b/recipes/distributed-lock-manager/src/main/java/org/apache/helix/lockmanager/Lock.java @@ -24,11 +24,16 @@ import org.apache.helix.participant.statemachine.StateModel; import org.apache.helix.participant.statemachine.StateModelInfo; import org.apache.helix.participant.statemachine.Transition; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @StateModelInfo(initialState = "OFFLINE", states = { "OFFLINE", "ONLINE" }) public class Lock extends StateModel { + + private static final Logger LOG = LoggerFactory.getLogger(Lock.class); + private String lockName; public Lock(String lockName) { @@ -37,12 +42,12 @@ public Lock(String lockName) { @Transition(from = "OFFLINE", to = "ONLINE") public void lock(Message m, NotificationContext context) { - System.out.println(context.getManager().getInstanceName() + " acquired lock:" + lockName); + LOG.info(context.getManager().getInstanceName() + " acquired lock:" + lockName); } @Transition(from = "ONLINE", to = "OFFLINE") public void release(Message m, NotificationContext context) { - System.out.println(context.getManager().getInstanceName() + " releasing lock:" + lockName); + LOG.info(context.getManager().getInstanceName() + " releasing lock:" + lockName); } } diff --git a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/datamodel/serializer/ZNRecordStreamingSerializer.java b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/datamodel/serializer/ZNRecordStreamingSerializer.java index 41033e559f..41163a3c42 100644 --- a/zookeeper-api/src/main/java/org/apache/helix/zookeeper/datamodel/serializer/ZNRecordStreamingSerializer.java +++ b/zookeeper-api/src/main/java/org/apache/helix/zookeeper/datamodel/serializer/ZNRecordStreamingSerializer.java @@ -51,7 +51,7 @@ private static int getListFieldBound(ZNRecord record) { try { max = Integer.parseInt(maxStr); } catch (Exception e) { - LOG.error("IllegalNumberFormat for list field bound: " + maxStr); + LOG.error("IllegalNumberFormat for list field bound: " + maxStr, e); } } return max; @@ -284,35 +284,34 @@ public static void main(String[] args) { ZNRecordStreamingSerializer serializer = new ZNRecordStreamingSerializer(); byte[] bytes = serializer.serialize(record); - System.out.println(new String(bytes)); + LOG.info(new String(bytes)); ZNRecord record2 = (ZNRecord) serializer.deserialize(bytes); - System.out.println(record2); + LOG.info(record2.toString()); long start = System.currentTimeMillis(); for (int i = 0; i < 100; i++) { bytes = serializer.serialize(record); - // System.out.println(new String(bytes)); + // LOG.info(new String(bytes)); record2 = (ZNRecord) serializer.deserialize(bytes); - // System.out.println(record2); + // LOG.info(record2); } long end = System.currentTimeMillis(); - System.out.println("ZNRecordStreamingSerializer time used: " + (end - start)); + LOG.info("ZNRecordStreamingSerializer time used: " + (end - start)); ZNRecordSerializer serializer2 = new ZNRecordSerializer(); bytes = serializer2.serialize(record); - // System.out.println(new String(bytes)); + // LOG.info(new String(bytes)); record2 = (ZNRecord) serializer2.deserialize(bytes); - // System.out.println(record2); + // LOG.info(record2); start = System.currentTimeMillis(); for (int i = 0; i < 100; i++) { bytes = serializer2.serialize(record); - // System.out.println(new String(bytes)); + // LOG.info(new String(bytes)); record2 = (ZNRecord) serializer2.deserialize(bytes); - // System.out.println(record2); + // LOG.info(record2); } end = System.currentTimeMillis(); - System.out.println("ZNRecordSerializer time used: " + (end - start)); - + LOG.info("ZNRecordSerializer time used: " + (end - start)); } } diff --git a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/TestHelper.java b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/TestHelper.java index bbdad74668..6a547a563c 100644 --- a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/TestHelper.java +++ b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/TestHelper.java @@ -50,7 +50,7 @@ public static int getRandomPort() static public void stopZkServer(ZkServer zkServer) { if (zkServer != null) { zkServer.shutdown(); - System.out.println( + LOG.info( "Shut down zookeeper at port " + zkServer.getPort() + " in thread " + Thread .currentThread().getName()); } diff --git a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/TestZooKeeperConnection.java b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/TestZooKeeperConnection.java index 0ea8524dbb..a3157c6d76 100644 --- a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/TestZooKeeperConnection.java +++ b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/TestZooKeeperConnection.java @@ -11,11 +11,15 @@ import org.apache.zookeeper.WatchedEvent; import org.apache.zookeeper.Watcher; import org.apache.zookeeper.ZooDefs; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.Test; public class TestZooKeeperConnection extends ZkTestBase { + + private static final Logger LOG = LoggerFactory.getLogger(TestZooKeeperConnection.class); final int count = 100; final AtomicInteger[] get_count = {new AtomicInteger(0)}; CountDownLatch countDownLatch = new CountDownLatch(count*2); @@ -53,7 +57,7 @@ void testPersistWatcher() throws Exception { _zk.writeData(path, ("datat"+i).getBytes(), -1); _zk.create(path+"/c2_" +i, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } - System.out.println("testPersistWatcher: rafter register one time listener, original listener received event count: " + get_count[0]); + LOG.info("testPersistWatcher: rafter register one time listener, original listener received event count: " + get_count[0]); // total number of event is 400. We will miss event now Assert.assertTrue(TestHelper.verify(() -> { return (get_count[0].get() >= 202 & get_count[0].get() < 400); @@ -88,7 +92,7 @@ void testRecursivePersistWatcherWithOneTimeWatcher() throws Exception { _zk.writeData(path, ("datat"+i).getBytes(), -1); _zk.create(path+"/c2_" +i, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } - System.out.println("testRecursivePersistWatcherWithOneTimeWatcher: after register one time listener, original listener received event count: " + get_count[0]); + LOG.info("testRecursivePersistWatcherWithOneTimeWatcher: after register one time listener, original listener received event count: " + get_count[0]); // total number of event is 500. We will miss event now Assert.assertTrue(TestHelper.verify(() -> { return (get_count[0].get() >= 302 && get_count[0].get() < 500); diff --git a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/ZkTestBase.java b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/ZkTestBase.java index ef4e02ff3d..d7c7431120 100644 --- a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/ZkTestBase.java +++ b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/ZkTestBase.java @@ -141,7 +141,7 @@ protected synchronized static ZkServer startZkServer(final String zkAddress) { int port = Integer.parseInt(zkAddress.substring(zkAddress.lastIndexOf(':') + 1)); ZkServer zkServer = new ZkServer(dataDir, logDir, defaultNameSpace, port); - System.out.println("Starting ZK server at " + zkAddress); + LOG.info("Starting ZK server at " + zkAddress); zkServer.start(); return zkServer; } diff --git a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/ZkTestHelper.java b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/ZkTestHelper.java index 32e2b8acce..38b815e96e 100644 --- a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/ZkTestHelper.java +++ b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/ZkTestHelper.java @@ -426,7 +426,6 @@ public static boolean tryWaitZkEventsCleaned(RealmAwareZkClient zkclient) return true; } Thread.sleep(100); - System.out.println("pending zk-events in queue: " + queue); } return false; } diff --git a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestDedicatedZkClient.java b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestDedicatedZkClient.java index 82ffc1f5d4..39965fef3c 100644 --- a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestDedicatedZkClient.java +++ b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestDedicatedZkClient.java @@ -40,6 +40,8 @@ import org.apache.helix.zookeeper.impl.factory.DedicatedZkClientFactory; import org.apache.helix.zookeeper.routing.RoutingDataManager; import org.apache.zookeeper.CreateMode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeClass; @@ -48,9 +50,11 @@ public class TestDedicatedZkClient extends RealmAwareZkClientFactoryTestBase { + private static final Logger LOG = LoggerFactory.getLogger(TestDedicatedZkClient.class); + @BeforeClass public void beforeClass() throws IOException, InvalidRoutingDataException { - System.out.println("Starting " + TestDedicatedZkClient.class.getSimpleName()); + LOG.info("Starting " + TestDedicatedZkClient.class.getSimpleName()); super.beforeClass(); // Set the factory to DedicatedZkClientFactory _realmAwareZkClientFactory = DedicatedZkClientFactory.getInstance(); @@ -60,7 +64,7 @@ public void beforeClass() throws IOException, InvalidRoutingDataException { public void afterClass() { super.afterClass(); // Close it as it is created in before class. - System.out.println("Ending " + TestDedicatedZkClient.class.getSimpleName()); + LOG.info("Ending " + TestDedicatedZkClient.class.getSimpleName()); } /** diff --git a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestFederatedZkClient.java b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestFederatedZkClient.java index 30335efb13..185495ff51 100644 --- a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestFederatedZkClient.java +++ b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/impl/client/TestFederatedZkClient.java @@ -59,8 +59,6 @@ public class TestFederatedZkClient extends RealmAwareZkClientTestBase { @BeforeClass public void beforeClass() throws IOException, InvalidRoutingDataException { - System.out.println("Starting " + TestFederatedZkClient.class.getSimpleName()); - // Feed the raw routing data into TrieRoutingData to construct an in-memory representation // of routing information. _realmAwareZkClient = @@ -72,7 +70,6 @@ public void beforeClass() throws IOException, InvalidRoutingDataException { public void afterClass() { // Close it as it is created in before class. _realmAwareZkClient.close(); - System.out.println("Ending " + TestFederatedZkClient.class.getSimpleName()); } /* diff --git a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/zkclient/util/TestZkPathRecursiveWatcherTrie.java b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/zkclient/util/TestZkPathRecursiveWatcherTrie.java index ca0198c750..35a8015bfc 100644 --- a/zookeeper-api/src/test/java/org/apache/helix/zookeeper/zkclient/util/TestZkPathRecursiveWatcherTrie.java +++ b/zookeeper-api/src/test/java/org/apache/helix/zookeeper/zkclient/util/TestZkPathRecursiveWatcherTrie.java @@ -50,7 +50,6 @@ public class TestZkPathRecursiveWatcherTrie { */ @org.testng.annotations.Test public void testAddRemoveGetWatcher() { - System.out.println("START testAddRemoveWatcher at " + new Date(System.currentTimeMillis())); _recursiveWatcherTrie.addRecursiveListener("/a/b/c/d", new Test()); _recursiveWatcherTrie.addRecursiveListener("/a/b/c/d1", new Test()); _recursiveWatcherTrie.addRecursiveListener("/a/b/c/d2", new Test());