- priority: 5 --> 8
An abstraction of SIP MESSAGE would be very nice. Right now IM tests
are very granular. I would be nice with something like:
// [first we register, i'll skip this part since the level of
abstraction is very nice already]
ub.listenRequestMessage(); // start the listener
// send a MESSAGE to alice, wait 15 sec for the 200 OK
String content = "Hello Alice";
SipTransaction tx = ua.sendMessage(content", "sip:alice@mydomain.com", 15000);
// wait 15 seconds for a sip MESSAGE from ua
RequestEvent event = ub.waitRequest(15000);
// [would be nice if create response is accessible directly from the
SipPhone instead of having to go to the message factory]
Response response = ub.createResponse(Response.OK, event.getRequest());
// [save us from having to to
response.addHeader(ub.getParent.getHeaderFactory().createContactHeader(ua.getAddress()));
ub.sendMessageReply(event, response, ua.getAddress());
assertLastOperationSuccess(ub.format(), ub);
// wait 10 sec on the 200 OK
ua.waitResponse(tx, 10000);
// Check that we got 200 OK back, not sure what "last operation would
be so an alternative would be
assertMessageSentSuccessfully(ua.format(), ua);
assertLastOperationSuccess("Failed to reach the other phone: " +
ua.format(), ua);
// [an additional test method saves us from having to deal with
TimeoutEvent, checking the ResponseEvent, and getting the response
from there]
assertMessageReceived("Did not get the message", event);
// Check that the message came through unaltered.
assertEquals("Message content mismatch", content,
event.getRequest().getContent());