Class InitialUrlFilter

java.lang.Object
com.sun.javatest.TestFilter
com.sun.javatest.InitialUrlFilter

public class InitialUrlFilter extends TestFilter
Filters tests based on a set of initial files or URLs. Any test which does not begin with one of the supplied initial URLs is rejected. This is the obvious way to select subsets of a test suite based on the test suite hierarchy. Comparisons of initial URLs vs. test URLs are done without respect to case.
  • Constructor Details

    • InitialUrlFilter

      public InitialUrlFilter(File... initFiles)
      Create a filter based on the given files. These file paths must be relative to the testsuite root. String matching against the paths represented will be used to filter tests. You may specify a path to a "directory", a specific test, or to a filename which contains tests.
      Parameters:
      initFiles - Files which specify the tests to be accepted. Null or zero length arrays are accepted and result in accepts() always returning true.
    • InitialUrlFilter

      public InitialUrlFilter(String... initialUrls)
      Create a filter based on the given initial URLs. These URLs must be forward slash separated and relative to the testsuite root. String matching against the paths represented will be used to filter tests. You may specify a path to a "directory", a specific test, or to a filename which contains tests.
      Parameters:
      initialUrls - Paths which specify the tests to be accepted. Null or zero length arrays are accepted and result in accepts() always returning true.
  • Method Details

    • isInitialUrlMatch

      public static boolean isInitialUrlMatch(String toCheck, String compareTo)
      Find out if a given URL falls under a particular initial URL. This effectively compares one incoming URL to one in a set of known initial URLs.
      Parameters:
      toCheck - The incoming name to check. This might originate from a TestDescription being filtered.
      compareTo - The known initial URL to compare the previous parameter to. This would probably originate from a set of parameters.
      Returns:
      True if the toCheck URL falls within the range specified by the compareTo URL.
    • accepts

      public boolean accepts(TestDescription td)
      Description copied from class: TestFilter
      Determines whether a TestDescription should be accepted or rejected by this filter.
      Specified by:
      accepts in class TestFilter
      Parameters:
      td - the TestDescription to check
      Returns:
      true if td should be included in collection; false otherwise.
    • getInitFiles

      public File[] getInitFiles()
    • getInitStrings

      public String[] getInitStrings()
    • getName

      public String getName()
      Description copied from class: TestFilter
      Get the name of this filter, as might be used to choose of of a set of filters. This string should be localized.
      Specified by:
      getName in class TestFilter
      Returns:
      the name of this filter
    • getDescription

      public String getDescription()
      Description copied from class: TestFilter
      Get a description of this filter, as might be used to give more details about this filter than provided by TestFilter.getName(). This string should be localized.
      Specified by:
      getDescription in class TestFilter
      Returns:
      a description of this filter
    • getReason

      public String getReason()
      Description copied from class: TestFilter
      Get the reason why this filter would reject a test, as might be used in reports. This string should be localized.
      Specified by:
      getReason in class TestFilter
      Returns:
      a rejection reason for this filter