Examples of TestDTO


Examples of org.geotools.validation.dto.TestDTO

            Iterator j = dto.getTests().keySet().iterator();

            // go through each test plugIn
            //
            while (j.hasNext()) {
                TestDTO tdto = (TestDTO) dto.getTests().get(j.next());
                plugInNames.add(tdto.getPlugIn().getName());
            }
        }

        return plugInNames;
    }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

            TestSuiteDTO tdto = (TestSuiteDTO) testSuiteDTOs.get(i.next());
            Iterator j = tdto.getTests().keySet().iterator();

            // for each TEST in the test suite
            while (j.hasNext()) {
                TestDTO dto = (TestDTO) tdto.getTests().get(j.next());

                // deal with test
                Map testArgs = dto.getArgs();

                if (testArgs == null) {
                    testArgs = new HashMap();
                } else {
                    Map m = new HashMap();
                    Iterator k = testArgs.keySet().iterator();

                    while (k.hasNext()) {
                        ArgumentDTO adto = (ArgumentDTO) testArgs.get(k.next());
                        m.put(adto.getName(), adto.getValue());
                    }

                    testArgs = m;
                }

                PlugIn plugIn = (org.geotools.validation.PlugIn) plugIns.get(dto.getPlugIn()
                                                                                .getName());
                Validation validation = plugIn.createValidation(dto.getName(),
                        dto.getDescription(), testArgs);

                if (validation instanceof FeatureValidation) {
                    addValidation((FeatureValidation) validation);
                }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

            /*assertTrue("TestSuite Description read",("This test suite checks each road name to see \n"+
               "that they are of appropriate length and checks to \n"+
               "see if they are on the list of possible road names.\n"+
               "It also checks to see if any roads are contained in\n"+
               "a specified box.").equals(testsuite.getDescription()));*/
            TestDTO test = (TestDTO) testsuite.getTests().get("NameLookup");

            assertNotNull("NameLookup does not exist as a test",test);

            // multi line so cannot effectively test
            // assertTrue("Test Description read","Checks to see if the road name is in the list of possible names.".equals(test.getDescription()));
            assertNotNull("Should not be null", test.getPlugIn());
            assertTrue("Test plugInName read",
                "NameInList".equals(test.getPlugIn().getName()));

            assertNotNull("Should be one arg.", test.getArgs());
            assertTrue("Should be one arg.", test.getArgs().size() == 2);
            assertTrue("Arg. name", test.getArgs().containsKey("LUTName"));

            // multi line so cannot effectively test
            //assertTrue("Arg. value : "+test.getArgs().get("LUTName"),test.getArgs().containsValue("RoadNameLUT.xls"));
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

                throw new ValidationException(
                    "The test suite loader has detected an error: no tests provided.");
            } else {
                for (int i = 0; i < nl.getLength(); i++) {
                    try {
                        TestDTO t = loadTestDTO((Element) nl.item(i), plugIns);
                        l.put(t.getName(), t);
                    } catch (ValidationException e) {
                        throw new ValidationException(
                            "An error occured loading a test in "
                            + dto.getName() + " test suite.", e);
                    }
                    catch (Throwable t) {
                        throw new ValidationException(
                            "Could not load test suite "
                            + dto.getName() + ":"+ t.getMessage(), t);
                    }                   
                }
            }
        } catch (IOException e) {
            throw new ValidationException("An error occured loading the "
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

     *
     * @throws ValidationException DOCUMENT ME!
     */
    private static TestDTO loadTestDTO(Element elem, Map plugIns)
        throws ValidationException {
        TestDTO dto = new TestDTO();

        try {
            dto.setName(ReaderUtils.getChildText(elem, "name", true));
        } catch (SAXException e) {
            throw new ValidationException("Error reading the name for this test case.",
                e);
        }

        try {
            dto.setDescription(ReaderUtils.getChildText(elem, "description",
                    false));
        } catch (SAXException e) {
            throw new ValidationException(
                "Error reading the description for the " + dto.getName()
                + " test case.", e);
        }

        try {
            String pluginName = ReaderUtils.getChildText(elem, "plugin", true);
            dto.setPlugIn((PlugInDTO) plugIns.get(pluginName));

            if (dto.getPlugIn() == null) {
                throw new NullPointerException(
                    "Error - should have a plugin at "+elem);
            }
        } catch (SAXException e) {
            throw new ValidationException("Error reading the plugin for the "
                + dto.getName() + " test case.", e);
        }

        NodeList nl = elem.getElementsByTagName("argument");

        if (nl != null) {
            Map m = new HashMap();
            dto.setArgs(m);

            for (int i = 0; i < nl.getLength(); i++) {
                elem = (Element) nl.item(i);

                ArgumentDTO adto = null;

                try {
                    adto = loadArg(elem, dto.getPlugIn());
                } catch (ValidationException e) {
                    e.printStackTrace();

                    // error
                }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

        tests = new HashMap();

        Iterator i = ts.getTests().keySet().iterator();

        while (i.hasNext()) {
            TestDTO t = (TestDTO) ts.getTests().get(i.next());
            tests.put(t.getName(), new TestConfig(t, plugInConfigs));
        }
    }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

        while (i.hasNext()) {
            TestSuiteDTO dto = (TestSuiteDTO) testSuites.get(i.next());
            Iterator j = dto.getTests().keySet().iterator();

            while (j.hasNext()) {
                TestDTO tdto = (TestDTO) dto.getTests().get(j.next());
                plugInNames.add(tdto.getPlugIn().getName());
            }
        }

        // Mark all plug-ins as not loaded
        //
        i = plugIns.values().iterator();

        while (i.hasNext()) {
            PlugInDTO dto = (PlugInDTO) i.next();
            errors.put(dto, Boolean.FALSE);
        }

        // step 2 configure plug-ins with defaults
        Map defaultPlugIns = new HashMap(plugInNames.size());
        i = plugInNames.iterator();

        while (i.hasNext()) {
            String plugInName = (String) i.next();
            PlugInDTO dto = (PlugInDTO) plugIns.get(plugInName);
            Class plugInClass = null;

            try {
                plugInClass = Class.forName(dto.getClassName());
            } catch (ClassNotFoundException e) {
                //Error, using default.
                errors.put(dto, e);
                e.printStackTrace();
            }

            if (plugInClass == null) {
                plugInClass = Validation.class;
            }

            Map plugInArgs = dto.getArgs();

            if (plugInArgs == null) {
                plugInArgs = new HashMap();
            }

            try {
                PlugIn plugIn = new org.geotools.validation.PlugIn(plugInName, plugInClass,
                        dto.getDescription(), plugInArgs);
                defaultPlugIns.put(plugInName, plugIn);
            } catch (ValidationException e) {
                e.printStackTrace();
                // Update dto entry w/ an error?
                errors.put(dto, e);

                continue;
            }

            // mark dto entry as a success
            errors.put(dto, Boolean.TRUE);
        }

        // step 3 configure plug-ins with tests + add to processor
        i = testSuites.keySet().iterator();

        while (i.hasNext()) {
            TestSuiteDTO tdto = (TestSuiteDTO) testSuites.get(i.next());
            Iterator j = tdto.getTests().keySet().iterator();

            while (j.hasNext()) {
                TestDTO dto = (TestDTO) tdto.getTests().get(j.next());

                // deal with test
                Map testArgs = dto.getArgs();

                if (testArgs == null) {
                    testArgs = new HashMap();
                } else {
                    Map m = new HashMap();
                    Iterator k = testArgs.keySet().iterator();

                    while (k.hasNext()) {
                        ArgumentDTO adto = (ArgumentDTO) testArgs.get(k.next());
                        m.put(adto.getName(), adto.getValue());
                    }

                    testArgs = m;
                }

                try {
                    PlugIn plugIn = (org.geotools.validation.PlugIn) defaultPlugIns.get(dto.getPlugIn()
                                                                                           .getName());
                    Validation validation = plugIn.createValidation(dto.getName(),
                            dto.getDescription(), testArgs);

                    if (validation instanceof FeatureValidation) {
                        addValidation((FeatureValidation) validation);
                    }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

    public boolean equals(Object obj) {
        if ((obj == null) || !(obj instanceof TestDTO)) {
            return false;
        }

        TestDTO t = (TestDTO) obj;
        boolean r = true;

        if (name != null) {
            r = r && (name.equals(t.getName()));
        }

        if (description != null) {
            r = r && (description.equals(t.getDescription()));
        }

        if (plugIn == null) {
            if (t.getPlugIn() != null) {
                return false;
            }
        } else {
            if (t.getPlugIn() != null) {
                r = r && plugIn.equals(t.getPlugIn());
            } else {
                return false;
            }
        }

        if (args == null) {
            if (t.getArgs() != null) {
                return false;
            }
        } else {
            if (t.getArgs() != null) {
                r = r && args.equals(t.getArgs());
            } else {
                return false;
            }
        }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

     * @see java.lang.Object#clone()
     * @param plugIns Map of PlugInDTO objects
     * @return TestDTO
     */
    public TestDTO toDTO(Map plugIns) {
        TestDTO dto = new TestDTO();

        dto.setName(name);
        dto.setDescription(description);
        dto.setPlugIn((PlugInDTO) plugIns.get(plugIn.getName()));

        Map myArgs = new HashMap();

        if (this.args != null) {
            Iterator i = this.args.keySet().iterator();

            while (i.hasNext()) {
                String key = (String) i.next();
                myArgs.put(key, ((ArgumentConfig) this.args.get(key)).toDTO());
            }
        }

        dto.setArgs(myArgs);

        return dto;
    }
View Full Code Here

Examples of org.geotools.validation.dto.TestDTO

        while (i.hasNext()) {
            TestSuiteDTO dto = (TestSuiteDTO) testSuites.get(i.next());
            Iterator j = dto.getTests().keySet().iterator();

            while (j.hasNext()) {
                TestDTO tdto = (TestDTO) dto.getTests().get(j.next());
                plugInNames.add(tdto.getPlugIn().getName());
            }
        }

        // Mark all plug-ins as not loaded
        //
        i = plugIns.values().iterator();

        while (i.hasNext()) {
            PlugInDTO dto = (PlugInDTO) i.next();
            errors.put(dto, Boolean.FALSE);
        }

        // step 2 configure plug-ins with defaults
        Map defaultPlugIns = new HashMap(plugInNames.size());
        i = plugInNames.iterator();

        while (i.hasNext()) {
            String plugInName = (String) i.next();
            PlugInDTO dto = (PlugInDTO) plugIns.get(plugInName);
            Class plugInClass = null;

            try {
                plugInClass = Class.forName(dto.getClassName());
            } catch (ClassNotFoundException e) {
                //Error, using default.
                errors.put(dto, e);
                e.printStackTrace();
            }

            if (plugInClass == null) {
                plugInClass = Validation.class;
            }

            Map plugInArgs = dto.getArgs();

            if (plugInArgs == null) {
                plugInArgs = new HashMap();
            }

            try {
                PlugIn plugIn = new org.geotools.validation.PlugIn(plugInName, plugInClass,
                        dto.getDescription(), plugInArgs);
                defaultPlugIns.put(plugInName, plugIn);
            } catch (ValidationException e) {
                e.printStackTrace();
                // Update dto entry w/ an error?
                errors.put(dto, e);

                continue;
            }

            // mark dto entry as a success
            errors.put(dto, Boolean.TRUE);
        }

        // step 3 configure plug-ins with tests + add to processor
        i = testSuites.keySet().iterator();

        while (i.hasNext()) {
            TestSuiteDTO tdto = (TestSuiteDTO) testSuites.get(i.next());
            Iterator j = tdto.getTests().keySet().iterator();

            while (j.hasNext()) {
                TestDTO dto = (TestDTO) tdto.getTests().get(j.next());

                // deal with test
                Map testArgs = dto.getArgs();

                if (testArgs == null) {
                    testArgs = new HashMap();
                } else {
                    Map m = new HashMap();
                    Iterator k = testArgs.keySet().iterator();

                    while (k.hasNext()) {
                        ArgumentDTO adto = (ArgumentDTO) testArgs.get(k.next());
                        m.put(adto.getName(), adto.getValue());
                    }

                    testArgs = m;
                }

                try {
                    PlugIn plugIn = (org.geotools.validation.PlugIn) defaultPlugIns.get(dto.getPlugIn()
                                                                                           .getName());
                    Validation validation = plugIn.createValidation(dto.getName(),
                            dto.getDescription(), testArgs);

                    if (validation instanceof FeatureValidation) {
                        addValidation((FeatureValidation) validation);
                    }
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.