Search in sources :

Example 1 with MQEndpointProperties

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;
}
Also used : MQEndpointProperties(io.irontest.models.endpoint.MQEndpointProperties) MQTeststepProperties(io.irontest.models.teststep.MQTeststepProperties) Hashtable(java.util.Hashtable) MQDataException(com.ibm.mq.headers.MQDataException) IOException(java.io.IOException)

Example 2 with MQEndpointProperties

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;
}
Also used : MQEndpointProperties(io.irontest.models.endpoint.MQEndpointProperties) Endpoint(io.irontest.models.endpoint.Endpoint) SOAPEndpointProperties(io.irontest.models.endpoint.SOAPEndpointProperties)

Aggregations

MQEndpointProperties (io.irontest.models.endpoint.MQEndpointProperties)2 MQDataException (com.ibm.mq.headers.MQDataException)1 Endpoint (io.irontest.models.endpoint.Endpoint)1 SOAPEndpointProperties (io.irontest.models.endpoint.SOAPEndpointProperties)1 MQTeststepProperties (io.irontest.models.teststep.MQTeststepProperties)1 IOException (java.io.IOException)1 Hashtable (java.util.Hashtable)1