Skip to content

Commit b091b89

Browse files
A S Adil MohammadA S Adil Mohammad
authored andcommitted
fix: incorrect datatype in config
Signed-off-by: A S Adil Mohammad <asadilmohammad2020@gmail.com>
1 parent b45aea0 commit b091b89

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

src/integration/java/com/ibm/eventstreams/connect/mqsink/MQSinkTaskIT.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,44 @@ public void verifyStringMessages() throws JMSException {
127127
assertEquals("world", messagesInMQ.get(1).getBody(String.class));
128128
}
129129

130+
@Test
131+
public void verifyMqConfig() throws JMSException {
132+
final MQSinkTask newConnectTask = new MQSinkTask();
133+
134+
// configure a sink task for string messages
135+
final Map<String, String> connectorConfigProps = createDefaultConnectorProperties();
136+
connectorConfigProps.put("mq.message.builder",
137+
DEFAULT_MESSAGE_BUILDER);
138+
139+
connectorConfigProps.put("mq.ssl.use.ibm.cipher.mappings",
140+
"true");
141+
142+
// start the task so that it connects to MQ
143+
newConnectTask.start(connectorConfigProps);
144+
145+
// create some test messages
146+
final List<SinkRecord> records = new ArrayList<>();
147+
records.add(generateSinkRecord(null, "hello"));
148+
records.add(generateSinkRecord(null, "world"));
149+
newConnectTask.put(records);
150+
151+
// flush the messages
152+
final Map<TopicPartition, OffsetAndMetadata> offsets = new HashMap<>();
153+
final TopicPartition topic = new TopicPartition(TOPIC, PARTITION);
154+
final OffsetAndMetadata offset = new OffsetAndMetadata(commonOffset);
155+
offsets.put(topic, offset);
156+
newConnectTask.flush(offsets);
157+
158+
// stop the task
159+
newConnectTask.stop();
160+
161+
// verify that the messages were successfully submitted to MQ
162+
final List<Message> messagesInMQ = getAllMessagesFromQueue(DEFAULT_SINK_QUEUE_NAME);
163+
assertEquals(2, messagesInMQ.size());
164+
assertEquals("hello", messagesInMQ.get(0).getBody(String.class));
165+
assertEquals("world", messagesInMQ.get(1).getBody(String.class));
166+
}
167+
130168
@Test
131169
public void verifyStringJmsMessages() throws JMSException {
132170
final MQSinkTask newConnectTask = new MQSinkTask();

src/main/java/com/ibm/eventstreams/connect/mqsink/JMSWorker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public void configure(final AbstractConfig config) throws ConnectException {
102102
mqConnectionHelper = new MQConnectionHelper(config);
103103

104104
if (mqConnectionHelper.getUseIBMCipherMappings() != null) {
105-
System.setProperty("com.ibm.mq.cfg.useIBMCipherMappings", mqConnectionHelper.getUseIBMCipherMappings());
105+
System.setProperty("com.ibm.mq.cfg.useIBMCipherMappings", Boolean.toString(mqConnectionHelper.getUseIBMCipherMappings()));
106106
}
107107

108108
try {

src/main/java/com/ibm/eventstreams/connect/mqsink/MQConnectionHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ public Boolean isPersistent() {
6363
return config.getBoolean(MQSinkConfig.CONFIG_NAME_MQ_PERSISTENT);
6464
}
6565

66-
public String getUseIBMCipherMappings() {
67-
return config.getString(MQSinkConfig.CONFIG_NAME_MQ_SSL_USE_IBM_CIPHER_MAPPINGS);
66+
public Boolean getUseIBMCipherMappings() {
67+
return config.getBoolean(MQSinkConfig.CONFIG_NAME_MQ_SSL_USE_IBM_CIPHER_MAPPINGS);
6868
}
6969

7070
public int getTransportType() {

0 commit comments

Comments
 (0)