NO-JIRA add user/pass as part of junit rule
This commit is contained in:
parent
c2c2ce0a47
commit
407f63cf3a
|
@ -37,6 +37,14 @@ public abstract class AbstractActiveMQClientResource extends ExternalResource {
|
|||
ServerLocator serverLocator;
|
||||
ClientSessionFactory sessionFactory;
|
||||
ClientSession session;
|
||||
String username;
|
||||
String password;
|
||||
|
||||
public AbstractActiveMQClientResource(String url, String username, String password) {
|
||||
this(url);
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public AbstractActiveMQClientResource(String url) {
|
||||
if (url == null) {
|
||||
|
@ -50,6 +58,12 @@ public abstract class AbstractActiveMQClientResource extends ExternalResource {
|
|||
}
|
||||
}
|
||||
|
||||
public AbstractActiveMQClientResource(ServerLocator serverLocator, String username, String password) {
|
||||
this(serverLocator);
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public AbstractActiveMQClientResource(ServerLocator serverLocator) {
|
||||
if (serverLocator == null) {
|
||||
throw new IllegalArgumentException(String.format("Error creating %s - ServerLocator cannot be null", this.getClass().getSimpleName()));
|
||||
|
@ -88,7 +102,7 @@ public abstract class AbstractActiveMQClientResource extends ExternalResource {
|
|||
log.info("Starting {}", this.getClass().getSimpleName());
|
||||
try {
|
||||
sessionFactory = serverLocator.createSessionFactory();
|
||||
session = sessionFactory.createSession();
|
||||
session = sessionFactory.createSession(username, password, false, true, true, serverLocator.isPreAcknowledge(), serverLocator.getAckBatchSize());
|
||||
} catch (RuntimeException runtimeEx) {
|
||||
throw runtimeEx;
|
||||
} catch (Exception ex) {
|
||||
|
|
|
@ -50,21 +50,37 @@ public class ActiveMQConsumerResource extends AbstractActiveMQClientResource {
|
|||
ClientConsumer consumer;
|
||||
|
||||
public ActiveMQConsumerResource(String url, String queueName) {
|
||||
this(url, SimpleString.toSimpleString(queueName));
|
||||
this(url, SimpleString.toSimpleString(queueName), null, null);
|
||||
}
|
||||
|
||||
public ActiveMQConsumerResource(String url, String queueName, String username, String password) {
|
||||
this(url, SimpleString.toSimpleString(queueName), username, password);
|
||||
}
|
||||
|
||||
public ActiveMQConsumerResource(String url, SimpleString queueName, String username, String password) {
|
||||
super(url, username, password);
|
||||
this.queueName = queueName;
|
||||
}
|
||||
|
||||
public ActiveMQConsumerResource(String url, SimpleString queueName) {
|
||||
super(url);
|
||||
this.queueName = queueName;
|
||||
this(url, queueName, null, null);
|
||||
}
|
||||
|
||||
public ActiveMQConsumerResource(ServerLocator serverLocator, String queueName, String username, String password) {
|
||||
this(serverLocator, SimpleString.toSimpleString(queueName), username, password);
|
||||
}
|
||||
|
||||
public ActiveMQConsumerResource(ServerLocator serverLocator, String queueName) {
|
||||
this(serverLocator, SimpleString.toSimpleString(queueName));
|
||||
this(serverLocator, SimpleString.toSimpleString(queueName), null, null);
|
||||
}
|
||||
|
||||
public ActiveMQConsumerResource(ServerLocator serverLocator, SimpleString queueName, String username, String password) {
|
||||
super(serverLocator, username, password);
|
||||
this.queueName = queueName;
|
||||
}
|
||||
|
||||
public ActiveMQConsumerResource(ServerLocator serverLocator, SimpleString queueName) {
|
||||
super(serverLocator);
|
||||
this.queueName = queueName;
|
||||
this(serverLocator, queueName, null, null);
|
||||
}
|
||||
|
||||
public long getDefaultReceiveTimeout() {
|
||||
|
|
|
@ -44,18 +44,34 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
|
|||
*/
|
||||
public class ActiveMQDynamicProducerResource extends ActiveMQProducerResource {
|
||||
|
||||
public ActiveMQDynamicProducerResource(String url, String username, String password) {
|
||||
super(url, username, password);
|
||||
}
|
||||
|
||||
public ActiveMQDynamicProducerResource(String url) {
|
||||
super(url);
|
||||
}
|
||||
|
||||
public ActiveMQDynamicProducerResource(ServerLocator serverLocator, String username, String password) {
|
||||
super(serverLocator, username, password);
|
||||
}
|
||||
|
||||
public ActiveMQDynamicProducerResource(ServerLocator serverLocator) {
|
||||
super(serverLocator);
|
||||
}
|
||||
|
||||
public ActiveMQDynamicProducerResource(String url, SimpleString address, String username, String password) {
|
||||
super(url, address, username, password);
|
||||
}
|
||||
|
||||
public ActiveMQDynamicProducerResource(String url, SimpleString address) {
|
||||
super(url, address);
|
||||
}
|
||||
|
||||
public ActiveMQDynamicProducerResource(ServerLocator serverLocator, SimpleString address, String username, String password) {
|
||||
super(serverLocator, address, username, password);
|
||||
}
|
||||
|
||||
public ActiveMQDynamicProducerResource(ServerLocator serverLocator, SimpleString address) {
|
||||
super(serverLocator, address);
|
||||
}
|
||||
|
|
|
@ -49,38 +49,62 @@ public class ActiveMQProducerResource extends AbstractActiveMQClientResource {
|
|||
SimpleString address = null;
|
||||
ClientProducer producer;
|
||||
|
||||
protected ActiveMQProducerResource(String url, String username, String password) {
|
||||
super(url, username, password);
|
||||
}
|
||||
|
||||
protected ActiveMQProducerResource(String url) {
|
||||
super(url);
|
||||
}
|
||||
|
||||
protected ActiveMQProducerResource(ServerLocator serverLocator, String username, String password) {
|
||||
super(serverLocator, username, password);
|
||||
}
|
||||
|
||||
protected ActiveMQProducerResource(ServerLocator serverLocator) {
|
||||
super(serverLocator);
|
||||
}
|
||||
|
||||
public ActiveMQProducerResource(String url, String address) {
|
||||
this(url, SimpleString.toSimpleString(address));
|
||||
public ActiveMQProducerResource(String url, String address, String username, String password) {
|
||||
this(url, SimpleString.toSimpleString(address), username, password);
|
||||
}
|
||||
|
||||
public ActiveMQProducerResource(String url, SimpleString address) {
|
||||
super(url);
|
||||
public ActiveMQProducerResource(String url, String address) {
|
||||
this(url, address, null, null);
|
||||
}
|
||||
|
||||
public ActiveMQProducerResource(String url, SimpleString address, String username, String password) {
|
||||
super(url, username, password);
|
||||
if (address == null) {
|
||||
throw new IllegalArgumentException(String.format("%s construction error - address cannot be null", this.getClass().getSimpleName()));
|
||||
}
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public ActiveMQProducerResource(String url, SimpleString address) {
|
||||
this(url, address, null, null);
|
||||
}
|
||||
|
||||
public ActiveMQProducerResource(ServerLocator serverLocator, String address, String username, String password) {
|
||||
this(serverLocator, SimpleString.toSimpleString(address), username, password);
|
||||
}
|
||||
|
||||
public ActiveMQProducerResource(ServerLocator serverLocator, String address) {
|
||||
this(serverLocator, SimpleString.toSimpleString(address));
|
||||
}
|
||||
|
||||
public ActiveMQProducerResource(ServerLocator serverLocator, SimpleString address) {
|
||||
super(serverLocator);
|
||||
public ActiveMQProducerResource(ServerLocator serverLocator, SimpleString address, String username, String password) {
|
||||
super(serverLocator, username, password);
|
||||
if (address == null) {
|
||||
throw new IllegalArgumentException(String.format("%s construction error - address cannot be null", this.getClass().getSimpleName()));
|
||||
}
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public ActiveMQProducerResource(ServerLocator serverLocator, SimpleString address) {
|
||||
this(serverLocator, address, null, null);
|
||||
}
|
||||
|
||||
public boolean isUseDurableMessage() {
|
||||
return useDurableMessage;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue