private void syncProperties() { for (String name : propertyHolderSupport.getPropertyNames()) { if (!targetTestCase.hasProperty(name)) propertyHolderSupport.removeProperty(name); } for (String name : targetTestCase.getPropertyNames()) { if (!propertyHolderSupport.hasProperty(name)) propertyHolderSupport.addProperty(name); } }
public void actionPerformed(ActionEvent e) { if (optionsDialog == null) { optionsDialog = ADialogBuilder.buildDialog(OptionsForm.class); optionsDialog .getFormField(OptionsForm.TESTSUITE) .addFormFieldListener( new XFormFieldListener() { public void valueChanged( XFormField sourceField, String newValue, String oldValue) { List<TestCase> testCaseList = project.getTestSuiteByName(newValue).getTestCaseList(); testCaseList.remove(getModelItem().getTestCase()); optionsDialog.setOptions( OptionsForm.TESTCASE, ModelSupport.getNames(testCaseList)); if (testCaseList.size() > 0) { WsdlTestCase testCase = project.getTestSuiteByName(newValue).getTestCaseAt(0); optionsDialog.setOptions( OptionsForm.RETURN_PROPERTIES, testCase.getPropertyNames()); ((XFormMultiSelectList) optionsDialog.getFormField(OptionsForm.RETURN_PROPERTIES)) .setSelectedOptions(getModelItem().getReturnProperties().toStringArray()); } } }); optionsDialog .getFormField(OptionsForm.TESTCASE) .addFormFieldListener( new XFormFieldListener() { public void valueChanged( XFormField sourceField, String newValue, String oldValue) { WsdlTestSuite testSuite = project.getTestSuiteByName(optionsDialog.getValue(OptionsForm.TESTSUITE)); WsdlTestCase testCase = testSuite.getTestCaseByName(newValue); optionsDialog.setOptions( OptionsForm.RETURN_PROPERTIES, testCase.getPropertyNames()); ((XFormMultiSelectList) optionsDialog.getFormField(OptionsForm.RETURN_PROPERTIES)) .setSelectedOptions(getModelItem().getReturnProperties().toStringArray()); } }); } WsdlTestCase targetTestCase = getModelItem().getTargetTestCase(); optionsDialog.setOptions( OptionsForm.TESTSUITE, ModelSupport.getNames(project.getTestSuiteList())); if (targetTestCase != null) { optionsDialog.setValue(OptionsForm.TESTSUITE, targetTestCase.getTestSuite().getName()); List<TestCase> testCaseList = targetTestCase.getTestSuite().getTestCaseList(); testCaseList.remove(getModelItem().getTestCase()); optionsDialog.setOptions(OptionsForm.TESTCASE, ModelSupport.getNames(testCaseList)); optionsDialog.setValue(OptionsForm.TESTCASE, targetTestCase.getName()); optionsDialog.setOptions(OptionsForm.RETURN_PROPERTIES, targetTestCase.getPropertyNames()); ((XFormMultiSelectList) optionsDialog.getFormField(OptionsForm.RETURN_PROPERTIES)) .setSelectedOptions(getModelItem().getReturnProperties().toStringArray()); } else { if (project.getTestSuiteCount() == 0) { optionsDialog.setOptions(OptionsForm.TESTCASE, new String[0]); optionsDialog.setOptions(OptionsForm.RETURN_PROPERTIES, new String[0]); } else { List<TestCase> testCaseList = project.getTestSuiteAt(0).getTestCaseList(); testCaseList.remove(getModelItem().getTestCase()); optionsDialog.setOptions(OptionsForm.TESTCASE, ModelSupport.getNames(testCaseList)); if (testCaseList.isEmpty()) optionsDialog.setOptions(OptionsForm.RETURN_PROPERTIES, new String[0]); else optionsDialog.setOptions( OptionsForm.RETURN_PROPERTIES, testCaseList.get(0).getPropertyNames()); } } switch (getModelItem().getRunMode().intValue()) { case RunTestCaseRunModeTypeConfig.INT_PARALLELL: optionsDialog.setValue( OptionsForm.RUN_MODE, OptionsForm.CREATE_ISOLATED_COPY_FOR_EACH_RUN); break; case RunTestCaseRunModeTypeConfig.INT_SINGLETON_AND_FAIL: optionsDialog.setValue(OptionsForm.RUN_MODE, OptionsForm.RUN_PRIMARY_TEST_CASE); break; case RunTestCaseRunModeTypeConfig.INT_SINGLETON_AND_WAIT: optionsDialog.setValue(OptionsForm.RUN_MODE, OptionsForm.RUN_SYNCHRONIZED_TESTCASE); break; } optionsDialog.setBooleanValue( OptionsForm.COPY_HTTP_SESSION, getModelItem().isCopyHttpSession()); optionsDialog.setBooleanValue( OptionsForm.COPY_LOADTEST_PROPERTIES, getModelItem().isCopyLoadTestProperties()); optionsDialog.setBooleanValue( OptionsForm.IGNORE_EMPTY_PROPERTIES, getModelItem().isIgnoreEmptyProperties()); if (optionsDialog.show()) { WsdlTestSuite testSuite = project.getTestSuiteByName(optionsDialog.getValue(OptionsForm.TESTSUITE)); getModelItem() .setTargetTestCase( testSuite == null ? null : testSuite.getTestCaseByName(optionsDialog.getValue(OptionsForm.TESTCASE))); getModelItem() .setReturnProperties( new StringList( ((XFormMultiSelectList) optionsDialog.getFormField(OptionsForm.RETURN_PROPERTIES)) .getSelectedOptions())); switch (optionsDialog.getValueIndex(OptionsForm.RUN_MODE)) { case 0: getModelItem().setRunMode(RunTestCaseRunModeTypeConfig.PARALLELL); break; case 1: getModelItem().setRunMode(RunTestCaseRunModeTypeConfig.SINGLETON_AND_FAIL); break; case 2: getModelItem().setRunMode(RunTestCaseRunModeTypeConfig.SINGLETON_AND_WAIT); break; } getModelItem() .setCopyHttpSession(optionsDialog.getBooleanValue(OptionsForm.COPY_HTTP_SESSION)); getModelItem() .setCopyLoadTestProperties( optionsDialog.getBooleanValue(OptionsForm.COPY_LOADTEST_PROPERTIES)); getModelItem() .setIgnoreEmptyProperties( optionsDialog.getBooleanValue(OptionsForm.IGNORE_EMPTY_PROPERTIES)); titledBorder.setTitle(createTitleForBorder()); } }