Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -127,6 +127,42 @@ public void verifyStringMessages() throws JMSException {
assertEquals("world", messagesInMQ.get(1).getBody(String.class));
}

@Test
public void verifyCipherMappingsConfig() throws JMSException {
final MQSinkTask newConnectTask = new MQSinkTask();

// configure a sink task for validating config
final Map<String, String> connectorConfigProps = createDefaultConnectorProperties();
connectorConfigProps.put("mq.message.builder",
DEFAULT_MESSAGE_BUILDER);

connectorConfigProps.put("mq.ssl.use.ibm.cipher.mappings",
"true");

// start the task so that it connects to MQ
newConnectTask.start(connectorConfigProps);

// Check if the config reflects the change
String cipherMappingProp = System.getProperty("com.ibm.mq.cfg.useIBMCipherMappings");
assertEquals("true", cipherMappingProp);

// stop the task
newConnectTask.stop();

// configure a sink task for validating config for failure case
connectorConfigProps.put("mq.message.builder",
DEFAULT_MESSAGE_BUILDER);

connectorConfigProps.put("mq.ssl.use.ibm.cipher.mappings",
"hello");

// Verify the exception messages
final ConfigException exc = assertThrows(ConfigException.class, () -> {
newConnectTask.start(connectorConfigProps);
});
assertEquals("Invalid value hello for configuration mq.ssl.use.ibm.cipher.mappings: Expected value to be either true or false", exc.getMessage());
}

@Test
public void verifyStringJmsMessages() throws JMSException {
final MQSinkTask newConnectTask = new MQSinkTask();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void configure(final AbstractConfig config) throws ConnectException {
mqConnectionHelper = new MQConnectionHelper(config);

if (mqConnectionHelper.getUseIBMCipherMappings() != null) {
System.setProperty("com.ibm.mq.cfg.useIBMCipherMappings", mqConnectionHelper.getUseIBMCipherMappings());
System.setProperty("com.ibm.mq.cfg.useIBMCipherMappings", Boolean.toString(mqConnectionHelper.getUseIBMCipherMappings()));
}

try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public Boolean isPersistent() {
return config.getBoolean(MQSinkConfig.CONFIG_NAME_MQ_PERSISTENT);
}

public String getUseIBMCipherMappings() {
return config.getString(MQSinkConfig.CONFIG_NAME_MQ_SSL_USE_IBM_CIPHER_MAPPINGS);
public Boolean getUseIBMCipherMappings() {
return config.getBoolean(MQSinkConfig.CONFIG_NAME_MQ_SSL_USE_IBM_CIPHER_MAPPINGS);
}

public int getTransportType() {
Expand Down