Examples of TestDTO


Examples of org.geotools.validation.dto.TestDTO

   */
    public static boolean noNullArguments(TestSuiteDTO testSuite) {
      Map tests = testSuite.getTests();
      boolean badTests = false;
    for (Iterator i = tests.keySet().iterator(); i.hasNext();) {
            TestDTO currentTest = (TestDTO) tests.get(i.next());
            if (!noNullArguments(currentTest)) {
              //the test contains a null argument!
              badTests = true;
              break;
            }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

                            selection = new StructuredSelection(event.getElement());
                            treeViewer.setSelection(selection);
                        }
                        //automatically create a child if none exist
                        if (!contentProvider.hasChildren(selectedTreeItem)) {
                            TestDTO newTest = addTest();
                            selection = new StructuredSelection(newTest);
                            treeViewer.setSelection(selection);
                        }
                    }
                }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

        }
    }

    private TestDTO addTest() {
        Object selection = selectedTreeItem;
        TestDTO thisTest = null;
        //plugin is selected?
        if (selection instanceof PlugInDTO) {
            // create a new validation test object
            PlugInDTO plugin = (PlugInDTO) selection;
            Validation newTest = null;
            try {
                newTest = processor.createValidation(plugin);
            } catch (Exception e1) {
                // log the exception and return
                MessageDialog
                        .openError(
                                PlatformUI.getWorkbench()
                                        .getActiveWorkbenchWindow()
                                        .getShell(),
                                "Exception Occurred", e1.getClass().toString() + " " + e1.getMessage())//$NON-NLS-1$//$NON-NLS-2$
                ValidationPlugin.log(e1.getMessage(), e1);
                return null;
            }
            // determine which TestSuiteDTO to use (for now, use the default)
            String testSuiteDTOKey = defaultTestSuite;
            // add the validation to the processor (creates a testDTO
            // and adds the validation to the appropriate lookup)
            processor.addValidation(newTest, plugin, testSuiteDTOKey);
            // if a defaultTypeRef exists, set any typeRefs to that value
            if ((defaultTypeRef != null) && defaultTypeRef.length() > 0) {
                thisTest = (TestDTO) processor.getTests().get(newTest.getName());
                Map args = thisTest.getArgs();
                for (Iterator i = args.keySet().iterator(); i.hasNext();) {
                    ArgumentDTO arg = (ArgumentDTO) args.get(i.next());
                    String argName = arg.getName();
                    //is it a typeRef?
                    if (isTypeRef(argName)) {
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

         */
        public void modifyText(ModifyEvent e) {
            //ensure this is a validation test description (plugin descriptions cannot be modified)
            if (selectedTreeItem instanceof TestDTO) {
                //save the text
                TestDTO treeItem = ((TestDTO) selectedTreeItem);
                treeItem.setDescription(descText.getText());
            }
        }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

         */
        public void modifyText(ModifyEvent e) {
            //ensure this is a validation test description (plugin descriptions cannot be modified)
            if (selectedTreeItem instanceof TestDTO) {
                //save the text
                TestDTO treeItem = ((TestDTO) selectedTreeItem);
                boolean renameSuccess = processor.renameValidation(treeItem.getName(), nameText.getText(), defaultTestSuite);
                if (renameSuccess) {
                    treeViewer.refresh();
                    getDialog().setErrorMessage(null);
                } else {
                    //user tried to create 2 identical test names -- complain.
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

        public void widgetSelected(SelectionEvent e) {
            Object selection = selectedTreeItem;
            //a test is selected?
            if (selection instanceof TestDTO) {
                //find the validation, given the TestDTO
                TestDTO test = (TestDTO) selection;
                //delete the validation test
                processor.removeValidation(test);
                treeViewer.refresh();
                updateButtons();
            }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

          validationProcessor = newProcessor;         
        }

    public Object getParent(Object element) {
            if (element instanceof TestDTO) {
                TestDTO test = (TestDTO) element;
                return test.getPlugIn();
            }
      return null;
    }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

      MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),"Problem Occurred", errorMsg); //$NON-NLS-1$
      ValidationPlugin.log(errorMsg, new ValidationException());
      return;
    }
    //create a testDTO containing the new validation test and args
    TestDTO newTest = new TestDTO();
    //set the name, desc, plugin, and args
    newTest.setName(validation.getName());
    newTest.setDescription(validation.getDescription());
    newTest.setPlugIn(plugin);
    //create a copy of the map and args
    //note: this copies the args from the PlugInDTO
    //Map oldArgs = plugin.getArgs();
    Map<String, ArgumentDTO> oldArgs = allArgs;
    Map<String, ArgumentDTO> newArgs = new HashMap<String, ArgumentDTO>();
    for (Iterator i = oldArgs.keySet().iterator(); i.hasNext();) {
      ArgumentDTO oldArg = (ArgumentDTO) oldArgs.get(i.next());
      ArgumentDTO newArg = (ArgumentDTO) oldArg.clone();
      newArgs.put(newArg.getName(), newArg);
    }
    //store the new args
    newTest.setArgs(newArgs);
    //add the new test to the appropriate testSuite
    Map<String, TestDTO> tests = ((TestSuiteDTO) testSuiteDTOs.get(testSuiteDTOKey)).getTests();
    tests.put(newTest.getName(), newTest);
    ((TestSuiteDTO) testSuiteDTOs.get(testSuiteDTOKey)).setTests(tests);
  }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

    public boolean renameValidation(String oldKey, String newKey, Object testSuiteDTOKey) {
        Map<String, TestDTO> tests = ((TestSuiteDTO) testSuiteDTOs.get(testSuiteDTOKey)).getTests();
        if (oldKey.equals(newKey)) return true; //no change
        if (tests.containsKey(newKey)) return false; //duplicate key -- abort!
        TestDTO test = tests.remove(oldKey);
        test.setName(newKey);
        tests.put(newKey, test);
        return true;
    }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

      oldTests = testSuite.getTests();
      newTests = new HashMap(testSuite.getTests()); //create a new copy of the object, so we can modify it
      //for each test
      for (Iterator j = ((HashMap) oldTests).keySet().iterator(); j.hasNext();) {
        Object testKey = j.next();
        TestDTO currentTest = (TestDTO) oldTests.get(testKey);
        if (currentTest.equals(test)) {
          newTests.remove(testKey); //this is the test we want to delete
        }
      }
      testSuite.setTests(newTests); //save the modified map of tests in the testSuite
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.