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
Includes various tests of OGC CDB 1.0 Capability Level 1.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interface
This interface is used to connect the directory iterator to validation lambda functions. -
Field Summary
Fields inherited from class org.opengis.cite.cdb10.CommonFixture
path, ROOT_PKG_PATH, SAMPLE_CDB_PATH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDatasetPaths
(String cdbRoot, String datasetName) Scan the "Tiles" directory in the given CDB path for all Datasets with a matching name, returning a list of their paths.protected void
iterateDatasets
(ArrayList<Path> datasets, Capability1Tests.validateFile lambda) Combine looping of the array of dataset paths with lambda file evaluation.protected void
iterateEntries
(Path baseDirectory, int depth, Capability1Tests.validateFile lambda) Run a lambda function against all files a certain depth below a given directory.void
obtainTestSubject
(org.testng.ITestContext testContext) Obtains the test subject from the ISuite context.protected Integer
Parse a positive/negative integer from a String containing an LOD.protected void
validateComponentSelector1
(String cs1, String dataset, ArrayList<String> errors) Validate a first-level Component Selector based on a given Dataset.protected void
Validate a second-level Component Selector based on the first-level Component Selector and Dataset.protected void
validateComponentSelectorFormat
(String cs, Integer index, String filename, ArrayList<String> errors) Validate that a Component Selector is a valid formatprotected void
validateDISCategory
(Path file, ArrayList<String> errors) Validate that a DIS Category directory is a valid formatprotected void
validateDISCountry
(Path file, ArrayList<String> errors) Validate that a DIS Country directory is a valid formatprotected void
validateDISDomain
(Path file, ArrayList<String> errors) Validate that a DIS Domain directory is a valid formatprotected void
validateDISEntity
(Path file, ArrayList<String> errors) Validate that a DIS Entity directory is a valid formatprotected void
validateDISEntityKind
(Path file, ArrayList<String> errors) Validate that a DIS Entity Kind directory is a valid formatprotected void
validateFeatureCode
(String featureCode, Path file, ArrayList<String> errors) Validate that the Feature Code is a valid formatprotected void
validateFeatureSubCode
(String featureSubCode, Path file, ArrayList<String> errors) Validate that the Feature Sub Code is a valid formatprotected void
validateLatitude
(String latitude, ArrayList<String> errors) Validate a latitude code as being a valid latitude.protected void
validateLod
(String lod, ArrayList<String> errors) Validate a level-of-detail code.protected void
validateLOD
(Path file, ArrayList<String> errors) Deprecated.protected void
validateLongitude
(String longitude, ArrayList<String> errors) Validate a longitude code as being a valid longitude.protected void
validateModelName
(String modelName, Path file, ArrayList<String> errors) Validate that the Model Name substring is a valid formatprotected void
validateRref
(Integer rref, Integer lod, ArrayList<String> errors) Validates a RREF value is valid for an LOD.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.protected void
validateUref
(Integer uref, Integer lod, ArrayList<String> errors) Validate that a UREF value is valid for a given LOD.
-
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 attributeSuiteAttribute.TEST_SUBJECT
should evaluate to a DOM Document node. Obtains the test subject from the ISuite context. The suite attributeSuiteAttribute.TEST_SUBJECT
should evaluate to a DOM Document node.- Overrides:
obtainTestSubject
in classCommonFixture
- Parameters:
testContext
- The test (group) context.
-
getDatasetPaths
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 CDBdatasetName
- 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 evaluatelambda
- 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 entrieslambda
- Lambda function to run against files at target depth- Throws:
IOException
- Error reading from base directory
-
parseLOD
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
Validate a first-level Component Selector based on a given Dataset.- Parameters:
cs1
- String of Component Selector with leading zerosdataset
- String of Dataset ID with leading zeroserrors
- 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 zeroscs1
- String of Component Selector 1 with leading zerosdataset
- String of Dataset ID with leading zeroserrors
- 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 substringindex
- Integer for "1" (CS1) or "2" (CS2)filename
- The filename being tested, used for errorserrors
- ArrayList (String) of errors, will be modified in-place
-
validateDISCategory
Validate that a DIS Category directory is a valid format- Parameters:
file
- The Path to the DIS Country directoryerrors
- ArrayList (String) of errors, will be modified in-place
-
validateDISCountry
Validate that a DIS Country directory is a valid format- Parameters:
file
- The Path to the DIS Country directoryerrors
- ArrayList (String) of errors, will be modified in-place
-
validateDISDomain
Validate that a DIS Domain directory is a valid format- Parameters:
file
- The Path to the DIS Domain directoryerrors
- ArrayList (String) of errors, will be modified in-place
-
validateDISEntityKind
Validate that a DIS Entity Kind directory is a valid format- Parameters:
file
- The Path to the DIS Entity Kind directoryerrors
- ArrayList (String) of errors, will be modified in-place
-
validateDISEntity
Validate that a DIS Entity directory is a valid format- Parameters:
file
- The Path to the DIS Entity directoryerrors
- ArrayList (String) of errors, will be modified in-place
-
validateFeatureCode
Validate that the Feature Code is a valid format- Parameters:
featureCode
- The Feature Code substringfile
- The Path to the file being tested, used for errorserrors
- ArrayList (String) of errors, will be modified in-place
-
validateFeatureSubCode
Validate that the Feature Sub Code is a valid format- Parameters:
featureSubCode
- The Feature Sub Code substringfile
- The path to the file being tested, used for errorserrors
- ArrayList (String) of errors, will be modified in-place
-
validateLatitude
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
Deprecated.UsevalidateLod
instead, with the filenameValidate that an LOD directory is a valid format.- Parameters:
file
- The Path to the LOD directoryerrors
- ArrayList (String) of errors, will be modified in-place
-
validateLod
Validate a level-of-detail code.- Parameters:
lod
- String of level-of-detail codeerrors
- ArrayList (String) of errors, will be modified in-place
-
validateLongitude
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
Validate that the Model Name substring is a valid format- Parameters:
modelName
- The Model Name substringfile
- The path to the file being testederrors
- ArrayList (String) of errors, will be modified in-place
-
validateRref
Validates a RREF value is valid for an LOD.- Parameters:
rref
- Integer of RREF valuelod
- Integer of level of detail (LOD), expecting -10 to 23errors
- ArrayList (String) of errors, will be modified in-place
-
validateTextureNameCode
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 namefile
- The Path to the file being tested, used for errorserrors
- ArrayList (String) of errors, will be modified in-place
-
validateUref
Validate that a UREF value is valid for a given LOD.- Parameters:
uref
- Integer of UREF valuelod
- Integer of level of detail (LOD), expecting -10 to 23errors
- ArrayList (String) of errors, will be modified in-place
-
validateLod
instead, with the filename