use of jakarta.jms.Session in project spring-framework by spring-projects.
the class DynamicDestinationResolverTests method resolveWithPointToPointVanillaSession.
@Test
public void resolveWithPointToPointVanillaSession() throws Exception {
Queue expectedDestination = new StubQueue();
Session session = mock(Session.class);
given(session.createQueue(DESTINATION_NAME)).willReturn(expectedDestination);
testResolveDestination(session, expectedDestination, false);
}
use of jakarta.jms.Session in project spring-framework by spring-projects.
the class JndiDestinationResolverTests method testDoesNotDelegateToFallbackIfNotResolvedInJndi.
@Test
public void testDoesNotDelegateToFallbackIfNotResolvedInJndi() throws Exception {
final Session session = mock(Session.class);
DestinationResolver dynamicResolver = mock(DestinationResolver.class);
final JndiDestinationResolver resolver = new JndiDestinationResolver() {
@Override
protected <T> T lookup(String jndiName, Class<T> requiredClass) throws NamingException {
throw new NamingException();
}
};
resolver.setDynamicDestinationResolver(dynamicResolver);
assertThatExceptionOfType(DestinationResolutionException.class).isThrownBy(() -> resolver.resolveDestinationName(session, DESTINATION_NAME, true));
}
use of jakarta.jms.Session in project spring-framework by spring-projects.
the class JndiDestinationResolverTests method testDoesNotUseCacheIfCachingIsTurnedOff.
@Test
public void testDoesNotUseCacheIfCachingIsTurnedOff() throws Exception {
Session session = mock(Session.class);
CountingCannedJndiDestinationResolver resolver = new CountingCannedJndiDestinationResolver();
resolver.setCache(false);
Destination destination = resolver.resolveDestinationName(session, DESTINATION_NAME, true);
assertThat(destination).isNotNull();
assertThat(destination).isSameAs(DESTINATION);
assertThat(resolver.getCallCount()).isEqualTo(1);
destination = resolver.resolveDestinationName(session, DESTINATION_NAME, true);
assertThat(destination).isNotNull();
assertThat(destination).isSameAs(DESTINATION);
assertThat(resolver.getCallCount()).isEqualTo(2);
}
use of jakarta.jms.Session in project spring-framework by spring-projects.
the class JndiDestinationResolverTests method testHitsCacheSecondTimeThrough.
@Test
public void testHitsCacheSecondTimeThrough() throws Exception {
Session session = mock(Session.class);
JndiDestinationResolver resolver = new OneTimeLookupJndiDestinationResolver();
Destination destination = resolver.resolveDestinationName(session, DESTINATION_NAME, true);
assertThat(destination).isNotNull();
assertThat(destination).isSameAs(DESTINATION);
}
use of jakarta.jms.Session in project spring-framework by spring-projects.
the class MethodJmsListenerEndpointTests method resolveHeaderAndPayload.
@Test
void resolveHeaderAndPayload() throws JMSException {
MessagingMessageListenerAdapter listener = createDefaultInstance(String.class, int.class);
Session session = mock(Session.class);
StubTextMessage message = createSimpleJmsTextMessage("my payload");
message.setIntProperty("myCounter", 55);
listener.onMessage(message, session);
assertDefaultListenerMethodInvocation();
}
Aggregations