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;
}
Aggregations