rsmp_schemer 0.3.2 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +23 -22
  3. data/lib/rsmp_schemer/version.rb +3 -3
  4. data/rsmp_schemer.gemspec +3 -3
  5. data/schemas/core_3.1.2/schema/core/alarm.json +8 -4
  6. data/schemas/core_3.1.2/spec/core/alarm_spec.rb +15 -0
  7. data/schemas/core_3.1.3/Gemfile.lock +20 -20
  8. data/schemas/core_3.1.3/schema/core/alarm.json +8 -4
  9. data/schemas/core_3.1.3/schema/core/core.json +0 -1
  10. data/schemas/core_3.1.3/schema/core/rsmp.json +0 -9
  11. data/schemas/core_3.1.3/spec/core/alarm_spec.rb +20 -7
  12. data/schemas/core_3.1.3/spec/core/command_request_spec.rb +3 -6
  13. data/schemas/core_3.1.3/spec/core/command_response_spec.rb +1 -43
  14. data/schemas/core_3.1.3/spec/core/status_request_spec.rb +4 -8
  15. data/schemas/core_3.1.3/spec/core/status_response_spec.rb +13 -8
  16. data/schemas/core_3.1.3/spec/core/status_subscribe_spec.rb +4 -8
  17. data/schemas/core_3.1.3/spec/core/status_unsubscribe_spec.rb +4 -8
  18. data/schemas/core_3.1.3/spec/core/status_update_spec.rb +4 -8
  19. data/schemas/core_3.1.3/spec/schemer_helper.rb +19 -17
  20. data/schemas/core_3.1.4/.gitignore +1 -0
  21. data/schemas/core_3.1.4/schema/core/alarm.json +8 -4
  22. data/schemas/core_3.1.4/spec/core/alarm_spec.rb +15 -0
  23. data/schemas/core_3.1.4/spec/core/version_spec.rb +3 -2
  24. data/schemas/core_3.1.5/.gitignore +1 -0
  25. data/schemas/core_3.1.5/schema/core/alarm.json +40 -41
  26. data/schemas/core_3.1.5/schema/core/alarm_issue.json +44 -0
  27. data/schemas/core_3.1.5/schema/core/alarm_suspend_resume.json +3 -0
  28. data/schemas/core_3.1.5/schema/core/alarm_suspended_resumed.json +47 -0
  29. data/schemas/core_3.1.5/schema/core/command_response.json +1 -1
  30. data/schemas/core_3.1.5/schema/core/status_response.json +1 -1
  31. data/schemas/core_3.1.5/schema/core/status_update.json +1 -1
  32. data/schemas/core_3.1.5/spec/core/alarm_issue_spec.rb +299 -0
  33. data/schemas/core_3.1.5/spec/core/alarm_resume_spec.rb +93 -0
  34. data/schemas/core_3.1.5/spec/core/alarm_resumed_spec.rb +277 -0
  35. data/schemas/core_3.1.5/spec/core/alarm_suspend_spec.rb +93 -0
  36. data/schemas/core_3.1.5/spec/core/alarm_suspended_spec.rb +277 -0
  37. data/schemas/core_3.1.5/spec/core/version_spec.rb +3 -2
  38. data/schemas/tlc_1.0.15/Gemfile.lock +17 -17
  39. data/schemas/tlc_1.0.15/README.md +7 -0
  40. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0001.json +1 -1
  41. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0002.json +1 -1
  42. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0003.json +1 -1
  43. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0004.json +1 -1
  44. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0005.json +1 -1
  45. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0006.json +1 -1
  46. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0007.json +1 -1
  47. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0008.json +1 -1
  48. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0009.json +1 -1
  49. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0010.json +1 -1
  50. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0101.json +1 -1
  51. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0201.json +1 -1
  52. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0202.json +1 -1
  53. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0301.json +1 -1
  54. data/schemas/tlc_1.0.15/schema/tlc/alarms/A0302.json +1 -1
  55. data/schemas/tlc_1.0.15/schema/tlc/commands/M0002.json +1 -1
  56. data/schemas/tlc_1.0.15/schema/tlc/commands/M0003.json +1 -1
  57. data/schemas/tlc_1.0.15/schema/tlc/commands/M0004.json +1 -1
  58. data/schemas/tlc_1.0.15/schema/tlc/commands/M0005.json +1 -1
  59. data/schemas/tlc_1.0.15/schema/tlc/commands/M0006.json +1 -1
  60. data/schemas/tlc_1.0.15/schema/tlc/commands/M0007.json +1 -1
  61. data/schemas/tlc_1.0.15/schema/tlc/commands/M0008.json +1 -1
  62. data/schemas/tlc_1.0.15/schema/tlc/commands/M0010.json +1 -1
  63. data/schemas/tlc_1.0.15/schema/tlc/commands/M0011.json +1 -1
  64. data/schemas/tlc_1.0.15/schema/tlc/commands/M0012.json +1 -1
  65. data/schemas/tlc_1.0.15/schema/tlc/commands/M0013.json +1 -1
  66. data/schemas/tlc_1.0.15/schema/tlc/commands/M0014.json +1 -1
  67. data/schemas/tlc_1.0.15/schema/tlc/commands/M0015.json +1 -1
  68. data/schemas/tlc_1.0.15/schema/tlc/commands/M0016.json +1 -1
  69. data/schemas/tlc_1.0.15/schema/tlc/commands/M0017.json +1 -1
  70. data/schemas/tlc_1.0.15/schema/tlc/commands/M0018.json +1 -1
  71. data/schemas/tlc_1.0.15/schema/tlc/commands/M0019.json +1 -1
  72. data/schemas/tlc_1.0.15/schema/tlc/commands/M0020.json +1 -1
  73. data/schemas/tlc_1.0.15/schema/tlc/commands/M0021.json +1 -1
  74. data/schemas/tlc_1.0.15/schema/tlc/commands/M0103.json +1 -1
  75. data/schemas/tlc_1.0.15/schema/tlc/commands/M0104.json +1 -1
  76. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0001.json +1 -1
  77. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0002.json +1 -1
  78. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0003.json +1 -1
  79. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0004.json +1 -1
  80. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0005.json +1 -1
  81. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0006.json +1 -1
  82. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0007.json +1 -1
  83. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0008.json +1 -1
  84. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0009.json +1 -1
  85. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0010.json +1 -1
  86. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0011.json +1 -1
  87. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0012.json +1 -1
  88. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0013.json +1 -1
  89. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0014.json +1 -1
  90. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0015.json +1 -1
  91. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0016.json +1 -1
  92. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0017.json +1 -1
  93. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0018.json +1 -1
  94. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0019.json +1 -1
  95. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0020.json +1 -1
  96. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0021.json +1 -1
  97. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0022.json +1 -1
  98. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0023.json +1 -1
  99. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0024.json +1 -1
  100. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0025.json +1 -1
  101. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0026.json +1 -1
  102. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0027.json +1 -1
  103. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0028.json +2 -2
  104. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0029.json +1 -1
  105. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0030.json +1 -1
  106. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0031.json +1 -1
  107. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0091.json +1 -1
  108. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0092.json +1 -1
  109. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0095.json +1 -1
  110. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0096.json +1 -1
  111. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0097.json +1 -1
  112. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0098.json +2 -2
  113. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0201.json +1 -1
  114. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0202.json +2 -2
  115. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0203.json +2 -2
  116. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0204.json +2 -2
  117. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0205.json +3 -3
  118. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0206.json +3 -3
  119. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0207.json +3 -3
  120. data/schemas/tlc_1.0.15/schema/tlc/statuses/S0208.json +11 -11
  121. data/schemas/tlc_1.0.15/schema/tlc/sxl.yaml +1655 -0
  122. metadata +20 -105
  123. data/schemas/core_3.1.2/examples/validate.rb +0 -35
  124. data/schemas/core_3.1.3/examples/validate.rb +0 -32
  125. data/schemas/core_3.1.3/schema/core/aggregated_status_request.json +0 -9
  126. data/schemas/core_3.1.3/schema/tlc/alarms/A0001.json +0 -7
  127. data/schemas/core_3.1.3/schema/tlc/alarms/A0002.json +0 -7
  128. data/schemas/core_3.1.3/schema/tlc/alarms/A0003.json +0 -7
  129. data/schemas/core_3.1.3/schema/tlc/alarms/A0004.json +0 -7
  130. data/schemas/core_3.1.3/schema/tlc/alarms/A0005.json +0 -7
  131. data/schemas/core_3.1.3/schema/tlc/alarms/A0006.json +0 -7
  132. data/schemas/core_3.1.3/schema/tlc/alarms/A0007.json +0 -7
  133. data/schemas/core_3.1.3/schema/tlc/alarms/A0008.json +0 -19
  134. data/schemas/core_3.1.3/schema/tlc/alarms/A0009.json +0 -7
  135. data/schemas/core_3.1.3/schema/tlc/alarms/A0101.json +0 -7
  136. data/schemas/core_3.1.3/schema/tlc/alarms/A0201.json +0 -20
  137. data/schemas/core_3.1.3/schema/tlc/alarms/A0202.json +0 -20
  138. data/schemas/core_3.1.3/schema/tlc/alarms/A0301.json +0 -49
  139. data/schemas/core_3.1.3/schema/tlc/alarms/A0302.json +0 -59
  140. data/schemas/core_3.1.3/schema/tlc/alarms/alarms.json +0 -68
  141. data/schemas/core_3.1.3/schema/tlc/commands/M0001.json +0 -48
  142. data/schemas/core_3.1.3/schema/tlc/commands/M0002.json +0 -39
  143. data/schemas/core_3.1.3/schema/tlc/commands/M0003.json +0 -39
  144. data/schemas/core_3.1.3/schema/tlc/commands/M0004.json +0 -30
  145. data/schemas/core_3.1.3/schema/tlc/commands/M0005.json +0 -39
  146. data/schemas/core_3.1.3/schema/tlc/commands/M0006.json +0 -39
  147. data/schemas/core_3.1.3/schema/tlc/commands/M0007.json +0 -30
  148. data/schemas/core_3.1.3/schema/tlc/commands/M0008.json +0 -40
  149. data/schemas/core_3.1.3/schema/tlc/commands/M0010.json +0 -30
  150. data/schemas/core_3.1.3/schema/tlc/commands/M0011.json +0 -30
  151. data/schemas/core_3.1.3/schema/tlc/commands/M0012.json +0 -29
  152. data/schemas/core_3.1.3/schema/tlc/commands/M0013.json +0 -1
  153. data/schemas/core_3.1.3/schema/tlc/commands/M0014.json +0 -38
  154. data/schemas/core_3.1.3/schema/tlc/commands/M0015.json +0 -38
  155. data/schemas/core_3.1.3/schema/tlc/commands/M0016.json +0 -29
  156. data/schemas/core_3.1.3/schema/tlc/commands/M0017.json +0 -29
  157. data/schemas/core_3.1.3/schema/tlc/commands/M0018.json +0 -38
  158. data/schemas/core_3.1.3/schema/tlc/commands/M0019.json +0 -49
  159. data/schemas/core_3.1.3/schema/tlc/commands/M0020.json +0 -49
  160. data/schemas/core_3.1.3/schema/tlc/commands/M0021.json +0 -1
  161. data/schemas/core_3.1.3/schema/tlc/commands/M0103.json +0 -39
  162. data/schemas/core_3.1.3/schema/tlc/commands/M0104.json +0 -1
  163. data/schemas/core_3.1.3/schema/tlc/commands/command_requests.json +0 -7
  164. data/schemas/core_3.1.3/schema/tlc/commands/command_responses.json +0 -7
  165. data/schemas/core_3.1.3/schema/tlc/commands/commands.json +0 -97
  166. data/schemas/core_3.1.3/schema/tlc/statuses/S0001.json +0 -45
  167. data/schemas/core_3.1.3/schema/tlc/statuses/S0002.json +0 -17
  168. data/schemas/core_3.1.3/schema/tlc/statuses/S0003.json +0 -26
  169. data/schemas/core_3.1.3/schema/tlc/statuses/S0004.json +0 -26
  170. data/schemas/core_3.1.3/schema/tlc/statuses/S0005.json +0 -18
  171. data/schemas/core_3.1.3/schema/tlc/statuses/S0006.json +0 -27
  172. data/schemas/core_3.1.3/schema/tlc/statuses/S0007.json +0 -26
  173. data/schemas/core_3.1.3/schema/tlc/statuses/S0008.json +0 -26
  174. data/schemas/core_3.1.3/schema/tlc/statuses/S0009.json +0 -26
  175. data/schemas/core_3.1.3/schema/tlc/statuses/S0010.json +0 -26
  176. data/schemas/core_3.1.3/schema/tlc/statuses/S0011.json +0 -26
  177. data/schemas/core_3.1.3/schema/tlc/statuses/S0012.json +0 -26
  178. data/schemas/core_3.1.3/schema/tlc/statuses/S0013.json +0 -27
  179. data/schemas/core_3.1.3/schema/tlc/statuses/S0014.json +0 -17
  180. data/schemas/core_3.1.3/schema/tlc/statuses/S0015.json +0 -17
  181. data/schemas/core_3.1.3/schema/tlc/statuses/S0016.json +0 -17
  182. data/schemas/core_3.1.3/schema/tlc/statuses/S0017.json +0 -17
  183. data/schemas/core_3.1.3/schema/tlc/statuses/S0018.json +0 -17
  184. data/schemas/core_3.1.3/schema/tlc/statuses/S0019.json +0 -17
  185. data/schemas/core_3.1.3/schema/tlc/statuses/S0020.json +0 -27
  186. data/schemas/core_3.1.3/schema/tlc/statuses/S0021.json +0 -18
  187. data/schemas/core_3.1.3/schema/tlc/statuses/S0022.json +0 -17
  188. data/schemas/core_3.1.3/schema/tlc/statuses/S0023.json +0 -18
  189. data/schemas/core_3.1.3/schema/tlc/statuses/S0024.json +0 -18
  190. data/schemas/core_3.1.3/schema/tlc/statuses/S0025.json +0 -80
  191. data/schemas/core_3.1.3/schema/tlc/statuses/S0026.json +0 -18
  192. data/schemas/core_3.1.3/schema/tlc/statuses/S0027.json +0 -18
  193. data/schemas/core_3.1.3/schema/tlc/statuses/S0028.json +0 -18
  194. data/schemas/core_3.1.3/schema/tlc/statuses/S0029.json +0 -17
  195. data/schemas/core_3.1.3/schema/tlc/statuses/S0030.json +0 -1
  196. data/schemas/core_3.1.3/schema/tlc/statuses/S0031.json +0 -1
  197. data/schemas/core_3.1.3/schema/tlc/statuses/S0091.json +0 -27
  198. data/schemas/core_3.1.3/schema/tlc/statuses/S0092.json +0 -27
  199. data/schemas/core_3.1.3/schema/tlc/statuses/S0095.json +0 -17
  200. data/schemas/core_3.1.3/schema/tlc/statuses/S0096.json +0 -68
  201. data/schemas/core_3.1.3/schema/tlc/statuses/S0097.json +0 -26
  202. data/schemas/core_3.1.3/schema/tlc/statuses/S0201.json +0 -26
  203. data/schemas/core_3.1.3/schema/tlc/statuses/S0202.json +0 -26
  204. data/schemas/core_3.1.3/schema/tlc/statuses/S0203.json +0 -26
  205. data/schemas/core_3.1.3/schema/tlc/statuses/S0204.json +0 -98
  206. data/schemas/core_3.1.3/schema/tlc/statuses/S0205.json +0 -26
  207. data/schemas/core_3.1.3/schema/tlc/statuses/S0206.json +0 -26
  208. data/schemas/core_3.1.3/schema/tlc/statuses/S0207.json +0 -26
  209. data/schemas/core_3.1.3/schema/tlc/statuses/S0208.json +0 -98
  210. data/schemas/core_3.1.3/schema/tlc/statuses/statuses.json +0 -181
  211. data/schemas/core_3.1.3/schema/tlc/sxl.json +0 -24
  212. data/schemas/core_3.1.3/spec/tlc/M0001_spec.rb +0 -67
  213. data/schemas/core_3.1.3/spec/tlc/S0007_spec.rb +0 -233
  214. data/schemas/core_3.1.4/examples/validate.rb +0 -35
  215. data/schemas/core_3.1.4/spec/core/alarm_request_spec.rb +0 -72
  216. data/schemas/core_3.1.5/examples/validate.rb +0 -35
  217. data/schemas/core_3.1.5/spec/core/alarm_request_spec.rb +0 -72
  218. data/schemas/core_3.1.5/spec/core/alarm_spec.rb +0 -298
@@ -0,0 +1,277 @@
1
+ RSpec.describe "Traffic Light Controller RSMP SXL Schema validation" do
2
+ describe 'Alarm Issue' do
3
+ let(:message) {{
4
+ "mType" => "rSMsg",
5
+ "type" => "Alarm",
6
+ "mId" => "2ea7edfc-8e3a-4765-85e7-db844c4702a0",
7
+ "ntsOId" => "",
8
+ "xNId" => "",
9
+ "cId" => "AB+84001=860VA001",
10
+ "aCId" => "A0004",
11
+ "xACId" => "",
12
+ "xNACId" => "",
13
+ "aSp" => "Suspend",
14
+ "ack" => "Acknowledged",
15
+ "aS" => "Active",
16
+ "sS" => "notSuspended",
17
+ "aTs" => "2015-05-29T08:56:25.390Z",
18
+ "cat" => "D",
19
+ "pri" => "3",
20
+ "rvs" => [
21
+ {
22
+ "n" => "Temp",
23
+ "v" => "-18.5"
24
+ }
25
+ ]
26
+ }}
27
+
28
+ it 'accepts valid alarm suspended' do
29
+ expect( validate(message) ).to be_nil
30
+ end
31
+
32
+ it 'catches missing component id' do
33
+ invalid = message.dup
34
+ invalid.delete 'cId'
35
+ expect( validate(invalid) ).to eq([
36
+ ["", "required", {"missing_keys"=>["cId"]}]
37
+ ])
38
+ end
39
+
40
+ it 'catches missing alarm code id' do
41
+ invalid = message.dup
42
+ invalid.delete 'aCId'
43
+ expect( validate(invalid) ).to eq([
44
+ ["", "required", {"missing_keys"=>["aCId"]}]
45
+ ])
46
+ end
47
+
48
+ it 'catches bad alarm code id' do
49
+ invalid = message.dup
50
+ invalid['aCId'] = "001"
51
+ expect( validate(invalid) ).to eq([
52
+ ["/aCId", "pattern"]
53
+ ])
54
+ end
55
+
56
+ it 'catches wrong alarm code id type' do
57
+ invalid = message.dup
58
+ invalid['aCId'] = 123
59
+ expect( validate(invalid) ).to eq([
60
+ ["/aCId", "string"]
61
+ ])
62
+ end
63
+
64
+ it 'catches missing extended alarm code id' do
65
+ invalid = message.dup
66
+ invalid.delete 'xACId'
67
+ expect( validate(invalid) ).to eq([
68
+ ["", "required", {"missing_keys"=>["xACId"]}]
69
+ ])
70
+ end
71
+
72
+ it 'catches wrong extended alarm code id type' do
73
+ invalid = message.dup
74
+ invalid['xACId'] = 123
75
+ expect( validate(invalid) ).to eq([
76
+ ["/xACId", "string"]
77
+ ])
78
+ end
79
+
80
+ it 'catches missing specialization' do
81
+ invalid = message.dup
82
+ invalid.delete 'aSp'
83
+ expect( validate(invalid) ).to eq([
84
+ ["", "required", {"missing_keys"=>["aSp"]}]
85
+ ])
86
+ end
87
+
88
+ it 'catches bad specialization' do
89
+ invalid = message.dup
90
+ invalid['aSp'] = "Bad"
91
+ expect( validate(invalid) ).to eq([
92
+ ["/aSp", "enum"]
93
+ ])
94
+ end
95
+
96
+ it 'catches wrong specialization type' do
97
+ invalid = message.dup
98
+ invalid['aSp'] = 123
99
+ expect( validate(invalid) ).to eq([
100
+ ["/aSp", "enum"],
101
+ ["/aSp", "string"]
102
+ ])
103
+ end
104
+
105
+ it 'catches missing alarm active status' do
106
+ invalid = message.dup
107
+ invalid.delete 'aS'
108
+ expect( validate(invalid) ).to eq([
109
+ ["", "required", {"missing_keys"=>["aS"]}]
110
+ ])
111
+ end
112
+
113
+ it 'catches bad alarm active status' do
114
+ invalid = message.dup
115
+ invalid['aS'] = "Bad"
116
+ expect( validate(invalid) ).to eq([
117
+ ["/aS", "enum"]
118
+ ])
119
+ end
120
+
121
+ it 'catches wrong alarm active status' do
122
+ invalid = message.dup
123
+ invalid['aS'] = 123
124
+ expect( validate(invalid) ).to eq([
125
+ ["/aS", "enum"],
126
+ ["/aS", "string"]
127
+ ])
128
+ end
129
+
130
+ it 'catches missing alarm acknowledged status' do
131
+ invalid = message.dup
132
+ invalid.delete 'ack'
133
+ expect( validate(invalid) ).to eq([
134
+ ["", "required", {"missing_keys"=>["ack"]}]
135
+ ])
136
+ end
137
+
138
+ it 'catches bad alarm acknowledged status' do
139
+ invalid = message.dup
140
+ invalid['ack'] = "Bad"
141
+ expect( validate(invalid) ).to eq([
142
+ ["/ack", "enum"]
143
+ ])
144
+ end
145
+
146
+ it 'catches wrong alarm acknowledged status type' do
147
+ invalid = message.dup
148
+ invalid['ack'] = 123
149
+ expect( validate(invalid) ).to eq([
150
+ ["/ack", "enum"],
151
+ ["/ack", "string"]
152
+ ])
153
+ end
154
+
155
+ it 'catches missing category' do
156
+ invalid = message.dup
157
+ invalid.delete 'cat'
158
+ expect( validate(invalid) ).to eq([
159
+ ["", "required", {"missing_keys"=>["cat"]}]
160
+ ])
161
+ end
162
+
163
+ it 'catches bad category' do
164
+ invalid = message.dup
165
+ invalid['cat'] = "A"
166
+ expect( validate(invalid) ).to eq([
167
+ ["/cat", "enum"]
168
+ ])
169
+ end
170
+
171
+ it 'catches wrong category' do
172
+ invalid = message.dup
173
+ invalid['cat'] = 123
174
+ expect( validate(invalid) ).to eq([
175
+ ["/cat", "enum"],
176
+ ["/cat", "string"]
177
+ ])
178
+ end
179
+
180
+ it 'catches missing priority' do
181
+ invalid = message.dup
182
+ invalid.delete 'pri'
183
+ expect( validate(invalid) ).to eq([
184
+ ["", "required", {"missing_keys"=>["pri"]}]
185
+ ])
186
+ end
187
+
188
+ it 'catches bad priority' do
189
+ invalid = message.dup
190
+ invalid['pri'] = "4"
191
+ expect( validate(invalid) ).to eq([
192
+ ["/pri", "enum"]
193
+ ])
194
+ end
195
+
196
+ it 'catches wrong priority' do
197
+ invalid = message.dup
198
+ invalid['pri'] = 1
199
+ expect( validate(invalid) ).to eq([
200
+ ["/pri", "enum"],
201
+ ["/pri", "string"]
202
+ ])
203
+ end
204
+
205
+ it 'catches missing timestamp' do
206
+ invalid = message.dup
207
+ invalid.delete 'aTs'
208
+ expect( validate(invalid) ).to eq([
209
+ ["", "required", {"missing_keys"=>["aTs"]}]
210
+ ])
211
+ end
212
+
213
+ it 'catches bad timestamp' do
214
+ invalid = message.dup
215
+ invalid['aTs'] = "yesterday"
216
+ expect( validate(invalid) ).to eq([
217
+ ["/aTs", "pattern"]
218
+ ])
219
+ end
220
+
221
+ it 'catches wrong timestamp type' do
222
+ invalid = message.dup
223
+ invalid['aTs'] = 123
224
+ expect( validate(invalid) ).to eq([
225
+ ["/aTs", "string"]
226
+ ])
227
+ end
228
+
229
+ it 'catches missing rvs' do
230
+ invalid = message.dup
231
+ invalid.delete 'rvs'
232
+ expect( validate(invalid) ).to eq([
233
+ ["", "required", {"missing_keys"=>["rvs"]}]
234
+ ])
235
+ end
236
+
237
+ it 'catches bad rvs type' do
238
+ invalid = message.dup
239
+ invalid["rvs"] = {}
240
+ expect( validate(invalid) ).to eq([
241
+ ["/rvs", "array"]
242
+ ])
243
+ end
244
+
245
+ it 'catches missing alarm name' do
246
+ invalid = message.dup
247
+ invalid["rvs"].first.delete 'n'
248
+ expect( validate(invalid) ).to eq([
249
+ ["/rvs/0", "required", {"missing_keys"=>["n"]}]
250
+ ])
251
+ end
252
+
253
+ it 'catches bad alarm name' do
254
+ invalid = message.dup
255
+ invalid["rvs"].first['n'] = 3
256
+ expect( validate(invalid) ).to eq([
257
+ ["/rvs/0/n", "string"]
258
+ ])
259
+ end
260
+
261
+ it 'catches missing alarm value' do
262
+ invalid = message.dup
263
+ invalid["rvs"].first.delete 'v'
264
+ expect( validate(invalid) ).to eq([
265
+ ["/rvs/0", "required", {"missing_keys"=>["v"]}]
266
+ ])
267
+ end
268
+
269
+ it 'catches bad alarm value' do
270
+ invalid = message.dup
271
+ invalid["rvs"].first['v'] = 3
272
+ expect( validate(invalid) ).to eq([
273
+ ["/rvs/0/v", "string"]
274
+ ])
275
+ end
276
+ end
277
+ end
@@ -0,0 +1,93 @@
1
+ RSpec.describe "Traffic Light Controller RSMP SXL Schema validation" do
2
+ describe 'Alarm Suspend' do
3
+ let(:message) {{
4
+ "mType" => "rSMsg",
5
+ "type" => "Alarm",
6
+ "mId" => "2a744145-403a-423f-ba80-f38e283a778e",
7
+ "ntsOId" => "",
8
+ "xNId" => "",
9
+ "cId" => "AB+84001=860VA001",
10
+ "aCId" => "A0004",
11
+ "xACId" => "",
12
+ "xNACId" => "",
13
+ "aSp" => "Suspend"
14
+ }}
15
+
16
+ it 'accepts valid alarm suspend' do
17
+ expect( validate(message) ).to be_nil
18
+ end
19
+
20
+ it 'catches missing component id' do
21
+ invalid = message.dup
22
+ invalid.delete 'cId'
23
+ expect( validate(invalid) ).to eq([
24
+ ["", "required", {"missing_keys"=>["cId"]}]
25
+ ])
26
+ end
27
+
28
+ it 'catches missing alarm code id' do
29
+ invalid = message.dup
30
+ invalid.delete 'aCId'
31
+ expect( validate(invalid) ).to eq([
32
+ ["", "required", {"missing_keys"=>["aCId"]}]
33
+ ])
34
+ end
35
+
36
+ it 'catches bad alarm code id' do
37
+ invalid = message.dup
38
+ invalid['aCId'] = "001"
39
+ expect( validate(invalid) ).to eq([
40
+ ["/aCId", "pattern"]
41
+ ])
42
+ end
43
+
44
+ it 'catches wrong alarm code id type' do
45
+ invalid = message.dup
46
+ invalid['aCId'] = 123
47
+ expect( validate(invalid) ).to eq([
48
+ ["/aCId", "string"]
49
+ ])
50
+ end
51
+
52
+ it 'catches missing extended alarm code id' do
53
+ invalid = message.dup
54
+ invalid.delete 'xACId'
55
+ expect( validate(invalid) ).to eq([
56
+ ["", "required", {"missing_keys"=>["xACId"]}]
57
+ ])
58
+ end
59
+
60
+ it 'catches wrong extended alarm code id type' do
61
+ invalid = message.dup
62
+ invalid['xACId'] = 123
63
+ expect( validate(invalid) ).to eq([
64
+ ["/xACId", "string"]
65
+ ])
66
+ end
67
+
68
+ it 'catches missing specialization' do
69
+ invalid = message.dup
70
+ invalid.delete 'aSp'
71
+ expect( validate(invalid) ).to eq([
72
+ ["", "required", {"missing_keys"=>["aSp"]}]
73
+ ])
74
+ end
75
+
76
+ it 'catches bad specialization' do
77
+ invalid = message.dup
78
+ invalid['aSp'] = "Bad"
79
+ expect( validate(invalid) ).to eq([
80
+ ["/aSp", "enum"]
81
+ ])
82
+ end
83
+
84
+ it 'catches wrong specialization type' do
85
+ invalid = message.dup
86
+ invalid['aSp'] = 123
87
+ expect( validate(invalid) ).to eq([
88
+ ["/aSp", "enum"],
89
+ ["/aSp", "string"]
90
+ ])
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,277 @@
1
+ RSpec.describe "Traffic Light Controller RSMP SXL Schema validation" do
2
+ describe 'Alarm Issue' do
3
+ let(:message) {{
4
+ "mType" => "rSMsg",
5
+ "type" => "Alarm",
6
+ "mId" => "2ea7edfc-8e3a-4765-85e7-db844c4702a0",
7
+ "ntsOId" => "",
8
+ "xNId" => "",
9
+ "cId" => "AB+84001=860VA001",
10
+ "aCId" => "A0004",
11
+ "xACId" => "",
12
+ "xNACId" => "",
13
+ "aSp" => "Suspend",
14
+ "ack" => "Acknowledged",
15
+ "aS" => "Active",
16
+ "sS" => "suspended",
17
+ "aTs" => "2015-05-29T08:56:25.390Z",
18
+ "cat" => "D",
19
+ "pri" => "3",
20
+ "rvs" => [
21
+ {
22
+ "n" => "Temp",
23
+ "v" => "-18.5"
24
+ }
25
+ ]
26
+ }}
27
+
28
+ it 'accepts valid alarm suspended' do
29
+ expect( validate(message) ).to be_nil
30
+ end
31
+
32
+ it 'catches missing component id' do
33
+ invalid = message.dup
34
+ invalid.delete 'cId'
35
+ expect( validate(invalid) ).to eq([
36
+ ["", "required", {"missing_keys"=>["cId"]}]
37
+ ])
38
+ end
39
+
40
+ it 'catches missing alarm code id' do
41
+ invalid = message.dup
42
+ invalid.delete 'aCId'
43
+ expect( validate(invalid) ).to eq([
44
+ ["", "required", {"missing_keys"=>["aCId"]}]
45
+ ])
46
+ end
47
+
48
+ it 'catches bad alarm code id' do
49
+ invalid = message.dup
50
+ invalid['aCId'] = "001"
51
+ expect( validate(invalid) ).to eq([
52
+ ["/aCId", "pattern"]
53
+ ])
54
+ end
55
+
56
+ it 'catches wrong alarm code id type' do
57
+ invalid = message.dup
58
+ invalid['aCId'] = 123
59
+ expect( validate(invalid) ).to eq([
60
+ ["/aCId", "string"]
61
+ ])
62
+ end
63
+
64
+ it 'catches missing extended alarm code id' do
65
+ invalid = message.dup
66
+ invalid.delete 'xACId'
67
+ expect( validate(invalid) ).to eq([
68
+ ["", "required", {"missing_keys"=>["xACId"]}]
69
+ ])
70
+ end
71
+
72
+ it 'catches wrong extended alarm code id type' do
73
+ invalid = message.dup
74
+ invalid['xACId'] = 123
75
+ expect( validate(invalid) ).to eq([
76
+ ["/xACId", "string"]
77
+ ])
78
+ end
79
+
80
+ it 'catches missing specialization' do
81
+ invalid = message.dup
82
+ invalid.delete 'aSp'
83
+ expect( validate(invalid) ).to eq([
84
+ ["", "required", {"missing_keys"=>["aSp"]}]
85
+ ])
86
+ end
87
+
88
+ it 'catches bad specialization' do
89
+ invalid = message.dup
90
+ invalid['aSp'] = "Bad"
91
+ expect( validate(invalid) ).to eq([
92
+ ["/aSp", "enum"]
93
+ ])
94
+ end
95
+
96
+ it 'catches wrong specialization type' do
97
+ invalid = message.dup
98
+ invalid['aSp'] = 123
99
+ expect( validate(invalid) ).to eq([
100
+ ["/aSp", "enum"],
101
+ ["/aSp", "string"]
102
+ ])
103
+ end
104
+
105
+ it 'catches missing alarm active status' do
106
+ invalid = message.dup
107
+ invalid.delete 'aS'
108
+ expect( validate(invalid) ).to eq([
109
+ ["", "required", {"missing_keys"=>["aS"]}]
110
+ ])
111
+ end
112
+
113
+ it 'catches bad alarm active status' do
114
+ invalid = message.dup
115
+ invalid['aS'] = "Bad"
116
+ expect( validate(invalid) ).to eq([
117
+ ["/aS", "enum"]
118
+ ])
119
+ end
120
+
121
+ it 'catches wrong alarm active status' do
122
+ invalid = message.dup
123
+ invalid['aS'] = 123
124
+ expect( validate(invalid) ).to eq([
125
+ ["/aS", "enum"],
126
+ ["/aS", "string"]
127
+ ])
128
+ end
129
+
130
+ it 'catches missing alarm acknowledged status' do
131
+ invalid = message.dup
132
+ invalid.delete 'ack'
133
+ expect( validate(invalid) ).to eq([
134
+ ["", "required", {"missing_keys"=>["ack"]}]
135
+ ])
136
+ end
137
+
138
+ it 'catches bad alarm acknowledged status' do
139
+ invalid = message.dup
140
+ invalid['ack'] = "Bad"
141
+ expect( validate(invalid) ).to eq([
142
+ ["/ack", "enum"]
143
+ ])
144
+ end
145
+
146
+ it 'catches wrong alarm acknowledged status type' do
147
+ invalid = message.dup
148
+ invalid['ack'] = 123
149
+ expect( validate(invalid) ).to eq([
150
+ ["/ack", "enum"],
151
+ ["/ack", "string"]
152
+ ])
153
+ end
154
+
155
+ it 'catches missing category' do
156
+ invalid = message.dup
157
+ invalid.delete 'cat'
158
+ expect( validate(invalid) ).to eq([
159
+ ["", "required", {"missing_keys"=>["cat"]}]
160
+ ])
161
+ end
162
+
163
+ it 'catches bad category' do
164
+ invalid = message.dup
165
+ invalid['cat'] = "A"
166
+ expect( validate(invalid) ).to eq([
167
+ ["/cat", "enum"]
168
+ ])
169
+ end
170
+
171
+ it 'catches wrong category' do
172
+ invalid = message.dup
173
+ invalid['cat'] = 123
174
+ expect( validate(invalid) ).to eq([
175
+ ["/cat", "enum"],
176
+ ["/cat", "string"]
177
+ ])
178
+ end
179
+
180
+ it 'catches missing priority' do
181
+ invalid = message.dup
182
+ invalid.delete 'pri'
183
+ expect( validate(invalid) ).to eq([
184
+ ["", "required", {"missing_keys"=>["pri"]}]
185
+ ])
186
+ end
187
+
188
+ it 'catches bad priority' do
189
+ invalid = message.dup
190
+ invalid['pri'] = "4"
191
+ expect( validate(invalid) ).to eq([
192
+ ["/pri", "enum"]
193
+ ])
194
+ end
195
+
196
+ it 'catches wrong priority' do
197
+ invalid = message.dup
198
+ invalid['pri'] = 1
199
+ expect( validate(invalid) ).to eq([
200
+ ["/pri", "enum"],
201
+ ["/pri", "string"]
202
+ ])
203
+ end
204
+
205
+ it 'catches missing timestamp' do
206
+ invalid = message.dup
207
+ invalid.delete 'aTs'
208
+ expect( validate(invalid) ).to eq([
209
+ ["", "required", {"missing_keys"=>["aTs"]}]
210
+ ])
211
+ end
212
+
213
+ it 'catches bad timestamp' do
214
+ invalid = message.dup
215
+ invalid['aTs'] = "yesterday"
216
+ expect( validate(invalid) ).to eq([
217
+ ["/aTs", "pattern"]
218
+ ])
219
+ end
220
+
221
+ it 'catches wrong timestamp type' do
222
+ invalid = message.dup
223
+ invalid['aTs'] = 123
224
+ expect( validate(invalid) ).to eq([
225
+ ["/aTs", "string"]
226
+ ])
227
+ end
228
+
229
+ it 'catches missing rvs' do
230
+ invalid = message.dup
231
+ invalid.delete 'rvs'
232
+ expect( validate(invalid) ).to eq([
233
+ ["", "required", {"missing_keys"=>["rvs"]}]
234
+ ])
235
+ end
236
+
237
+ it 'catches bad rvs type' do
238
+ invalid = message.dup
239
+ invalid["rvs"] = {}
240
+ expect( validate(invalid) ).to eq([
241
+ ["/rvs", "array"]
242
+ ])
243
+ end
244
+
245
+ it 'catches missing alarm name' do
246
+ invalid = message.dup
247
+ invalid["rvs"].first.delete 'n'
248
+ expect( validate(invalid) ).to eq([
249
+ ["/rvs/0", "required", {"missing_keys"=>["n"]}]
250
+ ])
251
+ end
252
+
253
+ it 'catches bad alarm name' do
254
+ invalid = message.dup
255
+ invalid["rvs"].first['n'] = 3
256
+ expect( validate(invalid) ).to eq([
257
+ ["/rvs/0/n", "string"]
258
+ ])
259
+ end
260
+
261
+ it 'catches missing alarm value' do
262
+ invalid = message.dup
263
+ invalid["rvs"].first.delete 'v'
264
+ expect( validate(invalid) ).to eq([
265
+ ["/rvs/0", "required", {"missing_keys"=>["v"]}]
266
+ ])
267
+ end
268
+
269
+ it 'catches bad alarm value' do
270
+ invalid = message.dup
271
+ invalid["rvs"].first['v'] = 3
272
+ expect( validate(invalid) ).to eq([
273
+ ["/rvs/0/v", "string"]
274
+ ])
275
+ end
276
+ end
277
+ end
@@ -10,9 +10,10 @@ RSpec.describe "Traffic Light Controller RSMP SXL Schema validation" do
10
10
  { "vers" => "3.1.1" },
11
11
  { "vers" => "3.1.2" },
12
12
  { "vers" => "3.1.3" },
13
- { "vers" => "3.1.4" }
13
+ { "vers" => "3.1.4" },
14
+ { "vers" => "3.1.5" }
14
15
  ],
15
- "SXL" => "1.1"
16
+ "SXL" => "1.0.15"
16
17
  }}
17
18
 
18
19
  it 'accepts valid message' do
@@ -1,29 +1,29 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- diff-lcs (1.4.4)
5
- ecma-re-validator (0.3.0)
6
- regexp_parser (~> 2.0)
4
+ diff-lcs (1.5.0)
5
+ ecma-re-validator (0.4.0)
6
+ regexp_parser (~> 2.2)
7
7
  hana (1.3.7)
8
- json_schemer (0.2.18)
8
+ json_schemer (0.2.21)
9
9
  ecma-re-validator (~> 0.3)
10
10
  hana (~> 1.3)
11
11
  regexp_parser (~> 2.0)
12
12
  uri_template (~> 0.7)
13
- regexp_parser (2.1.1)
14
- rspec (3.10.0)
15
- rspec-core (~> 3.10.0)
16
- rspec-expectations (~> 3.10.0)
17
- rspec-mocks (~> 3.10.0)
18
- rspec-core (3.10.1)
19
- rspec-support (~> 3.10.0)
20
- rspec-expectations (3.10.1)
13
+ regexp_parser (2.5.0)
14
+ rspec (3.11.0)
15
+ rspec-core (~> 3.11.0)
16
+ rspec-expectations (~> 3.11.0)
17
+ rspec-mocks (~> 3.11.0)
18
+ rspec-core (3.11.0)
19
+ rspec-support (~> 3.11.0)
20
+ rspec-expectations (3.11.0)
21
21
  diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.10.0)
23
- rspec-mocks (3.10.2)
22
+ rspec-support (~> 3.11.0)
23
+ rspec-mocks (3.11.1)
24
24
  diff-lcs (>= 1.2.0, < 2.0)
25
- rspec-support (~> 3.10.0)
26
- rspec-support (3.10.2)
25
+ rspec-support (~> 3.11.0)
26
+ rspec-support (3.11.0)
27
27
  uri_template (0.7.0)
28
28
 
29
29
  PLATFORMS
@@ -34,4 +34,4 @@ DEPENDENCIES
34
34
  rspec
35
35
 
36
36
  BUNDLED WITH
37
- 2.2.3
37
+ 2.3.7