adiwg-json_schemas 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.travis.yml +9 -0
  4. data/CREDITS +3 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE +24 -0
  7. data/README.md +36 -0
  8. data/Rakefile +12 -0
  9. data/adiwg-json_schemas.gemspec +24 -0
  10. data/examples/adiwg_project_example_1.json +847 -0
  11. data/examples/citation.json +60 -0
  12. data/examples/contact.json +165 -0
  13. data/examples/contactRef.json +15 -0
  14. data/examples/dataQuality.json +132 -0
  15. data/examples/data_example.json +371 -0
  16. data/examples/date.json +19 -0
  17. data/examples/distributor.json +53 -0
  18. data/examples/extent_linestring.json +288 -0
  19. data/examples/extent_point.json +200 -0
  20. data/examples/extent_polygon.json +353 -0
  21. data/examples/full_example.json +1629 -0
  22. data/examples/geojson.json +253 -0
  23. data/examples/graphicOverview.json +23 -0
  24. data/examples/hierarchyLevel.json +90 -0
  25. data/examples/keywords.json +68 -0
  26. data/examples/lcc_project_example.json +245 -0
  27. data/examples/maintInfo.json +22 -0
  28. data/examples/onlineResource.json +12 -0
  29. data/examples/resolution.json +9 -0
  30. data/examples/resourceConstraints.json +25 -0
  31. data/examples/resourceInfo.json +1287 -0
  32. data/examples/resourceMaintenance.json +10 -0
  33. data/examples/taxonomy.json +98 -0
  34. data/examples/uri.json +7 -0
  35. data/examples/usage.json +23 -0
  36. data/lib/adiwg/json_schemas/utils.rb +20 -0
  37. data/lib/adiwg/json_schemas/version.rb +6 -0
  38. data/lib/adiwg/json_schemas.rb +7 -0
  39. data/lib/adiwg-json_schemas.rb +1 -0
  40. data/schema/schema/citation.json +77 -0
  41. data/schema/schema/contact.json +175 -0
  42. data/schema/schema/dataQuality.json +82 -0
  43. data/schema/schema/distributor.json +89 -0
  44. data/schema/schema/extent.json +118 -0
  45. data/schema/schema/geojson/bbox.json +10 -0
  46. data/schema/schema/geojson/crs.json +53 -0
  47. data/schema/schema/geojson/geojson.json +131 -0
  48. data/schema/schema/geojson/geometry.json +123 -0
  49. data/schema/schema/graphicOverview.json +22 -0
  50. data/schema/schema/keyword.json +37 -0
  51. data/schema/schema/maintInfo.json +26 -0
  52. data/schema/schema/metadata.json +88 -0
  53. data/schema/schema/onlineResource.json +28 -0
  54. data/schema/schema/resolution.json +29 -0
  55. data/schema/schema/resourceConstraint.json +65 -0
  56. data/schema/schema/resourceInfo.json +151 -0
  57. data/schema/schema/taxonomy.json +61 -0
  58. data/schema/schema/usage.json +23 -0
  59. data/schema/schema.json +42 -0
  60. data/templates/adiwg_metadata_template.json +585 -0
  61. data/test/tc_schemas.rb +133 -0
  62. data/test/tc_utils.rb +26 -0
  63. metadata +150 -0
@@ -0,0 +1,133 @@
1
+ =begin
2
+ * Description: Test Validation of examples schemas and templates
3
+ * Author: Josh Bradley, Stan Smith
4
+ * Date: 2014-05-02
5
+ * License: Public Domain
6
+ =end
7
+
8
+ require "test/unit"
9
+ require 'adiwg/json_schemas'
10
+ require 'json-schema'
11
+
12
+ class TestExamples < Test::Unit::TestCase
13
+
14
+ @@dir = ADIWG::JsonSchemas::Utils.schema_dir
15
+ @@ex = ADIWG::JsonSchemas::Utils.examples_dir
16
+ @@schema = ADIWG::JsonSchemas::Utils.schema_path
17
+
18
+ =begin def test_example
19
+ errors = JSON::Validator.fully_validate(@@schema, @@data)
20
+ assert(errors.empty?, errors.join("/n"))
21
+ end
22
+
23
+ def test_full
24
+ errors = JSON::Validator.fully_validate(@@schema, @@ex + 'full_example.json')
25
+ assert(errors.empty?, errors.join("/n"))
26
+ end
27
+ =end
28
+ def test_data_template
29
+ errors = JSON::Validator.fully_validate(@@schema, @@dir + '../templates/adiwg_metadata_template.json')
30
+ assert(errors.empty?, errors.join("/n"))
31
+ end
32
+
33
+ def test_lcc_example
34
+ errors = JSON::Validator.fully_validate(@@schema , @@ex + 'lcc_project_example.json')
35
+ assert(errors.empty?, errors.join("/n"))
36
+ end
37
+
38
+ def test_contact
39
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/contact.json', @@ex + 'contact.json')
40
+ assert(errors.empty?, errors.join("/n"))
41
+ end
42
+
43
+ def test_citation
44
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/citation.json', @@ex + 'citation.json', :list => true)
45
+ assert(errors.empty?, errors.join("/n"))
46
+ end
47
+
48
+ def test_taxonomy
49
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/taxonomy.json', @@ex + 'taxonomy.json', :list => true)
50
+ assert(errors.empty?, errors.join("/n"))
51
+ end
52
+
53
+ def test_usage
54
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/usage.json', @@ex + 'usage.json', :list => true)
55
+ assert(errors.empty?, errors.join("/n"))
56
+ end
57
+
58
+ def test_resolution
59
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resolution.json', @@ex + 'resolution.json', :list => true)
60
+ assert(errors.empty?, errors.join("/n"))
61
+ end
62
+
63
+ def test_graphicOverview
64
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/graphicOverview.json', @@ex + 'graphicOverview.json', :list => true)
65
+ assert(errors.empty?, errors.join("/n"))
66
+ end
67
+
68
+ def test_resourceInfo
69
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceInfo.json', @@ex + 'resourceInfo.json', :list => true)
70
+ assert(errors.empty?, errors.join("/n"))
71
+ end
72
+
73
+ def test_onlineResource
74
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/onlineResource.json', @@ex + 'onlineResource.json', :list => true)
75
+ assert(errors.empty?, errors.join("/n"))
76
+ end
77
+
78
+ def test_resourceConstraint
79
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceConstraint.json', @@ex + 'resourceConstraints.json', :list => true)
80
+ assert(errors.empty?, errors.join("/n"))
81
+ end
82
+
83
+ def test_date
84
+ errors = JSON::Validator.fully_validate(@@schema, @@ex + 'date.json', :fragment => "#/definitions/date", :list => true)
85
+ assert(errors.empty?, errors.join("/n"))
86
+ end
87
+
88
+ def test_contactRef
89
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/contact.json', @@ex + 'contactRef.json', :fragment => "#/definitions/contactRef", :list => true)
90
+ assert(errors.empty?, errors.join("/n"))
91
+ end
92
+
93
+ def test_keywords
94
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/keyword.json', @@ex + 'keywords.json', :list => true)
95
+ assert(errors.empty?, errors.join("/n"))
96
+ end
97
+
98
+ def test_distributor
99
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/distributor.json', @@ex + 'distributor.json', :list => true)
100
+ assert(errors.empty?, errors.join("/n"))
101
+ end
102
+
103
+ def test_geojson
104
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/geojson/geojson.json', @@ex + 'geojson.json', :list => true)
105
+ assert(errors.empty?, errors.join("/n"))
106
+ end
107
+
108
+ def test_extent_linestring
109
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_linestring.json', :list => true)
110
+ assert(errors.empty?, errors.join("/n"))
111
+ end
112
+
113
+ def test_extent_point
114
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_point.json', :list => true)
115
+ assert(errors.empty?, errors.join("/n"))
116
+ end
117
+
118
+ def test_extent_polygon
119
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_polygon.json', :list => true)
120
+ assert(errors.empty?, errors.join("/n"))
121
+ end
122
+
123
+ def test_maintInfo
124
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/maintInfo.json', @@ex + 'maintInfo.json', :list => true)
125
+ errors = errors + JSON::Validator.fully_validate(@@dir + 'schema/maintInfo.json', @@ex + 'resourceMaintenance.json', :list => true)
126
+ assert(errors.empty?, errors.join("/n"))
127
+ end
128
+
129
+ def test_dataQuality
130
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/dataQuality.json', @@ex + 'dataQuality.json', :list => true)
131
+ assert(errors.empty?, errors.join("/n"))
132
+ end
133
+ end
data/test/tc_utils.rb ADDED
@@ -0,0 +1,26 @@
1
+ =begin
2
+ * Description: Test Utility functions
3
+ * Author: Josh Bradley
4
+ * Date: 2014-05-06
5
+ * License: Public Domain
6
+ =end
7
+
8
+ require "test/unit"
9
+ require 'adiwg/json_schemas'
10
+
11
+ class TestUtils < Test::Unit::TestCase
12
+ def test_examples_dir
13
+ errors = File.exist?(ADIWG::JsonSchemas::Utils.examples_dir)
14
+ assert_equal( true, errors, failure_message = 'Examples directory does not exist.')
15
+ end
16
+
17
+ def test_schema_path
18
+ errors = File.file?(ADIWG::JsonSchemas::Utils.schema_path)
19
+ assert_equal( true, errors, failure_message = 'File schema.json does not exist.')
20
+ end
21
+
22
+ def test_schema_dir
23
+ errors = File.exist?(ADIWG::JsonSchemas::Utils.schema_dir)
24
+ assert_equal( true, errors, failure_message = 'Schema directory does not exist.')
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: adiwg-json_schemas
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ platform: ruby
6
+ authors:
7
+ - Josh Bradley, Stan Smith
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json-schema
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: JSON schemas for validating according to the the ADIwg project and data
56
+ metadata standard. The schemas comply JSON Schema draft version 4.
57
+ email:
58
+ - jbradley@arcticlcc.org
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - .travis.yml
65
+ - CREDITS
66
+ - Gemfile
67
+ - LICENSE
68
+ - README.md
69
+ - Rakefile
70
+ - adiwg-json_schemas.gemspec
71
+ - examples/adiwg_project_example_1.json
72
+ - examples/citation.json
73
+ - examples/contact.json
74
+ - examples/contactRef.json
75
+ - examples/dataQuality.json
76
+ - examples/data_example.json
77
+ - examples/date.json
78
+ - examples/distributor.json
79
+ - examples/extent_linestring.json
80
+ - examples/extent_point.json
81
+ - examples/extent_polygon.json
82
+ - examples/full_example.json
83
+ - examples/geojson.json
84
+ - examples/graphicOverview.json
85
+ - examples/hierarchyLevel.json
86
+ - examples/keywords.json
87
+ - examples/lcc_project_example.json
88
+ - examples/maintInfo.json
89
+ - examples/onlineResource.json
90
+ - examples/resolution.json
91
+ - examples/resourceConstraints.json
92
+ - examples/resourceInfo.json
93
+ - examples/resourceMaintenance.json
94
+ - examples/taxonomy.json
95
+ - examples/uri.json
96
+ - examples/usage.json
97
+ - lib/adiwg-json_schemas.rb
98
+ - lib/adiwg/json_schemas.rb
99
+ - lib/adiwg/json_schemas/utils.rb
100
+ - lib/adiwg/json_schemas/version.rb
101
+ - schema/schema.json
102
+ - schema/schema/citation.json
103
+ - schema/schema/contact.json
104
+ - schema/schema/dataQuality.json
105
+ - schema/schema/distributor.json
106
+ - schema/schema/extent.json
107
+ - schema/schema/geojson/bbox.json
108
+ - schema/schema/geojson/crs.json
109
+ - schema/schema/geojson/geojson.json
110
+ - schema/schema/geojson/geometry.json
111
+ - schema/schema/graphicOverview.json
112
+ - schema/schema/keyword.json
113
+ - schema/schema/maintInfo.json
114
+ - schema/schema/metadata.json
115
+ - schema/schema/onlineResource.json
116
+ - schema/schema/resolution.json
117
+ - schema/schema/resourceConstraint.json
118
+ - schema/schema/resourceInfo.json
119
+ - schema/schema/taxonomy.json
120
+ - schema/schema/usage.json
121
+ - templates/adiwg_metadata_template.json
122
+ - test/tc_schemas.rb
123
+ - test/tc_utils.rb
124
+ homepage: https://github.com/adiwg/adiwg-json-schemas
125
+ licenses:
126
+ - UNLICENSE
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.0.3
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: JSON schemas for the ADIwg metadata standard
148
+ test_files:
149
+ - test/tc_schemas.rb
150
+ - test/tc_utils.rb