Renames occurrences of 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 0598e56a0e
commit 41add54fd4

@ -61,7 +61,7 @@ public int getCallPeerCount()
*
* @param callParticipant the new <tt>CallParticipant</tt>
*/
public void addCallParticipant(MockCallParticipant callParticipant)
public void addCallParticipant(MockCallPeer callParticipant)
{
if(callParticipants.contains(callParticipant))
return;
@ -83,7 +83,7 @@ public void addCallParticipant(MockCallParticipant callParticipant)
*
* @param callParticipant the <tt>CallParticipant</tt> leaving the call;
*/
public void removeCallParticipant(MockCallParticipant callParticipant)
public void removeCallParticipant(MockCallPeer callParticipant)
{
if(!callParticipants.contains(callParticipant))
return;
@ -106,7 +106,7 @@ public void peerStateChanged(CallPeerChangeEvent evt)
== CallPeerState.FAILED)
{
removeCallParticipant(
(MockCallParticipant) evt.getSourceCallPeer());
(MockCallPeer) evt.getSourceCallPeer());
}
else if ( ( (CallPeerState) evt.getNewValue())
== CallPeerState.CONNECTED

@ -1,119 +0,0 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.protocol.mock;
import net.java.sip.communicator.service.protocol.*;
/**
* @author Damian Minkov
*/
public class MockCallParticipant
extends AbstractCallPeer
{
/**
* The sip address of this participant
*/
private String participantAddress = null;
/**
* The call participant belongs to.
*/
private MockCall call;
/**
* A string uniquely identifying the participant.
*/
private String participantID;
public MockCallParticipant(String address, MockCall owningCall)
{
this.participantAddress = address;
this.call = owningCall;
call.addCallParticipant(this);
//create the uid
this.participantID = String.valueOf( System.currentTimeMillis())
+ String.valueOf(hashCode());
}
/**
* Returns a String locator for that participant.
*
* @return the participant's address or phone number.
*/
public String getAddress()
{
return participantAddress;
}
/**
* Returns a reference to the call that this participant belongs to.
*
* @return a reference to the call containing this participant.
*/
public Call getCall()
{
return call;
}
/**
* Returns a human readable name representing this participant.
*
* @return a String containing a name for that participant.
*/
public String getDisplayName()
{
return participantAddress;
}
/**
* The method returns an image representation of the call participant
* (e.g.
*
* @return byte[] a byte array containing the image or null if no image
* is available.
*/
public byte[] getImage()
{
return null;
}
/**
* Returns a unique identifier representing this participant.
*
* @return an identifier representing this call participant.
*/
public String getPeerID()
{
return participantID;
}
/**
* Returns the contact corresponding to this participant or null if no
* particular contact has been associated.
* <p>
* @return the <tt>Contact</tt> corresponding to this participant or null
* if no particular contact has been associated.
*/
public Contact getContact()
{
/** @todo implement getContact() */
return null;
}
/**
* Returns the protocol provider that this participant belongs to.
* @return a reference to the ProtocolProviderService that this participant
* belongs to.
*/
public ProtocolProviderService getProtocolProvider()
{
return this.call.getProtocolProvider();
}
}

@ -28,7 +28,7 @@ public class MockOperationSetBasicTelephony
/**
* A table mapping call ids against call instances.
*/
private Hashtable activeCalls = new Hashtable();
private Hashtable<String, Call> activeCalls = new Hashtable<String, Call>();
public MockOperationSetBasicTelephony(MockProvider protocolProvider)
@ -38,36 +38,36 @@ public MockOperationSetBasicTelephony(MockProvider protocolProvider)
/**
* Indicates a user request to answer an incoming call from the specified
* CallParticipant.
* CallPeer.
*
* @param participant the call participant that we'd like to anwer.
* @param peer the call peer that we'd like to answer.
* @throws OperationFailedException with the corresponding code if we
* encounter an error while performing this operation.
*/
public void answerCallPeer(CallPeer participant) throws
public void answerCallPeer(CallPeer peer) throws
OperationFailedException
{
MockCallParticipant callParticipant
= (MockCallParticipant)participant;
if(participant.getState().equals(CallPeerState.CONNECTED))
MockCallPeer callPeer
= (MockCallPeer)peer;
if(peer.getState().equals(CallPeerState.CONNECTED))
{
logger.info("Ignoring user request to answer a CallParticipant "
+ "that is already connected. CP:" + participant);
logger.info("Ignoring user request to answer a CallPeer "
+ "that is already connected. CP:" + peer);
return;
}
callParticipant.setState(CallPeerState.CONNECTED, null);
callPeer.setState(CallPeerState.CONNECTED, null);
}
/**
* Create a new call and invite the specified CallParticipant to it.
* Create a new call and invite the specified CallPeer to it.
*
* @param uri the address of the callee that we should invite to a new
* call.
* @return CallParticipant the CallParticipant that will represented by
* @return CallPeer the CallPeer that will represented by
* the specified uri. All following state change events will be
* delivered through that call participant. The Call that this
* participant is a member of could be retrieved from the
* delivered through that call peer. The Call that this
* peer is a member of could be retrieved from the
* CallParticipatn instance with the use of the corresponding method.
* @throws OperationFailedException with the corresponding code if we
* fail to create the call.
@ -81,14 +81,14 @@ public Call createCall(String uri) throws OperationFailedException,
}
/**
* Create a new call and invite the specified CallParticipant to it.
* Create a new call and invite the specified CallPeer to it.
*
* @param callee the address of the callee that we should invite to a
* new call.
* @return CallParticipant the CallParticipant that will represented by
* @return CallPeer the CallPeer that will represented by
* the specified uri. All following state change events will be
* delivered through that call participant. The Call that this
* participant is a member of could be retrieved from the
* delivered through that call peer. The Call that this
* peer is a member of could be retrieved from the
* CallParticipatn instance with the use of the corresponding method.
* @throws OperationFailedException with the corresponding code if we
* fail to create the call.
@ -105,7 +105,7 @@ private Call createNewCall(String address)
newCall.addCallChangeListener(this);
activeCalls.put(newCall.getCallID(), newCall);
new MockCallParticipant(address, newCall);
new MockCallPeer(address, newCall);
return newCall;
}
@ -115,7 +115,7 @@ private Call createNewCall(String address)
*
* @return Iterator
*/
public Iterator getActiveCalls()
public Iterator<Call> getActiveCalls()
{
return activeCalls.values().iterator();
}
@ -124,52 +124,52 @@ public Iterator getActiveCalls()
* Indicates a user request to end a call with the specified call
* particiapnt.
*
* @param participant the participant that we'd like to hang up on.
* @param peer the peer that we'd like to hang up on.
* @throws OperationFailedException with the corresponding code if we
* encounter an error while performing this operation.
*/
public void hangupCallPeer(CallPeer participant) throws
public void hangupCallPeer(CallPeer peer) throws
OperationFailedException
{
//do nothing if the call is already ended
if (participant.getState().equals(CallPeerState.DISCONNECTED))
if (peer.getState().equals(CallPeerState.DISCONNECTED))
{
logger.debug("Ignoring a request to hangup a call participant "
logger.debug("Ignoring a request to hangup a call peer "
+"that is already DISCONNECTED");
return;
}
MockCallParticipant callParticipant
= (MockCallParticipant)participant;
MockCallPeer callPeer
= (MockCallPeer)peer;
logger.info("hangupCallParticipant");
callParticipant.setState(CallPeerState.DISCONNECTED, null);
logger.info("hangupCallPeer");
callPeer.setState(CallPeerState.DISCONNECTED, null);
}
/**
* Resumes communication with a call participant previously put on hold.
* Resumes communication with a call peer previously put on hold.
*
* @param participant the call participant to put on hold.
* @param peer the call peer to put on hold.
* @todo Implement this
* net.java.sip.communicator.service.protocol.OperationSetBasicTelephony
* method
*/
public void putOffHold(CallPeer participant)
public void putOffHold(CallPeer peer)
{
}
/**
* Puts the specified CallParticipant "on hold".
* Puts the specified CallPeer "on hold".
*
* @param participant the participant that we'd like to put on hold.
* @param peer the peer that we'd like to put on hold.
* @throws OperationFailedException with the corresponding code if we
* encounter an error while performing this operation.
* @todo Implement this
* net.java.sip.communicator.service.protocol.OperationSetBasicTelephony
* method
*/
public void putOnHold(CallPeer participant) throws
public void putOnHold(CallPeer peer) throws
OperationFailedException
{
}
@ -189,9 +189,9 @@ public Call placeCall(String toAddress)
Call newCall = createCall(toAddress);
fireCallEvent(CallEvent.CALL_INITIATED, newCall);
// must have one participant
MockCallParticipant callPArt =
(MockCallParticipant)newCall.getCallPeers().next();
// must have one peer
MockCallPeer callPArt =
(MockCallPeer)newCall.getCallPeers().next();
callPArt.setState(CallPeerState.ALERTING_REMOTE_SIDE, "no reason");
callPArt.setState(CallPeerState.CONNECTED, "no reason");
@ -199,9 +199,9 @@ public Call placeCall(String toAddress)
return newCall;
}
public CallPeer addNewCallParticipant(Call call, String address)
public CallPeer addNewCallPeer(Call call, String address)
{
MockCallParticipant callPArt = new MockCallParticipant(address, (MockCall)call);
MockCallPeer callPArt = new MockCallPeer(address, (MockCall)call);
callPArt.setState(CallPeerState.ALERTING_REMOTE_SIDE, "no reason");
callPArt.setState(CallPeerState.CONNECTED, "no reason");

@ -294,7 +294,7 @@ public void checkRecordCompleteness()
waitSeconds(2000);
CallPeer newParticipant =
mockBTelphonyOpSet.addNewCallParticipant(newCall,
mockBTelphonyOpSet.addNewCallPeer(newCall,
partAddresses[1]);
mockBTelphonyOpSet.hangupCallPeer(newParticipant);

Loading…
Cancel
Save