[Asterisk-java-cvs] CVS: asterisk-java/src/test/net/sf/asterisk/manager DefaultManagerConnectionTest
Brought to you by:
srt
From: Stefan R. <sr...@us...> - 2005-03-05 02:58:37
|
Update of /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/manager In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14379/src/test/net/sf/asterisk/manager Modified Files: DefaultManagerConnectionTest.java Log Message: Fixed timing when checking for ManagerReader.run() being called Index: DefaultManagerConnectionTest.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/manager/DefaultManagerConnectionTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -p -r1.5 -r1.6 --- DefaultManagerConnectionTest.java 5 Mar 2005 01:39:51 -0000 1.5 +++ DefaultManagerConnectionTest.java 5 Mar 2005 02:58:24 -0000 1.6 @@ -127,7 +127,10 @@ public class DefaultManagerConnectionTes assertEquals("unexpected other actions sent", 0, mockWriter.otherActionsSent); assertEquals("setSocket() not called 1 time", 1, mockReader.setSocketCalls); - // assertEquals("run() not called 1 time", 1, mockReader.runCalls); + // Some time for the reader thread to be started. Otherwise run() might not yet have been + // called. + Thread.sleep(10); + assertEquals("run() not called 1 time", 1, mockReader.runCalls); assertEquals("unexpected call to die()", 0, mockReader.dieCalls); assertTrue("keepAlive not set", dmc.getKeepAlive()); @@ -168,8 +171,10 @@ public class DefaultManagerConnectionTes assertEquals("unexpected other actions sent", 0, mockWriter.otherActionsSent); assertEquals("setSocket() not called 1 time", 1, mockReader.setSocketCalls); - // TODO why is run() not called? - // assertEquals("run() not called 1 time", 1, mockReader.runCalls); + // Some time for the reader thread to be started. Otherwise run() might not yet have been + // called. + Thread.sleep(10); + assertEquals("run() not called 1 time", 1, mockReader.runCalls); assertEquals("unexpected call to die()", 0, mockReader.dieCalls); socketMC.verify(); @@ -231,6 +236,9 @@ public class DefaultManagerConnectionTes assertEquals("unexpected other actions sent", 0, mockWriter.otherActionsSent); assertEquals("setSocket() not called 1 time", 1, mockReader.setSocketCalls); + // Some time for the reader thread to be started. Otherwise run() might not yet have been + // called. + Thread.sleep(10); assertEquals("run() not called 1 time", 1, mockReader.runCalls); assertEquals("unexpected call to die()", 0, mockReader.dieCalls); @@ -263,6 +271,9 @@ public class DefaultManagerConnectionTes assertEquals("unexpected other actions sent", 0, mockWriter.otherActionsSent); assertEquals("setSocket() not called 1 time", 1, mockReader.setSocketCalls); + // Some time for the reader thread to be started. Otherwise run() might not yet have been + // called. + Thread.sleep(10); assertEquals("run() not called 1 time", 1, mockReader.runCalls); assertEquals("unexpected call to die()", 0, mockReader.dieCalls); |