use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.
the class TestSingleRecipReliableMessageMonitorRoute method testSingleRecip_MDNProcessedAndErrorReceived_assertConditionComplete.
@Test
public void testSingleRecip_MDNProcessedAndErrorReceived_assertConditionComplete() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
// send original message
final String originalMessageId = UUID.randomUUID().toString();
Tx originalMessage = TestUtils.makeReliableMessage(TxMessageType.IMF, originalMessageId, "", "gm2552@cerner.com", "gm2552@direct.securehealthemail.com", "", "", "");
template.sendBody("direct:start", originalMessage);
// send MDN processed to original message
Tx mdnMessage = TestUtils.makeReliableMessage(TxMessageType.MDN, UUID.randomUUID().toString(), originalMessageId, "gm2552@direct.securehealthemail.com", "gm2552@cerner.com", "gm2552@direct.securehealthemail.com", "", MDNStandard.Disposition_Processed);
template.sendBody("direct:start", mdnMessage);
// send MDN error to original message
mdnMessage = TestUtils.makeReliableMessage(TxMessageType.MDN, UUID.randomUUID().toString(), originalMessageId, "gm2552@direct.securehealthemail.com", "gm2552@cerner.com", "gm2552@direct.securehealthemail.com", "", MDNStandard.Disposition_Error);
template.sendBody("direct:start", mdnMessage);
List<Exchange> exchanges = mock.getReceivedExchanges();
assertEquals(1, exchanges.size());
}
use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.
the class TestSingleRecipReliableMessageMonitorRoute method testSingleRecip_DSNErroReceived_assertConditionComplete.
@Test
public void testSingleRecip_DSNErroReceived_assertConditionComplete() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
// send original message
final String originalMessageId = UUID.randomUUID().toString();
Tx originalMessage = TestUtils.makeReliableMessage(TxMessageType.IMF, originalMessageId, "", "gm2552@cerner.com", "gm2552@direct.securehealthemail.com", "", "", "");
template.sendBody("direct:start", originalMessage);
// send MDN error to original message
Tx mdnMessage = TestUtils.makeReliableMessage(TxMessageType.DSN, UUID.randomUUID().toString(), originalMessageId, "gm2552@direct.securehealthemail.com", "gm2552@cerner.com", "gm2552@direct.securehealthemail.com", DSNStandard.DSNAction.FAILED.toString(), "");
template.sendBody("direct:start", mdnMessage);
List<Exchange> exchanges = mock.getReceivedExchanges();
assertEquals(1, exchanges.size());
}
use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.
the class TestSingleRecipReliableMessageMonitorRoute method testSingleRecip_MDNProcessedAndDisplayedReceived_assertConditionNotComplete.
@Test
public void testSingleRecip_MDNProcessedAndDisplayedReceived_assertConditionNotComplete() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
// send original message
final String originalMessageId = UUID.randomUUID().toString();
Tx originalMessage = TestUtils.makeReliableMessage(TxMessageType.IMF, originalMessageId, "", "gm2552@cerner.com", "gm2552@direct.securehealthemail.com", "", "", "");
template.sendBody("direct:start", originalMessage);
// send MDN processed to original message
Tx mdnMessage = TestUtils.makeReliableMessage(TxMessageType.MDN, UUID.randomUUID().toString(), originalMessageId, "gm2552@direct.securehealthemail.com", "gm2552@cerner.com", "gm2552@direct.securehealthemail.com", "", MDNStandard.Disposition_Processed);
template.sendBody("direct:start", mdnMessage);
// send MDN dispatched to original message
mdnMessage = TestUtils.makeReliableMessage(TxMessageType.MDN, UUID.randomUUID().toString(), originalMessageId, "gm2552@direct.securehealthemail.com", "gm2552@cerner.com", "gm2552@direct.securehealthemail.com", "", MDNStandard.Disposition_Displayed);
template.sendBody("direct:start", mdnMessage);
List<Exchange> exchanges = mock.getReceivedExchanges();
assertEquals(0, exchanges.size());
}
use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.
the class TxResource_suppressNotificationTest method testSuppressNotification_suppressFalse_assertFalseAnd200StatusCode.
@Test
public void testSuppressNotification_suppressFalse_assertFalseAnd200StatusCode() {
Tx tx = mock(Tx.class);
DuplicateNotificationStateManager dupMgr = mock(DuplicateNotificationStateManager.class);
TxsResource resource = new TxsResource(null, dupMgr);
Response res = resource.supressNotification(tx);
assertEquals(200, res.getStatus());
assertFalse((Boolean) res.getEntity());
}
use of org.nhindirect.common.tx.model.Tx in project nhin-d by DirectProject.
the class TxResource_suppressNotificationTest method testSuppressNotification_nullDAO_assertExcecption.
@Test
public void testSuppressNotification_nullDAO_assertExcecption() {
Tx tx = mock(Tx.class);
TxsResource resource = new TxsResource(null, null);
boolean exceptionOccured = false;
try {
resource.supressNotification(tx);
} catch (IllegalStateException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
Aggregations