use of io.irontest.models.endpoint.MQEndpointProperties 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;
}
use of io.irontest.models.endpoint.MQEndpointProperties in project irontest by zheng-wang.
the class EndpointDAO method createUnmanagedEndpoint_NoTransaction.
public Endpoint createUnmanagedEndpoint_NoTransaction(String teststepType, AppMode appMode) throws JsonProcessingException {
Endpoint endpoint = null;
if (!Teststep.TYPE_WAIT.equals(teststepType)) {
endpoint = new Endpoint();
endpoint.setName("Unmanaged Endpoint");
if (Teststep.TYPE_SOAP.equals(teststepType)) {
endpoint.setType(Endpoint.TYPE_SOAP);
endpoint.setOtherProperties(new SOAPEndpointProperties());
} else if (Teststep.TYPE_DB.equals(teststepType)) {
endpoint.setType(Endpoint.TYPE_DB);
} else if (Teststep.TYPE_MQ.equals(teststepType)) {
endpoint.setType(Endpoint.TYPE_MQ);
MQEndpointProperties endpointProperties = new MQEndpointProperties();
endpointProperties.setConnectionMode(appMode == AppMode.LOCAL ? MQConnectionMode.BINDINGS : MQConnectionMode.CLIENT);
endpoint.setOtherProperties(endpointProperties);
} else if (Teststep.TYPE_IIB.equals(teststepType)) {
endpoint.setType(Endpoint.TYPE_IIB);
}
long id = insertUnmanagedEndpoint_NoTransaction(endpoint);
endpoint.setId(id);
}
return endpoint;
}
Aggregations