if (!UISupport.confirm("Request is missing response, create default mock response instead?", title)) {
return;
}
}
WsdlMockService mockService = null;
WsdlMockOperation mockOperation = (WsdlMockOperation) param;
if (mockOperation != null) {
mockService = mockOperation.getMockService();
}
WsdlProject project = request.getOperation().getInterface().getProject();
while (mockService == null) {
if (project.getMockServiceCount() > 0) {
String[] mockServices = ModelSupport.getNames(project.getMockServiceList(),
new String[]{CREATE_MOCKSUITE_OPTION});
// prompt
String option = UISupport.prompt("Select MockService for MockOperation", title, mockServices);
if (option == null) {
return;
}
mockService = project.getMockServiceByName(option);
}
// create new mocksuite?
if (mockService == null) {
String mockServiceName = UISupport.prompt("Enter name of new MockService", title, "MockService "
+ (project.getMockServiceCount() + 1));
if (mockServiceName == null || mockServiceName.trim().length() == 0) {
return;
}
mockService = project.addNewMockService(mockServiceName);
}
mockOperation = mockService.getMockOperation(request.getOperation());
if (mockOperation != null) {
Boolean retval = UISupport.confirmOrCancel("MockService [" + mockService.getName()
+ "] already has a MockOperation for [" + request.getOperation().getName()
+ "],\r\nShould MockResponse be added to this MockOperation instead", "Add Request to MockService");
if (retval == null) {
return;
}
if (!retval.booleanValue()) {
mockService = null;
}
}
}
// add mockoperation
if (mockOperation == null) {
mockOperation = (WsdlMockOperation) mockService.addNewMockOperation(request.getOperation());
}
WsdlMockResponse mockResponse = mockOperation.addNewMockResponse(
"Response " + (1 + mockOperation.getMockResponseCount()), false);