Tuesday, April 30, 2024

Maximo Mock Service for Integrations based on JMS

A sample Java based mock service for Maximo JMS Integrations to mock a PR Interface response from an external system. Code - gitlab-suren-jmsmockservice 

Mock Services are used to simulate the client calls, receives requests or returns responses for Integrations in environments other than production. 

It's used to create testing scenarios before the implementation of actual Interface, regression testing, cost effective availability of integration for non-production environments and create client demos.

This tool will receive the message from request queue, validate the message for mandatory fields, process the message to find the folder and prepare the response file and return it to response queue





The utility should be started as a service on the server from a command line from the com.custom.mockrunner.Driver class with Command line arguments. 


The Command Line must pass these Environment, Interface (or Service) and resource file path as arguments to establish connection to a JMS Bus, Interface to identify the response template and resource path to location of properties and response template folder. 


-e Environment argument denotes the system to which the tool needs to establish connection. It must match with the properties file (local, test etc.,) which has the JMS Connection properties like SIBus (Service Integration Bus) Provider URL, JNDI Factory and JMS Binding Names. It also has queue names of the JMS for reading the messages.

-s Service argument specifies the Interface name used in the MockFactory class to instance the particular JMSMock Class. 

-f Resource Path folder location where connection details and template files are placed.

Command Line statement to execute the Java Program
Driver -etest -sgetPR -f"/resources/"

Based on the (-s) service argument, the MockRunner interface (super class) will create object from its subclass JMSMockForGetPRResponse. It uses Factory Method design pattern to initiate objects based on any services in future.

JMSMockForGetPRResponse implements javax.jms.MessageListenser to read the message from PR_RequestQueue, find the folder/file to send the response back to PR_ResponseQueue. 




Pros:
  • Gives an option to test integrations in lower environment
  • Custom framework won't require any licensing cost like other Products like SOAPUI Pro
Cons: 
  • Needs Java Knowledge resource to maintain the mock service, instead an open source mock service providers like ActiveMQ can be used for easy of maintenance