Java Code Examples for org.springframework.jms.StubQueue

The following examples show how to use org.springframework.jms.StubQueue. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@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);

	assertEquals(destination, spec.getDestination());
	assertEquals(5, spec.getMaxConcurrency());
	assertEquals(3, spec.getMaxBatchSize());
}
 
Example 2
@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);

	assertEquals(destination, spec.getDestination());
	assertEquals(5, spec.getMaxConcurrency());
	assertEquals(3, spec.getMaxBatchSize());
}
 
Example 3
@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);

	assertEquals(destination, spec.getDestination());
	assertEquals(5, spec.getMaxConcurrency());
	assertEquals(3, spec.getMaxBatchSize());
}
 
Example 4
@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);
}
 
Example 5
@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);
}
 
Example 6
Source Project: spring-analysis-note   Source File: JmsTransactionManagerTests.java    License: MIT License 5 votes vote down vote up
@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();
}
 
Example 7
@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);
}
 
Example 8
@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);
}
 
Example 9
@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);
}
 
Example 10
@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);
}