adiwg-json_schemas 0.5.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/tc_schemas.rb CHANGED
@@ -5,130 +5,140 @@
5
5
  * License: Public Domain
6
6
  =end
7
7
 
8
- require "test/unit"
9
- require "json"
8
+ require 'test/unit'
9
+ require 'json'
10
10
  require 'json-schema'
11
- require File.dirname(__FILE__) + '/../lib/adiwg-json_schemas.rb'
11
+ require File.join(File.dirname(__FILE__),'..','lib', 'adiwg-json_schemas.rb')
12
12
 
13
13
  class TestExamples < Test::Unit::TestCase
14
14
 
15
- @@dir = File.dirname(__FILE__) + '/../schema/'
16
- @@ex = File.dirname(__FILE__) + '/../examples/'
17
- @@schema = File.dirname(__FILE__) + '/../schema/schema.json'
18
-
19
- def test_data_template
20
- errors = JSON::Validator.fully_validate(@@schema, @@dir + '../templates/adiwg_metadata_template.json', :strict => false)
21
- assert(errors.empty?, errors.join("/n"))
22
- end
23
-
24
- def test_full_example
25
- errors = JSON::Validator.fully_validate(@@schema , @@ex + 'full_example.json')
26
- assert(errors.empty?, errors.join("/n"))
27
- end
28
-
29
- def test_lcc_example
30
- errors = JSON::Validator.fully_validate(@@schema , @@ex + 'lcc_project_example.json')
31
- assert(errors.empty?, errors.join("/n"))
32
- end
33
-
34
- def test_contact
35
- errors = JSON::Validator.fully_validate(@@dir + 'schema/contact.json', @@ex + 'contact.json')
36
- assert(errors.empty?, errors.join("/n"))
37
- end
38
-
39
- def test_citation
40
- errors = JSON::Validator.fully_validate(@@dir + 'schema/citation.json', @@ex + 'citation.json', :list => true)
41
- assert(errors.empty?, errors.join("/n"))
42
- end
43
-
44
- def test_taxonomy
45
- errors = JSON::Validator.fully_validate(@@dir + 'schema/taxonomy.json', @@ex + 'taxonomy.json', :list => true)
46
- assert(errors.empty?, errors.join("/n"))
47
- end
48
-
49
- def test_usage
50
- errors = JSON::Validator.fully_validate(@@dir + 'schema/usage.json', @@ex + 'usage.json', :list => true)
51
- assert(errors.empty?, errors.join("/n"))
52
- end
53
-
54
- def test_resolution
55
- errors = JSON::Validator.fully_validate(@@dir + 'schema/resolution.json', @@ex + 'resolution.json', :list => true)
56
- assert(errors.empty?, errors.join("/n"))
57
- end
58
-
59
- def test_graphicOverview
60
- errors = JSON::Validator.fully_validate(@@dir + 'schema/graphicOverview.json', @@ex + 'graphicOverview.json', :list => true)
61
- assert(errors.empty?, errors.join("/n"))
62
- end
63
-
64
- def test_resourceInfo
65
- errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceInfo.json', @@ex + 'resourceInfo.json', :list => true)
66
- assert(errors.empty?, errors.join("/n"))
67
- end
68
-
69
- def test_onlineResource
70
- errors = JSON::Validator.fully_validate(@@dir + 'schema/onlineResource.json', @@ex + 'onlineResource.json', :list => true)
71
- assert(errors.empty?, errors.join("/n"))
72
- end
73
-
74
- def test_resourceConstraint
75
- errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceConstraint.json', @@ex + 'resourceConstraints.json', :list => true)
76
- assert(errors.empty?, errors.join("/n"))
77
- end
78
-
79
- def test_date
80
- errors = JSON::Validator.fully_validate(@@schema, @@ex + 'date.json', :fragment => "#/definitions/date", :list => true)
81
- assert(errors.empty?, errors.join("/n"))
82
- end
83
-
84
- def test_contactRef
85
- errors = JSON::Validator.fully_validate(@@dir + 'schema/contact.json', @@ex + 'contactRef.json', :fragment => "#/definitions/contactRef", :list => true)
86
- assert(errors.empty?, errors.join("/n"))
87
- end
88
-
89
- def test_keywords
90
- errors = JSON::Validator.fully_validate(@@dir + 'schema/keyword.json', @@ex + 'keywords.json', :list => true)
91
- assert(errors.empty?, errors.join("/n"))
92
- end
93
-
94
- def test_distributor
95
- errors = JSON::Validator.fully_validate(@@dir + 'schema/distributor.json', @@ex + 'distributor.json', :list => true)
96
- assert(errors.empty?, errors.join("/n"))
97
- end
98
-
99
- def test_geojson
100
- errors = JSON::Validator.fully_validate(@@dir + 'schema/geojson/geojson.json', @@ex + 'geojson.json', :list => true)
101
- assert(errors.empty?, errors.join("/n"))
102
- end
103
-
104
- def test_extent_linestring
105
- errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_linestring.json', :list => true)
106
- assert(errors.empty?, errors.join("/n"))
107
- end
108
-
109
- def test_extent_point
110
- errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_point.json', :list => true)
111
- assert(errors.empty?, errors.join("/n"))
112
- end
113
-
114
- def test_extent_polygon
115
- errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_polygon.json', :list => true)
116
- assert(errors.empty?, errors.join("/n"))
117
- end
118
-
119
- def test_maintInfo
120
- errors = JSON::Validator.fully_validate(@@dir + 'schema/maintInfo.json', @@ex + 'maintInfo.json', :list => true)
121
- errors = errors + JSON::Validator.fully_validate(@@dir + 'schema/maintInfo.json', @@ex + 'resourceMaintenance.json', :list => true)
122
- assert(errors.empty?, errors.join("/n"))
123
- end
124
-
125
- def test_dataQuality
126
- errors = JSON::Validator.fully_validate(@@dir + 'schema/dataQuality.json', @@ex + 'dataQuality.json', :list => true)
127
- assert(errors.empty?, errors.join("/n"))
128
- end
129
-
130
- def test_uri
131
- errors = JSON::Validator.fully_validate(@@schema, @@ex + 'uri.json', :fragment => "#/definitions/uri", :list => true)
132
- assert(errors.empty?, errors.join("/n"))
133
- end
15
+ @@dir = File.join(File.dirname(__FILE__),'..','schema/')
16
+ @@ex = File.join(File.dirname(__FILE__),'..','examples/')
17
+ @@schema = File.join(File.dirname(__FILE__),'..','schema','schema.json')
18
+
19
+ def test_data_template
20
+ errors = JSON::Validator.fully_validate(@@schema, @@dir + '../templates/adiwg_metadata_template.json', :strict => false)
21
+ assert(errors.empty?, errors.join("/n"))
22
+ end
23
+
24
+ def test_full_example
25
+ errors = JSON::Validator.fully_validate(@@schema , @@ex + 'full_example.json')
26
+ assert(errors.empty?, errors.join("/n"))
27
+ end
28
+
29
+ def test_full_example2
30
+ errors = JSON::Validator.fully_validate(@@schema , @@ex + 'full_example2.json')
31
+ assert(errors.empty?, errors.join("/n"))
32
+ end
33
+
34
+ def test_lcc_example
35
+ errors = JSON::Validator.fully_validate(@@schema , @@ex + 'lcc_project_example.json')
36
+ assert(errors.empty?, errors.join("/n"))
37
+ end
38
+
39
+ def test_contact
40
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/contact.json', @@ex + 'contact.json')
41
+ assert(errors.empty?, errors.join("/n"))
42
+ end
43
+
44
+ def test_citation
45
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/citation.json', @@ex + 'citation.json', :list => true)
46
+ assert(errors.empty?, errors.join("/n"))
47
+ end
48
+
49
+ def test_taxonomy
50
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/taxonomy.json', @@ex + 'taxonomy.json', :list => true)
51
+ assert(errors.empty?, errors.join("/n"))
52
+ end
53
+
54
+ def test_usage
55
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/usage.json', @@ex + 'usage.json', :list => true)
56
+ assert(errors.empty?, errors.join("/n"))
57
+ end
58
+
59
+ def test_resolution
60
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resolution.json', @@ex + 'resolution.json', :list => true)
61
+ assert(errors.empty?, errors.join("/n"))
62
+ end
63
+
64
+ def test_graphicOverview
65
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/graphicOverview.json', @@ex + 'graphicOverview.json', :list => true)
66
+ assert(errors.empty?, errors.join("/n"))
67
+ end
68
+
69
+ def test_resourceInfo
70
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceInfo.json', @@ex + 'resourceInfo.json', :list => true)
71
+ assert(errors.empty?, errors.join("/n"))
72
+ end
73
+
74
+ def test_onlineResource
75
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/onlineResource.json', @@ex + 'onlineResource.json', :list => true)
76
+ assert(errors.empty?, errors.join("/n"))
77
+ end
78
+
79
+ def test_resourceConstraint
80
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceConstraint.json', @@ex + 'resourceConstraints.json', :list => true)
81
+ assert(errors.empty?, errors.join("/n"))
82
+ end
83
+
84
+ def test_date
85
+ errors = JSON::Validator.fully_validate(@@schema, @@ex + 'date.json', :fragment => "#/definitions/date", :list => true)
86
+ assert(errors.empty?, errors.join("/n"))
87
+ end
88
+
89
+ def test_spatialRef
90
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceInfo.json', @@ex + 'spatialRef.json', :fragment => "#/properties/spatialReferenceSystem", :list => false)
91
+ assert(errors.empty?, errors.join("/n"))
92
+ end
93
+
94
+ def test_contactRef
95
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/contact.json', @@ex + 'contactRef.json', :fragment => "#/definitions/contactRef", :list => true)
96
+ assert(errors.empty?, errors.join("/n"))
97
+ end
98
+
99
+ def test_keywords
100
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/keyword.json', @@ex + 'keywords.json', :list => true)
101
+ assert(errors.empty?, errors.join("/n"))
102
+ end
103
+
104
+ def test_distributor
105
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/distributor.json', @@ex + 'distributor.json', :list => true)
106
+ assert(errors.empty?, errors.join("/n"))
107
+ end
108
+
109
+ def test_geojson
110
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/geojson/geojson.json', @@ex + 'geojson.json', :list => true)
111
+ assert(errors.empty?, errors.join("/n"))
112
+ end
113
+
114
+ def test_extent_linestring
115
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_linestring.json', :list => true)
116
+ assert(errors.empty?, errors.join("/n"))
117
+ end
118
+
119
+ def test_extent_point
120
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_point.json', :list => true)
121
+ assert(errors.empty?, errors.join("/n"))
122
+ end
123
+
124
+ def test_extent_polygon
125
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_polygon.json', :list => true)
126
+ assert(errors.empty?, errors.join("/n"))
127
+ end
128
+
129
+ def test_maintInfo
130
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/maintInfo.json', @@ex + 'maintInfo.json', :list => true)
131
+ errors = errors + JSON::Validator.fully_validate(@@dir + 'schema/maintInfo.json', @@ex + 'resourceMaintenance.json', :list => true)
132
+ assert(errors.empty?, errors.join("/n"))
133
+ end
134
+
135
+ def test_dataQuality
136
+ errors = JSON::Validator.fully_validate(@@dir + 'schema/dataQuality.json', @@ex + 'dataQuality.json', :list => true)
137
+ assert(errors.empty?, errors.join("/n"))
138
+ end
139
+
140
+ def test_uri
141
+ errors = JSON::Validator.fully_validate(@@schema, @@ex + 'uri.json', :fragment => "#/definitions/uri", :list => true)
142
+ assert(errors.empty?, errors.join("/n"))
143
+ end
134
144
  end
data/test/tc_utils.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  =end
7
7
 
8
8
  require "test/unit"
9
- require File.dirname(__FILE__) + '/../lib/adiwg-json_schemas.rb'
9
+ require File.join(File.dirname(__FILE__),'..','lib', 'adiwg-json_schemas.rb')
10
10
 
11
11
  class TestUtils < Test::Unit::TestCase
12
12
  def test_examples_dir
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adiwg-json_schemas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Bradley, Stan Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-30 00:00:00.000000000 Z
11
+ date: 2014-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,6 +92,7 @@ files:
92
92
  - examples/extent_point.json
93
93
  - examples/extent_polygon.json
94
94
  - examples/full_example.json
95
+ - examples/full_example2.json
95
96
  - examples/geojson.json
96
97
  - examples/graphicOverview.json
97
98
  - examples/hierarchyLevel.json
@@ -103,6 +104,7 @@ files:
103
104
  - examples/resourceConstraints.json
104
105
  - examples/resourceInfo.json
105
106
  - examples/resourceMaintenance.json
107
+ - examples/spatialRef.json
106
108
  - examples/taxonomy.json
107
109
  - examples/uri.json
108
110
  - examples/usage.json