test fixes for mq
This commit is contained in:
parent
17c471f0b0
commit
90e6650517
@ -57,8 +57,10 @@ public class IbmMqConnector implements Connector {
|
||||
try {
|
||||
if (keystorePath != null && !keystorePath.isBlank()) {
|
||||
System.setProperty("javax.net.ssl.keyStore", keystorePath);
|
||||
System.setProperty("javax.net.ssl.trustStore", keystorePath);
|
||||
if (keystorePassword != null) {
|
||||
System.setProperty("javax.net.ssl.keyStorePassword", keystorePassword);
|
||||
System.setProperty("javax.net.ssl.trustStorePassword", keystorePassword);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@ public class Template {
|
||||
}
|
||||
|
||||
public Template(String templateString) {
|
||||
this.template = new ST(templateString);
|
||||
this.template = new ST(templateString, '$', '$');
|
||||
}
|
||||
|
||||
public Template set(String variable, String value) {
|
||||
|
||||
7
tests/.checkstyle
Normal file
7
tests/.checkstyle
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
|
||||
<fileset name="all" enabled="true" check-config-name="Google Checks" local="false">
|
||||
<file-match-pattern match-pattern="." include-pattern="true"/>
|
||||
</fileset>
|
||||
</fileset-config>
|
||||
@ -24,7 +24,12 @@
|
||||
<artifactId>com.ibm.mq.allclient</artifactId>
|
||||
<version>${ibm.mq.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- StringTemplate -->
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>ST4</artifactId>
|
||||
<version>4.3.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.jms</groupId>
|
||||
<artifactId>javax.jms-api</artifactId>
|
||||
|
||||
@ -1,24 +1,48 @@
|
||||
package cz.moneta.test.system.messaging;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import cz.moneta.test.dsl.Harness;
|
||||
import cz.moneta.test.harness.annotations.TestCase;
|
||||
import cz.moneta.test.harness.annotations.TestScenario;
|
||||
import cz.moneta.test.harness.support.util.Template;
|
||||
|
||||
@TestScenario(name = "Send MQ message")
|
||||
public class SendMQMessage {
|
||||
|
||||
@TestCase(name = "Send MQ message")
|
||||
public void sendMessage(Harness harness) {
|
||||
String message = "Hello, this is a test message!";
|
||||
String destination = "mainframe-utf8-queue";
|
||||
|
||||
System.setProperty("javax.net.ssl.trustStore", "/home/kamma/tmp/mq-docker/ibmmq-client.p12");
|
||||
System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
|
||||
|
||||
//System.setProperty("jdk.tls.client.protocols", "TLSv1.2");
|
||||
//System.setProperty("javax.net.ssl.trustStoreType", "PKCS12");
|
||||
|
||||
harness.withMessaging().to(destination).asJson().withPayload(message).send();
|
||||
}
|
||||
@TestCase(name = "Send JSON message")
|
||||
public void sendJsonMessage(Harness harness) {
|
||||
|
||||
harness.withMessaging().to("payment-notifications").asJson()
|
||||
.withPayload("{\"paymentId\": \"PAY-456\", \"result\": \"OK\"}").send();
|
||||
|
||||
harness.withMessaging().from("payment-notifications").asJson()
|
||||
.receiveWhere(msg -> msg.extract("paymentId").equals("PAY-456")).withTimeout(5, TimeUnit.SECONDS)
|
||||
.andAssertFieldValue("result", "OK");
|
||||
}
|
||||
|
||||
@TestCase(name = "Send XML message")
|
||||
public void sendXmlMessage(Harness harness) {
|
||||
|
||||
harness.withMessaging().to("mainframe-requests").asXml()
|
||||
.withPayload("<request><accountId>12345</accountId><balance>50000</balance></request>").send();
|
||||
|
||||
harness.withMessaging().to("mainframe-requests").asXml()
|
||||
.withPayloadFromTemplate(Template.fromFilepath("messaging/mf-request.xml").set("accountId", "12345"))
|
||||
.send();
|
||||
|
||||
harness.withMessaging().from("mainframe-requests").asXml()
|
||||
.receiveWhere(msg -> msg.extract("/request/accountId").equals("12345"))
|
||||
.withTimeout(5, TimeUnit.SECONDS).andAssertFieldValue("/request/balance", "50000");
|
||||
}
|
||||
|
||||
@TestCase(name = "Send UTF8 message")
|
||||
public void sendUtf8Message(Harness harness) {
|
||||
|
||||
harness.withMessaging().to("mainframe-utf8-queue").asUtf8().withPayload("DATA|12345|ÚČET|CZK").send();
|
||||
|
||||
harness.withMessaging().from("mainframe-utf8-queue").asUtf8()
|
||||
.receiveWhere(msg -> msg.getBody().contains("12345")).withTimeout(5, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -12,30 +12,28 @@ messaging.kafka.value-serializer=avro
|
||||
# Messaging - IBM MQ
|
||||
messaging.ibmmq.host=localhost
|
||||
messaging.ibmmq.port=1414
|
||||
messaging.ibmmq.channel=CLIENT.CHANNEL
|
||||
messaging.ibmmq.channel=DEV.APP.SVRCONN
|
||||
messaging.ibmmq.queue-manager=QM1
|
||||
messaging.ibmmq.ssl-cipher-suite=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
|
||||
messaging.ibmmq.keystore.path=/home/kamma/tmp/mq-docker/ibmmq-client.p12
|
||||
messaging.ibmmq.keystore.path=/home/kamma/aa/mq-docker/truststore.jks
|
||||
messaging.ibmmq.keystore.password=changeit
|
||||
messaging.ibmmq.username=app
|
||||
messaging.ibmmq.password=app
|
||||
messaging.ibmmq.keystore.type=PKCS12
|
||||
messaging.ibmmq.tls.protocols=TLSv1.2
|
||||
|
||||
# Messaging destinations
|
||||
messaging.destination.order-events.type=kafka
|
||||
messaging.destination.order-events.topic=order-events-tst1
|
||||
messaging.destination.payment-notifications.type=ibmmq
|
||||
messaging.destination.payment-notifications.queue=PAYMENT.NOTIFICATIONS
|
||||
messaging.destination.payment-notifications.queue=DEV.QUEUE.1
|
||||
messaging.destination.payment-notifications.format=json
|
||||
messaging.destination.mainframe-requests.type=ibmmq
|
||||
messaging.destination.mainframe-requests.queue=MF.REQUESTS
|
||||
messaging.destination.mainframe-requests.queue=XML.QUEUE.1
|
||||
messaging.destination.mainframe-requests.format=xml
|
||||
messaging.destination.mainframe-ebcdic-queue.type=ibmmq
|
||||
messaging.destination.mainframe-ebcdic-queue.queue=MF.EBCDIC.QUEUE
|
||||
messaging.destination.mainframe-ebcdic-queue.format=ebcdic_870
|
||||
messaging.destination.mainframe-utf8-queue.type=ibmmq
|
||||
messaging.destination.mainframe-utf8-queue.queue=DEV.QUEUE.1
|
||||
messaging.destination.mainframe-utf8-queue.queue=UTF8.QUEUE.1
|
||||
messaging.destination.mainframe-utf8-queue.format=utf8_1208
|
||||
|
||||
# Messaging vault paths
|
||||
|
||||
4
tests/src/test/resources/messaging/mf-request.xml
Normal file
4
tests/src/test/resources/messaging/mf-request.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<request>
|
||||
<accountId>$accountId$</accountId>
|
||||
<balance>60000</balance>
|
||||
</request>
|
||||
Loading…
x
Reference in New Issue
Block a user