Search in sources :

Example 6 with DestinationResolutionException

use of org.springframework.jms.support.destination.DestinationResolutionException in project webcert by sklintyg.

the class LogServiceImplTest method logServiceJmsException.

@Test(expected = JmsException.class)
public void logServiceJmsException() throws Exception {
    when(userService.getUser()).thenReturn(createUser());
    doThrow(new DestinationResolutionException("")).when(template).send(any(MessageCreator.class));
    LogRequest logRequest = new LogRequest();
    logRequest.setIntygId("abc123");
    logRequest.setPatientId(createPnr("19121212-1212"));
    logRequest.setPatientName("Hans Olof van der Test");
    try {
        logService.logReadIntyg(logRequest);
    } finally {
        verify(template, times(1)).send(any(MessageCreator.class));
    }
}
Also used : LogRequest(se.inera.intyg.webcert.web.service.log.dto.LogRequest) DestinationResolutionException(org.springframework.jms.support.destination.DestinationResolutionException) MessageCreator(org.springframework.jms.core.MessageCreator) Test(org.junit.Test)

Example 7 with DestinationResolutionException

use of org.springframework.jms.support.destination.DestinationResolutionException in project webcert by sklintyg.

the class NotificationServiceImplTest method testIntygRevokedJmsException.

@Test(expected = JmsException.class)
public void testIntygRevokedJmsException() throws Exception {
    when(utkastRepo.findOne(INTYG_ID)).thenReturn(createUtkast());
    doThrow(new DestinationResolutionException("")).when(template).send(any(MessageCreator.class));
    try {
        notificationService.sendNotificationForIntygRevoked(INTYG_ID);
    } finally {
    // verify(template).send(any(MessageCreator.class));
    // verifyZeroInteractions(mockMonitoringLogService);
    }
}
Also used : DestinationResolutionException(org.springframework.jms.support.destination.DestinationResolutionException) MessageCreator(org.springframework.jms.core.MessageCreator) Test(org.junit.Test)

Example 8 with DestinationResolutionException

use of org.springframework.jms.support.destination.DestinationResolutionException in project webcert by sklintyg.

the class NotificationServiceImplTest method testAnswerRecievedArendeIntegreradEnhetJmsException.

@Test(expected = JmsException.class)
public void testAnswerRecievedArendeIntegreradEnhetJmsException() throws Exception {
    when(integreradeEnheterRegistry.isEnhetIntegrerad(ENHET_ID, INTYG_TYP_FK)).thenReturn(true);
    when(utkastRepo.findOne(INTYG_ID)).thenReturn(createUtkast());
    doThrow(new DestinationResolutionException("")).when(template).send(any(MessageCreator.class));
    try {
        notificationService.sendNotificationForAnswerRecieved(createArende());
    } finally {
        verify(template).send(any(MessageCreator.class));
        verifyZeroInteractions(mockMonitoringLogService);
    }
}
Also used : DestinationResolutionException(org.springframework.jms.support.destination.DestinationResolutionException) MessageCreator(org.springframework.jms.core.MessageCreator) Test(org.junit.Test)

Example 9 with DestinationResolutionException

use of org.springframework.jms.support.destination.DestinationResolutionException in project webcert by sklintyg.

the class NotificationServiceImplTest method testQuestionReceivedFragaSvarIntegreradEnhetJmsException.

@Test(expected = JmsException.class)
public void testQuestionReceivedFragaSvarIntegreradEnhetJmsException() throws Exception {
    when(integreradeEnheterRegistry.isEnhetIntegrerad(ENHET_ID, INTYG_TYP_FK)).thenReturn(true);
    when(utkastRepo.findOne(INTYG_ID)).thenReturn(createUtkast());
    doThrow(new DestinationResolutionException("")).when(template).send(any(MessageCreator.class));
    try {
        notificationService.sendNotificationForQuestionReceived(createFragaSvar());
    } finally {
        verify(template).send(any(MessageCreator.class));
        verifyZeroInteractions(mockMonitoringLogService);
    }
}
Also used : DestinationResolutionException(org.springframework.jms.support.destination.DestinationResolutionException) MessageCreator(org.springframework.jms.core.MessageCreator) Test(org.junit.Test)

Example 10 with DestinationResolutionException

use of org.springframework.jms.support.destination.DestinationResolutionException in project webcert by sklintyg.

the class NotificationServiceImplTest method testQuestionReceivedArendeIntegreradEnhetJmsException.

@Test(expected = JmsException.class)
public void testQuestionReceivedArendeIntegreradEnhetJmsException() throws Exception {
    when(integreradeEnheterRegistry.isEnhetIntegrerad(ENHET_ID, INTYG_TYP_FK)).thenReturn(true);
    when(utkastRepo.findOne(INTYG_ID)).thenReturn(createUtkast());
    doThrow(new DestinationResolutionException("")).when(template).send(any(MessageCreator.class));
    try {
        notificationService.sendNotificationForQuestionReceived(createArende());
    } finally {
        verify(template).send(any(MessageCreator.class));
        verifyZeroInteractions(mockMonitoringLogService);
    }
}
Also used : DestinationResolutionException(org.springframework.jms.support.destination.DestinationResolutionException) MessageCreator(org.springframework.jms.core.MessageCreator) Test(org.junit.Test)

Aggregations

DestinationResolutionException (org.springframework.jms.support.destination.DestinationResolutionException)13 Test (org.junit.Test)12 MessageCreator (org.springframework.jms.core.MessageCreator)12 JMSException (jakarta.jms.JMSException)1 LogRequest (se.inera.intyg.webcert.web.service.log.dto.LogRequest)1