PageRenderTime 49ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/src/test/java/org/jhove2/module/format/arc/ArcVersionHeaderTest.java

https://bitbucket.org/moabrichard/jhove2
Java | 330 lines | 284 code | 5 blank | 41 comment | 0 complexity | a473c81d25a9e21cf8bed8e814c598b5 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause
  1. /**
  2. * JHOVE2 - Next-generation architecture for format-aware characterization
  3. * <p>
  4. * Copyright (c) 2009 by The Regents of the University of California, Ithaka
  5. * Harbors, Inc., and The Board of Trustees of the Leland Stanford Junior
  6. * University. All rights reserved.
  7. * </p>
  8. * <p>
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions are met:
  11. * </p>
  12. * <ul>
  13. * <li>Redistributions of source code must retain the above copyright notice,
  14. * this list of conditions and the following disclaimer.</li>
  15. * <li>Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.</li>
  18. * <li>Neither the name of the University of California/California Digital
  19. * Library, Ithaka Harbors/Portico, or Stanford University, nor the names of its
  20. * contributors may be used to endorse or promote products derived from this
  21. * software without specific prior written permission.</li>
  22. * </ul>
  23. * <p>
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  27. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  28. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  29. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  30. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  31. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  32. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  33. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  34. * POSSIBILITY OF SUCH DAMAGE.
  35. * </p>
  36. */
  37. package org.jhove2.module.format.arc;
  38. import org.jhove2.module.format.Validator.Validity;
  39. import org.junit.Test;
  40. /**
  41. * Tests of ARC Module
  42. * @see org.jhove2.module.warc.ArcModule
  43. * @author nicl
  44. */
  45. public class ArcVersionHeaderTest extends ArcModuleTestBase {
  46. Object[][] cases = new Object[][] {
  47. {Validity.False, "invalid-versionheader-1.arc", new String[][] {
  48. {
  49. "[ERROR/OBJECT] Invalid ARC file"
  50. }
  51. }, new String[] {
  52. }},
  53. {Validity.False, "invalid-versionheader-2.arc", new String[][] {
  54. {
  55. "[ERROR/OBJECT] Invalid ARC file"
  56. }
  57. }, new String[] {
  58. }},
  59. {Validity.False, "invalid-versionheader-3.arc", new String[][] {
  60. {
  61. "[ERROR/OBJECT] Error in ARC version block, reason 'Version line empty'",
  62. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  63. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  64. }
  65. }, new String[] {
  66. }},
  67. {Validity.False, "invalid-versionheader-4.arc", new String[][] {
  68. {
  69. "[ERROR/OBJECT] Error in ARC version block, reason 'Version line empty'",
  70. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  71. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  72. }
  73. }, new String[] {
  74. }},
  75. {Validity.False, "invalid-versionheader-5.arc", new String[][] {
  76. {
  77. "[ERROR/OBJECT] Error in ARC version block, reason 'Version line empty'",
  78. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  79. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  80. }
  81. }, new String[] {
  82. }},
  83. {Validity.False, "invalid-versionheader-6.arc", new String[][] {
  84. {
  85. "[ERROR/OBJECT] Error in ARC version block, reason 'Version line empty'",
  86. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  87. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  88. }
  89. }, new String[] {
  90. }},
  91. {Validity.False, "invalid-versionheader-7.arc", new String[][] {
  92. {
  93. "[ERROR/OBJECT] Error in ARC version block, reason 'Version line empty'",
  94. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  95. }
  96. }, new String[] {
  97. }},
  98. {Validity.False, "invalid-versionheader-8.arc", new String[][] {
  99. {
  100. "[ERROR/OBJECT] Error in ARC version block, reason 'Version line empty'",
  101. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'",
  102. "[ERROR/OBJECT] Invalid ARC record does not match the version block definition, value: '2', expected: '1'"
  103. }
  104. }, new String[] {
  105. }},
  106. {Validity.False, "invalid-versionheader-9.arc", new String[][] {
  107. {
  108. "[ERROR/OBJECT] Error in ARC version block, reason 'Version line empty'",
  109. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'",
  110. "[ERROR/OBJECT] Invalid ARC record does not match the version block definition, value: '1', expected: '2'"
  111. }
  112. }, new String[] {
  113. }},
  114. {Validity.False, "invalid-versionheader-10.arc", new String[][] {
  115. {
  116. "[ERROR/OBJECT] Error in ARC version block, reason 'Version line empty'",
  117. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  118. }
  119. }, new String[] {
  120. }},
  121. {Validity.False, "invalid-versionheader-11.arc", new String[][] {
  122. {
  123. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  124. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  125. }
  126. }, new String[] {
  127. }},
  128. {Validity.False, "invalid-versionheader-12.arc", new String[][] {
  129. {
  130. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  131. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  132. }
  133. }, new String[] {
  134. }},
  135. {Validity.False, "invalid-versionheader-13.arc", new String[][] {
  136. {
  137. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  138. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  139. }
  140. }, new String[] {
  141. }},
  142. {Validity.False, "invalid-versionheader-14.arc", new String[][] {
  143. {
  144. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  145. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  146. }
  147. }, new String[] {
  148. }},
  149. {Validity.False, "invalid-versionheader-15.arc", new String[][] {
  150. {
  151. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  152. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  153. }
  154. }, new String[] {
  155. }},
  156. {Validity.False, "invalid-versionheader-16.arc", new String[][] {
  157. {
  158. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  159. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  160. }
  161. }, new String[] {
  162. }},
  163. {Validity.False, "invalid-versionheader-17.arc", new String[][] {
  164. {
  165. "[ERROR/OBJECT] Invalid 'Version-number' value, value: 'x', expected: 'Numeric format'",
  166. "[ERROR/OBJECT] Invalid ARC version block",
  167. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  168. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  169. }
  170. }, new String[] {
  171. }},
  172. {Validity.False, "invalid-versionheader-18.arc", new String[][] {
  173. {
  174. "[ERROR/OBJECT] Invalid 'Version-number' value, value: 'x', expected: 'Numeric format'",
  175. "[ERROR/OBJECT] Invalid ARC version block",
  176. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  177. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  178. }
  179. }, new String[] {
  180. }},
  181. {Validity.False, "invalid-versionheader-19.arc", new String[][] {
  182. {
  183. "[ERROR/OBJECT] Invalid 'Reserved' value, value: 'x', expected: 'Numeric format'",
  184. "[ERROR/OBJECT] Invalid ARC version block",
  185. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  186. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  187. }
  188. }, new String[] {
  189. }},
  190. {Validity.False, "invalid-versionheader-20.arc", new String[][] {
  191. {
  192. "[ERROR/OBJECT] Invalid 'Reserved' value, value: 'x', expected: 'Numeric format'",
  193. "[ERROR/OBJECT] Invalid ARC version block",
  194. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  195. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  196. }
  197. }, new String[] {
  198. }},
  199. {Validity.False, "invalid-versionheader-21.arc", new String[][] {
  200. {
  201. "[ERROR/OBJECT] Invalid ARC version block",
  202. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  203. }
  204. }, new String[] {
  205. }},
  206. {Validity.False, "invalid-versionheader-22.arc", new String[][] {
  207. {
  208. "[ERROR/OBJECT] Invalid ARC version block",
  209. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  210. }
  211. }, new String[] {
  212. }},
  213. {Validity.False, "invalid-versionheader-23.arc", new String[][] {
  214. {
  215. "[ERROR/OBJECT] Invalid ARC version block",
  216. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  217. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  218. }
  219. }, new String[] {
  220. }},
  221. {Validity.False, "invalid-versionheader-24.arc", new String[][] {
  222. {
  223. "[ERROR/OBJECT] Invalid ARC version block",
  224. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  225. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  226. }
  227. }, new String[] {
  228. }},
  229. {Validity.False, "invalid-versionheader-25.arc", new String[][] {
  230. {
  231. "[ERROR/OBJECT] Invalid ARC version block",
  232. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  233. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  234. }
  235. }, new String[] {
  236. }},
  237. {Validity.False, "invalid-versionheader-26.arc", new String[][] {
  238. {
  239. "[ERROR/OBJECT] Invalid ARC version block",
  240. "[ERROR/OBJECT] Error in ARC version block, reason 'Block definition empty'",
  241. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  242. }
  243. }, new String[] {
  244. }},
  245. {Validity.False, "invalid-versionheader-27.arc", new String[][] {
  246. {
  247. "[ERROR/OBJECT] Invalid ARC version block",
  248. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  249. }
  250. }, new String[] {
  251. }},
  252. {Validity.False, "invalid-versionheader-28.arc", new String[][] {
  253. {
  254. "[ERROR/OBJECT] Invalid ARC version block",
  255. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'",
  256. "[ERROR/OBJECT] Invalid ARC record does not match the version block definition, value: '2', expected: '1'"
  257. }
  258. }, new String[] {
  259. }},
  260. {Validity.False, "invalid-versionheader-29.arc", new String[][] {
  261. {
  262. "[ERROR/OBJECT] Invalid ARC version block",
  263. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'",
  264. "[ERROR/OBJECT] Invalid ARC record does not match the version block definition, value: '1', expected: '2'"
  265. }
  266. }, new String[] {
  267. }},
  268. {Validity.False, "invalid-versionheader-30.arc", new String[][] {
  269. {
  270. "[ERROR/OBJECT] Invalid ARC version block",
  271. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  272. }
  273. }, new String[] {
  274. }},
  275. {Validity.False, "invalid-versionheader-31.arc", new String[][] {
  276. {
  277. "[ERROR/OBJECT] Invalid ARC version block",
  278. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'",
  279. "[ERROR/OBJECT] Invalid ARC record does not match the version block definition, value: '1', expected: '2'"
  280. }
  281. }, new String[] {
  282. }},
  283. {Validity.False, "invalid-versionheader-32.arc", new String[][] {
  284. {
  285. "[ERROR/OBJECT] Invalid ARC version block",
  286. "[ERROR/OBJECT] Error in ARC version block, reason 'Version block is not valid!'"
  287. }
  288. }, new String[] {
  289. }},
  290. {Validity.False, "invalid-versionheader-33.arc", new String[][] {
  291. {
  292. "[ERROR/OBJECT] Invalid ARC record does not match the version block definition, value: '2', expected: '1'"
  293. }
  294. }, new String[] {
  295. }},
  296. {Validity.False, "invalid-versionheader-34.arc", new String[][] {
  297. {
  298. "[ERROR/OBJECT] Invalid ARC record does not match the version block definition, value: '2', expected: '1'"
  299. }
  300. }, new String[] {
  301. }},
  302. {Validity.False, "invalid-versionheader-35.arc", new String[][] {
  303. {
  304. "[ERROR/OBJECT] Invalid ARC record does not match the version block definition, value: '1', expected: '2'"
  305. }
  306. }, new String[] {
  307. }},
  308. {Validity.True, "valid-versionheader-1.arc", new String[][] {
  309. {}
  310. }, new String[] {
  311. }},
  312. {Validity.True, "valid-versionheader-2.arc", new String[][] {
  313. {}
  314. }, new String[] {
  315. }},
  316. {Validity.True, "valid-versionheader-3.arc", new String[][] {
  317. {}
  318. }, new String[] {
  319. }}
  320. };
  321. @Test
  322. public void test_arcversionheaders() {
  323. test_cases(cases, false);
  324. }
  325. }