Added:
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySessionImpl.java
(contents, props changed)
- copied, changed from r91,
/trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySession.java
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySessionState.java
Modified:
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/callback/CallbackHandler.java
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxyClient.java
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySession.java
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/command/DestroyCommand.java
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/command/UpdateCommand.java
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/config/RTPProxyClientConfigurator.java
trunk/rtpproxy-client-api/src/test/java/org/vtlabs/rtpproxy/callback/CallbackHandlerTest.java
trunk/rtpproxy-client-api/src/test/java/org/vtlabs/rtpproxy/client/RTPProxyClientTest.java
trunk/rtpproxy-client-api/src/test/java/org/vtlabs/rtpproxy/mock/client/RTPProxyClientListenerMOCK.java
trunk/rtpproxy-client-test/pom.xml
trunk/rtpproxy-client-test/src/test/java/org/vtlabs/rtpproxy/integration/RTPProxyClientTest.java
Log:
RESOLVED - issue RTPPC-6: Implement a RTPProxySession state control
mechanism
http://jira.vtlabs.org/browse/RTPPC-6
Modified:
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/callback/CallbackHandler.java
==============================================================================
---
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/callback/CallbackHandler.java
(original)
+++
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/callback/CallbackHandler.java
Fri Jul 10 14:51:11 2009
@@ -7,8 +7,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.vtlabs.rtpproxy.client.RTPProxyClientListener;
-import org.vtlabs.rtpproxy.client.RTPProxySession;
+import org.vtlabs.rtpproxy.client.RTPProxySessionImpl;
import org.vtlabs.rtpproxy.client.RTPProxySessionException;
+import org.vtlabs.rtpproxy.client.RTPProxySessionState;
import org.vtlabs.rtpproxy.command.Command;
import org.vtlabs.rtpproxy.command.CommandListener;
import org.vtlabs.rtpproxy.command.CommandTimeoutManager;
@@ -80,7 +81,7 @@
log.debug(sb.toString());
}
- RTPProxySession session = command.getSession();
+ RTPProxySessionImpl session = command.getSession();
boolean isError = errorMatcher.reset(message).matches();
if (session == null && isError) {
@@ -117,12 +118,13 @@
log.debug(sb.toString());
}
- RTPProxySession session = command.getSession();
+ RTPProxySessionImpl session = command.getSession();
RTPProxyClientListener listener = command.getCallbackListener();
Object appData = command.getAppData();
boolean isError = errorMatcher.reset(message).matches();
if (!isError) {
+ session.setState(RTPProxySessionState.DESTROYED);
listener.sessionDestroyed(session, appData);
} else {
@@ -130,6 +132,7 @@
"Error destroying RTPProxy session",
message);
+ session.setState(RTPProxySessionState.FAILED);
listener.destroySessionFailed(session, appData, t);
}
}
@@ -163,9 +166,10 @@
String message) {
log.debug("Processing event SessionCreated");
- RTPProxySession session = new RTPProxySession();
+ RTPProxySessionImpl session = new RTPProxySessionImpl();
session.setSessionID(command.getSessionID());
session.setServer(command.getServer());
+ session.setState(RTPProxySessionState.CREATED);
InetSocketAddress calleeMediaAddr = parseMediaAddress(message);
session.setCalleeMediaAddress(calleeMediaAddr);
@@ -193,9 +197,10 @@
Throwable t = createSessionException("Error updating RTPProxy
session",
errorMessage);
+ RTPProxySessionImpl session = command.getSession();
+ session.setState(RTPProxySessionState.FAILED);
RTPProxyClientListener listener = command.getCallbackListener();
- listener.updateSessionFailed(command.getSession(),
command.getAppData(),
- t);
+ listener.updateSessionFailed(session, command.getAppData(), t);
}
/**
@@ -207,7 +212,7 @@
String message) {
log.debug("Processing event SessionUpdated");
- RTPProxySession session = command.getSession();
+ RTPProxySessionImpl session = command.getSession();
InetSocketAddress callerMediaAddr = parseMediaAddress(message);
session.setCallerMediaAddress(callerMediaAddr);
@@ -254,13 +259,14 @@
*/
public void processUpdateCommandTimeout(UpdateCommand command) {
RTPProxyClientListener listener = command.getCallbackListener();
- RTPProxySession session = command.getSession();
+ RTPProxySessionImpl session = command.getSession();
Object appData = command.getAppData();
String sessionID = command.getSessionID();
if (session == null) {
listener.createSessionTimeout(sessionID, appData);
} else {
+ session.setState(RTPProxySessionState.FAILED);
listener.updateSessionTimeout(session, appData);
}
}
@@ -270,7 +276,8 @@
*/
public void processDestroyCommandTimeout(DestroyCommand command) {
RTPProxyClientListener listener = command.getCallbackListener();
- RTPProxySession session = command.getSession();
+ RTPProxySessionImpl session = command.getSession();
+ session.setState(RTPProxySessionState.FAILED);
Object appData = command.getAppData();
listener.destroySessionTimeout(session, appData);
}
Modified:
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxyClient.java
==============================================================================
---
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxyClient.java
(original)
+++
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxyClient.java
Fri Jul 10 14:51:11 2009
@@ -164,13 +164,14 @@
* (see {@link RTPProxyClientListener} for more information
about
* callback methods).
*/
- public void updateSession(RTPProxySession session,
+ public void updateSession(RTPProxySession sessionIface,
InetSocketAddress calleeAddress,
Object appData, RTPProxyClientListener listener)
throws NoServerAvailableException {
checkState();
+ RTPProxySessionImpl session = (RTPProxySessionImpl) sessionIface;
UpdateCommand updateCmd = new UpdateCommand(session,
callbackHandler);
updateCmd.setCallbackListener(listener);
updateCmd.setServer(session.getServer());
@@ -200,11 +201,12 @@
* (see {@link RTPProxyClientListener} for more information
about
* callback methods).
*/
- public void destroySession(RTPProxySession session, Object appData,
+ public void destroySession(RTPProxySession sessionIface, Object
appData,
RTPProxyClientListener listener) throws
NoServerAvailableException {
checkState();
+ RTPProxySessionImpl session = (RTPProxySessionImpl) sessionIface;
DestroyCommand destroyCmd = new DestroyCommand(session,
callbackHandler);
destroyCmd.setCallbackListener(listener);
destroyCmd.setAppData(appData);
Modified:
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySession.java
==============================================================================
---
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySession.java
(original)
+++
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySession.java
Fri Jul 10 14:51:11 2009
@@ -2,56 +2,15 @@
import java.net.InetSocketAddress;
-/**
- *
- * @author Marcos Hack <mar...@voicetechnology.com.br>
- */
-public class RTPProxySession {
- private String sessionID;
- private InetSocketAddress callerMediaAddress;
- private InetSocketAddress calleeMediaAddress;
- private RTPProxyServer server;
+public interface RTPProxySession {
- public InetSocketAddress getCalleeMediaAddress() {
- return calleeMediaAddress;
- }
+ public InetSocketAddress getCalleeMediaAddress();
- public void setCalleeMediaAddress(InetSocketAddress
calleeMediaAddress) {
- this.calleeMediaAddress = calleeMediaAddress;
- }
+ public InetSocketAddress getCallerMediaAddress();
- public InetSocketAddress getCallerMediaAddress() {
- return callerMediaAddress;
- }
+ public RTPProxyServer getServer();
- public void setCallerMediaAddress(InetSocketAddress
callerMediaAddress) {
- this.callerMediaAddress = callerMediaAddress;
- }
+ public String getSessionID();
- public RTPProxyServer getServer() {
- return server;
- }
-
- public void setServer(RTPProxyServer server) {
- this.server = server;
- }
-
- public String getSessionID() {
- return sessionID;
- }
-
- public void setSessionID(String sessionID) {
- this.sessionID = sessionID;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("RTPProxySession[");
- sb.append("sessionID = ").append(sessionID);
- sb.append(", calleeMediaAddress = ").append(calleeMediaAddress);
- sb.append(", callerMediaAddress = ").append(callerMediaAddress);
- sb.append(", server = ").append(server);
- sb.append("]");
- return sb.toString();
- }
+ public RTPProxySessionState getState();
}
Copied:
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySessionImpl.java
(from r91,
/trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySession.java)
==============================================================================
---
/trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySession.java
(original)
+++
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySessionImpl.java
Fri Jul 10 14:51:11 2009
@@ -6,11 +6,12 @@
*
* @author Marcos Hack <mar...@voicetechnology.com.br>
*/
-public class RTPProxySession {
+public class RTPProxySessionImpl implements RTPProxySession {
private String sessionID;
private InetSocketAddress callerMediaAddress;
private InetSocketAddress calleeMediaAddress;
private RTPProxyServer server;
+ private RTPProxySessionState state;
public InetSocketAddress getCalleeMediaAddress() {
return calleeMediaAddress;
@@ -43,8 +44,16 @@
public void setSessionID(String sessionID) {
this.sessionID = sessionID;
}
+
+ public RTPProxySessionState getState() {
+ return state;
+ }
+
+ public void setState(RTPProxySessionState state) {
+ this.state = state;
+ }
- @Override
+ @Override
public String toString() {
StringBuilder sb = new StringBuilder("RTPProxySession[");
sb.append("sessionID = ").append(sessionID);
Added:
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySessionState.java
==============================================================================
--- (empty file)
+++
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/client/RTPProxySessionState.java
Fri Jul 10 14:51:11 2009
@@ -0,0 +1,7 @@
+package org.vtlabs.rtpproxy.client;
+
+public enum RTPProxySessionState {
+ CREATED,
+ FAILED,
+ DESTROYED,
+}
Modified:
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/command/DestroyCommand.java
==============================================================================
---
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/command/DestroyCommand.java
(original)
+++
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/command/DestroyCommand.java
Fri Jul 10 14:51:11 2009
@@ -1,6 +1,6 @@
package org.vtlabs.rtpproxy.command;
-import org.vtlabs.rtpproxy.client.RTPProxySession;
+import org.vtlabs.rtpproxy.client.RTPProxySessionImpl;
/**
*
@@ -8,13 +8,13 @@
*/
public class DestroyCommand extends Command {
- RTPProxySession session;
+ RTPProxySessionImpl session;
public DestroyCommand(CommandListener cmdListener) {
super(cmdListener);
}
- public DestroyCommand(RTPProxySession session, CommandListener
listener) {
+ public DestroyCommand(RTPProxySessionImpl session, CommandListener
listener) {
super(listener);
this.session = session;
setSessionID(session.getSessionID());
@@ -29,11 +29,11 @@
return sb.toString();
}
- public RTPProxySession getSession() {
+ public RTPProxySessionImpl getSession() {
return session;
}
- public void setSession(RTPProxySession session) {
+ public void setSession(RTPProxySessionImpl session) {
this.session = session;
}
}
Modified:
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/command/UpdateCommand.java
==============================================================================
---
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/command/UpdateCommand.java
(original)
+++
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/command/UpdateCommand.java
Fri Jul 10 14:51:11 2009
@@ -2,7 +2,7 @@
import java.net.InetSocketAddress;
import org.vtlabs.rtpproxy.client.RTPProxyServer;
-import org.vtlabs.rtpproxy.client.RTPProxySession;
+import org.vtlabs.rtpproxy.client.RTPProxySessionImpl;
/**
* Update sesssion, creating a new one if it doesn't exist.
@@ -17,7 +17,7 @@
* RTPProxy session target of the update command. Its is 'null' in the
first
* update command used to create the session.
*/
- private RTPProxySession session;
+ private RTPProxySessionImpl session;
/**
* RTPProxy server to which the command will be send. Its primary use
is to
@@ -32,7 +32,7 @@
address = null;
}
- public UpdateCommand(RTPProxySession session, CommandListener
cmdListener) {
+ public UpdateCommand(RTPProxySessionImpl session, CommandListener
cmdListener) {
this(cmdListener);
this.session = session;
setSessionID(session.getSessionID());
@@ -73,11 +73,11 @@
this.address = address;
}
- public RTPProxySession getSession() {
+ public RTPProxySessionImpl getSession() {
return session;
}
- public void setSession(RTPProxySession session) {
+ public void setSession(RTPProxySessionImpl session) {
this.session = session;
}
Modified:
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/config/RTPProxyClientConfigurator.java
==============================================================================
---
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/config/RTPProxyClientConfigurator.java
(original)
+++
trunk/rtpproxy-client-api/src/main/java/org/vtlabs/rtpproxy/config/RTPProxyClientConfigurator.java
Fri Jul 10 14:51:11 2009
@@ -6,8 +6,10 @@
import org.vtlabs.rtpproxy.client.*;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
+import java.io.InputStream;
import java.net.InetSocketAddress;
import java.util.Properties;
import org.apache.commons.lang.StringUtils;
@@ -29,9 +31,9 @@
public static RTPProxyClientConfig load(File configFile)
throws RTPProxyClientConfigException {
try {
- FileReader reader = new FileReader(configFile);
+ FileInputStream fileInputStream = new
FileInputStream(configFile);
Properties configProperties = new Properties();
- configProperties.load(reader);
+ configProperties.load(fileInputStream);
return load(configProperties);
Modified:
trunk/rtpproxy-client-api/src/test/java/org/vtlabs/rtpproxy/callback/CallbackHandlerTest.java
==============================================================================
---
trunk/rtpproxy-client-api/src/test/java/org/vtlabs/rtpproxy/callback/CallbackHandlerTest.java
(original)
+++
trunk/rtpproxy-client-api/src/test/java/org/vtlabs/rtpproxy/callback/CallbackHandlerTest.java
Fri Jul 10 14:51:11 2009
@@ -10,6 +10,9 @@
import org.vtlabs.rtpproxy.callback.CallbackHandler;
import org.vtlabs.rtpproxy.client.RTPProxyServer;
import org.vtlabs.rtpproxy.client.RTPProxySession;
+import org.vtlabs.rtpproxy.client.RTPProxySessionImpl;
+import org.vtlabs.rtpproxy.client.RTPProxySessionState;
+import org.vtlabs.rtpproxy.command.DestroyCommand;
import org.vtlabs.rtpproxy.command.UpdateCommand;
import org.vtlabs.rtpproxy.BaseTest;
import org.vtlabs.rtpproxy.mock.client.RTPProxyClientListenerMOCK;
@@ -103,6 +106,9 @@
assertEquals("Invalid AppData for 'create' event", appData,
listener.createdAppData);
+
+ assertEquals("Invalid session state", RTPProxySessionState.CREATED,
+ session.getState());
}
@Test
@@ -180,9 +186,10 @@
// Update command has an RTPProxy session with a not null callee
media
// address
- RTPProxySession session = new RTPProxySession();
+ RTPProxySessionImpl session = new RTPProxySessionImpl();
session.setSessionID(sessionID);
session.setServer(server);
+ session.setState(RTPProxySessionState.CREATED);
InetSocketAddress calleeMediaAddr =
new InetSocketAddress("127.0.0.1", 3000);
session.setCalleeMediaAddress(calleeMediaAddr);
@@ -244,6 +251,9 @@
assertEquals("Invalid AppData for 'create' event", appData,
listener.updatedAppData);
+
+ assertEquals("Invalid session state", RTPProxySessionState.CREATED,
+ session.getState());
}
@Test
@@ -262,9 +272,10 @@
// Update command has an RTPProxy session with a not null callee
media
// address
- RTPProxySession session = new RTPProxySession();
+ RTPProxySessionImpl session = new RTPProxySessionImpl();
session.setSessionID(sessionID);
session.setServer(server);
+ session.setState(RTPProxySessionState.CREATED);
InetSocketAddress calleeMediaAddr =
new InetSocketAddress("127.0.0.1", 3000);
session.setCalleeMediaAddress(calleeMediaAddr);
@@ -311,9 +322,81 @@
assertEquals("Invalid AppData", appData,
listener.updateFailedAppData);
assertNotNull("Invalid exception", listener.updateFailedThrowable);
+
+ assertEquals("Invalid session state", RTPProxySessionState.FAILED,
+ session.getState());
log.debug("Update failed throwable:\n" +
listener.updateFailedThrowable.toString());
+ }
+
+
+ @Test
+ public void processSessionDestroyed() {
+ String sessionID = "session_destroyed_sessionid";
+ Long appData = 12345L; // A long object to be used as AppData.
+ String cmdCookie = "session_destroyed_cookie";
+ InetSocketAddress srvAddr = new InetSocketAddress("127.0.0.1",
22222);
+ RTPProxyServer server = new RTPProxyServer();
+ server.setAddress(srvAddr);
+
+ // From and To tags are the inverse of the udpate command to
create the
+ // session
+ String toTag = "session_destroyed_fromtag";
+ String fromTag = "session_destroyed_totag";
+
+ // Destroy command has an RTPProxy session with callee and caller
media
+ // address set and state CREATED.
+ RTPProxySessionImpl session = new RTPProxySessionImpl();
+ session.setSessionID(sessionID);
+ session.setServer(server);
+ session.setState(RTPProxySessionState.CREATED);
+ InetSocketAddress calleeMediaAddr =
+ new InetSocketAddress("127.0.0.1", 3000);
+ session.setCalleeMediaAddress(calleeMediaAddr);
+ InetSocketAddress callerMediaAddr =
+ new InetSocketAddress("127.0.0.1", 4000);
+ session.setCallerMediaAddress(callerMediaAddr);
+
+
+ // Create a destroy command to be recovered by the callback
handler via
+ // the command timeout manager
+ DestroyCommand destroyCommand = new DestroyCommand(session,
callbackHandler);
+ destroyCommand.setCallbackListener(listener);
+ destroyCommand.setAppData(appData);
+ destroyCommand.setSessionID(sessionID);
+ destroyCommand.setCookie(cmdCookie);
+ destroyCommand.setFromTag(fromTag);
+ destroyCommand.setToTag(toTag);
+
+ // Finally add the command to the timeout manager
+ timeoutMngr.addPendingCommand(destroyCommand);
+
+ // Create a fake RTPProxy response message with the session port
and IP
+ // address
+ String responseMessage = "0";
+
+ // Burn it!
+ callbackHandler.processResponse(cmdCookie, responseMessage,
srvAddr);
+
+ // Check
+ assertTrue("Listener didn't receive an 'destroy' event",
+ listener.isDestroy);
+
+ RTPProxySession destroyedSession = listener.destroySession;
+ assertNotNull("RTP session wasn't updated", destroyedSession);
+
+ assertEquals("Invalid session passed to update callback method",
+ session, destroyedSession);
+
+ assertNotNull("Caller media address wasn't created",
+ session.getCallerMediaAddress());
+
+ assertEquals("Invalid AppData for 'create' event", appData,
+ listener.destroyAppData);
+
+ assertEquals("Invalid session state",
RTPProxySessionState.DESTROYED,
+ session.getState());
}
@Test
Modified:
trunk/rtpproxy-client-api/src/test/java/org/vtlabs/rtpproxy/client/RTPProxyClientTest.java
==============================================================================
---
trunk/rtpproxy-client-api/src/test/java/org/vtlabs/rtpproxy/client/RTPProxyClientTest.java
(original)
+++
trunk/rtpproxy-client-api/src/test/java/org/vtlabs/rtpproxy/client/RTPProxyClientTest.java
Fri Jul 10 14:51:11 2009
@@ -57,7 +57,7 @@
Object appData = new Object();
RTPProxyServer server = new RTPProxyServer();
server.setAddress(new InetSocketAddress("127.0.0.1", 22222));
- RTPProxySession session = new RTPProxySession();
+ RTPProxySessionImpl session = new RTPProxySessionImpl();
session.setSessionID(sessionID);
session.setServer(server);
@@ -73,7 +73,7 @@
Object appData = new Object();
RTPProxyServer server = new RTPProxyServer();
server.setAddress(new InetSocketAddress("127.0.0.1", 22222));
- RTPProxySession session = new RTPProxySession();
+ RTPProxySessionImpl session = new RTPProxySessionImpl();
session.setSessionID(sessionID);
session.setServer(server);
Modified:
trunk/rtpproxy-client-api/src/test/java/org/vtlabs/rtpproxy/mock/client/RTPProxyClientListenerMOCK.java
==============================================================================
---
trunk/rtpproxy-client-api/src/test/java/org/vtlabs/rtpproxy/mock/client/RTPProxyClientListenerMOCK.java
(original)
+++
trunk/rtpproxy-client-api/src/test/java/org/vtlabs/rtpproxy/mock/client/RTPProxyClientListenerMOCK.java
Fri Jul 10 14:51:11 2009
@@ -6,6 +6,7 @@
import org.vtlabs.rtpproxy.client.RTPProxyClientListener;
import org.vtlabs.rtpproxy.client.RTPProxySession;
+import org.vtlabs.rtpproxy.client.RTPProxySessionImpl;
/**
*
@@ -22,21 +23,21 @@
public Object createFailedAppData;
public Object createFailedThrowable;
public boolean isUpdateFail;
- public RTPProxySession updateFailedSession;
+ public RTPProxySessionImpl updateFailedSession;
public Object updateFailedAppData;
public Object updateFailedThrowable;
public boolean isDestroyFail;
- public RTPProxySession destroyFailedSession;
+ public RTPProxySessionImpl destroyFailedSession;
public Object destroyFailedAppData;
public Object destroyFailedThrowable;
public boolean isCreate;
- public RTPProxySession createdSession;
+ public RTPProxySessionImpl createdSession;
public Object createdAppData;
public boolean isUpdate;
- public RTPProxySession updatedSession;
+ public RTPProxySessionImpl updatedSession;
public Object updatedAppData;
public boolean isDestroy;
- public RTPProxySession destroySession;
+ public RTPProxySessionImpl destroySession;
public Object destroyAppData;
public void createSessionTimeout(String sessionID, Object appData) {
@@ -56,7 +57,7 @@
public void updateSessionFailed(RTPProxySession session, Object
appData,
Throwable t) {
isUpdateFail = true;
- updateFailedSession = session;
+ updateFailedSession = (RTPProxySessionImpl) session;
updateFailedAppData = appData;
updateFailedThrowable = t;
}
@@ -67,19 +68,19 @@
public void sessionCreated(RTPProxySession session, Object appData) {
isCreate = true;
- createdSession = session;
+ createdSession = (RTPProxySessionImpl) session;
createdAppData = appData;
}
public void sessionUpdated(RTPProxySession session, Object appData) {
isUpdate = true;
- updatedSession = session;
+ updatedSession = (RTPProxySessionImpl) session;
updatedAppData = appData;
}
public void destroySessionFailed(RTPProxySession session, Object
appData, Throwable t) {
isDestroyFail = true;
- destroyFailedSession = session;
+ destroyFailedSession = (RTPProxySessionImpl) session;
destroyFailedAppData = appData;
destroyFailedThrowable = t;
}
@@ -90,7 +91,7 @@
public void sessionDestroyed(RTPProxySession session, Object appData) {
isDestroy = true;
- destroySession = session;
+ destroySession = (RTPProxySessionImpl) session;
destroyAppData = appData;
}
}
Modified: trunk/rtpproxy-client-test/pom.xml
==============================================================================
--- trunk/rtpproxy-client-test/pom.xml (original)
+++ trunk/rtpproxy-client-test/pom.xml Fri Jul 10 14:51:11 2009
@@ -18,7 +18,7 @@
<dependency>
<groupId>org.vtlabs</groupId>
<artifactId>rtpproxy-client-api</artifactId>
- <version>0.1</version>
+ <version>0.2</version>
</dependency>
</dependencies>
</project>
Modified:
trunk/rtpproxy-client-test/src/test/java/org/vtlabs/rtpproxy/integration/RTPProxyClientTest.java
==============================================================================
---
trunk/rtpproxy-client-test/src/test/java/org/vtlabs/rtpproxy/integration/RTPProxyClientTest.java
(original)
+++
trunk/rtpproxy-client-test/src/test/java/org/vtlabs/rtpproxy/integration/RTPProxyClientTest.java
Fri Jul 10 14:51:11 2009
@@ -11,6 +11,7 @@
import org.slf4j.LoggerFactory;
import org.vtlabs.rtpproxy.client.NoServerAvailableException;
import org.vtlabs.rtpproxy.client.RTPProxyClient;
+import org.vtlabs.rtpproxy.client.RTPProxySessionState;
import org.vtlabs.rtpproxy.config.RTPProxyClientConfig;
import org.vtlabs.rtpproxy.config.RTPProxyClientConfigurator;
import org.vtlabs.rtpproxy.client.RTPProxyClientListener;
@@ -69,7 +70,11 @@
assertNotNull("Caller media address wasn't created",
session.getCallerMediaAddress());
+
+ assertEquals("Invalid session state", RTPProxySessionState.CREATED,
+ session.getState());
+
log.info("Destroying session " + session);
synchronized (this) {
client.destroySession(session, appData, this);
@@ -77,6 +82,9 @@
}
assertTrue("Listener didn't receive destroy callback",
wasDestroyed);
+
+ assertEquals("Invalid session state",
RTPProxySessionState.DESTROYED,
+ session.getState());
client.terminate();
}