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