use of org.springframework.jms.StubQueue in project spring-framework by spring-projects.
the class DynamicDestinationResolverTests method resolveWithPointToPointQueueSession.
@Test
public void resolveWithPointToPointQueueSession() throws Exception {
Queue expectedDestination = new StubQueue();
Session session = mock(QueueSession.class);
given(session.createQueue(DESTINATION_NAME)).willReturn(expectedDestination);
testResolveDestination(session, expectedDestination, false);
}
use of org.springframework.jms.StubQueue 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 org.springframework.jms.StubQueue in project spring-framework by spring-projects.
the class JmsTransactionManagerTests method testTransactionCommitWithMessageProducer.
@Test
public void testTransactionCommitWithMessageProducer() throws JMSException {
Destination dest = new StubQueue();
ConnectionFactory cf = mock(ConnectionFactory.class);
Connection con = mock(Connection.class);
Session session = mock(Session.class);
MessageProducer producer = mock(MessageProducer.class);
final Message message = mock(Message.class);
given(cf.createConnection()).willReturn(con);
given(con.createSession(true, Session.AUTO_ACKNOWLEDGE)).willReturn(session);
given(session.createProducer(dest)).willReturn(producer);
given(session.getTransacted()).willReturn(true);
JmsTransactionManager tm = new JmsTransactionManager(cf);
TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
JmsTemplate jt = new JmsTemplate(cf);
jt.send(dest, sess -> message);
tm.commit(ts);
verify(producer).send(message);
verify(session).commit();
verify(producer).close();
verify(session).close();
verify(con).close();
}
use of org.springframework.jms.StubQueue in project spring-framework by spring-projects.
the class DefaultJmsActivationSpecFactoryTests method webSphereResourceAdapterSetup.
@Test
public void webSphereResourceAdapterSetup() throws Exception {
Destination destination = new StubQueue();
DestinationResolver destinationResolver = mock(DestinationResolver.class);
given(destinationResolver.resolveDestinationName(null, "destinationname", false)).willReturn(destination);
DefaultJmsActivationSpecFactory activationSpecFactory = new DefaultJmsActivationSpecFactory();
activationSpecFactory.setDestinationResolver(destinationResolver);
StubWebSphereActivationSpecImpl spec = (StubWebSphereActivationSpecImpl) activationSpecFactory.createActivationSpec(new StubWebSphereResourceAdapterImpl(), activationSpecConfig);
assertThat(spec.getDestination()).isEqualTo(destination);
assertThat(spec.getMaxConcurrency()).isEqualTo(5);
assertThat(spec.getMaxBatchSize()).isEqualTo(3);
}
Aggregations