use of com.adaptris.core.DefaultMessageFactory in project interlok by adaptris.
the class MetadataStatusProviderTest method testGetStatus_MissingMetadata.
@Test
public void testGetStatus_MissingMetadata() {
MetadataStatusProvider prov = new MetadataStatusProvider("httpStatus");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
assertEquals(HttpURLConnection.HTTP_INTERNAL_ERROR, prov.getStatus(msg).getCode());
assertEquals("Internal Server Error", prov.getStatus(msg).getText());
}
use of com.adaptris.core.DefaultMessageFactory in project interlok by adaptris.
the class MetadataStatusProviderTest method testGetStatus_WithText.
@Test
public void testGetStatus_WithText() {
MetadataStatusProvider prov = new MetadataStatusProvider("httpStatus", "httpStatusText");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
msg.addMetadata("httpStatus", "200");
msg.addMetadata("httpStatusText", "Really Not OK");
assertEquals(HttpURLConnection.HTTP_OK, prov.getStatus(msg).getCode());
assertNotSame("OK", prov.getStatus(msg).getText());
assertEquals("Really Not OK", prov.getStatus(msg).getText());
}
use of com.adaptris.core.DefaultMessageFactory in project interlok by adaptris.
the class RawContentTypeProviderTest method testGetContentType.
@Test
public void testGetContentType() throws Exception {
RawContentTypeProvider provider = new RawContentTypeProvider("%message{" + testName.getMethodName() + "}");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
msg.addMetadata(testName.getMethodName(), "text/complicated");
String contentType = provider.getContentType(msg);
assertEquals("text/complicated", contentType);
}
use of com.adaptris.core.DefaultMessageFactory in project interlok by adaptris.
the class RawStatusProviderTest method testGetStatus.
@Test
public void testGetStatus() {
RawStatusProvider prov = new RawStatusProvider(HttpStatus.OK_200.getStatusCode());
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
assertEquals(200, prov.getStatus(msg).getCode());
assertEquals("OK", prov.getStatus(msg).getText());
}
use of com.adaptris.core.DefaultMessageFactory in project interlok by adaptris.
the class RawStatusProviderTest method testGetStatus_WithText.
@Test
public void testGetStatus_WithText() {
RawStatusProvider prov = new RawStatusProvider(HttpURLConnection.HTTP_ACCEPTED);
prov.setText("Really Not OK");
AdaptrisMessage msg = new DefaultMessageFactory().newMessage("");
assertEquals(HttpURLConnection.HTTP_ACCEPTED, prov.getStatus(msg).getCode());
assertNotSame("OK", prov.getStatus(msg).getText());
assertEquals("Really Not OK", prov.getStatus(msg).getText());
}
Aggregations