Fixes behavioural problems introduced by property management refactoring. Should repair the tests

This commit is contained in:
emcho 2010-04-25 16:26:01 +00:00
parent f85fa67bfe
commit cb82b71f0d

View File

@ -140,9 +140,9 @@ public class TransactionSupportTests extends TestCase
public void testClientRetransmissions() throws Exception public void testClientRetransmissions() throws Exception
{ {
String oldRetransValue = System.getProperty( String oldRetransValue = System.getProperty(
StackProperties.MAX_CTRAN_RETRANSMISSIONS); StackProperties.MAX_CTRAN_RETRANSMISSIONS);
String oldMaxWaitValue = System.getProperty( String oldMaxWaitValue = System.getProperty(
StackProperties.MAX_CTRAN_RETRANS_TIMER); StackProperties.MAX_CTRAN_RETRANS_TIMER);
System.setProperty(StackProperties.MAX_CTRAN_RETRANS_TIMER, "100"); System.setProperty(StackProperties.MAX_CTRAN_RETRANS_TIMER, "100");
System.setProperty(StackProperties.MAX_CTRAN_RETRANSMISSIONS, "2"); System.setProperty(StackProperties.MAX_CTRAN_RETRANSMISSIONS, "2");
@ -156,6 +156,7 @@ public class TransactionSupportTests extends TestCase
//send //send
StunStack.getInstance().sendRequest(bindingRequest, StunStack.getInstance().sendRequest(bindingRequest,
serverAddress, clientAddress, responseCollector); serverAddress, clientAddress, responseCollector);
//wait for retransmissions //wait for retransmissions
Thread.sleep(1000); Thread.sleep(1000);
@ -163,10 +164,12 @@ public class TransactionSupportTests extends TestCase
Vector<StunMessageEvent> reqs Vector<StunMessageEvent> reqs
= requestCollector.getRequestsForTransaction( = requestCollector.getRequestsForTransaction(
bindingRequest.getTransactionID()); bindingRequest.getTransactionID());
assertTrue("No retransmissions of the request have been received", assertTrue("No retransmissions of the request have been received",
reqs.size() > 1); reqs.size() > 1);
assertTrue("The binding request has not been retransmitted enough!", assertTrue("The binding request has been retransmitted more than it "
reqs.size() >= 3); +"should have!",
reqs.size() >= 3);
//restore the retransmissions prop in case others are counting on //restore the retransmissions prop in case others are counting on
//defaults. //defaults.
@ -467,6 +470,7 @@ public class TransactionSupportTests extends TestCase
*/ */
public void requestReceived(StunMessageEvent evt) public void requestReceived(StunMessageEvent evt)
{ {
synchronized(this) synchronized(this)
{ {
receivedRequestsVector.add(evt); receivedRequestsVector.add(evt);