From: <tho...@us...> - 2013-11-11 18:33:00
|
Revision: 7529 http://bigdata.svn.sourceforge.net/bigdata/?rev=7529&view=rev Author: thompsonbry Date: 2013-11-11 18:32:53 +0000 (Mon, 11 Nov 2013) Log Message: ----------- Modified destroyAll() to provide more information if leader is none of A, B, or C. Removed explicit destroyAll() call from testABCMultiLoadFollowerReadsLargeLoad(). Not required. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/AbstractHA3JournalServerTestCase.java branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JournalServer.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/AbstractHA3JournalServerTestCase.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/AbstractHA3JournalServerTestCase.java 2013-11-11 17:31:44 UTC (rev 7528) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/AbstractHA3JournalServerTestCase.java 2013-11-11 18:32:53 UTC (rev 7529) @@ -468,8 +468,11 @@ } else if (leader.equals(serverC)) { leaderServiceDir = getServiceDirC(); leaderListener = serviceListenerC; - } else { - throw new IllegalStateException(); + } else {// log warning and fall through. + throw new IllegalStateException( + "Leader is none of A, B, or C: leader=" + leader + + ", A=" + serverA + ", B=" + serverB + ", C=" + + serverC); } } else { leader = null; @@ -531,6 +534,7 @@ final UUID[] services = getServices(members); assertCondition(new Runnable() { + @Override public void run() { try { assertEquals(services, quorum.getPipeline()); @@ -570,6 +574,7 @@ final UUID[] services = getServices(members); assertCondition(new Runnable() { + @Override public void run() { try { assertEquals(services, quorum.getJoined()); @@ -594,6 +599,7 @@ final UUID[] services = getServices(members); assertCondition(new Runnable() { + @Override public void run() { try { assertEquals(services, quorum.getMembers()); @@ -855,15 +861,16 @@ } private void tidyServiceDirectory(final File serviceDir) { - if (serviceDir == null || !serviceDir.exists()) - return; - + if (serviceDir == null || !serviceDir.exists()) + return; + for (File file : serviceDir.listFiles()) { - final String name = file.getName(); - - if (name.endsWith(".jnl") || name.equals("snapshot") || name.equals("HALog")) { - recursiveDelete(file); - } + final String name = file.getName(); + + if (name.endsWith(".jnl") || name.equals("snapshot") + || name.equals("HALog")) { + recursiveDelete(file); + } } } @@ -928,48 +935,50 @@ } protected void destroyA() { - safeDestroy(serverA, getServiceDirA(), serviceListenerA); - serverA = null; - serviceListenerA = null; + safeDestroy(serverA, getServiceDirA(), serviceListenerA); + serverA = null; + serviceListenerA = null; } protected void destroyB() { - safeDestroy(serverB, getServiceDirB(), serviceListenerB); - serverB = null; - serviceListenerB = null; + safeDestroy(serverB, getServiceDirB(), serviceListenerB); + serverB = null; + serviceListenerB = null; } protected void destroyC() { - safeDestroy(serverC, getServiceDirC(), serviceListenerC); - serverC = null; - serviceListenerC = null; + safeDestroy(serverC, getServiceDirC(), serviceListenerC); + serverC = null; + serviceListenerC = null; } protected void shutdownA() throws IOException { - safeShutdown(serverA, getServiceDirA(), serviceListenerA, true); - - serverA = null; - serviceListenerA = null; + safeShutdown(serverA, getServiceDirA(), serviceListenerA, true); + + serverA = null; + serviceListenerA = null; } - + protected void shutdownB() throws IOException { - safeShutdown(serverB, getServiceDirB(), serviceListenerB, true); - - serverB = null; - serviceListenerB = null; + safeShutdown(serverB, getServiceDirB(), serviceListenerB, true); + + serverB = null; + serviceListenerB = null; } - + protected void shutdownC() throws IOException { - safeShutdown(serverC, getServiceDirC(), serviceListenerC, true); - - serverC = null; - serviceListenerC = null; + safeShutdown(serverC, getServiceDirC(), serviceListenerC, true); + + serverC = null; + serviceListenerC = null; } - + protected void kill(final HAGlue service) throws IOException { + final int pid = ((HAGlueTest) service).getPID(); - + trySignal(SignalEnum.KILL, pid); + } /** @@ -977,19 +986,20 @@ * necessarily something we should rely on */ protected void shutdown(final HAGlue service) throws IOException { - if (service == null) { - throw new IllegalArgumentException(); - } - - if (service.equals(serverA)) { - shutdownA(); - } else if (service.equals(serverB)) { - shutdownB(); - } else if (service.equals(serverC)) { - shutdownC(); - } else { - throw new IllegalArgumentException("Unable to match service: " + service + " possible problem with equals() on Proxy"); - } + if (service == null) { + throw new IllegalArgumentException(); + } + + if (service.equals(serverA)) { + shutdownA(); + } else if (service.equals(serverB)) { + shutdownB(); + } else if (service.equals(serverC)) { + shutdownC(); + } else { + throw new IllegalArgumentException("Unable to match service: " + + service + " possible problem with equals() on Proxy"); + } } protected void shutdownLeader() throws AsynchronousQuorumCloseException, @@ -1028,6 +1038,7 @@ } + @Override public Void call() { safeShutdown(haGlue, serviceDir, serviceListener, now); @@ -1133,6 +1144,7 @@ final File serviceDir, final ServiceListener serviceListener) { assertCondition(new Runnable() { + @Override public void run() { try { haGlue.getRunState(); @@ -1145,6 +1157,7 @@ }); assertCondition(new Runnable() { + @Override public void run() { // try to discover the service item. @@ -1164,6 +1177,7 @@ try { assertCondition(new Runnable() { + @Override public void run() { // Wait for the process death. assertTrue(serviceListener.isDead()); @@ -1517,6 +1531,7 @@ } + @Override public HAGlue call() throws Exception { if (restart) { @@ -1542,6 +1557,7 @@ } + @Override public HAGlue call() throws Exception { if (restart) { @@ -1567,6 +1583,7 @@ } + @Override public HAGlue call() throws Exception { if (restart) { @@ -1621,15 +1638,15 @@ } protected UUID getServiceAId() { - return serverAId; + return serverAId; } - + protected UUID getServiceBId() { - return serverBId; + return serverBId; } - + protected UUID getServiceCId() { - return serverCId; + return serverCId; } private HAGlue startServer(final String name, Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JournalServer.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JournalServer.java 2013-11-11 17:31:44 UTC (rev 7528) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata-jini/src/test/com/bigdata/journal/jini/ha/TestHA3JournalServer.java 2013-11-11 18:32:53 UTC (rev 7529) @@ -2360,19 +2360,25 @@ } /** - * Similar to multitransaction but rather than a number of updates following a load it is simply a number of loads - * followed by queries on the folowers that are checkd for consistency. + * Similar to multitransaction but rather than a number of updates following + * a load it is simply a number of loads followed by queries on the folowers + * that are checkd for consistency. */ public void testABCMultiLoadFollowerReads() throws Exception { - doABCMultiLoadFollowerReads2(50/*nTransactions*/, false/*largeLoad*/); + + doABCMultiLoadFollowerReads2(50/* nTransactions */, false/* largeLoad */); + } - + /** - * Similar to multitransaction but rather than a number of updates following a load it is simply a number of loads - * followed by queries on the folowers that are checkd for consistency. + * Similar to multitransaction but rather than a number of updates following + * a load it is simply a number of loads followed by queries on the folowers + * that are checkd for consistency. */ public void testABCMultiLoadFollowerReadsLargeLoad() throws Exception { - doABCMultiLoadFollowerReads2(20/*nTransactions*/, true/*largeLoad*/); + + doABCMultiLoadFollowerReads2(20/* nTransactions */, true/* largeLoad */); + } /** @@ -2386,7 +2392,7 @@ protected void doABCMultiLoadFollowerReads2(final int nTransactions, final boolean largeLoad) throws Exception { - try { +// try { // Start all services. final ABC services = new ABC(true/* sequential */); @@ -2515,11 +2521,11 @@ // Finally cehck for binary compatibility assertDigestsEquals(new HAGlue[] { services.serverA, services.serverB, services.serverC }); - } finally { - - destroyAll(); - - } +// } finally { +// +// destroyAll(); +// +// } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |