use of org.springframework.jms.support.destination.DestinationResolutionException in project webcert by sklintyg.
the class NotificationServiceImplTest method testIntygSentJmsException.
@Test(expected = JmsException.class)
public void testIntygSentJmsException() throws Exception {
when(utkastRepo.findOne(INTYG_ID)).thenReturn(createUtkast());
doThrow(new DestinationResolutionException("")).when(template).send(any(MessageCreator.class));
try {
notificationService.sendNotificationForIntygSent(INTYG_ID);
} finally {
verify(template).send(any(MessageCreator.class));
verifyZeroInteractions(mockMonitoringLogService);
}
}
use of org.springframework.jms.support.destination.DestinationResolutionException in project webcert by sklintyg.
the class NotificationServiceImplTest method testAnswerRecievedFragaSvarIntegreradEnhetJmsException.
@Test(expected = JmsException.class)
public void testAnswerRecievedFragaSvarIntegreradEnhetJmsException() 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(createFragaSvar());
} finally {
// verify(template).send(any(MessageCreator.class));
// verifyZeroInteractions(mockMonitoringLogService);
}
}
use of org.springframework.jms.support.destination.DestinationResolutionException in project webcert by sklintyg.
the class NotificationServiceImplTest method testDraftCreatedJmsException.
@Test(expected = JmsException.class)
public void testDraftCreatedJmsException() throws Exception {
doThrow(new DestinationResolutionException("")).when(template).send(any(MessageCreator.class));
try {
notificationService.sendNotificationForDraftCreated(createUtkast());
} finally {
verify(template).send(any(MessageCreator.class));
verifyZeroInteractions(mockMonitoringLogService);
}
}
use of org.springframework.jms.support.destination.DestinationResolutionException in project webcert by sklintyg.
the class NotificationServiceImplTest method testSendNotificationForQAsJmsException.
@Test(expected = JmsException.class)
public void testSendNotificationForQAsJmsException() throws Exception {
when(utkastRepo.findOne(INTYG_ID)).thenReturn(createUtkast());
doThrow(new DestinationResolutionException("")).when(template).send(any(MessageCreator.class));
try {
notificationService.sendNotificationForQAs(INTYG_ID, NotificationEvent.QUESTION_FROM_CARE_WITH_ANSWER_HANDLED);
} finally {
verify(template).send(any(MessageCreator.class));
verifyZeroInteractions(mockMonitoringLogService);
}
}
use of org.springframework.jms.support.destination.DestinationResolutionException in project spring-framework by spring-projects.
the class StandardJmsActivationSpecFactory method populateActivationSpecProperties.
/**
* Populate the given ApplicationSpec object with the settings
* defined in the given configuration object.
* <p>This implementation applies all standard JMS settings, but ignores
* "maxConcurrency" and "prefetchSize" - not supported in standard JCA 1.5.
* @param bw the BeanWrapper wrapping the ActivationSpec object
* @param config the configured object holding common JMS settings
*/
protected void populateActivationSpecProperties(BeanWrapper bw, JmsActivationSpecConfig config) {
String destinationName = config.getDestinationName();
if (destinationName != null) {
boolean pubSubDomain = config.isPubSubDomain();
Object destination = destinationName;
if (this.destinationResolver != null) {
try {
destination = this.destinationResolver.resolveDestinationName(null, destinationName, pubSubDomain);
} catch (JMSException ex) {
throw new DestinationResolutionException("Cannot resolve destination name [" + destinationName + "]", ex);
}
}
bw.setPropertyValue("destination", destination);
bw.setPropertyValue("destinationType", pubSubDomain ? Topic.class.getName() : Queue.class.getName());
}
if (bw.isWritableProperty("subscriptionDurability")) {
bw.setPropertyValue("subscriptionDurability", config.isSubscriptionDurable() ? "Durable" : "NonDurable");
} else if (config.isSubscriptionDurable()) {
// Standard JCA 1.5 "subscriptionDurability" apparently not supported...
throw new IllegalArgumentException("Durable subscriptions not supported by underlying provider");
}
if (config.isSubscriptionShared()) {
throw new IllegalArgumentException("Shared subscriptions not supported for JCA-driven endpoints");
}
if (config.getSubscriptionName() != null) {
bw.setPropertyValue("subscriptionName", config.getSubscriptionName());
}
if (config.getClientId() != null) {
bw.setPropertyValue("clientId", config.getClientId());
}
if (config.getMessageSelector() != null) {
bw.setPropertyValue("messageSelector", config.getMessageSelector());
}
applyAcknowledgeMode(bw, config.getAcknowledgeMode());
}
Aggregations