From fe549c077446fd78f2e4de08be90f1393bdbcd4a Mon Sep 17 00:00:00 2001 From: ayeshLK Date: Mon, 27 Nov 2023 17:11:57 +0530 Subject: [PATCH] Add test case for produce/consume using one queue object --- .../tests/queue_producer_consumer_tests.bal | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ballerina/tests/queue_producer_consumer_tests.bal b/ballerina/tests/queue_producer_consumer_tests.bal index 7d2628a..d228df0 100644 --- a/ballerina/tests/queue_producer_consumer_tests.bal +++ b/ballerina/tests/queue_producer_consumer_tests.bal @@ -38,6 +38,25 @@ function basicQueueProducerConsumerTest() returns error? { check queueManager.disconnect(); } +@test:Config { + groups: ["ibmmqQueue"] +} +function basicQueueProducerConsumerWithOneQueueObjectTest() returns error? { + QueueManager queueManager = check new (name = "QM1", host = "localhost", channel = "DEV.APP.SVRCONN"); + Queue queue = check queueManager.accessQueue("DEV.QUEUE.1", MQOO_OUTPUT | MQOO_INPUT_AS_Q_DEF); + check queue->put({ + payload: "Hello World with one queue".toBytes() + }); + Message? message = check queue->get(); + if message !is () { + test:assertEquals(string:fromBytes(message.payload), "Hello World with one queue"); + } else { + test:assertFail("Expected a value for message"); + } + check queue->close(); + check queueManager.disconnect(); +} + @test:Config { groups: ["ibmmqQueue"] }