Search in sources :

Example 1 with DuplicateNotificationStateManager

use of org.nhindirect.monitor.processor.DuplicateNotificationStateManager in project nhin-d by DirectProject.

the class TxResource_suppressNotificationTest method testSuppressNotification_mgrException_assert500StatusCode.

@Test
public void testSuppressNotification_mgrException_assert500StatusCode() throws Exception {
    Tx tx = mock(Tx.class);
    DuplicateNotificationStateManager dupMgr = mock(DuplicateNotificationStateManager.class);
    when(dupMgr.suppressNotification(tx)).thenThrow(new DuplicateNotificationStateManagerException());
    TxsResource resource = new TxsResource(null, dupMgr);
    Response res = resource.supressNotification(tx);
    assertEquals(500, res.getStatus());
}
Also used : Response(javax.ws.rs.core.Response) DuplicateNotificationStateManager(org.nhindirect.monitor.processor.DuplicateNotificationStateManager) Tx(org.nhindirect.common.tx.model.Tx) DuplicateNotificationStateManagerException(org.nhindirect.monitor.processor.DuplicateNotificationStateManagerException) Test(org.junit.Test)

Example 2 with DuplicateNotificationStateManager

use of org.nhindirect.monitor.processor.DuplicateNotificationStateManager 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());
}
Also used : Response(javax.ws.rs.core.Response) DuplicateNotificationStateManager(org.nhindirect.monitor.processor.DuplicateNotificationStateManager) Tx(org.nhindirect.common.tx.model.Tx) Test(org.junit.Test)

Example 3 with DuplicateNotificationStateManager

use of org.nhindirect.monitor.processor.DuplicateNotificationStateManager in project nhin-d by DirectProject.

the class TxResource_suppressNotificationTest method testSuppressNotification_suppressTrue_assertTrueAnd200StatusCode.

@Test
public void testSuppressNotification_suppressTrue_assertTrueAnd200StatusCode() throws Exception {
    Tx tx = mock(Tx.class);
    DuplicateNotificationStateManager dupMgr = mock(DuplicateNotificationStateManager.class);
    when(dupMgr.suppressNotification(tx)).thenReturn(true);
    TxsResource resource = new TxsResource(null, dupMgr);
    Response res = resource.supressNotification(tx);
    assertEquals(200, res.getStatus());
    assertTrue((Boolean) res.getEntity());
}
Also used : Response(javax.ws.rs.core.Response) DuplicateNotificationStateManager(org.nhindirect.monitor.processor.DuplicateNotificationStateManager) Tx(org.nhindirect.common.tx.model.Tx) Test(org.junit.Test)

Example 4 with DuplicateNotificationStateManager

use of org.nhindirect.monitor.processor.DuplicateNotificationStateManager in project nhin-d by DirectProject.

the class TxsResource_constructTest method testConstruct_nonNullProducer.

@Test
public void testConstruct_nonNullProducer() {
    ProducerTemplate template = mock(ProducerTemplate.class);
    DuplicateNotificationStateManager dupMgr = mock(DuplicateNotificationStateManager.class);
    TxsResource resource = new TxsResource(template, dupMgr);
    assertEquals(template, resource.template);
    assertEquals(dupMgr, resource.dupStateManager);
}
Also used : ProducerTemplate(org.apache.camel.ProducerTemplate) DuplicateNotificationStateManager(org.nhindirect.monitor.processor.DuplicateNotificationStateManager) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 DuplicateNotificationStateManager (org.nhindirect.monitor.processor.DuplicateNotificationStateManager)4 Response (javax.ws.rs.core.Response)3 Tx (org.nhindirect.common.tx.model.Tx)3 ProducerTemplate (org.apache.camel.ProducerTemplate)1 DuplicateNotificationStateManagerException (org.nhindirect.monitor.processor.DuplicateNotificationStateManagerException)1