return null;
}
name = name.substring(1);
StringToObjectMap objects = new StringToObjectMap(context.getProperties());
objects.put("context", context);
objects.put("log", SoapUI.ensureGroovyLog());
if (context instanceof TestCaseRunContext) {
TestCaseRunContext testCaseRunContext = (TestCaseRunContext) context;
objects.put("testRunner", testCaseRunContext.getTestRunner());
objects.put("testStep", testCaseRunContext.getCurrentStep());
if (testCaseRunContext.getCurrentStep() instanceof SamplerTestStep) {
objects.put("request", ((SamplerTestStep) testCaseRunContext.getCurrentStep()).getTestRequest());
}
}
if (context instanceof LoadTestRunContext) {
objects.put("loadTestRunner", ((LoadTestRunContext) context).getLoadTestRunner());
}
if (context instanceof MockRunContext) {
objects.put("mockRunner", ((MockRunContext) context).getMockRunner());
}
ModelItem modelItem = context.getModelItem();
if (modelItem instanceof TestCase) {
objects.put("testCase", modelItem);
objects.put("testSuite", ((TestCase) modelItem).getTestSuite());
objects.put("project", ((TestCase) modelItem).getTestSuite().getProject());
} else if (modelItem instanceof TestStep) {
objects.put("testStep", modelItem);
if (modelItem instanceof SamplerTestStep) {
objects.put("request", ((SamplerTestStep) modelItem).getTestRequest());
}
objects.put("testCase", ((TestStep) modelItem).getTestCase());
objects.put("testSuite", ((TestStep) modelItem).getTestCase().getTestSuite());
objects.put("project", ((TestStep) modelItem).getTestCase().getTestSuite().getProject());
} else if (modelItem instanceof TestSuite) {
objects.put("testSuite", modelItem);
objects.put("project", ((TestSuite) modelItem).getProject());
}
if (modelItem instanceof LoadTest) {
objects.put("loadTest", modelItem);
objects.put("testCase", ((LoadTest) modelItem).getTestCase());
objects.put("testSuite", ((LoadTest) modelItem).getTestCase().getTestSuite());
objects.put("project", ((LoadTest) modelItem).getTestCase().getTestSuite().getProject());
} else if (modelItem instanceof Project) {
objects.put("project", modelItem);
} else if (modelItem instanceof MockService) {
objects.put("mockService", modelItem);
objects.put("project", ((MockService) modelItem).getProject());
} else if (modelItem instanceof MockOperation) {
objects.put("mockOperation", modelItem);
objects.put("mockService", ((MockOperation) modelItem).getMockService());
objects.put("project", ((MockOperation) modelItem).getMockService().getProject());
} else if (modelItem instanceof MockResponse) {
objects.put("mockResponse", modelItem);
objects.put("mockOperation", ((MockResponse) modelItem).getMockOperation());
objects.put("mockService", ((MockResponse) modelItem).getMockOperation().getMockService());
objects.put("project", ((MockResponse) modelItem).getMockOperation().getMockService().getProject());
} else if (modelItem instanceof Request) {
objects.put("request", modelItem);
if (modelItem instanceof TestRequest) {
objects.put("testStep", ((TestRequest) modelItem).getTestStep());
objects.put("testCase", ((TestRequest) modelItem).getTestStep().getTestCase());
objects.put("testSuite", ((TestRequest) modelItem).getTestStep().getTestCase().getTestSuite());
objects.put("project", ((TestRequest) modelItem).getTestStep().getTestCase().getTestSuite()
.getProject());
}
} else if (modelItem instanceof Operation) {
objects.put("operation", modelItem);
} else if (modelItem instanceof Interface) {
objects.put("interface", modelItem);
} else if (modelItem instanceof SecurityTest) {
objects.put("securityTest", modelItem);
}
if (modelItem != null) {
objects.put("modelItem", modelItem);
}
return doEval(name, modelItem, objects);
}