adiwg-mdtranslator 0.10.2 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -4
- data/Rakefile +4 -1
- data/adiwg-mdtranslator.gemspec +10 -8
- data/bin/mdtranslator +8 -2
- data/lib/adiwg/mdtranslator.rb +72 -147
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +538 -538
- data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +78 -78
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +153 -74
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +41 -108
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_additionalDocumentation.rb +54 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_address.rb +89 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_associatedResource.rb +82 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_boundingBox.rb +62 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_browseGraphic.rb +69 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_citation.rb +122 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_contacts.rb +150 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_coordinates.rb +63 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_dataDictionary.rb +63 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_dataQuality.rb +51 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_dateTime.rb +38 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_descriptiveKeyword.rb +60 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_dictionaryInfo.rb +63 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_distributionInfo.rb +161 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_domain.rb +73 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_domainItem.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_entity.rb +103 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_entityAttribute.rb +102 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_entityForeignKey.rb +54 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_entityIndex.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_extent.rb +73 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_geoCoordSystem.rb +57 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_geoProperties.rb +100 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_geographicElement.rb +179 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_legalConstraint.rb +56 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_lineString.rb +36 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_lineage.rb +61 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_mdJson.rb +69 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_metadata.rb +88 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_metadataExtension.rb +51 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_metadataInfo.rb +123 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_onlineResource.rb +79 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_phone.rb +79 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_point.rb +36 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_polygon.rb +66 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_processStep.rb +75 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resolution.rb +53 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceFormat.rb +46 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceIdentifier.rb +60 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceInfo.rb +328 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceMaintenance.rb +61 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_resourceSpecificUsage.rb +61 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_responsibleParty.rb +48 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_securityConstraint.rb +63 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_source.rb +59 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_spatialReference.rb +59 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_taxonClass.rb +54 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_taxonomy.rb +94 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_temporalElement.rb +82 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_timeInstant.rb +56 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_timePeriod.rb +64 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_verticalElement.rb +64 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9/module_voucher.rb +49 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/readme.md +1 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/validator.rb +43 -0
- data/lib/adiwg/mdtranslator/readers/mdReaders.rb +55 -0
- data/lib/adiwg/mdtranslator/version.rb +15 -4
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_address.rb +107 -86
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_aggregateInformation.rb +68 -57
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_boundingPolygon.rb +59 -48
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_browseGraphic.rb +57 -46
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_citation.rb +149 -138
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_contact.rb +83 -72
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_dataIdentification.rb +334 -322
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_dataQuality.rb +46 -34
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_date.rb +47 -36
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_digitalTransferOptions.rb +42 -31
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_distribution.rb +29 -18
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_distributor.rb +77 -66
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_extent.rb +87 -76
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureAttribute.rb +113 -102
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureConstraint.rb +44 -33
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureType.rb +121 -110
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_format.rb +45 -34
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_genericMetaData.rb +45 -36
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_geographicBoundingBox.rb +78 -67
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_geographicDescription.rb +25 -14
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_geographicElement.rb +30 -19
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_identifier.rb +41 -30
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_keyword.rb +58 -49
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_legalConstraints.rb +65 -54
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_lineString.rb +77 -66
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_lineage.rb +62 -51
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_listedValue.rb +70 -59
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_maintenanceInformation.rb +54 -43
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_medium.rb +58 -47
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_metadataExtension.rb +154 -143
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_multiGeometry.rb +138 -127
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_multiplicity.rb +37 -26
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_onlineResource.rb +79 -68
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_point.rb +77 -66
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_polygon.rb +98 -87
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_processStep.rb +80 -69
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_referenceIdentifier.rb +38 -27
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_referenceSystem.rb +25 -14
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_resolution.rb +51 -40
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_responsibleParty.rb +88 -77
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_securityConstraints.rb +70 -59
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_source.rb +58 -47
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_standardOrderProcess.rb +75 -63
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_taxonClassification.rb +55 -44
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_taxonSystem.rb +98 -87
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_telephone.rb +73 -62
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_temporalExtent.rb +58 -47
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_timeInstant.rb +36 -27
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_timePeriod.rb +42 -33
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_usage.rb +59 -48
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_useConstraints.rb +26 -15
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_verticalExtent.rb +52 -41
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_vouchers.rb +39 -28
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_associationType.rb +41 -29
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_characterSet.rb +82 -47
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_classification.rb +42 -24
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_datatype.rb +56 -34
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_dateType.rb +34 -19
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_initiativeType.rb +41 -29
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_keywordType.rb +46 -27
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_maintenanceFrequency.rb +55 -36
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_mediumFormat.rb +44 -26
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_mediumName.rb +68 -38
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_obligation.rb +32 -25
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_onlineFunction.rb +42 -25
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_presentationForm.rb +58 -31
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_progress.rb +44 -25
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_restriction.rb +47 -32
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_role.rb +52 -29
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_scope.rb +58 -35
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_spatialRepresentationType.rb +43 -30
- data/lib/adiwg/mdtranslator/writers/iso/codelists/code_topicCategory.rb +51 -44
- data/lib/adiwg/mdtranslator/writers/iso/units/class_baseUnit.rb +26 -15
- data/lib/adiwg/mdtranslator/writers/iso/units/class_conventionalUnit.rb +56 -45
- data/lib/adiwg/mdtranslator/writers/iso/units/class_definitionUnit.rb +23 -12
- data/lib/adiwg/mdtranslator/writers/iso/units/class_derivedUnit.rb +30 -19
- data/lib/adiwg/mdtranslator/writers/iso/units/class_unitsOfMeasure.rb +223 -212
- data/lib/adiwg/mdtranslator/writers/iso19110/class_FCfeatureCatalogue.rb +174 -0
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +41 -12
- data/lib/adiwg/mdtranslator/writers/iso19115_2/class_MImetadata.rb +347 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +151 -119
- data/lib/adiwg/mdtranslator/writers/mdWriters.rb +63 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_additionalDocumentation.rb +84 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_address.rb +100 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_associatedResource.rb +100 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_browseGraphic.rb +66 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_citation.rb +115 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_contact.rb +137 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_onlineResource.rb +47 -0
- data/test/readers/mdJson/v0_9/tc_reader_mdjson_phone.rb +128 -0
- data/test/readers/mdJson/v0_9/tc_translation.rb +82 -0
- data/test/writers/iso19115_2/tc_writer_iso19115_2_address.rb +222 -0
- metadata +87 -60
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_additionalDocumentation.rb +0 -36
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_address.rb +0 -71
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_associatedResource.rb +0 -66
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_boundingBox.rb +0 -51
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_browseGraphic.rb +0 -52
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_citation.rb +0 -104
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_contacts.rb +0 -121
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_coordinates.rb +0 -52
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dataDictionary.rb +0 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dataQuality.rb +0 -40
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dateTime.rb +0 -27
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_descriptiveKeyword.rb +0 -49
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dictionaryInfo.rb +0 -52
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_distributionInfo.rb +0 -150
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domain.rb +0 -62
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domainItem.rb +0 -42
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entity.rb +0 -92
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityAttribute.rb +0 -91
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityForeignKey.rb +0 -43
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityIndex.rb +0 -42
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_extent.rb +0 -62
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_geoCoordSystem.rb +0 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_geoProperties.rb +0 -89
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_geographicElement.rb +0 -168
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_legalConstraint.rb +0 -45
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_lineString.rb +0 -25
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_lineage.rb +0 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_metadata.rb +0 -77
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_metadataExtension.rb +0 -40
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_metadataInfo.rb +0 -112
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_onlineResource.rb +0 -62
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_phone.rb +0 -59
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_point.rb +0 -25
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_polygon.rb +0 -55
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_processStep.rb +0 -64
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resolution.rb +0 -42
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceFormat.rb +0 -35
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceIdentifier.rb +0 -49
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceInfo.rb +0 -317
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceMaintenance.rb +0 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_resourceSpecificUsage.rb +0 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_responsibleParty.rb +0 -37
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_securityConstraint.rb +0 -52
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_source.rb +0 -48
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_spatialReference.rb +0 -48
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_taxonClass.rb +0 -43
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_taxonomy.rb +0 -83
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_temporalElement.rb +0 -71
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_timeInstant.rb +0 -45
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_timePeriod.rb +0 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_verticalElement.rb +0 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_voucher.rb +0 -38
- data/lib/adiwg/mdtranslator/validator.rb +0 -43
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_FCfeatureCatalogue.rb +0 -171
- data/lib/adiwg/mdtranslator/writers/iso/classes/class_MImetadata.rb +0 -333
- data/test/tc_translation.rb +0 -73
@@ -0,0 +1,100 @@
|
|
1
|
+
# MdTranslator - minitest of
|
2
|
+
# reader / mdJson / module_associatedResource
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2014-12-30 original script
|
6
|
+
|
7
|
+
#set globals used in testing
|
8
|
+
#set globals used by mdJson_reader.rb before requiring module
|
9
|
+
$response = {
|
10
|
+
readerVersionUsed: '0.9'
|
11
|
+
}
|
12
|
+
|
13
|
+
require 'minitest/autorun'
|
14
|
+
require 'json'
|
15
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
16
|
+
require 'adiwg/mdtranslator/readers/mdJson/mdJson_reader'
|
17
|
+
require 'adiwg/mdtranslator/readers/mdJson/modules_0.9/module_associatedResource'
|
18
|
+
|
19
|
+
class TestReaderMdJsonAssociatedResource_v0_9 < MiniTest::Test
|
20
|
+
|
21
|
+
# get json test example
|
22
|
+
file = File.open('test/schemas/v0_9/examples/associatedResource.json', 'r')
|
23
|
+
jsonFile = file.read
|
24
|
+
file.close
|
25
|
+
aIn = JSON.parse(jsonFile)
|
26
|
+
@@hIn = aIn[0]
|
27
|
+
|
28
|
+
# set namespace
|
29
|
+
@@NameSpace = ADIWG::Mdtranslator::Readers::MdJson::AssociatedResource
|
30
|
+
|
31
|
+
def test_complete_associatedResource_object
|
32
|
+
|
33
|
+
hIn = @@hIn.clone
|
34
|
+
hIn.delete('resourceCitation')
|
35
|
+
hIn.delete('metadataCitation')
|
36
|
+
|
37
|
+
intObj = {
|
38
|
+
associationType: 'associationType',
|
39
|
+
initiativeType: 'initiativeType',
|
40
|
+
resourceType: 'resourceType',
|
41
|
+
resourceCitation: {},
|
42
|
+
metadataCitation: {}
|
43
|
+
}
|
44
|
+
|
45
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_empty_associatedResource_elements
|
50
|
+
|
51
|
+
hIn = @@hIn.clone
|
52
|
+
hIn['associationType'] = ''
|
53
|
+
hIn['initiativeType'] = ''
|
54
|
+
hIn['resourceType'] = ''
|
55
|
+
hIn['resourceCitation'] = {}
|
56
|
+
hIn['metadataCitation'] = {}
|
57
|
+
|
58
|
+
intObj = {
|
59
|
+
associationType: nil,
|
60
|
+
initiativeType: nil,
|
61
|
+
resourceType: nil,
|
62
|
+
resourceCitation: {},
|
63
|
+
metadataCitation: {}
|
64
|
+
}
|
65
|
+
|
66
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_missing_associatedResource_citation
|
71
|
+
|
72
|
+
# note: except for associationType
|
73
|
+
|
74
|
+
hIn = @@hIn.clone
|
75
|
+
hIn.delete('initiativeType')
|
76
|
+
hIn.delete('resourceType')
|
77
|
+
hIn.delete('resourceCitation')
|
78
|
+
hIn.delete('metadataCitation')
|
79
|
+
|
80
|
+
intObj = {
|
81
|
+
associationType: 'associationType',
|
82
|
+
initiativeType: nil,
|
83
|
+
resourceType: nil,
|
84
|
+
resourceCitation: {},
|
85
|
+
metadataCitation: {}
|
86
|
+
}
|
87
|
+
|
88
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_empty_associatedResource_object
|
93
|
+
|
94
|
+
hIn = JSON.parse('{}')
|
95
|
+
|
96
|
+
assert_equal nil, @@NameSpace.unpack(hIn)
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# MdTranslator - minitest of
|
2
|
+
# reader / mdJson / module_browseGraphic
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2014-12-24 original script
|
6
|
+
|
7
|
+
require 'minitest/autorun'
|
8
|
+
require 'json'
|
9
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
10
|
+
require 'adiwg/mdtranslator/readers/mdJson/modules_0.9/module_browseGraphic'
|
11
|
+
|
12
|
+
class TestReaderMdJsonBrowseGraphic_v0_9 < MiniTest::Test
|
13
|
+
|
14
|
+
# get json test example
|
15
|
+
file = File.open('test/schemas/v0_9/examples/graphicOverview.json', 'r')
|
16
|
+
jsonFile = file.read
|
17
|
+
file.close
|
18
|
+
aIn = JSON.parse(jsonFile)
|
19
|
+
@@hIn = aIn[0]
|
20
|
+
|
21
|
+
# set namespace
|
22
|
+
@@NameSpace = ADIWG::Mdtranslator::Readers::MdJson::BrowseGraphic
|
23
|
+
|
24
|
+
def test_complete_browseGraphic_object
|
25
|
+
|
26
|
+
hIn = @@hIn.clone
|
27
|
+
|
28
|
+
intObj = {
|
29
|
+
bGName: 'fileName',
|
30
|
+
bGDescription: 'fileDescription',
|
31
|
+
bGType: 'fileType',
|
32
|
+
bGURI: 'http://thisisanexample.com'
|
33
|
+
}
|
34
|
+
|
35
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_empty_browseGraphic_elements
|
40
|
+
|
41
|
+
hIn = @@hIn.clone
|
42
|
+
hIn['fileName'] = ''
|
43
|
+
hIn['fileDescription'] = ''
|
44
|
+
hIn['fileType'] = ''
|
45
|
+
hIn['fileUri'] = ''
|
46
|
+
|
47
|
+
intObj = {
|
48
|
+
bGName: nil,
|
49
|
+
bGDescription: nil,
|
50
|
+
bGType: nil,
|
51
|
+
bGURI: nil
|
52
|
+
}
|
53
|
+
|
54
|
+
assert_equal intObj,@@NameSpace.unpack(hIn)
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_empty_browseGraphic_object
|
59
|
+
|
60
|
+
hIn = JSON.parse('{}')
|
61
|
+
|
62
|
+
assert_equal nil, @@NameSpace.unpack(hIn)
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# MdTranslator - minitest of
|
2
|
+
# reader / mdJson / module_citation
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2014-12-19 original script
|
6
|
+
|
7
|
+
#set globals used in testing
|
8
|
+
#set globals used by mdJson_reader.rb before requiring module
|
9
|
+
$response = {
|
10
|
+
readerVersionUsed: '0.9',
|
11
|
+
readerExecutionPas: true,
|
12
|
+
readerExecutionMessages: []
|
13
|
+
}
|
14
|
+
|
15
|
+
require 'minitest/autorun'
|
16
|
+
require 'json'
|
17
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
18
|
+
require 'adiwg/mdtranslator/internal/module_dateTimeFun'
|
19
|
+
require 'adiwg/mdtranslator/readers/mdJson/mdJson_reader'
|
20
|
+
require 'adiwg/mdtranslator/readers/mdJson/modules_0.9/module_citation'
|
21
|
+
|
22
|
+
class TestReaderMdJsonCitation_v0_9 < MiniTest::Test
|
23
|
+
|
24
|
+
# get json test example
|
25
|
+
file = File.open('test/schemas/v0_9/examples/citation.json', 'r')
|
26
|
+
jsonFile = file.read
|
27
|
+
file.close
|
28
|
+
aIn = JSON.parse(jsonFile)
|
29
|
+
@@hIn = aIn[0]
|
30
|
+
|
31
|
+
# set namespace
|
32
|
+
@@NameSpace = ADIWG::Mdtranslator::Readers::MdJson::Citation
|
33
|
+
|
34
|
+
def test_complete_citation_object
|
35
|
+
|
36
|
+
hIn = @@hIn.clone
|
37
|
+
hIn.delete('date')
|
38
|
+
hIn.delete('responsibleParty')
|
39
|
+
hIn.delete('identifier')
|
40
|
+
hIn.delete('onlineResource')
|
41
|
+
|
42
|
+
intObj = {
|
43
|
+
citTitle: 'title',
|
44
|
+
citDate: [],
|
45
|
+
citEdition: 'edition',
|
46
|
+
citResourceIds: [],
|
47
|
+
citResponsibleParty: [],
|
48
|
+
citResourceForms: ['presentationForm1','presentationForm2'],
|
49
|
+
citOlResources: []
|
50
|
+
}
|
51
|
+
|
52
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_empty_citation_elements
|
57
|
+
|
58
|
+
hIn = @@hIn.clone
|
59
|
+
hIn['title'] = ''
|
60
|
+
hIn['date'] = []
|
61
|
+
hIn['edition'] = ''
|
62
|
+
hIn['responsibleParty'] = []
|
63
|
+
hIn['presentationForm'] = []
|
64
|
+
hIn['identifier'] = []
|
65
|
+
hIn['onlineResource'] = []
|
66
|
+
|
67
|
+
intObj = {
|
68
|
+
citTitle: nil,
|
69
|
+
citDate: [],
|
70
|
+
citEdition: nil,
|
71
|
+
citResourceIds: [],
|
72
|
+
citResponsibleParty: [],
|
73
|
+
citResourceForms: [],
|
74
|
+
citOlResources: []
|
75
|
+
}
|
76
|
+
|
77
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_missing_citation_elements
|
82
|
+
|
83
|
+
# note: except for title
|
84
|
+
|
85
|
+
hIn = @@hIn.clone
|
86
|
+
hIn.delete('date')
|
87
|
+
hIn.delete('edition')
|
88
|
+
hIn.delete('responsibleParty')
|
89
|
+
hIn.delete('presentationForm')
|
90
|
+
hIn.delete('identifier')
|
91
|
+
hIn.delete('onlineResource')
|
92
|
+
|
93
|
+
intObj = {
|
94
|
+
citTitle: 'title',
|
95
|
+
citDate: [],
|
96
|
+
citEdition: nil,
|
97
|
+
citResourceIds: [],
|
98
|
+
citResponsibleParty: [],
|
99
|
+
citResourceForms: [],
|
100
|
+
citOlResources: []
|
101
|
+
}
|
102
|
+
|
103
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_empty_citation_object
|
108
|
+
|
109
|
+
hIn = JSON.parse('{}')
|
110
|
+
|
111
|
+
assert_equal nil, @@NameSpace.unpack(hIn)
|
112
|
+
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
# MdTranslator - minitest of
|
2
|
+
# reader / mdJson / module_contacts
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2014-12-19 original script
|
6
|
+
|
7
|
+
#set globals used in testing
|
8
|
+
#set globals used by mdJson_reader.rb before requiring module
|
9
|
+
$response = {
|
10
|
+
readerVersionUsed: '0.9',
|
11
|
+
readerExecutionPas: true,
|
12
|
+
readerExecutionMessages: []
|
13
|
+
}
|
14
|
+
|
15
|
+
require 'minitest/autorun'
|
16
|
+
require 'json'
|
17
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
18
|
+
require 'adiwg/mdtranslator/readers/mdJson/mdJson_reader'
|
19
|
+
require 'adiwg/mdtranslator/readers/mdJson/modules_0.9/module_contacts'
|
20
|
+
|
21
|
+
class TestReaderMdJsonContact_v0_9 < MiniTest::Test
|
22
|
+
|
23
|
+
# get json test example
|
24
|
+
file = File.open('test/schemas/v0_9/examples/contact.json', 'r')
|
25
|
+
jsonFile = file.read
|
26
|
+
file.close
|
27
|
+
aIn = JSON.parse(jsonFile)
|
28
|
+
@@hIn = aIn[0]
|
29
|
+
|
30
|
+
# set namespace
|
31
|
+
@@NameSpace = ADIWG::Mdtranslator::Readers::MdJson::Contact
|
32
|
+
|
33
|
+
def test_complete_contact_object
|
34
|
+
|
35
|
+
hIn = @@hIn.clone
|
36
|
+
hIn.delete('phoneBook')
|
37
|
+
hIn.delete('address')
|
38
|
+
hIn.delete('onlineResource')
|
39
|
+
|
40
|
+
intObj = {
|
41
|
+
contactId: 'contactId',
|
42
|
+
indName: 'individualName',
|
43
|
+
orgName: 'organizationName',
|
44
|
+
position: 'positionName',
|
45
|
+
phones: [],
|
46
|
+
address: {},
|
47
|
+
onlineRes: [],
|
48
|
+
contactInstructions: 'contactInstructions'
|
49
|
+
}
|
50
|
+
|
51
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_empty_contact_elements
|
56
|
+
|
57
|
+
hIn = @@hIn.clone
|
58
|
+
hIn['individualName'] = ''
|
59
|
+
hIn['organizationName'] = ''
|
60
|
+
hIn['positionName'] = ''
|
61
|
+
hIn['onlineResource'] = []
|
62
|
+
hIn['contactInstructions'] = ''
|
63
|
+
hIn['phoneBook'] = []
|
64
|
+
hIn['address'] = {}
|
65
|
+
|
66
|
+
intObj = {
|
67
|
+
contactId: 'contactId',
|
68
|
+
indName: nil,
|
69
|
+
orgName: nil,
|
70
|
+
position: nil,
|
71
|
+
phones: [],
|
72
|
+
address: {},
|
73
|
+
onlineRes: [],
|
74
|
+
contactInstructions: nil
|
75
|
+
}
|
76
|
+
|
77
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_missing_contact_elements
|
82
|
+
|
83
|
+
hIn = @@hIn.clone
|
84
|
+
hIn.delete('individualName')
|
85
|
+
hIn.delete('organizationName')
|
86
|
+
hIn.delete('positionName')
|
87
|
+
hIn.delete('onlineResource')
|
88
|
+
hIn.delete('contactInstructions')
|
89
|
+
hIn.delete('phoneBook')
|
90
|
+
hIn.delete('address')
|
91
|
+
|
92
|
+
intObj = {
|
93
|
+
contactId: 'contactId',
|
94
|
+
indName: nil,
|
95
|
+
orgName: nil,
|
96
|
+
position: nil,
|
97
|
+
phones: [],
|
98
|
+
address: {},
|
99
|
+
onlineRes: [],
|
100
|
+
contactInstructions: nil
|
101
|
+
}
|
102
|
+
|
103
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_missing_contact_id
|
108
|
+
|
109
|
+
hIn = @@hIn.clone
|
110
|
+
hIn.delete('contactId')
|
111
|
+
|
112
|
+
intObj = nil
|
113
|
+
|
114
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_blank_contact_id
|
119
|
+
|
120
|
+
hIn = @@hIn.clone
|
121
|
+
hIn['contactId'] = ''
|
122
|
+
|
123
|
+
intObj = nil
|
124
|
+
|
125
|
+
assert_equal intObj, @@NameSpace.unpack(hIn)
|
126
|
+
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_empty_contact_object
|
130
|
+
|
131
|
+
hIn = JSON.parse('{}')
|
132
|
+
|
133
|
+
assert_equal nil, @@NameSpace.unpack(hIn)
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# MdTranslator - minitest of
|
2
|
+
# reader / mdJson / module_onlineResource
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2014-12-09 original script
|
6
|
+
# Stan Smith 2014-12-15 modified to use namespaces added to mdTranslator
|
7
|
+
|
8
|
+
require 'minitest/autorun'
|
9
|
+
require 'json'
|
10
|
+
require 'adiwg/mdtranslator/internal/internal_metadata_obj'
|
11
|
+
require 'adiwg/mdtranslator/readers/mdJson/modules_0.9/module_onlineResource'
|
12
|
+
|
13
|
+
class TestReaderMdJsonOnlineResource_v0_9 < MiniTest::Test
|
14
|
+
|
15
|
+
def test_build_full_onlineResource_object
|
16
|
+
|
17
|
+
json_string = '{ ' +
|
18
|
+
'"uri": "http://thisIsAnExample.com", ' +
|
19
|
+
'"protocol": "protocol", ' +
|
20
|
+
'"name": "Name", ' +
|
21
|
+
'"description": "Description", ' +
|
22
|
+
'"function": "function"' +
|
23
|
+
'}'
|
24
|
+
hIn = JSON.parse(json_string)
|
25
|
+
|
26
|
+
intObj = {
|
27
|
+
olResURI: 'http://thisIsAnExample.com',
|
28
|
+
olResProtocol: 'protocol',
|
29
|
+
olResName: 'Name',
|
30
|
+
olResDesc: 'Description',
|
31
|
+
olResFunction: 'function'
|
32
|
+
}
|
33
|
+
|
34
|
+
assert_equal intObj, ADIWG::Mdtranslator::Readers::MdJson::OnlineResource.unpack(hIn)
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_build_empty_onlineResource_object
|
39
|
+
|
40
|
+
json_string = '{}'
|
41
|
+
hIn = JSON.parse(json_string)
|
42
|
+
|
43
|
+
assert_equal nil, ADIWG::Mdtranslator::Readers::MdJson::OnlineResource.unpack(hIn)
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|