use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxHttpServerSbbTest method getStatusPOSTStringErrorTest.
@Test
public void getStatusPOSTStringErrorTest() {
System.out.println("getStatusPOSTStringErrorTest");
if (!this.cassandraDbInited) {
// Assert.fail("Cassandra DB is not inited");
return;
}
// prepare
ActivityContextInterface aci = new HttpActivityContextInterface();
MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
MockHttpServletRequest request = buildGetMessageIdStatusRequest(METHOD_POST, URL_GET_MESSAGE_ID_STATUS, USER_DEFAULT, PASSWORD_DEFAULT, null, FORMAT_STRING);
event.setRequest(request);
MockHttpServletResponse response = new MockHttpServletResponse();
event.setResponse(response);
// perform the action
this.sbb.onHttpPost(event, aci);
MockHttpServletResponse resp = (MockHttpServletResponse) event.getResponse();
printResponseData(resp);
Assert.assertTrue(isValid(resp, FORMAT_STRING, false), "Response is not valid");
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxHttpServerSbbTest method sendArabicMessageGETJsonSuccessTest.
@Test
public void sendArabicMessageGETJsonSuccessTest() throws UnsupportedEncodingException {
System.out.println("sendArabicMessageGETJsonSuccessTest");
if (!this.cassandraDbInited) {
// Assert.fail("Cassandra DB is not inited");
return;
}
// prepare
ActivityContextInterface aci = new HttpActivityContextInterface();
MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
String urlEncoded = null;
urlEncoded = URLEncoder.encode(MSG_ARABIC, "UTF-8");
MockHttpServletRequest request = buildSendMessageRequest(METHOD_GET, URL_SEND_MESSAGE, USER_DEFAULT, PASSWORD_DEFAULT, urlEncoded, FORMAT_JSON, ENCODING_UCS2, BODY_ENCODING_UTF8, SENDER_ID_DEFAULT, SENDER_TON_DEFAULT, SENDER_NPI_DEFAULT, TO_MULTIPLE);
// request.setContentType("application/x-www-form-urlencoded");
// request.setCharacterEncoding("UTF-8");
event.setRequest(request);
MockHttpServletResponse response = new MockHttpServletResponse();
event.setResponse(response);
// perform the action
this.sbb.onHttpGet(event, aci);
MockHttpServletResponse resp = (MockHttpServletResponse) event.getResponse();
printResponseData(resp);
Assert.assertTrue(isValid(resp, FORMAT_JSON, true, 3), "Response is not valid");
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxHttpServerSbbTest method getStatusGETPasswordNullErrorTest.
@Test
public void getStatusGETPasswordNullErrorTest() {
System.out.println("getStatusGETErrorTest");
if (!this.cassandraDbInited) {
// Assert.fail("Cassandra DB is not inited");
return;
}
// prepare
ActivityContextInterface aci = new HttpActivityContextInterface();
MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
MockHttpServletRequest request = buildGetMessageIdStatusRequest(METHOD_GET, URL_GET_MESSAGE_ID_STATUS, USER_DEFAULT, null, MESSAGE_ID, FORMAT_STRING);
event.setRequest(request);
MockHttpServletResponse response = new MockHttpServletResponse();
event.setResponse(response);
// perform the action
this.sbb.onHttpGet(event, aci);
MockHttpServletResponse resp = (MockHttpServletResponse) event.getResponse();
printResponseData(resp);
Assert.assertEquals(resp.getStatus(), HttpServletResponse.SC_UNAUTHORIZED);
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxHttpServerSbbTest method incorrectToAdressTest.
@Test
public void incorrectToAdressTest() {
System.out.println("incorrectToAdressTest");
if (!this.cassandraDbInited) {
// Assert.fail("Cassandra DB is not inited");
return;
}
// prepare
ActivityContextInterface aci = new HttpActivityContextInterface();
MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
MockHttpServletRequest request = buildSendMessageRequest(METHOD_GET, URL_SEND_MESSAGE, USER_DEFAULT, PASSWORD_DEFAULT, MESSAGE_DEFAULT, FORMAT_JSON, ENCODING_UCS2, BODY_ENCODING_UTF8, SENDER_ID_DEFAULT, SENDER_TON_DEFAULT, SENDER_NPI_DEFAULT, TO_INCORRECT);
event.setRequest(request);
MockHttpServletResponse response = new MockHttpServletResponse();
event.setResponse(response);
// perform the action
this.sbb.onHttpGet(event, aci);
MockHttpServletResponse resp = (MockHttpServletResponse) event.getResponse();
printResponseData(resp);
Assert.assertTrue(isValid(resp, FORMAT_JSON, false), "Response is not valid");
}
use of javax.slee.ActivityContextInterface in project smscgateway by RestComm.
the class TxHttpServerSbbTest method sendMessagePOSTStringWithMessageLinkSuccessTest.
@Test
public void sendMessagePOSTStringWithMessageLinkSuccessTest() {
System.out.println("sendMessagePOSTStringWithMessageLinkSuccessTest");
if (!this.cassandraDbInited) {
// Assert.fail("Cassandra DB is not inited");
return;
}
// prepare
ActivityContextInterface aci = new HttpActivityContextInterface();
MockHttpServletRequestEvent event = new MockHttpServletRequestEvent();
MockHttpServletRequest request = buildSendMessageRequest(METHOD_POST, URL_SEND_MESSAGE, USER_DEFAULT, PASSWORD_DEFAULT, MESSAGE_TEXT_WITH_LINK, FORMAT_STRING, ENCODING_GSM7, BODY_ENCODING_UTF8, SENDER_ID_DEFAULT, SENDER_TON_DEFAULT, SENDER_NPI_DEFAULT, TO_ONE);
event.setRequest(request);
MockHttpServletResponse response = new MockHttpServletResponse();
event.setResponse(response);
// perform the action
this.sbb.onHttpPost(event, aci);
MockHttpServletResponse resp = (MockHttpServletResponse) event.getResponse();
printResponseData(resp);
Assert.assertTrue(isValid(resp, FORMAT_STRING, true, 1), "Response is not valid");
}
Aggregations