Skip to content
Snippets Groups Projects
Commit edf48bdb authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#15052: Implement test for placeCall method using both good and bad phone number

parent 974363d4
No related branches found
No related tags found
No related merge requests found
......@@ -48,5 +48,5 @@ public class ManagerImpl {
public static native String getJniString();
public static native void initN(String config_file);
public static native void placeCall(String accountID, String callID, String to);
public static native void hangUp(String accountID);
public static native void hangUp(String callID);
}
......@@ -31,12 +31,35 @@
package com.savoirfairelinux.sflphone;
import java.lang.Thread;
import android.test.AndroidTestCase;
import com.savoirfairelinux.sflphone.client.ManagerImpl;
public class ManagerImplTest extends AndroidTestCase {
public static final String PACKAGE_NAME = "com.savoirfairelinux.sflphone";
public static final String ACCOUNT_ID = "IP2IP";
public static final String CALLING_VALID_IP = "127.0.0.1";
public static final String CALLING_BAD_IP = "123.234.123.234";
public static final String CALL_ID = "1234567";
public static final int CALL_SLEEP_TIME = 1000; // in ms
static {
System.loadLibrary("gnustl_shared");
System.loadLibrary("expat");
System.loadLibrary("yaml");
System.loadLibrary("ccgnu2");
System.loadLibrary("crypto");
System.loadLibrary("ssl");
System.loadLibrary("ccrtp1");
System.loadLibrary("dbus");
System.loadLibrary("dbus-c++-1");
System.loadLibrary("samplerate");
System.loadLibrary("codec_ulaw");
System.loadLibrary("codec_alaw");
System.loadLibrary("speexresampler");
System.loadLibrary("sflphone");
}
ManagerImpl managerimpl;
......@@ -45,6 +68,7 @@ public class ManagerImplTest extends AndroidTestCase {
super.setUp();
managerimpl = new ManagerImpl();
managerimpl.initN("");
}
@Override
......@@ -56,4 +80,36 @@ public class ManagerImplTest extends AndroidTestCase {
managerimpl.setAppPath(PACKAGE_NAME);
assertTrue(managerimpl.getAppPath() == PACKAGE_NAME);
}
public void testPlaceCallSuccessful() {
try {
managerimpl.placeCall(ACCOUNT_ID, CALL_ID, CALLING_VALID_IP);
assertTrue(true);
// FIXME: We should have a method returning the call state
// and wait for the call to be in state CURRENT.
Thread.sleep(CALL_SLEEP_TIME);
managerimpl.hangUp(CALL_ID);
assertTrue(true);
} catch (InterruptedException e) {
assertTrue(false);
}
}
public void testPlaceCallBad() {
try {
managerimpl.placeCall(ACCOUNT_ID, CALL_ID, CALLING_BAD_IP);
assertTrue(true);
Thread.sleep(CALL_SLEEP_TIME);
managerimpl.hangUp(CALL_ID);
assertTrue(true);
} catch (InterruptedException e) {
assertTrue(false);
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment