Search in sources :

Example 1 with ScriptMockOperationDispatcher

use of com.eviware.soapui.impl.wsdl.mock.dispatch.ScriptMockOperationDispatcher in project microcks by microcks.

the class SoapUIProjectImporter method extractOperations.

/**
 * Extract the list of operations from MockService according WsdlInterface.
 */
private List<Operation> extractOperations(MockService mockService, WsdlInterface wi) {
    List<Operation> result = new ArrayList<Operation>();
    List<MockOperation> operations = mockService.getMockOperationList();
    for (MockOperation mockOperation : operations) {
        // Build a new operation.
        Operation operation = new Operation();
        operation.setName(mockOperation.getName());
        // Retrieve part name from Wsdl operation coming from interface.
        WsdlOperation wo = wi.getOperationByName(mockOperation.getName());
        operation.setAction(wo.getAction());
        operation.setInputName(wo.getInputName());
        operation.setOutputName(wo.getOutputName());
        WsdlMockOperation wmo = (WsdlMockOperation) mockOperation;
        operation.setDispatcher(wmo.getDispatchStyle());
        // Check dispatcher configuration.
        MockOperationDispatcher dispatcher = wmo.getDispatcher();
        if (dispatcher instanceof QueryMatchMockOperationDispatcher) {
            QueryMatchMockOperationDispatcher qmDispatcher = (QueryMatchMockOperationDispatcher) dispatcher;
            String query = qmDispatcher.getQueryAt(0).getQuery();
            operation.setDispatcherRules(query);
        } else if (dispatcher instanceof ScriptMockOperationDispatcher) {
            ScriptMockOperationDispatcher sDispatcher = (ScriptMockOperationDispatcher) dispatcher;
            String script = sDispatcher.getMockOperation().getScript();
            operation.setDispatcherRules(script);
        }
        result.add(operation);
    }
    return result;
}
Also used : WsdlOperation(com.eviware.soapui.impl.wsdl.WsdlOperation) ScriptMockOperationDispatcher(com.eviware.soapui.impl.wsdl.mock.dispatch.ScriptMockOperationDispatcher) WsdlOperation(com.eviware.soapui.impl.wsdl.WsdlOperation) MockOperation(com.eviware.soapui.model.mock.MockOperation) WsdlMockOperation(com.eviware.soapui.impl.wsdl.mock.WsdlMockOperation) MockOperation(com.eviware.soapui.model.mock.MockOperation) WsdlMockOperation(com.eviware.soapui.impl.wsdl.mock.WsdlMockOperation) WsdlMockOperation(com.eviware.soapui.impl.wsdl.mock.WsdlMockOperation) MockOperationDispatcher(com.eviware.soapui.impl.wsdl.mock.dispatch.MockOperationDispatcher) ScriptMockOperationDispatcher(com.eviware.soapui.impl.wsdl.mock.dispatch.ScriptMockOperationDispatcher) QueryMatchMockOperationDispatcher(com.eviware.soapui.impl.wsdl.mock.dispatch.QueryMatchMockOperationDispatcher) QueryMatchMockOperationDispatcher(com.eviware.soapui.impl.wsdl.mock.dispatch.QueryMatchMockOperationDispatcher)

Aggregations

WsdlOperation (com.eviware.soapui.impl.wsdl.WsdlOperation)1 WsdlMockOperation (com.eviware.soapui.impl.wsdl.mock.WsdlMockOperation)1 MockOperationDispatcher (com.eviware.soapui.impl.wsdl.mock.dispatch.MockOperationDispatcher)1 QueryMatchMockOperationDispatcher (com.eviware.soapui.impl.wsdl.mock.dispatch.QueryMatchMockOperationDispatcher)1 ScriptMockOperationDispatcher (com.eviware.soapui.impl.wsdl.mock.dispatch.ScriptMockOperationDispatcher)1 MockOperation (com.eviware.soapui.model.mock.MockOperation)1