Renames CallParticipant to CallPeer so that it would better reflect our new Call architecture that also includes conferencing and ConferenceMembers

cusax-fix
Emil Ivov 16 years ago
parent 3f7d9ddd26
commit 15b312cf97

@ -115,55 +115,55 @@ public void testCreateCancelCall()
,CallEvent.CALL_RECEIVED, callReceivedEvent.getEventID()); ,CallEvent.CALL_RECEIVED, callReceivedEvent.getEventID());
assertNotNull("CallEvent.getSource()", callAtP2); assertNotNull("CallEvent.getSource()", callAtP2);
//verify that call participants are properly created //verify that call peers are properly created
assertEquals("callAtP1.getCallParticipantsCount()" assertEquals("callAtP1.getCallPeerCount()"
, 1, callAtP1.getCallPeerCount()); , 1, callAtP1.getCallPeerCount());
assertEquals("callAtP2.getCallParticipantsCount()" assertEquals("callAtP2.getCallPeerCount()"
, 1, callAtP2.getCallPeerCount()); , 1, callAtP2.getCallPeerCount());
CallPeer participantAtP1 CallPeer peerAtP1
= (CallPeer)callAtP1.getCallPeers().next(); = (CallPeer)callAtP1.getCallPeers().next();
CallPeer participantAtP2 CallPeer peerAtP2
= (CallPeer)callAtP2.getCallPeers().next(); = (CallPeer)callAtP2.getCallPeers().next();
//now add listeners to the participants and make sure they have entered //now add listeners to the peers and make sure they have entered
//the states they were expected to. //the states they were expected to.
//check states for call participants at both parties //check states for call peers at both parties
CallParticipantStateEventCollector stateCollectorForPp1 CallPeerStateEventCollector stateCollectorForPp1
= new CallParticipantStateEventCollector( = new CallPeerStateEventCollector(
participantAtP1, CallPeerState.ALERTING_REMOTE_SIDE); peerAtP1, CallPeerState.ALERTING_REMOTE_SIDE);
CallParticipantStateEventCollector stateCollectorForPp2 CallPeerStateEventCollector stateCollectorForPp2
= new CallParticipantStateEventCollector( = new CallPeerStateEventCollector(
participantAtP2, CallPeerState.INCOMING_CALL); peerAtP2, CallPeerState.INCOMING_CALL);
stateCollectorForPp1.waitForEvent(10000, true); stateCollectorForPp1.waitForEvent(10000, true);
stateCollectorForPp2.waitForEvent(10000, true); stateCollectorForPp2.waitForEvent(10000, true);
assertSame("participantAtP1.getCall" assertSame("peerAtP1.getCall"
, participantAtP1.getCall(), callAtP1); , peerAtP1.getCall(), callAtP1);
assertSame("participantAtP2.getCall" assertSame("peerAtP2.getCall"
, participantAtP2.getCall(), callAtP2); , peerAtP2.getCall(), callAtP2);
//make sure that the participants are in the proper state //make sure that the peers are in the proper state
assertEquals("The participant at provider one was not in the " assertEquals("The peer at provider one was not in the "
+"right state." +"right state."
, CallPeerState.ALERTING_REMOTE_SIDE , CallPeerState.ALERTING_REMOTE_SIDE
, participantAtP1.getState()); , peerAtP1.getState());
assertEquals("The participant at provider two was not in the " assertEquals("The peer at provider two was not in the "
+"right state." +"right state."
, CallPeerState.INCOMING_CALL , CallPeerState.INCOMING_CALL
, participantAtP2.getState()); , peerAtP2.getState());
//test whether caller/callee info is properly distributed in case //test whether caller/callee info is properly distributed in case
//the server is said to support it. //the server is said to support it.
if(Boolean.getBoolean("accounts.sip.PRESERVE_PARTICIPANT_INFO")) if(Boolean.getBoolean("accounts.sip.PRESERVE_PEER_INFO"))
{ {
//check properties on the remote call participant for the party that //check properties on the remote call peer for the party that
//initiated the call. //initiated the call.
String expectedParticipant1Address String expectedPeer1Address
= fixture.provider2.getAccountID().getAccountAddress(); = fixture.provider2.getAccountID().getAccountAddress();
String expectedParticipant1DisplayName String expectedPeer1DisplayName
= System.getProperty( = System.getProperty(
SipProtocolProviderServiceLick.ACCOUNT_2_PREFIX SipProtocolProviderServiceLick.ACCOUNT_2_PREFIX
+ ProtocolProviderFactory.DISPLAY_NAME); + ProtocolProviderFactory.DISPLAY_NAME);
@ -172,20 +172,20 @@ public void testCreateCancelCall()
//display name or something of the kind //display name or something of the kind
assertTrue("Provider 2 did not advertise their " assertTrue("Provider 2 did not advertise their "
+ "accountID.getAccoutAddress() address." + "accountID.getAccoutAddress() address."
, expectedParticipant1Address.indexOf( , expectedPeer1Address.indexOf(
participantAtP1.getAddress()) != -1 peerAtP1.getAddress()) != -1
|| participantAtP1.getAddress().indexOf( || peerAtP1.getAddress().indexOf(
expectedParticipant1Address) != -1); expectedPeer1Address) != -1);
assertEquals("Provider 2 did not properly advertise their " assertEquals("Provider 2 did not properly advertise their "
+ "display name." + "display name."
, expectedParticipant1DisplayName , expectedPeer1DisplayName
, participantAtP1.getDisplayName()); , peerAtP1.getDisplayName());
//check properties on the remote call participant for the party that //check properties on the remote call peer for the party that
//receives the call. //receives the call.
String expectedParticipant2Address String expectedPeer2Address
= fixture.provider1.getAccountID().getAccountAddress(); = fixture.provider1.getAccountID().getAccountAddress();
String expectedParticipant2DisplayName String expectedPeer2DisplayName
= System.getProperty( = System.getProperty(
SipProtocolProviderServiceLick.ACCOUNT_1_PREFIX SipProtocolProviderServiceLick.ACCOUNT_1_PREFIX
+ ProtocolProviderFactory.DISPLAY_NAME); + ProtocolProviderFactory.DISPLAY_NAME);
@ -194,23 +194,23 @@ public void testCreateCancelCall()
//display name or something of the kind //display name or something of the kind
assertTrue("Provider 1 did not advertise their " assertTrue("Provider 1 did not advertise their "
+ "accountID.getAccoutAddress() address." + "accountID.getAccoutAddress() address."
, expectedParticipant2Address.indexOf( , expectedPeer2Address.indexOf(
participantAtP2.getAddress()) != -1 peerAtP2.getAddress()) != -1
|| participantAtP2.getAddress().indexOf( || peerAtP2.getAddress().indexOf(
expectedParticipant2Address) != -1); expectedPeer2Address) != -1);
assertEquals("Provider 1 did not properly advertise their " assertEquals("Provider 1 did not properly advertise their "
+ "display name." + "display name."
, expectedParticipant2DisplayName , expectedPeer2DisplayName
, participantAtP2.getDisplayName()); , peerAtP2.getDisplayName());
} }
//we'll now try to cancel the call //we'll now try to cancel the call
//listeners monitoring state change of the participant //listeners monitoring state change of the peer
stateCollectorForPp1 = new CallParticipantStateEventCollector( stateCollectorForPp1 = new CallPeerStateEventCollector(
participantAtP1, CallPeerState.DISCONNECTED); peerAtP1, CallPeerState.DISCONNECTED);
stateCollectorForPp2 = new CallParticipantStateEventCollector( stateCollectorForPp2 = new CallPeerStateEventCollector(
participantAtP2, CallPeerState.DISCONNECTED); peerAtP2, CallPeerState.DISCONNECTED);
//listeners waiting for the op set to announce the end of the call //listeners waiting for the op set to announce the end of the call
call1Listener = new CallEventCollector(basicTelephonyP1); call1Listener = new CallEventCollector(basicTelephonyP1);
@ -223,7 +223,7 @@ public void testCreateCancelCall()
= new CallStateEventCollector(callAtP2, CallState.CALL_ENDED); = new CallStateEventCollector(callAtP2, CallState.CALL_ENDED);
//Now make the caller CANCEL the call. //Now make the caller CANCEL the call.
basicTelephonyP1.hangupCallPeer(participantAtP1); basicTelephonyP1.hangupCallPeer(peerAtP1);
//wait for everything to happen //wait for everything to happen
call1Listener.waitForEvent(10000); call1Listener.waitForEvent(10000);
@ -234,11 +234,11 @@ public void testCreateCancelCall()
call2StateCollector.waitForEvent(10000); call2StateCollector.waitForEvent(10000);
//make sure that the participant is disconnected //make sure that the peer is disconnected
assertEquals("The participant at provider one was not in the " assertEquals("The peer at provider one was not in the "
+"right state." +"right state."
, CallPeerState.DISCONNECTED , CallPeerState.DISCONNECTED
, participantAtP1.getState()); , peerAtP1.getState());
//make sure the telephony operation set distributed an event for the end //make sure the telephony operation set distributed an event for the end
//of the call //of the call
@ -257,11 +257,11 @@ public void testCreateCancelCall()
//same for provider 2 //same for provider 2
//make sure that the participant is disconnected //make sure that the peer is disconnected
assertEquals("The participant at provider one was not in the " assertEquals("The peer at provider one was not in the "
+"right state." +"right state."
, CallPeerState.DISCONNECTED , CallPeerState.DISCONNECTED
, participantAtP2.getState()); , peerAtP2.getState());
//make sure the telephony operation set distributed an event for the end //make sure the telephony operation set distributed an event for the end
//of the call //of the call
@ -345,55 +345,55 @@ public void testCreateRejectCall()
,CallEvent.CALL_RECEIVED, callReceivedEvent.getEventID()); ,CallEvent.CALL_RECEIVED, callReceivedEvent.getEventID());
assertNotNull("CallEvent.getSource()", callAtP2); assertNotNull("CallEvent.getSource()", callAtP2);
//verify that call participants are properly created //verify that call peers are properly created
assertEquals("callAtP1.getCallParticipantsCount()" assertEquals("callAtP1.getCallPeerCount()"
, 1, callAtP1.getCallPeerCount()); , 1, callAtP1.getCallPeerCount());
assertEquals("callAtP2.getCallParticipantsCount()" assertEquals("callAtP2.getCallPeerCount()"
, 1, callAtP2.getCallPeerCount()); , 1, callAtP2.getCallPeerCount());
CallPeer participantAtP1 CallPeer peerAtP1
= (CallPeer)callAtP1.getCallPeers().next(); = (CallPeer)callAtP1.getCallPeers().next();
CallPeer participantAtP2 CallPeer peerAtP2
= (CallPeer)callAtP2.getCallPeers().next(); = (CallPeer)callAtP2.getCallPeers().next();
//now add listeners to the participants and make sure they have entered //now add listeners to the peers and make sure they have entered
//the states they were expected to. //the states they were expected to.
//check states for call participants at both parties //check states for call peers at both parties
CallParticipantStateEventCollector stateCollectorForPp1 CallPeerStateEventCollector stateCollectorForPp1
= new CallParticipantStateEventCollector( = new CallPeerStateEventCollector(
participantAtP1, CallPeerState.ALERTING_REMOTE_SIDE); peerAtP1, CallPeerState.ALERTING_REMOTE_SIDE);
CallParticipantStateEventCollector stateCollectorForPp2 CallPeerStateEventCollector stateCollectorForPp2
= new CallParticipantStateEventCollector( = new CallPeerStateEventCollector(
participantAtP2, CallPeerState.INCOMING_CALL); peerAtP2, CallPeerState.INCOMING_CALL);
stateCollectorForPp1.waitForEvent(10000, true); stateCollectorForPp1.waitForEvent(10000, true);
stateCollectorForPp2.waitForEvent(10000, true); stateCollectorForPp2.waitForEvent(10000, true);
assertSame("participantAtP1.getCall" assertSame("peerAtP1.getCall"
, participantAtP1.getCall(), callAtP1); , peerAtP1.getCall(), callAtP1);
assertSame("participantAtP2.getCall" assertSame("peerAtP2.getCall"
, participantAtP2.getCall(), callAtP2); , peerAtP2.getCall(), callAtP2);
//make sure that the participants are in the proper state //make sure that the peers are in the proper state
assertEquals("The participant at provider one was not in the " assertEquals("The peer at provider one was not in the "
+"right state." +"right state."
, CallPeerState.ALERTING_REMOTE_SIDE , CallPeerState.ALERTING_REMOTE_SIDE
, participantAtP1.getState()); , peerAtP1.getState());
assertEquals("The participant at provider two was not in the " assertEquals("The peer at provider two was not in the "
+"right state." +"right state."
, CallPeerState.INCOMING_CALL , CallPeerState.INCOMING_CALL
, participantAtP2.getState()); , peerAtP2.getState());
//test whether caller/callee info is properly distributed in case //test whether caller/callee info is properly distributed in case
//the server is said to support it. //the server is said to support it.
if(Boolean.getBoolean("accounts.sip.PRESERVE_PARTICIPANT_INFO")) if(Boolean.getBoolean("accounts.sip.PRESERVE_PEER_INFO"))
{ {
//check properties on the remote call participant for the party that //check properties on the remote call peer for the party that
//initiated the call. //initiated the call.
String expectedParticipant1Address String expectedPeer1Address
= fixture.provider2.getAccountID().getAccountAddress(); = fixture.provider2.getAccountID().getAccountAddress();
String expectedParticipant1DisplayName String expectedPeer1DisplayName
= System.getProperty( = System.getProperty(
SipProtocolProviderServiceLick.ACCOUNT_2_PREFIX SipProtocolProviderServiceLick.ACCOUNT_2_PREFIX
+ ProtocolProviderFactory.DISPLAY_NAME); + ProtocolProviderFactory.DISPLAY_NAME);
@ -402,20 +402,20 @@ public void testCreateRejectCall()
//display name or something of the kind //display name or something of the kind
assertTrue("Provider 2 did not advertise their " assertTrue("Provider 2 did not advertise their "
+ "accountID.getAccoutAddress() address." + "accountID.getAccoutAddress() address."
, expectedParticipant1Address.indexOf( , expectedPeer1Address.indexOf(
participantAtP1.getAddress()) != -1 peerAtP1.getAddress()) != -1
|| participantAtP1.getAddress().indexOf( || peerAtP1.getAddress().indexOf(
expectedParticipant1Address) != -1); expectedPeer1Address) != -1);
assertEquals("Provider 2 did not properly advertise their " assertEquals("Provider 2 did not properly advertise their "
+ "display name." + "display name."
, expectedParticipant1DisplayName , expectedPeer1DisplayName
, participantAtP1.getDisplayName()); , peerAtP1.getDisplayName());
//check properties on the remote call participant for the party that //check properties on the remote call peer for the party that
//receives the call. //receives the call.
String expectedParticipant2Address String expectedPeer2Address
= fixture.provider1.getAccountID().getAccountAddress(); = fixture.provider1.getAccountID().getAccountAddress();
String expectedParticipant2DisplayName String expectedPeer2DisplayName
= System.getProperty( = System.getProperty(
SipProtocolProviderServiceLick.ACCOUNT_1_PREFIX SipProtocolProviderServiceLick.ACCOUNT_1_PREFIX
+ ProtocolProviderFactory.DISPLAY_NAME); + ProtocolProviderFactory.DISPLAY_NAME);
@ -424,26 +424,26 @@ public void testCreateRejectCall()
//display name or something of the kind //display name or something of the kind
assertTrue("Provider 1 did not advertise their " assertTrue("Provider 1 did not advertise their "
+ "accountID.getAccoutAddress() address." + "accountID.getAccoutAddress() address."
, expectedParticipant2Address.indexOf( , expectedPeer2Address.indexOf(
participantAtP2.getAddress()) != -1 peerAtP2.getAddress()) != -1
|| participantAtP2.getAddress().indexOf( || peerAtP2.getAddress().indexOf(
expectedParticipant2Address) != -1); expectedPeer2Address) != -1);
assertEquals("Provider 1 did not properly advertise their " assertEquals("Provider 1 did not properly advertise their "
+ "display name." + "display name."
, expectedParticipant2DisplayName , expectedPeer2DisplayName
, participantAtP2.getDisplayName()); , peerAtP2.getDisplayName());
} }
//we'll now try to send busy tone. //we'll now try to send busy tone.
//listeners monitoring state change of the participant //listeners monitoring state change of the peer
CallParticipantStateEventCollector busyStateCollectorForPp1 CallPeerStateEventCollector busyStateCollectorForPp1
= new CallParticipantStateEventCollector( = new CallPeerStateEventCollector(
participantAtP1, CallPeerState.BUSY); peerAtP1, CallPeerState.BUSY);
stateCollectorForPp1 = new CallParticipantStateEventCollector( stateCollectorForPp1 = new CallPeerStateEventCollector(
participantAtP1, CallPeerState.DISCONNECTED); peerAtP1, CallPeerState.DISCONNECTED);
stateCollectorForPp2 = new CallParticipantStateEventCollector( stateCollectorForPp2 = new CallPeerStateEventCollector(
participantAtP2, CallPeerState.DISCONNECTED); peerAtP2, CallPeerState.DISCONNECTED);
//listeners waiting for the op set to announce the end of the call //listeners waiting for the op set to announce the end of the call
call1Listener = new CallEventCollector(basicTelephonyP1); call1Listener = new CallEventCollector(basicTelephonyP1);
@ -456,9 +456,9 @@ public void testCreateRejectCall()
= new CallStateEventCollector(callAtP2, CallState.CALL_ENDED); = new CallStateEventCollector(callAtP2, CallState.CALL_ENDED);
//Now make the caller CANCEL the call. //Now make the caller CANCEL the call.
basicTelephonyP2.hangupCallPeer(participantAtP2); basicTelephonyP2.hangupCallPeer(peerAtP2);
busyStateCollectorForPp1.waitForEvent(10000); busyStateCollectorForPp1.waitForEvent(10000);
basicTelephonyP1.hangupCallPeer(participantAtP1); basicTelephonyP1.hangupCallPeer(peerAtP1);
//wait for everything to happen //wait for everything to happen
call1Listener.waitForEvent(10000); call1Listener.waitForEvent(10000);
@ -469,11 +469,11 @@ public void testCreateRejectCall()
call2StateCollector.waitForEvent(10000); call2StateCollector.waitForEvent(10000);
//make sure that the participant is disconnected //make sure that the peer is disconnected
assertEquals("The participant at provider one was not in the " assertEquals("The peer at provider one was not in the "
+"right state." +"right state."
, CallPeerState.DISCONNECTED , CallPeerState.DISCONNECTED
, participantAtP1.getState()); , peerAtP1.getState());
@ -494,11 +494,11 @@ public void testCreateRejectCall()
//same for provider 2 //same for provider 2
//make sure that the participant is disconnected //make sure that the peer is disconnected
assertEquals("The participant at provider one was not in the " assertEquals("The peer at provider one was not in the "
+"right state." +"right state."
, CallPeerState.DISCONNECTED , CallPeerState.DISCONNECTED
, participantAtP2.getState()); , peerAtP2.getState());
//make sure the telephony operation set distributed an event for the end //make sure the telephony operation set distributed an event for the end
//of the call //of the call
@ -582,55 +582,55 @@ public void aTestCreateAnswerHangupCall()
,CallEvent.CALL_RECEIVED, callReceivedEvent.getEventID()); ,CallEvent.CALL_RECEIVED, callReceivedEvent.getEventID());
assertNotNull("CallEvent.getSource()", callAtP2); assertNotNull("CallEvent.getSource()", callAtP2);
//verify that call participants are properly created //verify that call peers are properly created
assertEquals("callAtP1.getCallParticipantsCount()" assertEquals("callAtP1.getCallpeersCount()"
, 1, callAtP1.getCallPeerCount()); , 1, callAtP1.getCallPeerCount());
assertEquals("callAtP2.getCallParticipantsCount()" assertEquals("callAtP2.getCallpeersCount()"
, 1, callAtP2.getCallPeerCount()); , 1, callAtP2.getCallPeerCount());
CallPeer participantAtP1 CallPeer peerAtP1
= (CallPeer)callAtP1.getCallPeers().next(); = (CallPeer)callAtP1.getCallPeers().next();
CallPeer participantAtP2 CallPeer peerAtP2
= (CallPeer)callAtP2.getCallPeers().next(); = (CallPeer)callAtP2.getCallPeers().next();
//now add listeners to the participants and make sure they have entered //now add listeners to the peers and make sure they have entered
//the states they were expected to. //the states they were expected to.
//check states for call participants at both parties //check states for call peers at both parties
CallParticipantStateEventCollector stateCollectorForPp1 CallPeerStateEventCollector stateCollectorForPp1
= new CallParticipantStateEventCollector( = new CallPeerStateEventCollector(
participantAtP1, CallPeerState.ALERTING_REMOTE_SIDE); peerAtP1, CallPeerState.ALERTING_REMOTE_SIDE);
CallParticipantStateEventCollector stateCollectorForPp2 CallPeerStateEventCollector stateCollectorForPp2
= new CallParticipantStateEventCollector( = new CallPeerStateEventCollector(
participantAtP2, CallPeerState.INCOMING_CALL); peerAtP2, CallPeerState.INCOMING_CALL);
stateCollectorForPp1.waitForEvent(10000, true); stateCollectorForPp1.waitForEvent(10000, true);
stateCollectorForPp2.waitForEvent(10000, true); stateCollectorForPp2.waitForEvent(10000, true);
assertSame("participantAtP1.getCall" assertSame("peerAtP1.getCall"
, participantAtP1.getCall(), callAtP1); , peerAtP1.getCall(), callAtP1);
assertSame("participantAtP2.getCall" assertSame("peerAtP2.getCall"
, participantAtP2.getCall(), callAtP2); , peerAtP2.getCall(), callAtP2);
//make sure that the participants are in the proper state //make sure that the peers are in the proper state
assertEquals("The participant at provider one was not in the " assertEquals("The peer at provider one was not in the "
+"right state." +"right state."
, CallPeerState.ALERTING_REMOTE_SIDE , CallPeerState.ALERTING_REMOTE_SIDE
, participantAtP1.getState()); , peerAtP1.getState());
assertEquals("The participant at provider two was not in the " assertEquals("The peer at provider two was not in the "
+"right state." +"right state."
, CallPeerState.INCOMING_CALL , CallPeerState.INCOMING_CALL
, participantAtP2.getState()); , peerAtP2.getState());
//test whether caller/callee info is properly distributed in case //test whether caller/callee info is properly distributed in case
//the server is said to support it. //the server is said to support it.
if(Boolean.getBoolean("accounts.sip.PRESERVE_PARTICIPANT_INFO")) if(Boolean.getBoolean("accounts.sip.PRESERVE_PEER_INFO"))
{ {
//check properties on the remote call participant for the party that //check properties on the remote call peer for the party that
//initiated the call. //initiated the call.
String expectedParticipant1Address String expectedPeer1Address
= fixture.provider2.getAccountID().getAccountAddress(); = fixture.provider2.getAccountID().getAccountAddress();
String expectedParticipant1DisplayName String expectedPeer1DisplayName
= System.getProperty( = System.getProperty(
SipProtocolProviderServiceLick.ACCOUNT_2_PREFIX SipProtocolProviderServiceLick.ACCOUNT_2_PREFIX
+ ProtocolProviderFactory.DISPLAY_NAME); + ProtocolProviderFactory.DISPLAY_NAME);
@ -639,20 +639,20 @@ public void aTestCreateAnswerHangupCall()
//display name or something of the kind //display name or something of the kind
assertTrue("Provider 2 did not advertise their " assertTrue("Provider 2 did not advertise their "
+ "accountID.getAccoutAddress() address." + "accountID.getAccoutAddress() address."
, expectedParticipant1Address.indexOf( , expectedPeer1Address.indexOf(
participantAtP1.getAddress()) != -1 peerAtP1.getAddress()) != -1
|| participantAtP1.getAddress().indexOf( || peerAtP1.getAddress().indexOf(
expectedParticipant1Address) != -1); expectedPeer1Address) != -1);
assertEquals("Provider 2 did not properly advertise their " assertEquals("Provider 2 did not properly advertise their "
+ "display name." + "display name."
, expectedParticipant1DisplayName , expectedPeer1DisplayName
, participantAtP1.getDisplayName()); , peerAtP1.getDisplayName());
//check properties on the remote call participant for the party that //check properties on the remote call peer for the party that
//receives the call. //receives the call.
String expectedParticipant2Address String expectedPeer2Address
= fixture.provider1.getAccountID().getAccountAddress(); = fixture.provider1.getAccountID().getAccountAddress();
String expectedParticipant2DisplayName String expectedPeer2DisplayName
= System.getProperty( = System.getProperty(
SipProtocolProviderServiceLick.ACCOUNT_1_PREFIX SipProtocolProviderServiceLick.ACCOUNT_1_PREFIX
+ ProtocolProviderFactory.DISPLAY_NAME); + ProtocolProviderFactory.DISPLAY_NAME);
@ -661,85 +661,85 @@ public void aTestCreateAnswerHangupCall()
//display name or something of the kind //display name or something of the kind
assertTrue("Provider 1 did not advertise their " assertTrue("Provider 1 did not advertise their "
+ "accountID.getAccoutAddress() address." + "accountID.getAccoutAddress() address."
, expectedParticipant2Address.indexOf( , expectedPeer2Address.indexOf(
participantAtP2.getAddress()) != -1 peerAtP2.getAddress()) != -1
|| participantAtP2.getAddress().indexOf( || peerAtP2.getAddress().indexOf(
expectedParticipant2Address) != -1); expectedPeer2Address) != -1);
assertEquals("Provider 1 did not properly advertise their " assertEquals("Provider 1 did not properly advertise their "
+ "display name." + "display name."
, expectedParticipant2DisplayName , expectedPeer2DisplayName
, participantAtP2.getDisplayName()); , peerAtP2.getDisplayName());
} }
//add listeners to the participants and make sure enter //add listeners to the peers and make sure enter
//a connected state after we answer //a connected state after we answer
stateCollectorForPp1 stateCollectorForPp1
= new CallParticipantStateEventCollector( = new CallPeerStateEventCollector(
participantAtP1, CallPeerState.CONNECTED); peerAtP1, CallPeerState.CONNECTED);
stateCollectorForPp2 stateCollectorForPp2
= new CallParticipantStateEventCollector( = new CallPeerStateEventCollector(
participantAtP2, CallPeerState.CONNECTED); peerAtP2, CallPeerState.CONNECTED);
//we will now anser the call and verify that both parties change states //we will now anser the call and verify that both parties change states
//accordingly. //accordingly.
basicTelephonyP2.answerCallPeer(participantAtP2); basicTelephonyP2.answerCallPeer(peerAtP2);
stateCollectorForPp1.waitForEvent(10000); stateCollectorForPp1.waitForEvent(10000);
stateCollectorForPp2.waitForEvent(10000); stateCollectorForPp2.waitForEvent(10000);
//make sure that the participants are in the proper state //make sure that the peers are in the proper state
assertEquals("The participant at provider one was not in the " assertEquals("The peer at provider one was not in the "
+"right state." +"right state."
, CallPeerState.CONNECTED , CallPeerState.CONNECTED
, participantAtP1.getState()); , peerAtP1.getState());
assertEquals("The participant at provider two was not in the " assertEquals("The peer at provider two was not in the "
+"right state." +"right state."
, CallPeerState.CONNECTED , CallPeerState.CONNECTED
, participantAtP2.getState()); , peerAtP2.getState());
//make sure that events have been distributed when states were changed. //make sure that events have been distributed when states were changed.
assertEquals("No event was dispatched when a call participant changed " assertEquals("No event was dispatched when a call peer changed "
+"its state." +"its state."
, 1 , 1
, stateCollectorForPp1.collectedEvents.size()); , stateCollectorForPp1.collectedEvents.size());
assertEquals("No event was dispatched when a call participant changed " assertEquals("No event was dispatched when a call peer changed "
+"its state." +"its state."
, 1 , 1
, stateCollectorForPp2.collectedEvents.size()); , stateCollectorForPp2.collectedEvents.size());
//add listeners to the participants and make sure they have entered //add listeners to the peers and make sure they have entered
//the states they are expected to. //the states they are expected to.
stateCollectorForPp1 stateCollectorForPp1
= new CallParticipantStateEventCollector( = new CallPeerStateEventCollector(
participantAtP1, CallPeerState.DISCONNECTED); peerAtP1, CallPeerState.DISCONNECTED);
stateCollectorForPp2 stateCollectorForPp2
= new CallParticipantStateEventCollector( = new CallPeerStateEventCollector(
participantAtP2, CallPeerState.DISCONNECTED); peerAtP2, CallPeerState.DISCONNECTED);
//we will now end the call and verify that both parties change states //we will now end the call and verify that both parties change states
//accordingly. //accordingly.
basicTelephonyP2.hangupCallPeer(participantAtP2); basicTelephonyP2.hangupCallPeer(peerAtP2);
stateCollectorForPp1.waitForEvent(10000); stateCollectorForPp1.waitForEvent(10000);
stateCollectorForPp2.waitForEvent(10000); stateCollectorForPp2.waitForEvent(10000);
//make sure that the participants are in the proper state //make sure that the peers are in the proper state
assertEquals("The participant at provider one was not in the " assertEquals("The peer at provider one was not in the "
+"right state." +"right state."
, CallPeerState.DISCONNECTED , CallPeerState.DISCONNECTED
, participantAtP1.getState()); , peerAtP1.getState());
assertEquals("The participant at provider two was not in the " assertEquals("The peer at provider two was not in the "
+"right state." +"right state."
, CallPeerState.DISCONNECTED , CallPeerState.DISCONNECTED
, participantAtP2.getState()); , peerAtP2.getState());
//make sure that the corresponding events were delivered. //make sure that the corresponding events were delivered.
assertEquals("a provider did not distribute an event when a call " assertEquals("a provider did not distribute an event when a call "
+"participant changed states." +"peer changed states."
, 1 , 1
, stateCollectorForPp1.collectedEvents.size()); , stateCollectorForPp1.collectedEvents.size());
assertEquals("a provider did not distribute an event when a call " assertEquals("a provider did not distribute an event when a call "
+"participant changed states." +"peer changed states."
, 1 , 1
, stateCollectorForPp2.collectedEvents.size()); , stateCollectorForPp2.collectedEvents.size());
@ -853,30 +853,30 @@ public void callEnded(CallEvent event)
} }
/** /**
* Allows tests to wait for and collect events issued upon call participant * Allows tests to wait for and collect events issued upon call peer
* status changes. * status changes.
*/ */
public class CallParticipantStateEventCollector public class CallPeerStateEventCollector
extends CallPeerAdapter extends CallPeerAdapter
{ {
public ArrayList collectedEvents = new ArrayList(); public ArrayList collectedEvents = new ArrayList();
private CallPeer listenedCallParticipant = null; private CallPeer listenedCallPeer = null;
public CallPeerState awaitedState = null; public CallPeerState awaitedState = null;
/** /**
* Creates an instance of this collector and adds it as a listener * Creates an instance of this collector and adds it as a listener
* to <tt>callParticipant</tt>. * to <tt>callPeer</tt>.
* @param callParticipant the CallParticipant that we will be listening * @param callPeer the CallPeer that we will be listening
* to. * to.
* @param awaitedState the state that we will be waiting for inside * @param awaitedState the state that we will be waiting for inside
* this collector. * this collector.
*/ */
public CallParticipantStateEventCollector( public CallPeerStateEventCollector(
CallPeer callParticipant, CallPeer callPeer,
CallPeerState awaitedState) CallPeerState awaitedState)
{ {
this.listenedCallParticipant = callParticipant; this.listenedCallPeer = callPeer;
this.listenedCallParticipant.addCallPeerListener(this); this.listenedCallPeer.addCallPeerListener(this);
this.awaitedState = awaitedState; this.awaitedState = awaitedState;
} }
@ -920,23 +920,23 @@ public void waitForEvent(long waitFor)
* @param waitFor the number of miliseconds that we should be waiting * @param waitFor the number of miliseconds that we should be waiting
* for an event before simply bailing out. * for an event before simply bailing out.
* @param exitIfAlreadyInState specifies whether the method is to return * @param exitIfAlreadyInState specifies whether the method is to return
* if the call participant is already in such a state even if no event * if the call peer is already in such a state even if no event
* has been received for the sate change. * has been received for the sate change.
*/ */
public void waitForEvent(long waitFor, boolean exitIfAlreadyInState) public void waitForEvent(long waitFor, boolean exitIfAlreadyInState)
{ {
logger.trace("Waiting for a CallParticipantEvent with newState=" logger.trace("Waiting for a CallPeerEvent with newState="
+ awaitedState + " for participant " + awaitedState + " for peer "
+ this.listenedCallParticipant); + this.listenedCallPeer);
synchronized (this) synchronized (this)
{ {
if(exitIfAlreadyInState if(exitIfAlreadyInState
&& listenedCallParticipant.getState().equals(awaitedState)) && listenedCallPeer.getState().equals(awaitedState))
{ {
logger.trace("Src participant is already in the awaited " logger.trace("Src peer is already in the awaited "
+ "state." + "state."
+ collectedEvents); + collectedEvents);
listenedCallParticipant.removeCallPeerListener(this); listenedCallPeer.removeCallPeerListener(this);
return; return;
} }
if(collectedEvents.size() > 0) if(collectedEvents.size() > 0)
@ -949,7 +949,7 @@ public void waitForEvent(long waitFor, boolean exitIfAlreadyInState)
{ {
logger.trace("Event already received. " + logger.trace("Event already received. " +
collectedEvents); collectedEvents);
listenedCallParticipant listenedCallPeer
.removeCallPeerListener(this); .removeCallPeerListener(this);
return; return;
} }
@ -964,7 +964,7 @@ public void waitForEvent(long waitFor, boolean exitIfAlreadyInState)
logger.trace("No CallParticpantStateEvent received for " logger.trace("No CallParticpantStateEvent received for "
+ waitFor + "ms."); + waitFor + "ms.");
listenedCallParticipant listenedCallPeer
.removeCallPeerListener(this); .removeCallPeerListener(this);
} }
catch (InterruptedException ex) catch (InterruptedException ex)

Loading…
Cancel
Save