Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use username/password authentication to test IBM MQ in the integration tests #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ public class AbstractJMSContextIT {

private static final String QMGR_NAME = "MYQMGR";
private static final String CHANNEL_NAME = "DEV.APP.SVRCONN";
protected static final String APP_PASSWORD = "MySuperSecretPassword";
private static final String ADMIN_PASSWORD = "MyAdminPassword";

@ClassRule
public static GenericContainer<?> mqContainer = new GenericContainer<>("icr.io/ibm-messaging/mq:latest")
.withEnv("LICENSE", "accept")
.withEnv("MQ_QMGR_NAME", QMGR_NAME)
.withEnv("MQ_APP_PASSWORD", APP_PASSWORD)
.withEnv("MQ_ADMIN_PASSWORD", ADMIN_PASSWORD)
.withEnv("MQ_ENABLE_EMBEDDED_WEB_SERVER", "false")
.withExposedPorts(1414);

Expand All @@ -72,7 +76,7 @@ public JMSContext getJmsContext() throws Exception {
mqcf.setQueueManager(QMGR_NAME);
mqcf.setConnectionNameList(getConnectionName());

jmsContext = mqcf.createContext();
jmsContext = mqcf.createContext("app", APP_PASSWORD);
}

return jmsContext;
Expand Down Expand Up @@ -127,7 +131,8 @@ public void putAllMessagesToQueue(final String queueName, final List<Message> me
cf.setStringProperty(WMQConstants.WMQ_CHANNEL, getChannelName());
cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, getQmgrName());
cf.setBooleanProperty(WMQConstants.USER_AUTHENTICATION_MQCSP, false);
cf.setStringProperty(WMQConstants.USERID, "app");
cf.setStringProperty(WMQConstants.PASSWORD, APP_PASSWORD);

connection = cf.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Expand Down Expand Up @@ -163,7 +168,8 @@ public List<Message> getAllMessagesFromQueue(final String queueName) throws JMSE
cf.setStringProperty(WMQConstants.WMQ_CHANNEL, getChannelName());
cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
cf.setStringProperty(WMQConstants.WMQ_QUEUE_MANAGER, getQmgrName());
cf.setBooleanProperty(WMQConstants.USER_AUTHENTICATION_MQCSP, false);
cf.setStringProperty(WMQConstants.USERID, "app");
cf.setStringProperty(WMQConstants.PASSWORD, APP_PASSWORD);

connection = cf.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ private Map<String, String> createDefaultConnectorProperties() {
props.put("mq.channel.name", getChannelName());
props.put("mq.queue", MQ_QUEUE);
props.put("mq.user.authentication.mqcsp", "false");
props.put("mq.user.name", "app");
props.put("mq.password", APP_PASSWORD);
props.put("mq.user.authentication.mqcsp", "true");
return props;
}

Expand Down
Loading