Skip to content

Commit

Permalink
Merge pull request #32 from ayeshLK/master
Browse files Browse the repository at this point in the history
Add test case for produce/consume using one queue object
  • Loading branch information
ayeshLK authored Nov 27, 2023
2 parents 8e82288 + fe549c0 commit 90bf8f5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ballerina/tests/queue_producer_consumer_tests.bal
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}
Expand Down

0 comments on commit 90bf8f5

Please sign in to comment.