Class Capability1Tests

java.lang.Object
org.opengis.cite.cdb10.CommonFixture
org.opengis.cite.cdb10.cdbStructure.Capability1Tests
Direct Known Subclasses:
GSModelDescriptorStructureTests, GSModelGeometryStructureTests, GSModelInteriorDescriptorStructureTests, GSModelInteriorGeometryStructureTests, GSModelInteriorMaterialStructureTests, GSModelInteriorTextureStructureTests, GSModelMaterialStructureTests, GSModelTextureStructureTests, GTModelCMTStructureTests, GTModelDescriptorStructureTests, GTModelGeometryStructureTests, GTModelInteriorDescriptorStructureTests, GTModelInteriorGeometryStructureTests, GTModelInteriorMaterialStructureTests, GTModelInteriorTextureStructureTests, GTModelMaterialStructureTests, GTModelSignatureStructureTests, GTModelStructureTests, GTModelTextureStructureTests, MModelGeometryStructureTests, MModelSignatureStructureTests, MModelStructureTests, MModelTextureStructureTests, NavigationLibraryStructureTests, RootStructureTests, TilesStructureTests

public class Capability1Tests extends CommonFixture
Includes various tests of OGC CDB 1.0 Capability Level 1.
  • Constructor Details

    • Capability1Tests

      public Capability1Tests()

      Constructor for Capability1Tests.

  • Method Details

    • obtainTestSubject

      @BeforeClass public void obtainTestSubject(org.testng.ITestContext testContext)
      Obtains the test subject from the ISuite context. The suite attribute SuiteAttribute.TEST_SUBJECT should evaluate to a DOM Document node. Obtains the test subject from the ISuite context. The suite attribute SuiteAttribute.TEST_SUBJECT should evaluate to a DOM Document node.
      Overrides:
      obtainTestSubject in class CommonFixture
      Parameters:
      testContext - The test (group) context.
    • getDatasetPaths

      protected ArrayList<Path> getDatasetPaths(String cdbRoot, String datasetName) throws IOException
      Scan the "Tiles" directory in the given CDB path for all Datasets with a matching name, returning a list of their paths. This is used to collect datasets out of different geocells.
      Parameters:
      cdbRoot - String of path to root of CDB
      datasetName - String of directories to match and return
      Returns:
      ArrayList<Path>
      Throws:
      IOException - Error reading from base directory
    • iterateDatasets

      protected void iterateDatasets(ArrayList<Path> datasets, Capability1Tests.validateFile lambda) throws IOException
      Combine looping of the array of dataset paths with lambda file evaluation.
      Parameters:
      datasets - Array of datasets to evaluate
      lambda - Lambda used to validate individual files; lambda will receive one argument, a Path to the file to be tested.
      Throws:
      IOException - Error reading from CDB
    • iterateEntries

      protected void iterateEntries(Path baseDirectory, int depth, Capability1Tests.validateFile lambda) throws IOException
      Run a lambda function against all files a certain depth below a given directory. Alternative to nested for loops that iterate "DirectoryStream", but this function **will not** pass the parent directory names along to the lambda. For depth = 0, files in the given directory are evaluated. For depth = 2, the given directory is filtered by sub-directories, which are in turn filtered by their sub-directories, and the files at that depth are evaluated. Non-directory files encountered while depth is still greater than zero will be ignored. If depth is still greater than zero but no more subdirectories exist, then the function will silently exit.
      Parameters:
      baseDirectory - Path to directory into which to "walk"
      depth - How many levels of subdirectories to recurse before running lambdas against file entries
      lambda - Lambda function to run against files at target depth
      Throws:
      IOException - Error reading from base directory
    • parseLOD

      protected Integer parseLOD(String lod)
      Parse a positive/negative integer from a String containing an LOD. LOD String should include prefix "L" or "LC".
      Parameters:
      lod - String value of LOD from directory or filename
      Returns:
      Integer of LOD level
    • validateComponentSelector1

      protected void validateComponentSelector1(String cs1, String dataset, ArrayList<String> errors)
      Validate a first-level Component Selector based on a given Dataset.
      Parameters:
      cs1 - String of Component Selector with leading zeros
      dataset - String of Dataset ID with leading zeros
      errors - ArrayList (String) of errors, will be modified in-place
    • validateComponentSelector2

      protected void validateComponentSelector2(String cs2, String cs1, String dataset, ArrayList<String> errors)
      Validate a second-level Component Selector based on the first-level Component Selector and Dataset.
      Parameters:
      cs2 - String of Component Selector 2 with leading zeros
      cs1 - String of Component Selector 1 with leading zeros
      dataset - String of Dataset ID with leading zeros
      errors - ArrayList (String) of errors, will be modified in-place
    • validateComponentSelectorFormat

      protected void validateComponentSelectorFormat(String cs, Integer index, String filename, ArrayList<String> errors)
      Validate that a Component Selector is a valid format
      Parameters:
      cs - The Component Selector substring
      index - Integer for "1" (CS1) or "2" (CS2)
      filename - The filename being tested, used for errors
      errors - ArrayList (String) of errors, will be modified in-place
    • validateDISCategory

      protected void validateDISCategory(Path file, ArrayList<String> errors)
      Validate that a DIS Category directory is a valid format
      Parameters:
      file - The Path to the DIS Country directory
      errors - ArrayList (String) of errors, will be modified in-place
    • validateDISCountry

      protected void validateDISCountry(Path file, ArrayList<String> errors)
      Validate that a DIS Country directory is a valid format
      Parameters:
      file - The Path to the DIS Country directory
      errors - ArrayList (String) of errors, will be modified in-place
    • validateDISDomain

      protected void validateDISDomain(Path file, ArrayList<String> errors)
      Validate that a DIS Domain directory is a valid format
      Parameters:
      file - The Path to the DIS Domain directory
      errors - ArrayList (String) of errors, will be modified in-place
    • validateDISEntityKind

      protected void validateDISEntityKind(Path file, ArrayList<String> errors)
      Validate that a DIS Entity Kind directory is a valid format
      Parameters:
      file - The Path to the DIS Entity Kind directory
      errors - ArrayList (String) of errors, will be modified in-place
    • validateDISEntity

      protected void validateDISEntity(Path file, ArrayList<String> errors)
      Validate that a DIS Entity directory is a valid format
      Parameters:
      file - The Path to the DIS Entity directory
      errors - ArrayList (String) of errors, will be modified in-place
    • validateFeatureCode

      protected void validateFeatureCode(String featureCode, Path file, ArrayList<String> errors)
      Validate that the Feature Code is a valid format
      Parameters:
      featureCode - The Feature Code substring
      file - The Path to the file being tested, used for errors
      errors - ArrayList (String) of errors, will be modified in-place
    • validateFeatureSubCode

      protected void validateFeatureSubCode(String featureSubCode, Path file, ArrayList<String> errors)
      Validate that the Feature Sub Code is a valid format
      Parameters:
      featureSubCode - The Feature Sub Code substring
      file - The path to the file being tested, used for errors
      errors - ArrayList (String) of errors, will be modified in-place
    • validateLatitude

      protected void validateLatitude(String latitude, ArrayList<String> errors)
      Validate a latitude code as being a valid latitude.
      Parameters:
      latitude - String value of latitude, including prefix character (e.g. "S15")
      errors - ArrayList (String) of errors, will be modified in-place
    • validateLOD

      protected void validateLOD(Path file, ArrayList<String> errors)
      Deprecated.
      Use validateLod instead, with the filename
      Validate that an LOD directory is a valid format.
      Parameters:
      file - The Path to the LOD directory
      errors - ArrayList (String) of errors, will be modified in-place
    • validateLod

      protected void validateLod(String lod, ArrayList<String> errors)
      Validate a level-of-detail code.
      Parameters:
      lod - String of level-of-detail code
      errors - ArrayList (String) of errors, will be modified in-place
    • validateLongitude

      protected void validateLongitude(String longitude, ArrayList<String> errors)
      Validate a longitude code as being a valid longitude.
      Parameters:
      longitude - String value of longitude, including prefix character (e.g. "E100")
      errors - ArrayList (String) of errors, will be modified in-place
    • validateModelName

      protected void validateModelName(String modelName, Path file, ArrayList<String> errors)
      Validate that the Model Name substring is a valid format
      Parameters:
      modelName - The Model Name substring
      file - The path to the file being tested
      errors - ArrayList (String) of errors, will be modified in-place
    • validateRref

      protected void validateRref(Integer rref, Integer lod, ArrayList<String> errors)
      Validates a RREF value is valid for an LOD.
      Parameters:
      rref - Integer of RREF value
      lod - Integer of level of detail (LOD), expecting -10 to 23
      errors - ArrayList (String) of errors, will be modified in-place
    • validateTextureNameCode

      protected void validateTextureNameCode(String textureName, Path file, ArrayList<String> errors)
      Validate that the texture name component of a filename matches the name of the parent directory for that file.
      Parameters:
      textureName - The texture name code substring of the file name
      file - The Path to the file being tested, used for errors
      errors - ArrayList (String) of errors, will be modified in-place
    • validateUref

      protected void validateUref(Integer uref, Integer lod, ArrayList<String> errors)
      Validate that a UREF value is valid for a given LOD.
      Parameters:
      uref - Integer of UREF value
      lod - Integer of level of detail (LOD), expecting -10 to 23
      errors - ArrayList (String) of errors, will be modified in-place