adiwg-mdtranslator 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/Rakefile +1 -2
- data/adiwg-mdtranslator.gemspec +23 -23
- data/bin/mdtranslator +187 -155
- data/lib/adiwg/mdtranslator.rb +63 -38
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +123 -5
- data/lib/adiwg/mdtranslator/internal/module_coordinates.rb +55 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +98 -70
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +13 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_additionalDocumentation.rb +13 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_address.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_associatedResource.rb +22 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_boundingBox.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_browseGraphic.rb +11 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_citation.rb +28 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_classedData.rb +49 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_classedDataItem.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_contacts.rb +14 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_coverageInfo.rb +83 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_coverageItem.rb +136 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_dataDictionary.rb +9 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_dataQuality.rb +17 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_dateTime.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_descriptiveKeyword.rb +22 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_dictionaryInfo.rb +18 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_digitalTransferOption.rb +80 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_dimension.rb +81 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_distributionInfo.rb +89 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_distributionOrder.rb +62 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_domain.rb +24 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_domainItem.rb +23 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_entity.rb +26 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_entityAttribute.rb +24 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_entityForeignKey.rb +20 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_entityIndex.rb +20 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_extent.rb +9 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_geoCoordSystem.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_geoProperties.rb +9 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_geographicElement.rb +20 -18
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_gridInfo.rb +67 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_imageInfo.rb +119 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_legalConstraint.rb +7 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_lineString.rb +5 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_lineage.rb +11 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_locale.rb +57 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_mdJson.rb +10 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_medium.rb +73 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_metadata.rb +14 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_metadataExtension.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_metadataInfo.rb +35 -15
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_onlineResource.rb +7 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_phone.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_point.rb +5 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_polygon.rb +5 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_processStep.rb +19 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_resolution.rb +7 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_resourceFormat.rb +12 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_resourceIdentifier.rb +30 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_resourceInfo.rb +70 -33
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_resourceMaintenance.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_resourceSpecificUsage.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_responsibleParty.rb +10 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_securityConstraint.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/module_sensorInfo.rb +69 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_source.rb +11 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_spatialReference.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_taxonClass.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_taxonomy.rb +11 -9
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_temporalElement.rb +9 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_timeInstant.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_timePeriod.rb +6 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_verticalElement.rb +3 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/{modules_1.0 → modules_v1}/module_voucher.rb +5 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_v1/version.rb +19 -0
- data/lib/adiwg/mdtranslator/readers/mdReaders.rb +21 -18
- data/lib/adiwg/mdtranslator/version.rb +15 -1
- data/lib/adiwg/mdtranslator/writers/html/html_writer.rb +11 -8
- data/lib/adiwg/mdtranslator/writers/html/md_html_writer.rb +21 -18
- data/lib/adiwg/mdtranslator/writers/html/sections/html_additionalDocumentation.rb +48 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_associatedResource.rb +73 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_body.rb +84 -135
- data/lib/adiwg/mdtranslator/writers/html/sections/html_citation.rb +18 -8
- data/lib/adiwg/mdtranslator/writers/html/sections/html_classedData.rb +50 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_classedDataItem.rb +50 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_contact.rb +5 -9
- data/lib/adiwg/mdtranslator/writers/html/sections/html_coverageInfo.rb +88 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_coverageItem.rb +139 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_dataDictionary.rb +13 -12
- data/lib/adiwg/mdtranslator/writers/html/sections/html_dataLineage.rb +5 -4
- data/lib/adiwg/mdtranslator/writers/html/sections/html_dataSource.rb +5 -4
- data/lib/adiwg/mdtranslator/writers/html/sections/html_dimension.rb +71 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_distributor.rb +62 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_domain.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_entity.rb +5 -4
- data/lib/adiwg/mdtranslator/writers/html/sections/html_extent.rb +7 -6
- data/lib/adiwg/mdtranslator/writers/html/sections/html_format.rb +7 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_geographicElement.rb +7 -7
- data/lib/adiwg/mdtranslator/writers/html/sections/html_gridInfo.rb +65 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_head.rb +18 -3
- data/lib/adiwg/mdtranslator/writers/html/sections/html_imageInfo.rb +120 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_inlineCss.css +13 -20
- data/lib/adiwg/mdtranslator/writers/html/sections/html_keyword.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_medium.rb +19 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_metadataInfo.rb +22 -9
- data/lib/adiwg/mdtranslator/writers/html/sections/html_orderProcess.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_processStep.rb +5 -4
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceContact.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceGeneral.rb +25 -14
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceId.rb +30 -3
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceInfo.rb +194 -129
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceMaint.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceOther.rb +7 -6
- data/lib/adiwg/mdtranslator/writers/html/sections/html_resourceUsage.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_responsibleParty.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_sensorInfo.rb +66 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +7 -6
- data/lib/adiwg/mdtranslator/writers/html/sections/html_temporalElement.rb +7 -6
- data/lib/adiwg/mdtranslator/writers/html/sections/html_timeInstant.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_timePeriod.rb +3 -2
- data/lib/adiwg/mdtranslator/writers/html/sections/html_transferOption.rb +29 -4
- data/lib/adiwg/mdtranslator/writers/html/version.rb +17 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/class_FCfeatureCatalogue.rb +17 -16
- data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_address.rb +12 -8
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_baseUnit.rb +42 -0
- data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_codelist.rb +8 -3
- data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_contact.rb +16 -25
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_conventionalUnit.rb +68 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_definitionUnit.rb +39 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_derivedUnit.rb +46 -0
- data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_featureAttribute.rb +17 -14
- data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_featureConstraint.rb +6 -2
- data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_featureType.rb +16 -12
- data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_listedValue.rb +9 -18
- data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_multiplicity.rb +8 -4
- data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_onlineResource.rb +13 -9
- data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_responsibleParty.rb +16 -12
- data/lib/adiwg/mdtranslator/writers/{iso → iso19110}/classes/class_telephone.rb +9 -5
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_unitsOfMeasure.rb +262 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +36 -16
- data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +14 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/class_MImetadata.rb +73 -37
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_address.rb +116 -0
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_aggregateInformation.rb +13 -9
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_band.rb +165 -0
- data/lib/adiwg/mdtranslator/writers/{iso/units → iso19115_2/classes}/class_baseUnit.rb +6 -6
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_boundingPolygon.rb +14 -10
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_browseGraphic.rb +9 -5
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_citation.rb +31 -16
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_codelist.rb +56 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contact.rb +87 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contentInfo.rb +111 -0
- data/lib/adiwg/mdtranslator/writers/{iso/units → iso19115_2/classes}/class_conventionalUnit.rb +6 -6
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_dataIdentification.rb +106 -59
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_dataQuality.rb +11 -7
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_date.rb +8 -5
- data/lib/adiwg/mdtranslator/writers/{iso/units → iso19115_2/classes}/class_definitionUnit.rb +7 -7
- data/lib/adiwg/mdtranslator/writers/{iso/units → iso19115_2/classes}/class_derivedUnit.rb +6 -6
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_digitalTransferOptions.rb +92 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dimension.rb +68 -0
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_distribution.rb +8 -4
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_distributor.rb +44 -22
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_enumerationList.rb +7 -2
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_extent.rb +18 -14
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_format.rb +18 -2
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_geographicBoundingBox.rb +6 -2
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_geographicDescription.rb +8 -4
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_geographicElement.rb +10 -6
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gridInfo.rb +80 -0
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_identifier.rb +10 -6
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_imageDescription.rb +157 -0
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_keyword.rb +12 -8
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_legalConstraints.rb +12 -8
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_lineString.rb +13 -10
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_lineage.rb +14 -10
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_locale.rb +67 -0
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_maintenanceInformation.rb +12 -8
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_medium.rb +30 -9
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_metadataExtension.rb +19 -15
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_multiGeometry.rb +22 -17
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_onlineResource.rb +94 -0
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_point.rb +12 -9
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_polygon.rb +14 -11
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_processStep.rb +12 -9
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rangeElementDescription.rb +88 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +52 -0
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_resolution.rb +6 -2
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resourceIdentifier.rb +94 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +106 -0
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_securityConstraints.rb +12 -8
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_source.rb +12 -8
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_standardOrderProcess.rb +11 -9
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_taxonClassification.rb +8 -4
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_taxonSystem.rb +18 -14
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_telephone.rb +92 -0
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_temporalExtent.rb +10 -6
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_timeInstant.rb +9 -8
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_timePeriod.rb +10 -8
- data/lib/adiwg/mdtranslator/writers/{iso/units → iso19115_2/classes}/class_unitsOfMeasure.rb +48 -25
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_usage.rb +11 -7
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_useConstraints.rb +6 -2
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_verticalExtent.rb +6 -2
- data/lib/adiwg/mdtranslator/writers/{iso → iso19115_2}/classes/class_vouchers.rb +8 -4
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +32 -19
- data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +17 -0
- data/lib/adiwg/mdtranslator/writers/mdWriters.rb +21 -24
- data/test/readers/mdJson/v1/tc_reader_mdjson_additionalDocumentation.rb +116 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_address.rb +111 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_associatedResource.rb +157 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_browseGraphic.rb +119 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_citation.rb +143 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_contact.rb +138 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_dataQuality.rb +111 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_dateTime.rb +159 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_descriptiveKeyword.rb +115 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_dictionaryInfo.rb +121 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_digitalTransferOption.rb +94 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_distributionOrder.rb +103 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_domain.rb +130 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_domainItem.rb +98 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_entity.rb +134 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_entityAttribute.rb +154 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_entityForeignKey.rb +100 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_entityIndex.rb +99 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_legalConstraint.rb +104 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_lineage.rb +117 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_medium.rb +98 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_metadataInfo.rb +141 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_onlineResource.rb +110 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_phone.rb +112 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_processStep.rb +118 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_resolution.rb +77 -0
- data/test/readers/mdJson/v1/tc_reader_mdjson_source.rb +117 -0
- data/test/readers/mdJson/v1/tc_translation_19110.rb +57 -0
- data/test/readers/mdJson/{v1_0/tc_translation.rb → v1/tc_translation_19115_2.rb} +16 -31
- data/test/writers/iso19115_2/tc_writer_iso19115_2_address.rb +22 -15
- metadata +219 -140
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_1.0/module_coordinates.rb +0 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_1.0/module_distributionInfo.rb +0 -161
- data/lib/adiwg/mdtranslator/writers/html/sections/logo150.txt +0 -25
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_digitalTransferOptions.rb +0 -62
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_genericMetaData.rb +0 -74
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_referenceIdentifier.rb +0 -53
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_referenceSystem.rb +0 -40
- data/test/readers/mdJson/v1_0/tc_reader_mdjson_additionalDocumentation.rb +0 -85
- data/test/readers/mdJson/v1_0/tc_reader_mdjson_address.rb +0 -100
- data/test/readers/mdJson/v1_0/tc_reader_mdjson_associatedResource.rb +0 -101
- data/test/readers/mdJson/v1_0/tc_reader_mdjson_browseGraphic.rb +0 -86
- data/test/readers/mdJson/v1_0/tc_reader_mdjson_citation.rb +0 -116
- data/test/readers/mdJson/v1_0/tc_reader_mdjson_contact.rb +0 -138
- data/test/readers/mdJson/v1_0/tc_reader_mdjson_dictionaryInfo.rb +0 -95
- data/test/readers/mdJson/v1_0/tc_reader_mdjson_domain.rb +0 -99
- data/test/readers/mdJson/v1_0/tc_reader_mdjson_onlineResource.rb +0 -92
- data/test/readers/mdJson/v1_0/tc_reader_mdjson_phone.rb +0 -110
@@ -0,0 +1,138 @@
|
|
1
|
+
# MdTranslator - minitest of
|
2
|
+
# reader / mdJson / module_contacts
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2014-12-19 original script
|
6
|
+
# Stan Smith 2015-06-22 refactored setup to after removal of globals
|
7
|
+
|
8
|
+
# set reader version used by mdJson_reader.rb to require correct modules
|
9
|
+
module ADIWG
|
10
|
+
module Mdtranslator
|
11
|
+
module Readers
|
12
|
+
module MdJson
|
13
|
+
|
14
|
+
@responseObj = {
|
15
|
+
readerVersionUsed: '1.1.0'
|
16
|
+
}
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'minitest/autorun'
|
24
|
+
require 'json'
|
25
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
26
|
+
require 'adiwg/mdtranslator/readers/mdJson/mdJson_reader'
|
27
|
+
require 'adiwg/mdtranslator/readers/mdJson/modules_v1/module_contacts'
|
28
|
+
|
29
|
+
class TestReaderMdJsonContact_v1 < MiniTest::Test
|
30
|
+
|
31
|
+
# set constants and variables
|
32
|
+
@@NameSpace = ADIWG::Mdtranslator::Readers::MdJson::Contact
|
33
|
+
@@responseObj = {
|
34
|
+
readerVersionUsed: '1.0',
|
35
|
+
readerExecutionPass: true,
|
36
|
+
readerExecutionMessages: []
|
37
|
+
}
|
38
|
+
|
39
|
+
# get json file for tests from examples folder
|
40
|
+
file = File.join(File.dirname(__FILE__), '../../../', 'schemas/v1_0/examples', 'contact.json')
|
41
|
+
file = File.open(file, 'r')
|
42
|
+
jsonFile = file.read
|
43
|
+
file.close
|
44
|
+
aIn = JSON.parse(jsonFile)
|
45
|
+
|
46
|
+
# only the first instance in the example array is used for tests
|
47
|
+
# the first example is fully populated
|
48
|
+
@@hIn = aIn[0]
|
49
|
+
|
50
|
+
def test_complete_contact_object
|
51
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
52
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
53
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
54
|
+
|
55
|
+
assert_equal metadata[:contactId], 'contactId'
|
56
|
+
assert_equal metadata[:indName], 'individualName'
|
57
|
+
assert_equal metadata[:orgName], 'organizationName'
|
58
|
+
assert_equal metadata[:position], 'positionName'
|
59
|
+
refute_empty metadata[:phones]
|
60
|
+
refute_empty metadata[:address]
|
61
|
+
refute_empty metadata[:onlineRes]
|
62
|
+
assert_equal metadata[:contactInstructions], 'contactInstructions'
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_empty_contactId
|
66
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
67
|
+
hIn['contactId'] = ''
|
68
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
69
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
70
|
+
|
71
|
+
assert_nil metadata
|
72
|
+
refute hResponse[:readerExecutionPass]
|
73
|
+
refute_empty hResponse[:readerExecutionMessages]
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_missing_contactId
|
77
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
78
|
+
hIn.delete('contactId')
|
79
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
80
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
81
|
+
|
82
|
+
assert_nil metadata
|
83
|
+
refute hResponse[:readerExecutionPass]
|
84
|
+
refute_empty hResponse[:readerExecutionMessages]
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_empty_contact_elements
|
88
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
89
|
+
hIn['individualName'] = ''
|
90
|
+
hIn['organizationName'] = ''
|
91
|
+
hIn['positionName'] = ''
|
92
|
+
hIn['onlineResource'] = []
|
93
|
+
hIn['contactInstructions'] = ''
|
94
|
+
hIn['phoneBook'] = []
|
95
|
+
hIn['address'] = {}
|
96
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
97
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
98
|
+
|
99
|
+
assert_equal metadata[:contactId], 'contactId'
|
100
|
+
assert_nil metadata[:indName]
|
101
|
+
assert_nil metadata[:orgName]
|
102
|
+
assert_nil metadata[:position]
|
103
|
+
assert_empty metadata[:phones]
|
104
|
+
assert_empty metadata[:address]
|
105
|
+
assert_empty metadata[:onlineRes]
|
106
|
+
assert_nil metadata[:contactInstructions]
|
107
|
+
end
|
108
|
+
|
109
|
+
def test_missing_contact_elements
|
110
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
111
|
+
hIn.delete('individualName')
|
112
|
+
hIn.delete('organizationName')
|
113
|
+
hIn.delete('positionName')
|
114
|
+
hIn.delete('onlineResource')
|
115
|
+
hIn.delete('contactInstructions')
|
116
|
+
hIn.delete('phoneBook')
|
117
|
+
hIn.delete('address')
|
118
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
119
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
120
|
+
|
121
|
+
assert_equal metadata[:contactId], 'contactId'
|
122
|
+
assert_nil metadata[:indName]
|
123
|
+
assert_nil metadata[:orgName]
|
124
|
+
assert_nil metadata[:position]
|
125
|
+
assert_empty metadata[:phones]
|
126
|
+
assert_empty metadata[:address]
|
127
|
+
assert_empty metadata[:onlineRes]
|
128
|
+
assert_nil metadata[:contactInstructions]
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_empty_contact_object
|
132
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
133
|
+
metadata = @@NameSpace.unpack({}, hResponse)
|
134
|
+
|
135
|
+
assert_nil metadata
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# MdTranslator - minitest of
|
2
|
+
# reader / mdJson / module_dataQuality
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2015-09-22 original script
|
6
|
+
|
7
|
+
# set reader version used by mdJson_reader.rb to require correct modules
|
8
|
+
module ADIWG
|
9
|
+
module Mdtranslator
|
10
|
+
module Readers
|
11
|
+
module MdJson
|
12
|
+
|
13
|
+
@responseObj = {
|
14
|
+
readerVersionUsed: '1.1.0'
|
15
|
+
}
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'minitest/autorun'
|
23
|
+
require 'json'
|
24
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
25
|
+
require 'adiwg/mdtranslator/readers/mdJson/mdJson_reader'
|
26
|
+
require 'adiwg/mdtranslator/readers/mdJson/modules_v1/module_dataQuality'
|
27
|
+
|
28
|
+
class TestReaderMdJsonDataQuality_v1 < MiniTest::Test
|
29
|
+
|
30
|
+
# set constants and variables
|
31
|
+
@@NameSpace = ADIWG::Mdtranslator::Readers::MdJson::DataQuality
|
32
|
+
@@responseObj = {
|
33
|
+
readerExecutionMessages: [],
|
34
|
+
readerExecutionPass: true
|
35
|
+
}
|
36
|
+
|
37
|
+
# get json file for tests from examples folder
|
38
|
+
file = File.join(File.dirname(__FILE__), '../../../', 'schemas/v1_0/examples', 'dataQuality.json')
|
39
|
+
file = File.open(file, 'r')
|
40
|
+
jsonFile = file.read
|
41
|
+
file.close
|
42
|
+
aIn = JSON.parse(jsonFile)
|
43
|
+
|
44
|
+
# only the first instance in the example array is used for tests
|
45
|
+
# the first example is fully populated
|
46
|
+
# remove responsible party from process step and source to prevent search for contact
|
47
|
+
# in contact array which has not been loaded
|
48
|
+
@@hIn = aIn[0]
|
49
|
+
@@hIn['lineage']['processStep'][0]['processor'] = []
|
50
|
+
@@hIn['lineage']['processStep'][1]['processor'] = []
|
51
|
+
@@hIn['lineage']['source'][0]['citation']['responsibleParty'] = []
|
52
|
+
@@hIn['lineage']['source'][0]['citation']['identifier'] = []
|
53
|
+
@@hIn['lineage']['source'][0]['processStep'] = []
|
54
|
+
|
55
|
+
def test_complete_dataQuality_object
|
56
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
57
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
58
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
59
|
+
|
60
|
+
assert_equal metadata[:dataScope], 'scope'
|
61
|
+
refute_empty metadata[:dataLineage]
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_empty_dataQuality_scope
|
65
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
66
|
+
hIn['scope'] = ''
|
67
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
68
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
69
|
+
|
70
|
+
assert_nil metadata
|
71
|
+
refute hResponse[:readerExecutionPass]
|
72
|
+
refute_empty hResponse[:readerExecutionMessages]
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_missing_dataQuality_scope
|
76
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
77
|
+
hIn['scope'] = ''
|
78
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
79
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
80
|
+
|
81
|
+
assert_nil metadata
|
82
|
+
refute hResponse[:readerExecutionPass]
|
83
|
+
refute_empty hResponse[:readerExecutionMessages]
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_empty_dataQuality_elements
|
87
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
88
|
+
hIn['lineage'] = {}
|
89
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
90
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
91
|
+
|
92
|
+
assert_empty metadata[:dataLineage]
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_missing_dataQuality_elements
|
96
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
97
|
+
hIn.delete('lineage')
|
98
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
99
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
100
|
+
|
101
|
+
assert_empty metadata[:dataLineage]
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_empty_dataQuality_object
|
105
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
106
|
+
metadata = @@NameSpace.unpack({}, hResponse)
|
107
|
+
|
108
|
+
assert_nil metadata
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
@@ -0,0 +1,159 @@
|
|
1
|
+
# MdTranslator - minitest of
|
2
|
+
# reader / mdJson / module_dateTime
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2015-08-23 original script
|
6
|
+
|
7
|
+
# set reader version used by mdJson_reader.rb to require correct modules
|
8
|
+
module ADIWG
|
9
|
+
module Mdtranslator
|
10
|
+
module Readers
|
11
|
+
module MdJson
|
12
|
+
|
13
|
+
@responseObj = {
|
14
|
+
readerVersionUsed: '1.2.0'
|
15
|
+
}
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'minitest/autorun'
|
23
|
+
require 'json'
|
24
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
25
|
+
require 'adiwg/mdtranslator/readers/mdJson/modules_v1/module_dateTime'
|
26
|
+
|
27
|
+
class TestReaderMdJsonDateTime_v1 < MiniTest::Test
|
28
|
+
|
29
|
+
# set constants and variables
|
30
|
+
@@NameSpace = ADIWG::Mdtranslator::Readers::MdJson::DateTime
|
31
|
+
@@responseObj = {}
|
32
|
+
|
33
|
+
# supported date formats to test
|
34
|
+
@@hIn = %w[
|
35
|
+
2013
|
36
|
+
2013-02
|
37
|
+
2013-02-03
|
38
|
+
2013-02-03T04
|
39
|
+
2013-02-03T04:05
|
40
|
+
2013-02-03T04:05:06
|
41
|
+
2013-02-03T04:05:06.78
|
42
|
+
2013-02-03T04Z
|
43
|
+
2013-02-03T04-09
|
44
|
+
2013-02-03T04+09:10
|
45
|
+
2013-02-03T04:05Z
|
46
|
+
2013-02-03T04:05-09
|
47
|
+
2013-02-03T04:05+09:10
|
48
|
+
2013-02-03T04:05:06Z
|
49
|
+
2013-02-03T04:05:06-09
|
50
|
+
2013-02-03T04:05:06+09:10
|
51
|
+
2013-02-03T04:05:06.78Z
|
52
|
+
2013-02-03T04:05:06.78-09
|
53
|
+
2013-02-03T04:05:06.78+09:10
|
54
|
+
]
|
55
|
+
|
56
|
+
def test_dateTime
|
57
|
+
|
58
|
+
# year
|
59
|
+
metadata = @@NameSpace.unpack(@@hIn[0], @@responseObj)
|
60
|
+
assert_equal '2013-01-01T00:00:00+00:00', metadata[:dateTime].to_s
|
61
|
+
assert_equal 'Y', metadata[:dateResolution]
|
62
|
+
assert_nil metadata[:dateType]
|
63
|
+
|
64
|
+
# year-month
|
65
|
+
metadata = @@NameSpace.unpack(@@hIn[1], @@responseObj)
|
66
|
+
assert_equal '2013-02-01T00:00:00+00:00', metadata[:dateTime].to_s
|
67
|
+
assert_equal 'YM', metadata[:dateResolution]
|
68
|
+
|
69
|
+
# year-month-day
|
70
|
+
metadata = @@NameSpace.unpack(@@hIn[2], @@responseObj)
|
71
|
+
assert_equal '2013-02-03T00:00:00+00:00', metadata[:dateTime].to_s
|
72
|
+
assert_equal 'YMD', metadata[:dateResolution]
|
73
|
+
|
74
|
+
# year-month-day-hour
|
75
|
+
metadata = @@NameSpace.unpack(@@hIn[3], @@responseObj)
|
76
|
+
assert_equal '2013-02-03T04:00:00+00:00', metadata[:dateTime].to_s
|
77
|
+
assert_equal 'YMDh', metadata[:dateResolution]
|
78
|
+
|
79
|
+
# year-month-day-hour-minute
|
80
|
+
metadata = @@NameSpace.unpack(@@hIn[4], @@responseObj)
|
81
|
+
assert_equal '2013-02-03T04:05:00+00:00', metadata[:dateTime].to_s
|
82
|
+
assert_equal 'YMDhm', metadata[:dateResolution]
|
83
|
+
|
84
|
+
# year-month-day-hour-minute-second
|
85
|
+
metadata = @@NameSpace.unpack(@@hIn[5], @@responseObj)
|
86
|
+
assert_equal '2013-02-03T04:05:06+00:00', metadata[:dateTime].to_s
|
87
|
+
assert_equal 'YMDhms', metadata[:dateResolution]
|
88
|
+
|
89
|
+
# year-month-day-hour-minute-second.fraction
|
90
|
+
# note: there is a problem with Ruby strftime. When printing times with fractions
|
91
|
+
# ... of seconds the fractions are not displayed if %:z is used unless %:z is
|
92
|
+
# ... separated from %L by a space or other character.
|
93
|
+
metadata = @@NameSpace.unpack(@@hIn[6], @@responseObj)
|
94
|
+
assert_equal '2013-02-03T04:05:06.780 +00:00', metadata[:dateTime].strftime('%Y-%m-%dT%H:%M:%S.%L %:z')
|
95
|
+
assert_equal 'YMDhmsL', metadata[:dateResolution]
|
96
|
+
|
97
|
+
# year-month-day-hour-zulu
|
98
|
+
metadata = @@NameSpace.unpack(@@hIn[7], @@responseObj)
|
99
|
+
assert_equal '2013-02-03T04:00:00+00:00', metadata[:dateTime].to_s
|
100
|
+
assert_equal 'YMDhZ', metadata[:dateResolution]
|
101
|
+
|
102
|
+
# year-month-day-hour-offset(-)
|
103
|
+
metadata = @@NameSpace.unpack(@@hIn[8], @@responseObj)
|
104
|
+
assert_equal '2013-02-03T04:00:00-09:00', metadata[:dateTime].to_s
|
105
|
+
assert_equal 'YMDhZ', metadata[:dateResolution]
|
106
|
+
|
107
|
+
# year-month-day-hour-offset(+)
|
108
|
+
metadata = @@NameSpace.unpack(@@hIn[9], @@responseObj)
|
109
|
+
assert_equal '2013-02-03T04:00:00+09:10', metadata[:dateTime].to_s
|
110
|
+
assert_equal 'YMDhZ', metadata[:dateResolution]
|
111
|
+
|
112
|
+
# year-month-day-hour-minute-zulu
|
113
|
+
metadata = @@NameSpace.unpack(@@hIn[10], @@responseObj)
|
114
|
+
assert_equal '2013-02-03T04:05:00+00:00', metadata[:dateTime].to_s
|
115
|
+
assert_equal 'YMDhmZ', metadata[:dateResolution]
|
116
|
+
|
117
|
+
# year-month-day-hour-minute-offset(-)
|
118
|
+
metadata = @@NameSpace.unpack(@@hIn[11], @@responseObj)
|
119
|
+
assert_equal '2013-02-03T04:05:00-09:00', metadata[:dateTime].to_s
|
120
|
+
assert_equal 'YMDhmZ', metadata[:dateResolution]
|
121
|
+
|
122
|
+
# year-month-day-hour-minute-offset(+)
|
123
|
+
metadata = @@NameSpace.unpack(@@hIn[12], @@responseObj)
|
124
|
+
assert_equal '2013-02-03T04:05:00+09:10', metadata[:dateTime].to_s
|
125
|
+
assert_equal 'YMDhmZ', metadata[:dateResolution]
|
126
|
+
|
127
|
+
# year-month-day-hour-minute-second-zulu
|
128
|
+
metadata = @@NameSpace.unpack(@@hIn[13], @@responseObj)
|
129
|
+
assert_equal '2013-02-03T04:05:06+00:00', metadata[:dateTime].to_s
|
130
|
+
assert_equal 'YMDhmsZ', metadata[:dateResolution]
|
131
|
+
|
132
|
+
# year-month-day-hour-minute-second-offset(-)
|
133
|
+
metadata = @@NameSpace.unpack(@@hIn[14], @@responseObj)
|
134
|
+
assert_equal '2013-02-03T04:05:06-09:00', metadata[:dateTime].to_s
|
135
|
+
assert_equal 'YMDhmsZ', metadata[:dateResolution]
|
136
|
+
|
137
|
+
# year-month-day-hour-minute-second-offset(+)
|
138
|
+
metadata = @@NameSpace.unpack(@@hIn[15], @@responseObj)
|
139
|
+
assert_equal '2013-02-03T04:05:06+09:10', metadata[:dateTime].to_s
|
140
|
+
assert_equal 'YMDhmsZ', metadata[:dateResolution]
|
141
|
+
|
142
|
+
# year-month-day-hour-minute-second.fraction-zulu
|
143
|
+
metadata = @@NameSpace.unpack(@@hIn[16], @@responseObj)
|
144
|
+
assert_equal '2013-02-03T04:05:06.780 +00:00', metadata[:dateTime].strftime('%Y-%m-%dT%H:%M:%S.%L %:z')
|
145
|
+
assert_equal 'YMDhmsLZ', metadata[:dateResolution]
|
146
|
+
|
147
|
+
# year-month-day-hour-minute-second.fraction-offset(-)
|
148
|
+
metadata = @@NameSpace.unpack(@@hIn[17], @@responseObj)
|
149
|
+
assert_equal '2013-02-03T04:05:06.780 -09:00', metadata[:dateTime].strftime('%Y-%m-%dT%H:%M:%S.%L %:z')
|
150
|
+
assert_equal 'YMDhmsLZ', metadata[:dateResolution]
|
151
|
+
|
152
|
+
# year-month-day-hour-minute-second.fraction-offset(+)
|
153
|
+
metadata = @@NameSpace.unpack(@@hIn[18], @@responseObj)
|
154
|
+
assert_equal '2013-02-03T04:05:06.780 +09:10', metadata[:dateTime].strftime('%Y-%m-%dT%H:%M:%S.%L %:z')
|
155
|
+
assert_equal 'YMDhmsLZ', metadata[:dateResolution]
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# MdTranslator - minitest of
|
2
|
+
# reader / mdJson / module_descriptiveKeyword
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2015-08-24 original script
|
6
|
+
|
7
|
+
# set reader version used by mdJson_reader.rb to require correct modules
|
8
|
+
module ADIWG
|
9
|
+
module Mdtranslator
|
10
|
+
module Readers
|
11
|
+
module MdJson
|
12
|
+
|
13
|
+
@responseObj = {
|
14
|
+
readerVersionUsed: '1.2.0'
|
15
|
+
}
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'minitest/autorun'
|
23
|
+
require 'json'
|
24
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
25
|
+
require 'adiwg/mdtranslator/readers/mdJson/mdJson_reader'
|
26
|
+
require 'adiwg/mdtranslator/readers/mdJson/modules_v1/module_descriptiveKeyword'
|
27
|
+
|
28
|
+
class TestReaderMdJsonDescriptiveKeyword_v1 < MiniTest::Test
|
29
|
+
|
30
|
+
# set constants and variables
|
31
|
+
@@NameSpace = ADIWG::Mdtranslator::Readers::MdJson::DescriptiveKeyword
|
32
|
+
@@responseObj = {
|
33
|
+
readerExecutionMessages: [],
|
34
|
+
readerExecutionPass: true
|
35
|
+
}
|
36
|
+
|
37
|
+
# get json file for tests from examples folder
|
38
|
+
file = File.join(File.dirname(__FILE__), '../../../', 'schemas/v1_0/examples', 'keywords.json')
|
39
|
+
file = File.open(file, 'r')
|
40
|
+
jsonFile = file.read
|
41
|
+
file.close
|
42
|
+
aIn = JSON.parse(jsonFile)
|
43
|
+
|
44
|
+
# only the first instance in the example array is used for tests
|
45
|
+
# the first example is fully populated
|
46
|
+
# remove responsible party from citation to prevent search for contact
|
47
|
+
# in contact array which has not been loaded
|
48
|
+
@@hIn = aIn[0]
|
49
|
+
@@hIn['thesaurus']['responsibleParty'] = []
|
50
|
+
@@hIn['thesaurus']['identifier'][0]['authority']['responsibleParty'] = []
|
51
|
+
|
52
|
+
def test_complete_keyword_object
|
53
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
54
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
55
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
56
|
+
|
57
|
+
assert_equal metadata[:keyword].length, 2
|
58
|
+
assert_equal metadata[:keyword][0], 'keyword1'
|
59
|
+
assert_equal metadata[:keyword][1], 'keyword2'
|
60
|
+
assert_equal metadata[:keywordType], 'keywordType'
|
61
|
+
refute_empty metadata[:keyTheCitation]
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_empty_keyword_list
|
65
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
66
|
+
hIn['keyword'] = []
|
67
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
68
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
69
|
+
|
70
|
+
assert_nil metadata
|
71
|
+
refute hResponse[:readerExecutionPass]
|
72
|
+
refute_empty hResponse[:readerExecutionMessages]
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_missing_keyword_list
|
76
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
77
|
+
hIn.delete('keyword')
|
78
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
79
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
80
|
+
|
81
|
+
assert_nil metadata
|
82
|
+
refute hResponse[:readerExecutionPass]
|
83
|
+
refute_empty hResponse[:readerExecutionMessages]
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_empty_keyword_elements
|
87
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
88
|
+
hIn['keywordType'] = ''
|
89
|
+
hIn['thesaurus'] = ''
|
90
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
91
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
92
|
+
|
93
|
+
assert_nil metadata[:keywordType]
|
94
|
+
assert_empty metadata[:keyTheCitation]
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_missing_keyword_elements
|
98
|
+
hIn = Marshal::load(Marshal.dump(@@hIn))
|
99
|
+
hIn.delete('keywordType')
|
100
|
+
hIn.delete('thesaurus')
|
101
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
102
|
+
metadata = @@NameSpace.unpack(hIn, hResponse)
|
103
|
+
|
104
|
+
assert_nil metadata[:keywordType]
|
105
|
+
assert_empty metadata[:keyTheCitation]
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_empty_keyword_object
|
109
|
+
hResponse = Marshal::load(Marshal.dump(@@responseObj))
|
110
|
+
metadata = @@NameSpace.unpack({}, hResponse)
|
111
|
+
|
112
|
+
assert_nil metadata
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|