This is an automated email from the ASF dual-hosted git repository. echobravo pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git
The following commit(s) were added to refs/heads/develop by this push: new 540bd0e GEODE-7541: Clean up of auto-generated catch blocks. (#4520) 540bd0e is described below commit 540bd0ed43d22e2ec3333ca09b85283cbe5bc737 Author: Ernie Burghardt <eburgha...@pivotal.io> AuthorDate: Mon Dec 23 17:00:54 2019 -0800 GEODE-7541: Clean up of auto-generated catch blocks. (#4520) * Removed some un-thrown exception clauses. * spotless --- .../gms/fd/GMSHealthMonitorJUnitTest.java | 78 +++++++++------------- 1 file changed, 33 insertions(+), 45 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java index c643152..2e63f5b 100644 --- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/membership/gms/fd/GMSHealthMonitorJUnitTest.java @@ -122,7 +122,7 @@ public class GMSHealthMonitorJUnitTest { private final int myAddressIndex = 3; @Before - public void initMocks() throws UnknownHostException, MemberStartupException { + public void initMocks() throws MemberStartupException { // ensure that Geode's serialization and version are initialized Version currentVersion = Version.CURRENT; InternalDataSerializer.getDSFIDSerializer(); @@ -191,17 +191,13 @@ public class GMSHealthMonitorJUnitTest { } @Test - public void testHMServiceStarted() throws IOException { + public void testHMServiceStarted() throws Exception { MemberIdentifier mbr = new InternalDistributedMember("localhost", 12345); mbr.setVmViewId(1); when(messenger.getMemberID()).thenReturn(mbr); - try { - gmsHealthMonitor.started(); - } catch (MemberStartupException e) { - e.printStackTrace(); - } + gmsHealthMonitor.started(); GMSMembershipView v = new GMSMembershipView(mbr, 1, mockMembers); @@ -212,16 +208,13 @@ public class GMSHealthMonitorJUnitTest { } @Test - public void testHMServiceHandlesShutdownRace() throws IOException { + public void testHMServiceHandlesShutdownRace() throws IOException, Exception { // The health monitor starts a thread to monitor the tcp socket, both that thread and the // stopServices call will attempt to shut down the socket during a normal close. This test tries // to create a problematic ordering to make sure we still shutdown properly. ((GMSHealthMonitorTest) gmsHealthMonitor).useBlockingSocket = true; - try { - gmsHealthMonitor.started(); - } catch (MemberStartupException e) { - e.printStackTrace(); - } + gmsHealthMonitor.started(); + gmsHealthMonitor.stop(); } @@ -229,7 +222,7 @@ public class GMSHealthMonitorJUnitTest { * checks who is next neighbor */ @Test - public void testHMNextNeighborVerify() throws IOException { + public void testHMNextNeighborVerify() throws Exception { installAView(); assertEquals(mockMembers.get(myAddressIndex + 1), gmsHealthMonitor.getNextNeighbor()); } @@ -260,7 +253,7 @@ public class GMSHealthMonitorJUnitTest { */ @Test - public void testHMNextNeighborBeforeTimeout() throws IOException { + public void testHMNextNeighborBeforeTimeout() throws Exception { long startTime = System.currentTimeMillis(); installAView(); final MemberIdentifier neighbor = gmsHealthMonitor.getNextNeighbor(); @@ -293,16 +286,13 @@ public class GMSHealthMonitorJUnitTest { System.out.println("testSuspectMembersCalledThroughMemberCheckThread ending"); } - private GMSMembershipView installAView() { + private GMSMembershipView installAView() throws Exception { GMSMembershipView v = new GMSMembershipView(mockMembers.get(0), 2, mockMembers); // 3rd is current member when(messenger.getMemberID()).thenReturn(mockMembers.get(myAddressIndex)); - try { - gmsHealthMonitor.started(); - } catch (MemberStartupException e) { - e.printStackTrace(); - } + gmsHealthMonitor.started(); + gmsHealthMonitor.installView(v); @@ -322,7 +312,7 @@ public class GMSHealthMonitorJUnitTest { * checks ping thread didn't sends suspectMembers message before timeout */ @Test - public void testSuspectMembersNotCalledThroughPingThreadBeforeTimeout() { + public void testSuspectMembersNotCalledThroughPingThreadBeforeTimeout() throws Exception { long startTime = System.currentTimeMillis(); installAView(); MemberIdentifier neighbor = gmsHealthMonitor.getNextNeighbor(); @@ -354,7 +344,7 @@ public class GMSHealthMonitorJUnitTest { * Checks suspect thread doesn't sends suspectMembers message before timeout */ @Test - public void testSuspectMembersNotCalledThroughSuspectThreadBeforeTimeout() { + public void testSuspectMembersNotCalledThroughSuspectThreadBeforeTimeout() throws Exception { installAView(); gmsHealthMonitor.suspect(mockMembers.get(1), "Not responding"); @@ -399,18 +389,14 @@ public class GMSHealthMonitorJUnitTest { * Shouldn't send remove member message before doing final check, or before ping Timeout */ @Test - public void testRemoveMemberNotCalledBeforeTimeout() { + public void testRemoveMemberNotCalledBeforeTimeout() throws Exception { System.out.println("testRemoveMemberNotCalledBeforeTimeout starting"); GMSMembershipView v = new GMSMembershipView(mockMembers.get(0), 2, mockMembers); // 3rd is current member when(messenger.getMemberID()).thenReturn(mockMembers.get(0)); // coordinator and local member when(joinLeave.getMemberID()).thenReturn(mockMembers.get(0)); // coordinator and local member - try { - gmsHealthMonitor.started(); - } catch (MemberStartupException e) { - e.printStackTrace(); - } + gmsHealthMonitor.started(); gmsHealthMonitor.installView(v); @@ -470,7 +456,7 @@ public class GMSHealthMonitorJUnitTest { } @Test - public void testCheckIfAvailableWithSimulatedHeartBeat() { + public void testCheckIfAvailableWithSimulatedHeartBeat() throws Exception { GMSMembershipView v = installAView(); MemberIdentifier memberToCheck = mockMembers.get(1); @@ -489,7 +475,7 @@ public class GMSHealthMonitorJUnitTest { } @Test - public void testCheckIfAvailableWithSimulatedHeartBeatWithTcpCheck() { + public void testCheckIfAvailableWithSimulatedHeartBeatWithTcpCheck() throws Exception { System.out.println("testCheckIfAvailableWithSimulatedHeartBeatWithTcpCheck"); useGMSHealthMonitorTestClass = true; @@ -508,7 +494,7 @@ public class GMSHealthMonitorJUnitTest { } @Test - public void testMemberIsExaminedAgainAfterPassingAvailabilityCheck() { + public void testMemberIsExaminedAgainAfterPassingAvailabilityCheck() throws Exception { // use the test health monitor's availability check for the first round of suspect processing // but then turn it off so that a subsequent round is performed and fails to get a heartbeat useGMSHealthMonitorTestClass = true; @@ -534,7 +520,7 @@ public class GMSHealthMonitorJUnitTest { } @Test - public void testNeighborRemainsSameAfterSuccessfulFinalCheck() { + public void testNeighborRemainsSameAfterSuccessfulFinalCheck() throws Exception { useGMSHealthMonitorTestClass = true; try { @@ -560,7 +546,7 @@ public class GMSHealthMonitorJUnitTest { @Test - public void testNeighborChangesAfterFailedFinalCheck() { + public void testNeighborChangesAfterFailedFinalCheck() throws Exception { useGMSHealthMonitorTestClass = true; simulateHeartbeatInGMSHealthMonitorTestClass = false; @@ -588,7 +574,7 @@ public class GMSHealthMonitorJUnitTest { @Test - public void testExonerationMessageIsSentAfterSuccessfulFinalCheck() { + public void testExonerationMessageIsSentAfterSuccessfulFinalCheck() throws Exception { useGMSHealthMonitorTestClass = true; try { @@ -613,7 +599,7 @@ public class GMSHealthMonitorJUnitTest { } @Test - public void testExonerationMessageIsNotSentToVersion_1_3() { + public void testExonerationMessageIsNotSentToVersion_1_3() throws Exception { // versions older than 1.4 don't know about the FinalCheckPassedMessage class useGMSHealthMonitorTestClass = true; @@ -656,7 +642,7 @@ public class GMSHealthMonitorJUnitTest { @Test - public void testInitiatorRewatchesSuspectAfterSuccessfulFinalCheck() { + public void testInitiatorRewatchesSuspectAfterSuccessfulFinalCheck() throws Exception { GMSMembershipView v = installAView(); setFailureDetectionPorts(v); @@ -670,7 +656,7 @@ public class GMSHealthMonitorJUnitTest { @Test - public void testFinalCheckFailureLeavesMemberAsSuspect() { + public void testFinalCheckFailureLeavesMemberAsSuspect() throws Exception { useGMSHealthMonitorTestClass = true; simulateHeartbeatInGMSHealthMonitorTestClass = false; @@ -686,7 +672,7 @@ public class GMSHealthMonitorJUnitTest { } @Test - public void testFailedSelfCheckRemovesMemberAsSuspect() { + public void testFailedSelfCheckRemovesMemberAsSuspect() throws Exception { useGMSHealthMonitorTestClass = true; simulateHeartbeatInGMSHealthMonitorTestClass = false; allowSelfCheckToSucceed = false; @@ -710,7 +696,7 @@ public class GMSHealthMonitorJUnitTest { * a failed availablility check should initiate suspect processing */ @Test - public void testFailedCheckIfAvailableDoesNotRemoveMember() { + public void testFailedCheckIfAvailableDoesNotRemoveMember() throws Exception { useGMSHealthMonitorTestClass = true; simulateHeartbeatInGMSHealthMonitorTestClass = false; @@ -730,7 +716,7 @@ public class GMSHealthMonitorJUnitTest { * Same test as above but with request to initiate removal */ @Test - public void testFailedCheckIfAvailableRemovesMember() { + public void testFailedCheckIfAvailableRemovesMember() throws Exception { useGMSHealthMonitorTestClass = true; simulateHeartbeatInGMSHealthMonitorTestClass = false; @@ -750,7 +736,8 @@ public class GMSHealthMonitorJUnitTest { */ @Test - public void testFailedCheckIfAvailableWithoutFailureDetectionPortDoesNotRemoveMember() { + public void testFailedCheckIfAvailableWithoutFailureDetectionPortDoesNotRemoveMember() + throws Exception { useGMSHealthMonitorTestClass = true; simulateHeartbeatInGMSHealthMonitorTestClass = false; @@ -769,7 +756,8 @@ public class GMSHealthMonitorJUnitTest { } @Test - public void testFailedCheckIfAvailableWithoutFailureDetectionPortRemovesMember() { + public void testFailedCheckIfAvailableWithoutFailureDetectionPortRemovesMember() + throws Exception { useGMSHealthMonitorTestClass = true; simulateHeartbeatInGMSHealthMonitorTestClass = false; @@ -788,7 +776,7 @@ public class GMSHealthMonitorJUnitTest { } @Test - public void testShutdown() { + public void testShutdown() throws Exception { installAView(); @@ -900,7 +888,7 @@ public class GMSHealthMonitorJUnitTest { } @Test - public void testBeSickAndPlayDead() throws Exception { + public void testBeSickAndPlayDead() { GMSMembershipView v = new GMSMembershipView(mockMembers.get(0), 2, mockMembers); gmsHealthMonitor.installView(v); gmsHealthMonitor.beSick();