mirror of
https://github.com/apache/nifi.git
synced 2025-02-07 18:48:51 +00:00
Changed some unit tests to Integration Tests because they are creating embedded JMS Brokers (implicitly) and commnicating with it. This becomes brittle in a full build, especially if any other unit test attempts to create a broker implicitly due to the way that the activemq broker implicit creation works.
This commit is contained in:
parent
ada069ce42
commit
3f0aa6e13c
@ -16,41 +16,15 @@
|
||||
*/
|
||||
package org.apache.nifi.jms.processors;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
import javax.jms.ConnectionFactory;
|
||||
import javax.jms.Session;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.nifi.processor.Processor;
|
||||
import org.junit.Test;
|
||||
import org.springframework.jms.connection.CachingConnectionFactory;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
|
||||
public class CommonTest {
|
||||
|
||||
@Test
|
||||
public void validateServiceIsLocatableViaServiceLoader() {
|
||||
ServiceLoader<Processor> loader = ServiceLoader.<Processor> load(Processor.class);
|
||||
Iterator<Processor> iter = loader.iterator();
|
||||
boolean pubJmsPresent = false;
|
||||
boolean consumeJmsPresent = false;
|
||||
while (iter.hasNext()) {
|
||||
Processor p = iter.next();
|
||||
if (p.getClass().getSimpleName().equals(PublishJMS.class.getSimpleName())) {
|
||||
pubJmsPresent = true;
|
||||
} else if (p.getClass().getSimpleName().equals(ConsumeJMS.class.getSimpleName())) {
|
||||
consumeJmsPresent = true;
|
||||
}
|
||||
|
||||
}
|
||||
assertTrue(pubJmsPresent);
|
||||
assertTrue(consumeJmsPresent);
|
||||
}
|
||||
|
||||
static JmsTemplate buildJmsTemplateForDestination(boolean pubSub) {
|
||||
ConnectionFactory activeMqConnectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
|
||||
final ConnectionFactory connectionFactory = new CachingConnectionFactory(activeMqConnectionFactory);
|
||||
|
@ -33,7 +33,7 @@ import org.springframework.jms.connection.CachingConnectionFactory;
|
||||
import org.springframework.jms.core.JmsTemplate;
|
||||
import org.springframework.jms.support.JmsHeaders;
|
||||
|
||||
public class ConsumeJMSTest {
|
||||
public class ConsumeJMSIT {
|
||||
|
||||
@Test
|
||||
public void validateSuccessfulConsumeAndTransferToSuccess() throws Exception {
|
@ -39,7 +39,7 @@ import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class PublishJMSTest {
|
||||
public class PublishJMSIT {
|
||||
|
||||
@Test(timeout = 10000)
|
||||
public void validateSuccessfulPublishAndTransferToSuccess() throws Exception {
|
Loading…
x
Reference in New Issue
Block a user