use of io.irontest.models.teststep.MQTeststepProperties in project irontest by zheng-wang.
the class MQTeststepRunner method run.
protected BasicTeststepRun run(Teststep teststep) throws Exception {
String action = teststep.getAction();
if (teststep.getAction() == null) {
throw new Exception("Action not specified.");
}
MQTeststepProperties teststepProperties = (MQTeststepProperties) teststep.getOtherProperties();
if (teststepProperties.getDestinationType() == null) {
throw new Exception("Destination type not specified.");
}
BasicTeststepRun basicTeststepRun = new BasicTeststepRun();
MQAPIResponse response = new MQAPIResponse();
MQEndpointProperties endpointProperties = (MQEndpointProperties) teststep.getEndpoint().getOtherProperties();
MQQueueManager queueManager = null;
try {
// connect to queue manager
if (endpointProperties.getConnectionMode() == MQConnectionMode.BINDINGS) {
queueManager = new MQQueueManager(endpointProperties.getQueueManagerName());
} else {
Hashtable qmConnProperties = new Hashtable();
qmConnProperties.put(CMQC.HOST_NAME_PROPERTY, endpointProperties.getHost());
qmConnProperties.put(CMQC.PORT_PROPERTY, endpointProperties.getPort());
qmConnProperties.put(CMQC.CHANNEL_PROPERTY, endpointProperties.getSvrConnChannelName());
queueManager = new MQQueueManager(endpointProperties.getQueueManagerName(), qmConnProperties);
}
if (MQDestinationType.QUEUE == teststepProperties.getDestinationType()) {
Object responseValue = doQueueAction(queueManager, teststepProperties.getQueueName(), action, teststep.getRequest(), teststepProperties.getRfh2Header());
response.setValue(responseValue);
} else if (MQDestinationType.TOPIC == teststepProperties.getDestinationType()) {
doTopicAction(queueManager, teststepProperties.getTopicString(), action, teststep.getRequest(), teststepProperties.getRfh2Header());
}
} finally {
if (queueManager != null) {
queueManager.disconnect();
}
}
basicTeststepRun.setResponse(response);
return basicTeststepRun;
}
Aggregations