Class Test

    • Constructor Detail

      • Test

        public Test​(String name,
                    String description)
        Constructor
        Parameters:
        name - Name of the test
        description - Description of the test
      • Test

        public Test​(String name)
        Constructor
        Parameters:
        name - Name of the test
    • Method Detail

      • initialize

        public void initialize()
                        throws Exception
        Initializes any global data used this tester.
        Throws:
        Exception - When cannot initialize the test
      • startTest

        public void startTest​(ProgressMonitor progressMonitor)
        Start the test using a given progress monitor
        Parameters:
        progressMonitor - the progress monitor
      • setPartialSelection

        public void setPartialSelection​(boolean partialSelection)
        Flag notifying that this test is run over a partial data selection
        Parameters:
        partialSelection - Whether the test is on a partial selection data
      • getErrors

        public List<TestErrorgetErrors()
        Gets the validation errors accumulated until this moment.
        Returns:
        The list of errors
      • endTest

        public void endTest()
        Notification of the end of the test. The tester may perform additional actions and destroy the used structures.

        If you override this method, don't forget to cleanup progressMonitor (most overrides call super.endTest() to do this).

      • visit

        public void visit​(Collection<OsmPrimitive> selection)
        Visits all primitives to be tested. These primitives are always visited in the same order: nodes first, then ways.
        Parameters:
        selection - The primitives to be tested
      • isPrimitiveUsable

        public boolean isPrimitiveUsable​(OsmPrimitive p)
        Determines if the primitive is usable for tests.
        Parameters:
        p - The primitive
        Returns:
        true if the primitive can be tested, false otherwise
      • addGui

        public void addGui​(JPanel testPanel)
        Allow the tester to manage its own preferences
        Parameters:
        testPanel - The panel to add any preferences component
      • ok

        public boolean ok()
        Called when the used submits the preferences
        Returns:
        true if restart is required, false otherwise
      • fixError

        public Command fixError​(TestError testError)
        Fixes the error with the appropriate command
        Parameters:
        testError - error to fix
        Returns:
        The command to fix the error
      • isFixable

        public boolean isFixable​(TestError testError)
        Returns true if the given error can be fixed automatically
        Parameters:
        testError - The error to check if can be fixed
        Returns:
        true if the error can be fixed
      • testBeforeUpload

        public boolean testBeforeUpload()
        Returns true if this plugin must check the uploaded data before uploading
        Returns:
        true if this plugin must check the uploaded data before uploading
      • setBeforeUpload

        public void setBeforeUpload​(boolean isUpload)
        Sets the flag that marks an upload check
        Parameters:
        isUpload - if true, the test is before upload
      • getName

        public String getName()
        Returns the test name.
        Returns:
        The test name
      • isCanceled

        public boolean isCanceled()
        Determines if the test has been canceled.
        Returns:
        true if the test has been canceled, false otherwise
      • deletePrimitivesIfNeeded

        protected final Command deletePrimitivesIfNeeded​(Collection<? extends OsmPrimitive> primitives)
        Build a Delete command on all primitives that have not yet been deleted manually by user, or by another error fix. If all primitives have already been deleted, null is returned.
        Parameters:
        primitives - The primitives wanted for deletion
        Returns:
        a Delete command on all primitives that have not yet been deleted, or null otherwise
      • isBuilding

        protected static final boolean isBuilding​(OsmPrimitive p)
        Determines if the specified primitive denotes a building.
        Parameters:
        p - The primitive to be tested
        Returns:
        True if building key is set and different from no,entrance
      • isResidentialArea

        protected static final boolean isResidentialArea​(OsmPrimitive p)
        Determines if the specified primitive denotes a residential area.
        Parameters:
        p - The primitive to be tested
        Returns:
        True if landuse key is equal to residential
      • clear

        public void clear()
        Free resources.
      • getSource

        public Object getSource()
        Returns the name of this class.
        Returns:
        the name of this class (for ToolTip)
        Since:
        15972