use of nl.teslanet.mule.connectors.coap.test.utils.MuleEventSpy in project mule-coap-connector by teslanet-nl.
the class AbstractInboundPropertyTestcase method spyMessage.
/**
* Create spy to assert the inbound property
* @param propertyName name of the property to inspect
* @throws Exception
*/
private MuleEventSpy spyMessage() throws Exception {
MuleEventSpy spy = new MuleEventSpy(getPropertyName(), getPropertyName(), getReplacementValue());
spy.clear();
return spy;
}
use of nl.teslanet.mule.connectors.coap.test.utils.MuleEventSpy in project mule-coap-connector by teslanet-nl.
the class AbstractInboundPropertyTestcase method testInbound.
/**
* Test inbound property
* @throws Exception
*/
@Test(timeout = 20000L)
public void testInbound() throws Exception {
MuleEventSpy spy = spyMessage();
Request request = new Request(requestCode);
// set URI explicitly otherwise uri-options could get overwritten
request.setURI(client.getURI());
if (unintendedPayload)
request.setUnintendedPayload();
addOption(request.setPayload("<nothing_important/>").getOptions());
client.setTimeout(20000L);
CoapResponse response = client.advanced(request);
assertNotNull("no response", response);
assertTrue("response indicates failure", response.isSuccess());
assertSpy(spy, getExpectedPropertyValue());
}
use of nl.teslanet.mule.connectors.coap.test.utils.MuleEventSpy in project mule-coap-connector by teslanet-nl.
the class PayloadTest method testOutboundRequest.
@Test(timeout = 20000L)
public void testOutboundRequest() throws URISyntaxException, ConnectorException, IOException {
// mockResponseMessage();
MuleEventSpy spy = new MuleEventSpy(spyId, null, Data.getContent(contentSize));
spy.clear();
Request request = new Request(requestCode);
if (unintendedPayload)
request.setUnintendedPayload();
request.setPayload("nothing important");
CoapResponse response = client.advanced(request);
validateOutboundResponse(response, spy);
}
use of nl.teslanet.mule.connectors.coap.test.utils.MuleEventSpy in project mule-coap-connector by teslanet-nl.
the class PayloadTest method testInboundRequestEarlyNegotiation.
@Test(timeout = 20000L)
public void testInboundRequestEarlyNegotiation() throws Exception {
// spyRequestMessage();
MuleEventSpy spy = new MuleEventSpy(spyId);
spy.clear();
client.useEarlyNegotiation(32);
Request request = new Request(requestCode);
if (unintendedPayload)
request.setUnintendedPayload();
request.setPayload(Data.getContent(contentSize));
CoapResponse response = client.advanced(request);
validateInboundResponse(response, spy);
}
use of nl.teslanet.mule.connectors.coap.test.utils.MuleEventSpy in project mule-coap-connector by teslanet-nl.
the class PayloadTest method testInboundRequest.
@Test(timeout = 20000L)
public void testInboundRequest() throws Exception {
// spyRequestMessage();
MuleEventSpy spy = new MuleEventSpy(spyId);
spy.clear();
// spyActivated.set( false );
client.useLateNegotiation();
Request request = new Request(requestCode);
if (unintendedPayload)
request.setUnintendedPayload();
request.setPayload(Data.getContent(contentSize));
CoapResponse response = client.advanced(request);
validateInboundResponse(response, spy);
}
Aggregations