Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test case for produce/consume using one queue object #32

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Changes from all 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
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