org.springframework.jms.StubQueue Java Examples

The following examples show how to use org.springframework.jms.StubQueue. 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
Source File: DefaultJmsActivationSpecFactoryTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@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
Source File: DefaultJmsActivationSpecFactoryTests.java    From java-technology-stack with MIT License 6 votes vote down vote up
@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
Source File: DefaultJmsActivationSpecFactoryTests.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
@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
Source File: DynamicDestinationResolverTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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
Source File: DynamicDestinationResolverTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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 File: JmsTransactionManagerTests.java    From spring-analysis-note with 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
Source File: DynamicDestinationResolverTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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
Source File: DynamicDestinationResolverTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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
Source File: DynamicDestinationResolverTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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
Source File: DynamicDestinationResolverTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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);
}