adiwg-json_schemas 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/test/tc_schemas.rb CHANGED
@@ -6,123 +6,129 @@
6
6
  =end
7
7
 
8
8
  require "test/unit"
9
- require 'adiwg/json_schemas'
9
+ require "json"
10
10
  require 'json-schema'
11
+ require File.dirname(__FILE__) + '/../lib/adiwg-json_schemas.rb'
11
12
 
12
13
  class TestExamples < Test::Unit::TestCase
13
14
 
14
- @@dir = ADIWG::JsonSchemas::Utils.schema_dir
15
- @@ex = ADIWG::JsonSchemas::Utils.examples_dir
16
- @@schema = ADIWG::JsonSchemas::Utils.schema_path
17
-
18
- def test_data_template
19
- errors = JSON::Validator.fully_validate(@@schema, @@dir + '../templates/adiwg_metadata_template.json', :strict => false)
20
- assert(errors.empty?, errors.join("/n"))
21
- end
22
-
23
- def test_full_example
24
- errors = JSON::Validator.fully_validate(@@schema , @@ex + 'full_example.json')
25
- assert(errors.empty?, errors.join("/n"))
26
- end
27
-
28
- def test_lcc_example
29
- errors = JSON::Validator.fully_validate(@@schema , @@ex + 'lcc_project_example.json')
30
- assert(errors.empty?, errors.join("/n"))
31
- end
32
-
33
- def test_contact
34
- errors = JSON::Validator.fully_validate(@@dir + 'schema/contact.json', @@ex + 'contact.json')
35
- assert(errors.empty?, errors.join("/n"))
36
- end
37
-
38
- def test_citation
39
- errors = JSON::Validator.fully_validate(@@dir + 'schema/citation.json', @@ex + 'citation.json', :list => true)
40
- assert(errors.empty?, errors.join("/n"))
41
- end
42
-
43
- def test_taxonomy
44
- errors = JSON::Validator.fully_validate(@@dir + 'schema/taxonomy.json', @@ex + 'taxonomy.json', :list => true)
45
- assert(errors.empty?, errors.join("/n"))
46
- end
47
-
48
- def test_usage
49
- errors = JSON::Validator.fully_validate(@@dir + 'schema/usage.json', @@ex + 'usage.json', :list => true)
50
- assert(errors.empty?, errors.join("/n"))
51
- end
52
-
53
- def test_resolution
54
- errors = JSON::Validator.fully_validate(@@dir + 'schema/resolution.json', @@ex + 'resolution.json', :list => true)
55
- assert(errors.empty?, errors.join("/n"))
56
- end
57
-
58
- def test_graphicOverview
59
- errors = JSON::Validator.fully_validate(@@dir + 'schema/graphicOverview.json', @@ex + 'graphicOverview.json', :list => true)
60
- assert(errors.empty?, errors.join("/n"))
61
- end
62
-
63
- def test_resourceInfo
64
- errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceInfo.json', @@ex + 'resourceInfo.json', :list => true)
65
- assert(errors.empty?, errors.join("/n"))
66
- end
67
-
68
- def test_onlineResource
69
- errors = JSON::Validator.fully_validate(@@dir + 'schema/onlineResource.json', @@ex + 'onlineResource.json', :list => true)
70
- assert(errors.empty?, errors.join("/n"))
71
- end
72
-
73
- def test_resourceConstraint
74
- errors = JSON::Validator.fully_validate(@@dir + 'schema/resourceConstraint.json', @@ex + 'resourceConstraints.json', :list => true)
75
- assert(errors.empty?, errors.join("/n"))
76
- end
77
-
78
- def test_date
79
- errors = JSON::Validator.fully_validate(@@schema, @@ex + 'date.json', :fragment => "#/definitions/date", :list => true)
80
- assert(errors.empty?, errors.join("/n"))
81
- end
82
-
83
- def test_contactRef
84
- errors = JSON::Validator.fully_validate(@@dir + 'schema/contact.json', @@ex + 'contactRef.json', :fragment => "#/definitions/contactRef", :list => true)
85
- assert(errors.empty?, errors.join("/n"))
86
- end
87
-
88
- def test_keywords
89
- errors = JSON::Validator.fully_validate(@@dir + 'schema/keyword.json', @@ex + 'keywords.json', :list => true)
90
- assert(errors.empty?, errors.join("/n"))
91
- end
92
-
93
- def test_distributor
94
- errors = JSON::Validator.fully_validate(@@dir + 'schema/distributor.json', @@ex + 'distributor.json', :list => true)
95
- assert(errors.empty?, errors.join("/n"))
96
- end
97
-
98
- def test_geojson
99
- errors = JSON::Validator.fully_validate(@@dir + 'schema/geojson/geojson.json', @@ex + 'geojson.json', :list => true)
100
- assert(errors.empty?, errors.join("/n"))
101
- end
102
-
103
- def test_extent_linestring
104
- errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_linestring.json', :list => true)
105
- assert(errors.empty?, errors.join("/n"))
106
- end
107
-
108
- def test_extent_point
109
- errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_point.json', :list => true)
110
- assert(errors.empty?, errors.join("/n"))
111
- end
112
-
113
- def test_extent_polygon
114
- errors = JSON::Validator.fully_validate(@@dir + 'schema/extent.json', @@ex + 'extent_polygon.json', :list => true)
115
- assert(errors.empty?, errors.join("/n"))
116
- end
117
-
118
- def test_maintInfo
119
- errors = JSON::Validator.fully_validate(@@dir + 'schema/maintInfo.json', @@ex + 'maintInfo.json', :list => true)
120
- errors = errors + JSON::Validator.fully_validate(@@dir + 'schema/maintInfo.json', @@ex + 'resourceMaintenance.json', :list => true)
121
- assert(errors.empty?, errors.join("/n"))
122
- end
123
-
124
- def test_dataQuality
125
- errors = JSON::Validator.fully_validate(@@dir + 'schema/dataQuality.json', @@ex + 'dataQuality.json', :list => true)
126
- assert(errors.empty?, errors.join("/n"))
127
- end
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
128
134
  end
data/test/tc_utils.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  =end
7
7
 
8
8
  require "test/unit"
9
- require 'adiwg/json_schemas'
9
+ require 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.0
4
+ version: 0.5.2
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-06-19 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -82,12 +82,10 @@ files:
82
82
  - README.md
83
83
  - Rakefile
84
84
  - adiwg-json_schemas.gemspec
85
- - examples/adiwg_project_example_1.json
86
85
  - examples/citation.json
87
86
  - examples/contact.json
88
87
  - examples/contactRef.json
89
88
  - examples/dataQuality.json
90
- - examples/data_example.json
91
89
  - examples/date.json
92
90
  - examples/distributor.json
93
91
  - examples/extent_linestring.json