Search in sources :

Example 1 with MockOperationDispatcher

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

the class SoapUIProjectImporter method buildQueryMatchDispatchCriteriaToResponseMap.

/**
 * Build a map where keys are dispatch criteria and values response name.
 */
private Map<String, String> buildQueryMatchDispatchCriteriaToResponseMap(WsdlMockOperation wmo) {
    Map<String, String> matchResponseMap = new HashMap<String, String>();
    // MockOperationDispatcher dispatcher = wmo.getMockOperationDispatcher();
    MockOperationDispatcher dispatcher = wmo.getDispatcher();
    if (dispatcher instanceof QueryMatchMockOperationDispatcher) {
        QueryMatchMockOperationDispatcher qmDispatcher = (QueryMatchMockOperationDispatcher) dispatcher;
        for (int i = 0; i < qmDispatcher.getQueryCount(); i++) {
            QueryMatchMockOperationDispatcher.Query query = qmDispatcher.getQueryAt(i);
            matchResponseMap.put(query.getMatch(), query.getResponse());
        }
    }
    return matchResponseMap;
}
Also used : 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)

Example 2 with MockOperationDispatcher

use of com.eviware.soapui.impl.wsdl.mock.dispatch.MockOperationDispatcher 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

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