soap4r-straightjacket 1.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (425) hide show
  1. data/bin/wsdl2ruby.rb +137 -0
  2. data/bin/xsd2ruby.rb +90 -0
  3. data/lib/soap/attachment.rb +108 -0
  4. data/lib/soap/attrproxy.rb +34 -0
  5. data/lib/soap/baseData.rb +1094 -0
  6. data/lib/soap/element.rb +277 -0
  7. data/lib/soap/encodingstyle/aspDotNetHandler.rb +207 -0
  8. data/lib/soap/encodingstyle/handler.rb +120 -0
  9. data/lib/soap/encodingstyle/literalHandler.rb +195 -0
  10. data/lib/soap/encodingstyle/soapHandler.rb +559 -0
  11. data/lib/soap/filter.rb +13 -0
  12. data/lib/soap/filter/filterchain.rb +51 -0
  13. data/lib/soap/filter/handler.rb +31 -0
  14. data/lib/soap/filter/streamhandler.rb +29 -0
  15. data/lib/soap/generator.rb +299 -0
  16. data/lib/soap/header/handler.rb +61 -0
  17. data/lib/soap/header/handlerset.rb +70 -0
  18. data/lib/soap/header/mappinghandler.rb +47 -0
  19. data/lib/soap/header/simplehandler.rb +44 -0
  20. data/lib/soap/httpconfigloader.rb +139 -0
  21. data/lib/soap/mapping.rb +12 -0
  22. data/lib/soap/mapping/encodedregistry.rb +537 -0
  23. data/lib/soap/mapping/factory.rb +388 -0
  24. data/lib/soap/mapping/literalregistry.rb +391 -0
  25. data/lib/soap/mapping/mapping.rb +576 -0
  26. data/lib/soap/mapping/registry.rb +295 -0
  27. data/lib/soap/mapping/rubytypeFactory.rb +445 -0
  28. data/lib/soap/mapping/schemadefinition.rb +170 -0
  29. data/lib/soap/mapping/typeMap.rb +106 -0
  30. data/lib/soap/mapping/wsdlencodedregistry.rb +211 -0
  31. data/lib/soap/mapping/wsdlliteralregistry.rb +248 -0
  32. data/lib/soap/marshal.rb +59 -0
  33. data/lib/soap/mimemessage.rb +241 -0
  34. data/lib/soap/nestedexception.rb +42 -0
  35. data/lib/soap/netHttpClient.rb +241 -0
  36. data/lib/soap/ns.rb +34 -0
  37. data/lib/soap/parser.rb +252 -0
  38. data/lib/soap/processor.rb +66 -0
  39. data/lib/soap/property.rb +333 -0
  40. data/lib/soap/proxy.rb +14 -0
  41. data/lib/soap/rpc/cgistub.rb +247 -0
  42. data/lib/soap/rpc/driver.rb +221 -0
  43. data/lib/soap/rpc/element.rb +374 -0
  44. data/lib/soap/rpc/httpserver.rb +142 -0
  45. data/lib/soap/rpc/methodDef.rb +68 -0
  46. data/lib/soap/rpc/proxy.rb +572 -0
  47. data/lib/soap/rpc/router.rb +662 -0
  48. data/lib/soap/rpc/rpc.rb +25 -0
  49. data/lib/soap/rpc/soaplet.rb +200 -0
  50. data/lib/soap/rpc/standaloneServer.rb +43 -0
  51. data/lib/soap/soap.rb +151 -0
  52. data/lib/soap/streamHandler.rb +301 -0
  53. data/lib/soap/wsdlDriver.rb +164 -0
  54. data/lib/wsdl/binding.rb +65 -0
  55. data/lib/wsdl/data.rb +64 -0
  56. data/lib/wsdl/definitions.rb +236 -0
  57. data/lib/wsdl/documentation.rb +32 -0
  58. data/lib/wsdl/import.rb +80 -0
  59. data/lib/wsdl/importer.rb +38 -0
  60. data/lib/wsdl/info.rb +50 -0
  61. data/lib/wsdl/message.rb +54 -0
  62. data/lib/wsdl/operation.rb +151 -0
  63. data/lib/wsdl/operationBinding.rb +240 -0
  64. data/lib/wsdl/param.rb +93 -0
  65. data/lib/wsdl/parser.rb +164 -0
  66. data/lib/wsdl/part.rb +52 -0
  67. data/lib/wsdl/port.rb +66 -0
  68. data/lib/wsdl/portType.rb +75 -0
  69. data/lib/wsdl/service.rb +61 -0
  70. data/lib/wsdl/soap/address.rb +40 -0
  71. data/lib/wsdl/soap/binding.rb +49 -0
  72. data/lib/wsdl/soap/body.rb +58 -0
  73. data/lib/wsdl/soap/cgiStubCreator.rb +92 -0
  74. data/lib/wsdl/soap/classDefCreator.rb +433 -0
  75. data/lib/wsdl/soap/classDefCreatorSupport.rb +240 -0
  76. data/lib/wsdl/soap/classNameCreator.rb +54 -0
  77. data/lib/wsdl/soap/clientSkeltonCreator.rb +104 -0
  78. data/lib/wsdl/soap/complexType.rb +173 -0
  79. data/lib/wsdl/soap/data.rb +42 -0
  80. data/lib/wsdl/soap/definitions.rb +200 -0
  81. data/lib/wsdl/soap/driverCreator.rb +118 -0
  82. data/lib/wsdl/soap/element.rb +33 -0
  83. data/lib/wsdl/soap/encodedMappingRegistryCreator.rb +73 -0
  84. data/lib/wsdl/soap/fault.rb +56 -0
  85. data/lib/wsdl/soap/header.rb +86 -0
  86. data/lib/wsdl/soap/headerfault.rb +56 -0
  87. data/lib/wsdl/soap/literalMappingRegistryCreator.rb +115 -0
  88. data/lib/wsdl/soap/mappingRegistryCreator.rb +58 -0
  89. data/lib/wsdl/soap/mappingRegistryCreatorSupport.rb +376 -0
  90. data/lib/wsdl/soap/methodDefCreator.rb +199 -0
  91. data/lib/wsdl/soap/operation.rb +112 -0
  92. data/lib/wsdl/soap/servantSkeltonCreator.rb +89 -0
  93. data/lib/wsdl/soap/servletStubCreator.rb +104 -0
  94. data/lib/wsdl/soap/standaloneServerStubCreator.rb +100 -0
  95. data/lib/wsdl/soap/wsdl2ruby.rb +217 -0
  96. data/lib/wsdl/types.rb +44 -0
  97. data/lib/wsdl/wsdl.rb +24 -0
  98. data/lib/wsdl/xmlSchema/all.rb +24 -0
  99. data/lib/wsdl/xmlSchema/annotation.rb +34 -0
  100. data/lib/wsdl/xmlSchema/any.rb +61 -0
  101. data/lib/wsdl/xmlSchema/anyAttribute.rb +48 -0
  102. data/lib/wsdl/xmlSchema/attribute.rb +104 -0
  103. data/lib/wsdl/xmlSchema/attributeGroup.rb +68 -0
  104. data/lib/wsdl/xmlSchema/choice.rb +58 -0
  105. data/lib/wsdl/xmlSchema/complexContent.rb +97 -0
  106. data/lib/wsdl/xmlSchema/complexExtension.rb +119 -0
  107. data/lib/wsdl/xmlSchema/complexRestriction.rb +104 -0
  108. data/lib/wsdl/xmlSchema/complexType.rb +193 -0
  109. data/lib/wsdl/xmlSchema/content.rb +95 -0
  110. data/lib/wsdl/xmlSchema/data.rb +116 -0
  111. data/lib/wsdl/xmlSchema/element.rb +153 -0
  112. data/lib/wsdl/xmlSchema/enumeration.rb +36 -0
  113. data/lib/wsdl/xmlSchema/fractiondigits.rb +37 -0
  114. data/lib/wsdl/xmlSchema/group.rb +100 -0
  115. data/lib/wsdl/xmlSchema/import.rb +53 -0
  116. data/lib/wsdl/xmlSchema/importHandler.rb +45 -0
  117. data/lib/wsdl/xmlSchema/importer.rb +102 -0
  118. data/lib/wsdl/xmlSchema/include.rb +48 -0
  119. data/lib/wsdl/xmlSchema/length.rb +37 -0
  120. data/lib/wsdl/xmlSchema/list.rb +48 -0
  121. data/lib/wsdl/xmlSchema/maxexclusive.rb +37 -0
  122. data/lib/wsdl/xmlSchema/maxinclusive.rb +37 -0
  123. data/lib/wsdl/xmlSchema/maxlength.rb +37 -0
  124. data/lib/wsdl/xmlSchema/minexclusive.rb +37 -0
  125. data/lib/wsdl/xmlSchema/mininclusive.rb +37 -0
  126. data/lib/wsdl/xmlSchema/minlength.rb +37 -0
  127. data/lib/wsdl/xmlSchema/parser.rb +167 -0
  128. data/lib/wsdl/xmlSchema/pattern.rb +36 -0
  129. data/lib/wsdl/xmlSchema/ref.rb +33 -0
  130. data/lib/wsdl/xmlSchema/schema.rb +178 -0
  131. data/lib/wsdl/xmlSchema/sequence.rb +54 -0
  132. data/lib/wsdl/xmlSchema/simpleContent.rb +69 -0
  133. data/lib/wsdl/xmlSchema/simpleExtension.rb +62 -0
  134. data/lib/wsdl/xmlSchema/simpleRestriction.rb +132 -0
  135. data/lib/wsdl/xmlSchema/simpleType.rb +87 -0
  136. data/lib/wsdl/xmlSchema/totaldigits.rb +37 -0
  137. data/lib/wsdl/xmlSchema/union.rb +35 -0
  138. data/lib/wsdl/xmlSchema/unique.rb +34 -0
  139. data/lib/wsdl/xmlSchema/whitespace.rb +37 -0
  140. data/lib/wsdl/xmlSchema/xsd2ruby.rb +174 -0
  141. data/lib/xsd/charset.rb +189 -0
  142. data/lib/xsd/codegen.rb +12 -0
  143. data/lib/xsd/codegen/classdef.rb +208 -0
  144. data/lib/xsd/codegen/commentdef.rb +34 -0
  145. data/lib/xsd/codegen/gensupport.rb +273 -0
  146. data/lib/xsd/codegen/methoddef.rb +70 -0
  147. data/lib/xsd/codegen/moduledef.rb +208 -0
  148. data/lib/xsd/datatypes.rb +1466 -0
  149. data/lib/xsd/datatypes1999.rb +20 -0
  150. data/lib/xsd/iconvcharset.rb +33 -0
  151. data/lib/xsd/mapping.rb +68 -0
  152. data/lib/xsd/namedelements.rb +132 -0
  153. data/lib/xsd/ns.rb +182 -0
  154. data/lib/xsd/qname.rb +79 -0
  155. data/lib/xsd/xmlparser.rb +76 -0
  156. data/lib/xsd/xmlparser/libxmlparser.rb +115 -0
  157. data/lib/xsd/xmlparser/parser.rb +100 -0
  158. data/lib/xsd/xmlparser/rexmlparser.rb +58 -0
  159. data/lib/xsd/xmlparser/xmlparser.rb +50 -0
  160. data/lib/xsd/xmlparser/xmlscanner.rb +149 -0
  161. data/test/16runner.rb +68 -0
  162. data/test/interopR2/README.txt +2 -0
  163. data/test/interopR2/SOAPBuildersInterop_R2.wsdl +461 -0
  164. data/test/interopR2/SOAPBuildersInterop_R2GrB.wsdl +19 -0
  165. data/test/interopR2/base.rb +288 -0
  166. data/test/interopR2/client.NetRemoting.rb +17 -0
  167. data/test/interopR2/client.rb +1234 -0
  168. data/test/interopR2/client4S4C.rb +15 -0
  169. data/test/interopR2/client4S4C2.rb +14 -0
  170. data/test/interopR2/clientASP.NET.rb +17 -0
  171. data/test/interopR2/clientApacheAxis.rb +16 -0
  172. data/test/interopR2/clientApacheSOAP.rb +17 -0
  173. data/test/interopR2/clientBEAWebLogic.rb +17 -0
  174. data/test/interopR2/clientBase.rb +1967 -0
  175. data/test/interopR2/clientCapeConnect.rb +18 -0
  176. data/test/interopR2/clientDelphi.rb +19 -0
  177. data/test/interopR2/clientEasySoap.rb +14 -0
  178. data/test/interopR2/clientFrontier.rb +25 -0
  179. data/test/interopR2/clientGLUE.rb +32 -0
  180. data/test/interopR2/clientHP.rb +13 -0
  181. data/test/interopR2/clientJAX-RPC.rb +19 -0
  182. data/test/interopR2/clientJSOAP.rb +14 -0
  183. data/test/interopR2/clientKafkaXSLT.rb +15 -0
  184. data/test/interopR2/clientMSSOAPToolkit2.0.rb +17 -0
  185. data/test/interopR2/clientMSSOAPToolkit3.0.rb +17 -0
  186. data/test/interopR2/clientNuSOAP.rb +19 -0
  187. data/test/interopR2/clientNuWave.rb +15 -0
  188. data/test/interopR2/clientOpenLink.rb +15 -0
  189. data/test/interopR2/clientOracle.rb +15 -0
  190. data/test/interopR2/clientPEAR.rb +18 -0
  191. data/test/interopR2/clientPhalanx.rb +18 -0
  192. data/test/interopR2/clientSIMACE.rb +18 -0
  193. data/test/interopR2/clientSOAP4R.rb +18 -0
  194. data/test/interopR2/clientSOAP__Lite.rb +14 -0
  195. data/test/interopR2/clientSQLData.rb +18 -0
  196. data/test/interopR2/clientSilverStream.rb +17 -0
  197. data/test/interopR2/clientSpray2001.rb +17 -0
  198. data/test/interopR2/clientSun.rb +19 -0
  199. data/test/interopR2/clientVWOpentalkSoap.rb +19 -0
  200. data/test/interopR2/clientWASP.rb +19 -0
  201. data/test/interopR2/clientWASPC.rb +18 -0
  202. data/test/interopR2/clientWebMethods.rb +15 -0
  203. data/test/interopR2/clientWhiteMesa.rb +28 -0
  204. data/test/interopR2/clientWingfoot.rb +15 -0
  205. data/test/interopR2/clientXMLBus.rb +19 -0
  206. data/test/interopR2/clientXMLRPC-EPI.rb +17 -0
  207. data/test/interopR2/clientXSOAP.rb +14 -0
  208. data/test/interopR2/clientZSI.rb +19 -0
  209. data/test/interopR2/clienteSOAP.rb +18 -0
  210. data/test/interopR2/clientgSOAP.rb +18 -0
  211. data/test/interopR2/clientkSOAP.rb +17 -0
  212. data/test/interopR2/iSimonReg.rb +112 -0
  213. data/test/interopR2/interopResultBase.rb +114 -0
  214. data/test/interopR2/interopService.rb +247 -0
  215. data/test/interopR2/rwikiInteropService.rb +105 -0
  216. data/test/interopR2/server.cgi +270 -0
  217. data/test/interopR2/server.rb +275 -0
  218. data/test/interopR2/simonReg.rb +123 -0
  219. data/test/interopR2/test.sh +49 -0
  220. data/test/interopR4/client.rb +112 -0
  221. data/test/runner.rb +7 -0
  222. data/test/sm11/classDef.rb +156 -0
  223. data/test/sm11/client.rb +542 -0
  224. data/test/sm11/driver.rb +183 -0
  225. data/test/sm11/servant.rb +1067 -0
  226. data/test/sm11/server.rb +25 -0
  227. data/test/soap/asp.net/hello.wsdl +96 -0
  228. data/test/soap/asp.net/test_aspdotnet.rb +123 -0
  229. data/test/soap/auth/htdigest +2 -0
  230. data/test/soap/auth/htpasswd +2 -0
  231. data/test/soap/auth/test_basic.rb +117 -0
  232. data/test/soap/auth/test_digest.rb +118 -0
  233. data/test/soap/calc/calc.rb +17 -0
  234. data/test/soap/calc/calc2.rb +29 -0
  235. data/test/soap/calc/server.cgi +13 -0
  236. data/test/soap/calc/server.rb +17 -0
  237. data/test/soap/calc/server2.rb +20 -0
  238. data/test/soap/calc/test_calc.rb +51 -0
  239. data/test/soap/calc/test_calc2.rb +55 -0
  240. data/test/soap/calc/test_calc_cgi.rb +71 -0
  241. data/test/soap/case/test_mapping.rb +57 -0
  242. data/test/soap/fault/test_customfault.rb +60 -0
  243. data/test/soap/fault/test_fault.rb +46 -0
  244. data/test/soap/fault/test_soaparray.rb +35 -0
  245. data/test/soap/filter/test_filter.rb +146 -0
  246. data/test/soap/header/server.cgi +119 -0
  247. data/test/soap/header/test_authheader.rb +240 -0
  248. data/test/soap/header/test_authheader_cgi.rb +121 -0
  249. data/test/soap/header/test_simplehandler.rb +116 -0
  250. data/test/soap/helloworld/hw_s.rb +16 -0
  251. data/test/soap/helloworld/test_helloworld.rb +43 -0
  252. data/test/soap/htpasswd +2 -0
  253. data/test/soap/literalArrayMapping/amazonEc.rb +4778 -0
  254. data/test/soap/literalArrayMapping/amazonEcDriver.rb +172 -0
  255. data/test/soap/literalArrayMapping/amazonresponse.xml +100 -0
  256. data/test/soap/literalArrayMapping/test_definedarray.rb +34 -0
  257. data/test/soap/marshal/marshaltestlib.rb +494 -0
  258. data/test/soap/marshal/test_digraph.rb +56 -0
  259. data/test/soap/marshal/test_marshal.rb +26 -0
  260. data/test/soap/marshal/test_struct.rb +47 -0
  261. data/test/soap/ssl/README +1 -0
  262. data/test/soap/ssl/ca.cert +23 -0
  263. data/test/soap/ssl/client.cert +19 -0
  264. data/test/soap/ssl/client.key +15 -0
  265. data/test/soap/ssl/server.cert +19 -0
  266. data/test/soap/ssl/server.key +15 -0
  267. data/test/soap/ssl/sslsvr.rb +57 -0
  268. data/test/soap/ssl/subca.cert +21 -0
  269. data/test/soap/ssl/test_ssl.rb +235 -0
  270. data/test/soap/struct/test_struct.rb +70 -0
  271. data/test/soap/styleuse/client.rb +20 -0
  272. data/test/soap/styleuse/server.rb +86 -0
  273. data/test/soap/swa/test_file.rb +75 -0
  274. data/test/soap/test_basetype.rb +1090 -0
  275. data/test/soap/test_cookie.rb +112 -0
  276. data/test/soap/test_custom_ns.rb +105 -0
  277. data/test/soap/test_custommap.rb +110 -0
  278. data/test/soap/test_empty.rb +105 -0
  279. data/test/soap/test_envelopenamespace.rb +85 -0
  280. data/test/soap/test_extraattr.rb +54 -0
  281. data/test/soap/test_generator.rb +27 -0
  282. data/test/soap/test_httpconfigloader.rb +71 -0
  283. data/test/soap/test_mapping.rb +131 -0
  284. data/test/soap/test_nestedexception.rb +56 -0
  285. data/test/soap/test_nil.rb +57 -0
  286. data/test/soap/test_no_indent.rb +88 -0
  287. data/test/soap/test_property.rb +427 -0
  288. data/test/soap/test_response_as_xml.rb +117 -0
  289. data/test/soap/test_soapelement.rb +138 -0
  290. data/test/soap/test_streamhandler.rb +270 -0
  291. data/test/soap/test_styleuse.rb +326 -0
  292. data/test/soap/wsdlDriver/README.txt +2 -0
  293. data/test/soap/wsdlDriver/calc.wsdl +126 -0
  294. data/test/soap/wsdlDriver/document.wsdl +54 -0
  295. data/test/soap/wsdlDriver/echo_version.rb +29 -0
  296. data/test/soap/wsdlDriver/simpletype.wsdl +63 -0
  297. data/test/soap/wsdlDriver/test_calc.rb +71 -0
  298. data/test/soap/wsdlDriver/test_document.rb +71 -0
  299. data/test/soap/wsdlDriver/test_simpletype.rb +80 -0
  300. data/test/testutil.rb +54 -0
  301. data/test/wsdl/abstract/abstract.wsdl +176 -0
  302. data/test/wsdl/abstract/test_abstract.rb +159 -0
  303. data/test/wsdl/anonymous/expectedClassDef.rb +128 -0
  304. data/test/wsdl/anonymous/expectedDriver.rb +59 -0
  305. data/test/wsdl/anonymous/expectedMappingRegistry.rb +176 -0
  306. data/test/wsdl/anonymous/lp.wsdl +147 -0
  307. data/test/wsdl/anonymous/test_anonymous.rb +130 -0
  308. data/test/wsdl/any/any.wsdl +114 -0
  309. data/test/wsdl/any/expectedDriver.rb +68 -0
  310. data/test/wsdl/any/expectedEcho.rb +57 -0
  311. data/test/wsdl/any/expectedMappingRegistry.rb +63 -0
  312. data/test/wsdl/any/expectedService.rb +69 -0
  313. data/test/wsdl/any/test_any.rb +193 -0
  314. data/test/wsdl/axisArray/axisArray.wsdl +87 -0
  315. data/test/wsdl/axisArray/test_axisarray.rb +124 -0
  316. data/test/wsdl/choice/choice.wsdl +167 -0
  317. data/test/wsdl/choice/test_choice.rb +310 -0
  318. data/test/wsdl/complexcontent/complexContent.wsdl +83 -0
  319. data/test/wsdl/complexcontent/test_echo.rb +90 -0
  320. data/test/wsdl/datetime/DatetimeService.rb +44 -0
  321. data/test/wsdl/datetime/datetime.rb +0 -0
  322. data/test/wsdl/datetime/datetime.wsdl +45 -0
  323. data/test/wsdl/datetime/datetimeServant.rb +22 -0
  324. data/test/wsdl/datetime/test_datetime.rb +86 -0
  325. data/test/wsdl/document/array/double.wsdl +161 -0
  326. data/test/wsdl/document/array/test_array.rb +201 -0
  327. data/test/wsdl/document/document.wsdl +76 -0
  328. data/test/wsdl/document/number.wsdl +54 -0
  329. data/test/wsdl/document/ping_nosoapaction.wsdl +66 -0
  330. data/test/wsdl/document/test_nosoapaction.rb +102 -0
  331. data/test/wsdl/document/test_number.rb +92 -0
  332. data/test/wsdl/document/test_rpc.rb +355 -0
  333. data/test/wsdl/emptycomplextype.wsdl +31 -0
  334. data/test/wsdl/fault/fault.wsdl +79 -0
  335. data/test/wsdl/fault/multifault.wsdl +96 -0
  336. data/test/wsdl/fault/test_fault.rb +119 -0
  337. data/test/wsdl/fault/test_multifault.rb +134 -0
  338. data/test/wsdl/group/expectedClassdef.rb +58 -0
  339. data/test/wsdl/group/expectedDriver.rb +51 -0
  340. data/test/wsdl/group/expectedMappingRegistry.rb +67 -0
  341. data/test/wsdl/group/group.wsdl +88 -0
  342. data/test/wsdl/group/test_rpc.rb +145 -0
  343. data/test/wsdl/list/list.wsdl +93 -0
  344. data/test/wsdl/list/test_list.rb +124 -0
  345. data/test/wsdl/map/map.wsdl +92 -0
  346. data/test/wsdl/map/map.xml +43 -0
  347. data/test/wsdl/map/test_map.rb +99 -0
  348. data/test/wsdl/marshal/person.wsdl +21 -0
  349. data/test/wsdl/marshal/person_org.rb +23 -0
  350. data/test/wsdl/marshal/test_wsdlmarshal.rb +76 -0
  351. data/test/wsdl/multiplefault.wsdl +75 -0
  352. data/test/wsdl/oneway/oneway.wsdl +36 -0
  353. data/test/wsdl/oneway/test_oneway.rb +108 -0
  354. data/test/wsdl/overload/expectedClient.rb +37 -0
  355. data/test/wsdl/overload/expectedDriver.rb +61 -0
  356. data/test/wsdl/overload/expectedServant.rb +35 -0
  357. data/test/wsdl/overload/overload.wsdl +70 -0
  358. data/test/wsdl/overload/test_overload.rb +131 -0
  359. data/test/wsdl/qualified/lp.wsdl +47 -0
  360. data/test/wsdl/qualified/lp.xsd +26 -0
  361. data/test/wsdl/qualified/np.wsdl +51 -0
  362. data/test/wsdl/qualified/test_qualified.rb +137 -0
  363. data/test/wsdl/qualified/test_unqualified.rb +138 -0
  364. data/test/wsdl/raa/RAAService.rb +125 -0
  365. data/test/wsdl/raa/README.txt +8 -0
  366. data/test/wsdl/raa/expectedClassDef.rb +100 -0
  367. data/test/wsdl/raa/expectedDriver.rb +96 -0
  368. data/test/wsdl/raa/expectedMappingRegistry.rb +121 -0
  369. data/test/wsdl/raa/raa.wsdl +264 -0
  370. data/test/wsdl/raa/test_raa.rb +126 -0
  371. data/test/wsdl/ref/expectedDriver.rb +51 -0
  372. data/test/wsdl/ref/expectedProduct.rb +243 -0
  373. data/test/wsdl/ref/product.wsdl +147 -0
  374. data/test/wsdl/ref/test_ref.rb +268 -0
  375. data/test/wsdl/rpc/rpc.wsdl +109 -0
  376. data/test/wsdl/rpc/test-rpc-lit.wsdl +371 -0
  377. data/test/wsdl/rpc/test_rpc.rb +176 -0
  378. data/test/wsdl/rpc/test_rpc_lit.rb +470 -0
  379. data/test/wsdl/simplecontent/simplecontent.wsdl +84 -0
  380. data/test/wsdl/simplecontent/test_simplecontent.rb +102 -0
  381. data/test/wsdl/simpletype/rpc/expectedClient.rb +34 -0
  382. data/test/wsdl/simpletype/rpc/expectedDriver.rb +58 -0
  383. data/test/wsdl/simpletype/rpc/expectedEchoVersion.rb +36 -0
  384. data/test/wsdl/simpletype/rpc/expectedMappingRegistry.rb +57 -0
  385. data/test/wsdl/simpletype/rpc/expectedServant.rb +32 -0
  386. data/test/wsdl/simpletype/rpc/expectedService.rb +55 -0
  387. data/test/wsdl/simpletype/rpc/rpc.wsdl +98 -0
  388. data/test/wsdl/simpletype/rpc/test_rpc.rb +52 -0
  389. data/test/wsdl/simpletype/simpletype.wsdl +114 -0
  390. data/test/wsdl/simpletype/test_simpletype.rb +92 -0
  391. data/test/wsdl/soap/soapbodyparts.wsdl +103 -0
  392. data/test/wsdl/soap/test_soapbodyparts.rb +79 -0
  393. data/test/wsdl/soap/wsdl2ruby/expectedClassdef.rb +21 -0
  394. data/test/wsdl/soap/wsdl2ruby/expectedClient.rb +34 -0
  395. data/test/wsdl/soap/wsdl2ruby/expectedDriver.rb +58 -0
  396. data/test/wsdl/soap/wsdl2ruby/expectedMappingRegistry.rb +36 -0
  397. data/test/wsdl/soap/wsdl2ruby/expectedServant.rb +32 -0
  398. data/test/wsdl/soap/wsdl2ruby/expectedService.cgi +48 -0
  399. data/test/wsdl/soap/wsdl2ruby/expectedService.rb +55 -0
  400. data/test/wsdl/soap/wsdl2ruby/rpc.wsdl +80 -0
  401. data/test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb +37 -0
  402. data/test/wsdl/soap/wsdl2ruby/section/section.xsd +31 -0
  403. data/test/wsdl/soap/wsdl2ruby/section/test_section.rb +53 -0
  404. data/test/wsdl/soap/wsdl2ruby/soapenc/soapenc.wsdl +64 -0
  405. data/test/wsdl/soap/wsdl2ruby/soapenc/test_soapenc.rb +83 -0
  406. data/test/wsdl/soap/wsdl2ruby/test_wsdl2ruby.rb +102 -0
  407. data/test/wsdl/soaptype/soaptype.wsdl +61 -0
  408. data/test/wsdl/soaptype/test_soaptype.rb +178 -0
  409. data/test/wsdl/test_emptycomplextype.rb +21 -0
  410. data/test/wsdl/test_fault.rb +50 -0
  411. data/test/wsdl/test_multiplefault.rb +41 -0
  412. data/test/xsd/codegen/test_classdef.rb +244 -0
  413. data/test/xsd/noencoding.xml +4 -0
  414. data/test/xsd/test_noencoding.rb +32 -0
  415. data/test/xsd/test_ns.rb +41 -0
  416. data/test/xsd/test_xmlschemaparser.rb +22 -0
  417. data/test/xsd/test_xsd.rb +1638 -0
  418. data/test/xsd/xmllang.xml +43 -0
  419. data/test/xsd/xmlschema.xml +12 -0
  420. data/test/xsd/xsd2ruby/expected_mysample.rb +65 -0
  421. data/test/xsd/xsd2ruby/expected_mysample_mapper.rb +11 -0
  422. data/test/xsd/xsd2ruby/expected_mysample_mapping_registry.rb +51 -0
  423. data/test/xsd/xsd2ruby/section.xsd +49 -0
  424. data/test/xsd/xsd2ruby/test_xsd2ruby.rb +90 -0
  425. metadata +482 -0
@@ -0,0 +1,70 @@
1
+ require 'test/unit'
2
+ require 'soap/rpc/httpserver'
3
+ require 'soap/rpc/driver'
4
+ require File.join(File.dirname(File.expand_path(__FILE__)), '..', '..', 'testutil.rb')
5
+
6
+
7
+ module SOAP; module Struct
8
+
9
+
10
+ class TestStruct < Test::Unit::TestCase
11
+ Namespace = "urn:example.com:simpletype-rpc"
12
+ class Server < ::SOAP::RPC::HTTPServer
13
+ @@test_struct = ::Struct.new(:one, :two)
14
+
15
+ def on_init
16
+ add_method(self, 'a_method')
17
+ end
18
+
19
+ def a_method
20
+ @@test_struct.new("string", 1)
21
+ end
22
+ end
23
+
24
+ Port = 17171
25
+
26
+ def setup
27
+ setup_server
28
+ setup_client
29
+ end
30
+
31
+ def setup_server
32
+ @server = Server.new(
33
+ :Port => Port,
34
+ :BindAddress => "0.0.0.0",
35
+ :AccessLog => [],
36
+ :SOAPDefaultNamespace => Namespace
37
+ )
38
+ @server.level = Logger::Severity::ERROR
39
+ @server_thread = TestUtil.start_server_thread(@server)
40
+ end
41
+
42
+ def setup_client
43
+ @client = ::SOAP::RPC::Driver.new("http://localhost:#{Port}/", Namespace)
44
+ @client.wiredump_dev = STDERR if $DEBUG
45
+ @client.add_method('a_method')
46
+ end
47
+
48
+ def teardown
49
+ teardown_server if @server
50
+ teardown_client if @client
51
+ end
52
+
53
+ def teardown_server
54
+ @server.shutdown
55
+ @server_thread.kill
56
+ @server_thread.join
57
+ end
58
+
59
+ def teardown_client
60
+ @client.reset_stream
61
+ end
62
+
63
+ def test_struct
64
+ assert_equal("string", @client.a_method.one)
65
+ assert_equal(1, @client.a_method.two)
66
+ end
67
+ end
68
+
69
+
70
+ end; end
@@ -0,0 +1,20 @@
1
+ require 'soap/rpc/driver'
2
+
3
+ server = 'http://localhost:7000/'
4
+
5
+ app = SOAP::RPC::Driver.new(server, 'urn:styleuse')
6
+ app.add_rpc_method('rpc_serv', 'obj1', 'obj2')
7
+ app.add_document_method('doc_serv', 'urn:doc_serv#doc_serv',
8
+ [XSD::QName.new('urn:styleuse', 'req')],
9
+ [XSD::QName.new('urn:styleuse', 'res')])
10
+ app.add_document_method('doc_serv2', 'urn:doc_serv#doc_serv2',
11
+ [XSD::QName.new('urn:styleuse', 'req')],
12
+ [XSD::QName.new('urn:styleuse', 'res')])
13
+ app.wiredump_dev = STDOUT
14
+
15
+ p app.rpc_serv(true, false)
16
+ p app.rpc_serv("foo", "bar")
17
+ p app.doc_serv({"a" => "2"})
18
+ p app.doc_serv({"a" => {"b" => "2"}})
19
+ p app.doc_serv2({"a" => "2"})
20
+ p app.doc_serv2({"a" => {"b" => "2"}})
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'soap/rpc/standaloneServer'
4
+
5
+ class Server < SOAP::RPC::StandaloneServer
6
+ class RpcServant
7
+ def rpc_serv(obj1, obj2)
8
+ [obj1, obj2]
9
+ end
10
+ end
11
+
12
+ class DocumentServant
13
+ def doc_serv(hash)
14
+ hash
15
+ end
16
+
17
+ def doc_serv2(hash)
18
+ { 'newroot' => hash }
19
+ end
20
+ end
21
+
22
+ class GenericServant
23
+
24
+ # method name style: requeststyle_requestuse_responsestyle_responseuse
25
+
26
+ def rpc_enc_rpc_enc(obj1, obj2)
27
+ [obj1, obj2]
28
+ end
29
+
30
+ alias rpc_enc_rpc_lit rpc_enc_rpc_enc
31
+
32
+ def rpc_enc_doc_enc(obj1, obj2)
33
+ obj1
34
+ end
35
+
36
+ alias rpc_enc_doc_lit rpc_enc_doc_enc
37
+
38
+ def doc_enc_rpc_enc(obj)
39
+ [obj, obj]
40
+ end
41
+
42
+ alias doc_enc_rpc_lit doc_enc_rpc_enc
43
+
44
+ def doc_enc_doc_enc(obj)
45
+ obj
46
+ end
47
+
48
+ alias doc_enc_doc_lit doc_enc_doc_enc
49
+ end
50
+
51
+ def initialize(*arg)
52
+ super
53
+ rpcservant = RpcServant.new
54
+ docservant = DocumentServant.new
55
+ add_rpc_servant(rpcservant)
56
+ add_document_method(docservant, 'urn:doc_serv#doc_serv', 'doc_serv',
57
+ [XSD::QName.new('urn:styleuse', 'req')],
58
+ [XSD::QName.new('urn:styleuse', 'res')])
59
+ add_document_method(docservant, 'urn:doc_serv#doc_serv2', 'doc_serv2',
60
+ [XSD::QName.new('urn:styleuse', 'req')],
61
+ [XSD::QName.new('urn:styleuse', 'res')])
62
+
63
+ #servant = Servant.new
64
+ # ToDo: too plain: should add bare test case
65
+ #qname ||= XSD::QName.new(@default_namespace, name)
66
+ #add_operation(qname, nil, servant, "rpc_enc_rpc_enc", param_def,
67
+ # opt(:rpc, :rpc, :encoded, :encoded))
68
+ end
69
+
70
+ def opt(request_style, request_use, response_style, response_use)
71
+ {
72
+ :request_style => request_style,
73
+ :request_use => request_use,
74
+ :response_style => response_style,
75
+ :response_use => response_use
76
+ }
77
+ end
78
+ end
79
+
80
+ if $0 == __FILE__
81
+ server = Server.new('Server', 'urn:styleuse', '0.0.0.0', 7000)
82
+ trap(:INT) do
83
+ server.shutdown
84
+ end
85
+ server.start
86
+ end
@@ -0,0 +1,75 @@
1
+ require 'test/unit'
2
+ require 'soap/rpc/driver'
3
+ require 'soap/rpc/standaloneServer'
4
+ require 'soap/attachment'
5
+
6
+
7
+ module SOAP
8
+ module SWA
9
+
10
+
11
+ class TestFile < Test::Unit::TestCase
12
+ Port = 17171
13
+ THIS_FILE = File.expand_path(__FILE__)
14
+
15
+ class SwAService
16
+ def get_file
17
+ return {
18
+ 'name' => $0,
19
+ 'file' => SOAP::Attachment.new(File.open(THIS_FILE)) # closed when GCed.
20
+ }
21
+ end
22
+
23
+ def put_file(name, file)
24
+ "File '#{name}' was received ok."
25
+ end
26
+ end
27
+
28
+ def setup
29
+ @server = SOAP::RPC::StandaloneServer.new('SwAServer',
30
+ 'http://www.acmetron.com/soap', '0.0.0.0', Port)
31
+ @server.add_servant(SwAService.new)
32
+ @server.level = Logger::Severity::ERROR
33
+ @t = Thread.new {
34
+ @server.start
35
+ }
36
+ @endpoint = "http://localhost:#{Port}/"
37
+ @client = SOAP::RPC::Driver.new(@endpoint, 'http://www.acmetron.com/soap')
38
+ @client.add_method('get_file')
39
+ @client.add_method('put_file', 'name', 'file')
40
+ @client.wiredump_dev = STDERR if $DEBUG
41
+ end
42
+
43
+ def teardown
44
+ @server.shutdown if @server
45
+ if @t
46
+ @t.kill
47
+ @t.join
48
+ end
49
+ @client.reset_stream if @client
50
+ end
51
+
52
+ def test_get_file
53
+ assert_equal(
54
+ File.open(THIS_FILE) { |f| f.read },
55
+ @client.get_file['file'].content
56
+ )
57
+ end
58
+
59
+ def test_put_file
60
+ assert_equal(
61
+ "File 'foo' was received ok.",
62
+ @client.put_file('foo',
63
+ SOAP::Attachment.new(File.open(THIS_FILE)))
64
+ )
65
+ assert_equal(
66
+ "File 'bar' was received ok.",
67
+ @client.put_file('bar',
68
+ SOAP::Attachment.new(File.open(THIS_FILE) { |f| f.read }))
69
+ )
70
+ end
71
+ end
72
+
73
+
74
+ end
75
+ end
@@ -0,0 +1,1090 @@
1
+ require 'test/unit'
2
+ require 'soap/baseData'
3
+
4
+
5
+ module SOAP
6
+
7
+
8
+ class TestSOAP < Test::Unit::TestCase
9
+ NegativeZero = (-1.0 / (1.0 / 0.0))
10
+
11
+ def setup
12
+ # Nothing to do.
13
+ end
14
+
15
+ def teardown
16
+ # Nothing to do.
17
+ end
18
+
19
+ def assert_parsed_result(klass, str)
20
+ o = klass.new(str)
21
+ assert_equal(str, o.to_s)
22
+ end
23
+
24
+ def test_SOAPNil
25
+ o = SOAP::SOAPNil.new
26
+ assert_equal(XSD::Namespace, o.type.namespace)
27
+ assert_equal(XSD::NilLiteral, o.type.name)
28
+ assert_equal(nil, o.data)
29
+ assert_equal(true, o.is_nil)
30
+
31
+ o = SOAP::SOAPNil.new(nil)
32
+ assert_equal(true, o.is_nil)
33
+ assert_equal(nil, o.data)
34
+ assert_equal("", o.to_s)
35
+ o = SOAP::SOAPNil.new('var')
36
+ assert_equal(false, o.is_nil)
37
+ assert_equal('var', o.data)
38
+ assert_equal('var', o.to_s)
39
+ end
40
+
41
+ def test_SOAPString
42
+ o = SOAP::SOAPString.new
43
+ assert_equal(XSD::Namespace, o.type.namespace)
44
+ assert_equal(XSD::StringLiteral, o.type.name)
45
+ assert_equal(nil, o.data)
46
+ assert_equal(true, o.is_nil)
47
+
48
+ str = "abc"
49
+ assert_equal(str, SOAP::SOAPString.new(str).data)
50
+ assert_equal(str, SOAP::SOAPString.new(str).to_s)
51
+ back = XSD::XSDString.strict_ces_validation
52
+ XSD::XSDString.strict_ces_validation = true
53
+ begin
54
+ assert_raises(XSD::ValueSpaceError) do
55
+ SOAP::SOAPString.new("\0")
56
+ end
57
+ assert_raises(XSD::ValueSpaceError) do
58
+ SOAP::SOAPString.new("\xC0\xC0").to_s
59
+ end
60
+ ensure
61
+ XSD::XSDString.strict_ces_validation = back
62
+ end
63
+ end
64
+
65
+ def test_SOAPNormalizedString
66
+ XSD::Charset.module_eval { @encoding_backup = @internal_encoding; @internal_encoding = "NONE" }
67
+ begin
68
+ o = SOAP::SOAPNormalizedString.new
69
+ assert_equal(XSD::Namespace, o.type.namespace)
70
+ assert_equal(XSD::NormalizedStringLiteral, o.type.name)
71
+ assert_equal(nil, o.data)
72
+ assert_equal(true, o.is_nil)
73
+
74
+ str = "abc"
75
+ assert_equal(str, SOAP::SOAPNormalizedString.new(str).data)
76
+ assert_equal(str, SOAP::SOAPNormalizedString.new(str).to_s)
77
+ back = SOAP::SOAPString.strict_ces_validation
78
+ SOAP::SOAPString.strict_ces_validation = true
79
+ begin
80
+ assert_raises(XSD::ValueSpaceError) do
81
+ SOAP::SOAPNormalizedString.new("\0")
82
+ end
83
+ assert_raises(XSD::ValueSpaceError) do
84
+ SOAP::SOAPNormalizedString.new("\xC0\xC0").to_s
85
+ end
86
+ assert_raises(XSD::ValueSpaceError) do
87
+ SOAP::SOAPNormalizedString.new("a\tb").to_s
88
+ end
89
+ assert_raises(XSD::ValueSpaceError) do
90
+ SOAP::SOAPNormalizedString.new("a\r").to_s
91
+ end
92
+ assert_raises(XSD::ValueSpaceError) do
93
+ SOAP::SOAPNormalizedString.new("\nb").to_s
94
+ end
95
+ ensure
96
+ SOAP::SOAPString.strict_ces_validation = back
97
+ end
98
+ ensure
99
+ XSD::Charset.module_eval { @internal_encoding = @encoding_backup }
100
+ end
101
+ end
102
+
103
+ def test_SOAPToken
104
+ XSD::Charset.module_eval { @encoding_backup = @internal_encoding; @internal_encoding = "NONE" }
105
+ begin
106
+ o = SOAP::SOAPToken.new
107
+ assert_equal(XSD::Namespace, o.type.namespace)
108
+ assert_equal(XSD::TokenLiteral, o.type.name)
109
+ assert_equal(nil, o.data)
110
+ assert_equal(true, o.is_nil)
111
+
112
+ str = "abc"
113
+ assert_equal(str, SOAP::SOAPToken.new(str).data)
114
+ assert_equal(str, SOAP::SOAPToken.new(str).to_s)
115
+ back = XSD::XSDString.strict_ces_validation
116
+ XSD::XSDString.strict_ces_validation = true
117
+ begin
118
+ assert_raises(XSD::ValueSpaceError) do
119
+ SOAP::SOAPToken.new("\0")
120
+ end
121
+ assert_raises(XSD::ValueSpaceError) do
122
+ SOAP::SOAPToken.new("\xC0\xC0").to_s
123
+ end
124
+ assert_raises(XSD::ValueSpaceError) do
125
+ SOAP::SOAPToken.new("a\tb").to_s
126
+ end
127
+ assert_raises(XSD::ValueSpaceError) do
128
+ SOAP::SOAPToken.new("a\r").to_s
129
+ end
130
+ assert_raises(XSD::ValueSpaceError) do
131
+ SOAP::SOAPToken.new("\nb").to_s
132
+ end
133
+ assert_raises(XSD::ValueSpaceError) do
134
+ SOAP::SOAPToken.new(" a").to_s
135
+ end
136
+ assert_raises(XSD::ValueSpaceError) do
137
+ SOAP::SOAPToken.new("b ").to_s
138
+ end
139
+ assert_raises(XSD::ValueSpaceError) do
140
+ SOAP::SOAPToken.new("a b").to_s
141
+ end
142
+ assert_equal("a b", SOAP::SOAPToken.new("a b").data)
143
+ ensure
144
+ XSD::XSDString.strict_ces_validation = back
145
+ end
146
+ ensure
147
+ XSD::Charset.module_eval { @internal_encoding = @encoding_backup }
148
+ end
149
+ end
150
+
151
+ def test_SOAPLanguage
152
+ o = SOAP::SOAPLanguage.new
153
+ assert_equal(XSD::Namespace, o.type.namespace)
154
+ assert_equal(XSD::LanguageLiteral, o.type.name)
155
+ assert_equal(nil, o.data)
156
+ assert_equal(true, o.is_nil)
157
+
158
+ str = "ja"
159
+ assert_equal(str, SOAP::SOAPLanguage.new(str).data)
160
+ assert_equal(str, SOAP::SOAPLanguage.new(str).to_s)
161
+ str = "ja-jp"
162
+ assert_equal(str, SOAP::SOAPLanguage.new(str).data)
163
+ assert_equal(str, SOAP::SOAPLanguage.new(str).to_s)
164
+ assert_raises(XSD::ValueSpaceError) do
165
+ SOAP::SOAPLanguage.new("ja-jp-")
166
+ end
167
+ assert_raises(XSD::ValueSpaceError) do
168
+ SOAP::SOAPLanguage.new("-ja-")
169
+ end
170
+ assert_raises(XSD::ValueSpaceError) do
171
+ SOAP::SOAPLanguage.new("ja-")
172
+ end
173
+ assert_raises(XSD::ValueSpaceError) do
174
+ SOAP::SOAPLanguage.new("a1-01")
175
+ end
176
+ assert_equal("aA-01", SOAP::SOAPLanguage.new("aA-01").to_s)
177
+ end
178
+
179
+ def test_SOAPBoolean
180
+ o = SOAP::SOAPBoolean.new
181
+ assert_equal(XSD::Namespace, o.type.namespace)
182
+ assert_equal(XSD::BooleanLiteral, o.type.name)
183
+ assert_equal(nil, o.data)
184
+ assert_equal(true, o.is_nil)
185
+
186
+ targets = [
187
+ ["true", true],
188
+ ["1", true],
189
+ ["false", false],
190
+ ["0", false],
191
+ ]
192
+ targets.each do |data, expected|
193
+ assert_equal(expected, SOAP::SOAPBoolean.new(data).data)
194
+ assert_equal(expected.to_s, SOAP::SOAPBoolean.new(data).to_s)
195
+ end
196
+
197
+ assert_raises(XSD::ValueSpaceError) do
198
+ SOAP::SOAPBoolean.new("nil").to_s
199
+ end
200
+ end
201
+
202
+ def test_SOAPDecimal
203
+ o = SOAP::SOAPDecimal.new
204
+ assert_equal(XSD::Namespace, o.type.namespace)
205
+ assert_equal(XSD::DecimalLiteral, o.type.name)
206
+ assert_equal(nil, o.data)
207
+ assert_equal(true, o.is_nil)
208
+
209
+ targets = [
210
+ 0,
211
+ 1000000000,
212
+ -9999999999,
213
+ 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
214
+ 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
215
+ -1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789,
216
+ ]
217
+ targets.each do |dec|
218
+ assert_equal(dec.to_s, SOAP::SOAPDecimal.new(dec).data)
219
+ end
220
+
221
+ targets = [
222
+ "0",
223
+ "0.00000001",
224
+ "1000000000",
225
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
226
+ "-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123.45678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
227
+ ]
228
+ targets.each do |str|
229
+ assert_equal(str, SOAP::SOAPDecimal.new(str).to_s)
230
+ end
231
+
232
+ targets = [
233
+ ["-0", "0"],
234
+ ["+0", "0"],
235
+ ["0.0", "0"],
236
+ ["-0.0", "0"],
237
+ ["+0.0", "0"],
238
+ ["0.", "0"],
239
+ [".0", "0"],
240
+ [
241
+ "+0.12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
242
+ "0.1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
243
+ ],
244
+ [
245
+ ".0000012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
246
+ "0.000001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
247
+ ],
248
+ [
249
+ "-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.",
250
+ "-12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
251
+ ],
252
+ ]
253
+ targets.each do |data, expected|
254
+ assert_equal(expected, SOAP::SOAPDecimal.new(data).to_s)
255
+ end
256
+
257
+ targets = [
258
+ "0.000000000000a",
259
+ "00a.0000000000001",
260
+ "+-5",
261
+ ]
262
+ targets.each do |d|
263
+ assert_raises(XSD::ValueSpaceError) do
264
+ SOAP::SOAPDecimal.new(d)
265
+ end
266
+ end
267
+ end
268
+
269
+ def test_SOAPFloat
270
+ o = SOAP::SOAPFloat.new
271
+ assert_equal(XSD::Namespace, o.type.namespace)
272
+ assert_equal(XSD::FloatLiteral, o.type.name)
273
+ assert_equal(nil, o.data)
274
+ assert_equal(true, o.is_nil)
275
+
276
+ targets = [
277
+ 3.14159265358979,
278
+ 12.34e36,
279
+ 1.402e-45,
280
+ -1.402e-45,
281
+ ]
282
+ targets.each do |f|
283
+ assert_equal(f, SOAP::SOAPFloat.new(f).data)
284
+ end
285
+
286
+ targets = [
287
+ "+3.141592654",
288
+ "+1.234e+37",
289
+ "+1.402e-45",
290
+ "-1.402e-45",
291
+ ]
292
+ targets.each do |f|
293
+ assert_equal(f, SOAP::SOAPFloat.new(f).to_s)
294
+ end
295
+
296
+ targets = [
297
+ [3, "+3"], # should be 3.0?
298
+ [-2, "-2"], # ditto
299
+ [3.14159265358979, "+3.141592654"],
300
+ [12.34e36, "+1.234e+37"],
301
+ [1.402e-45, "+1.402e-45"],
302
+ [-1.402e-45, "-1.402e-45"],
303
+ ["1.402e", "+1.402"],
304
+ ["12.34E36", "+1.234e+37"],
305
+ ["1.402E-45", "+1.402e-45"],
306
+ ["-1.402E-45", "-1.402e-45"],
307
+ ["1.402E", "+1.402"],
308
+ ]
309
+ targets.each do |f, str|
310
+ assert_equal(str, SOAP::SOAPFloat.new(f).to_s)
311
+ end
312
+
313
+ assert_equal("+0", SOAP::SOAPFloat.new(+0.0).to_s)
314
+ assert_equal("-0", SOAP::SOAPFloat.new(NegativeZero).to_s)
315
+ assert(SOAP::SOAPFloat.new(0.0/0.0).data.nan?)
316
+ assert_equal("INF", SOAP::SOAPFloat.new(1.0/0.0).to_s)
317
+ assert_equal(1, SOAP::SOAPFloat.new(1.0/0.0).data.infinite?)
318
+ assert_equal("-INF", SOAP::SOAPFloat.new(-1.0/0.0).to_s)
319
+ assert_equal(-1, SOAP::SOAPFloat.new(-1.0/0.0).data.infinite?)
320
+
321
+ targets = [
322
+ "0.000000000000a",
323
+ "00a.0000000000001",
324
+ "+-5",
325
+ "5_0",
326
+ ]
327
+ targets.each do |d|
328
+ assert_raises(XSD::ValueSpaceError) do
329
+ SOAP::SOAPFloat.new(d)
330
+ end
331
+ end
332
+ end
333
+
334
+ def test_SOAPDouble
335
+ o = SOAP::SOAPDouble.new
336
+ assert_equal(XSD::Namespace, o.type.namespace)
337
+ assert_equal(XSD::DoubleLiteral, o.type.name)
338
+ assert_equal(nil, o.data)
339
+ assert_equal(true, o.is_nil)
340
+
341
+ targets = [
342
+ 3.14159265358979,
343
+ 12.34e36,
344
+ 1.402e-45,
345
+ -1.402e-45,
346
+ ]
347
+ targets.each do |f|
348
+ assert_equal(f, SOAP::SOAPDouble.new(f).data)
349
+ end
350
+
351
+ targets = [
352
+ "+3.14159265358979",
353
+ "+1.234e+37",
354
+ "+1.402e-45",
355
+ "-1.402e-45",
356
+ ]
357
+ targets.each do |f|
358
+ assert_equal(f, SOAP::SOAPDouble.new(f).to_s)
359
+ end
360
+
361
+ targets = [
362
+ [3, "+3"], # should be 3.0?
363
+ [-2, "-2"], # ditto.
364
+ [3.14159265358979, "+3.14159265358979"],
365
+ [12.34e36, "+1.234e+37"],
366
+ [1.402e-45, "+1.402e-45"],
367
+ [-1.402e-45, "-1.402e-45"],
368
+ ["1.402e", "+1.402"],
369
+ ["12.34E36", "+1.234e+37"],
370
+ ["1.402E-45", "+1.402e-45"],
371
+ ["-1.402E-45", "-1.402e-45"],
372
+ ["1.402E", "+1.402"],
373
+ ]
374
+ targets.each do |f, str|
375
+ assert_equal(str, SOAP::SOAPDouble.new(f).to_s)
376
+ end
377
+
378
+ assert_equal("+0", SOAP::SOAPFloat.new(+0.0).to_s)
379
+ assert_equal("-0", SOAP::SOAPFloat.new(NegativeZero).to_s)
380
+ assert_equal("NaN", SOAP::SOAPDouble.new(0.0/0.0).to_s)
381
+ assert(SOAP::SOAPDouble.new(0.0/0.0).data.nan?)
382
+ assert_equal("INF", SOAP::SOAPDouble.new(1.0/0.0).to_s)
383
+ assert_equal(1, SOAP::SOAPDouble.new(1.0/0.0).data.infinite?)
384
+ assert_equal("-INF", SOAP::SOAPDouble.new(-1.0/0.0).to_s)
385
+ assert_equal(-1, SOAP::SOAPDouble.new(-1.0/0.0).data.infinite?)
386
+
387
+ targets = [
388
+ "0.000000000000a",
389
+ "00a.0000000000001",
390
+ "+-5",
391
+ ]
392
+ targets.each do |d|
393
+ assert_raises(XSD::ValueSpaceError) do
394
+ SOAP::SOAPDouble.new(d)
395
+ end
396
+ end
397
+ end
398
+
399
+ def test_SOAPDuration
400
+ o = SOAP::SOAPDuration.new
401
+ assert_equal(XSD::Namespace, o.type.namespace)
402
+ assert_equal(XSD::DurationLiteral, o.type.name)
403
+ assert_equal(nil, o.data)
404
+ assert_equal(true, o.is_nil)
405
+
406
+ targets = [
407
+ "P1Y2M3DT4H5M6S",
408
+ "P1234Y5678M9012DT3456H7890M1234.5678S",
409
+ "PT3456H7890M1234.5678S",
410
+ "P1234Y5678M9012D",
411
+ "-P1234Y5678M9012DT3456H7890M1234.5678S",
412
+ "P5678M9012DT3456H7890M1234.5678S",
413
+ "-P1234Y9012DT3456H7890M1234.5678S",
414
+ "+P1234Y5678MT3456H7890M1234.5678S",
415
+ "P1234Y5678M9012DT7890M1234.5678S",
416
+ "-P1234Y5678M9012DT3456H1234.5678S",
417
+ "+P1234Y5678M9012DT3456H7890M",
418
+ "P123400000000000Y",
419
+ "-P567800000000000M",
420
+ "+P901200000000000D",
421
+ "PT345600000000000H",
422
+ "-PT789000000000000M",
423
+ "+PT123400000000000.000000000005678S",
424
+ "P1234YT1234.5678S",
425
+ "-P5678MT7890M",
426
+ "+P9012DT3456H",
427
+ ]
428
+ targets.each do |str|
429
+ assert_parsed_result(SOAP::SOAPDuration, str)
430
+ end
431
+
432
+ targets = [
433
+ ["P0Y0M0DT0H0M0S",
434
+ "P0D"],
435
+ ["-P0DT0S",
436
+ "-P0D"],
437
+ ["P01234Y5678M9012DT3456H7890M1234.5678S",
438
+ "P1234Y5678M9012DT3456H7890M1234.5678S"],
439
+ ["P1234Y005678M9012DT3456H7890M1234.5678S",
440
+ "P1234Y5678M9012DT3456H7890M1234.5678S"],
441
+ ["P1234Y5678M0009012DT3456H7890M1234.5678S",
442
+ "P1234Y5678M9012DT3456H7890M1234.5678S"],
443
+ ["P1234Y5678M9012DT00003456H7890M1234.5678S",
444
+ "P1234Y5678M9012DT3456H7890M1234.5678S"],
445
+ ["P1234Y5678M9012DT3456H000007890M1234.5678S",
446
+ "P1234Y5678M9012DT3456H7890M1234.5678S"],
447
+ ["P1234Y5678M9012DT3456H7890M0000001234.5678S",
448
+ "P1234Y5678M9012DT3456H7890M1234.5678S"],
449
+ ]
450
+ targets.each do |data, expected|
451
+ assert_equal(expected, SOAP::SOAPDuration.new(data).to_s)
452
+ end
453
+ end
454
+
455
+ def test_SOAPDateTime
456
+ o = SOAP::SOAPDateTime.new
457
+ assert_equal(XSD::Namespace, o.type.namespace)
458
+ assert_equal(XSD::DateTimeLiteral, o.type.name)
459
+ assert_equal(nil, o.data)
460
+ assert_equal(true, o.is_nil)
461
+
462
+ targets = [
463
+ "2002-05-18T16:52:20Z",
464
+ "0001-01-01T00:00:00Z",
465
+ "9999-12-31T23:59:59Z",
466
+ "19999-12-31T23:59:59Z",
467
+ "2002-12-31T23:59:59.999Z",
468
+ "2002-12-31T23:59:59.001Z",
469
+ "2002-12-31T23:59:59.99999999999999999999Z",
470
+ "2002-12-31T23:59:59.00000000000000000001Z",
471
+ "2002-12-31T23:59:59+09:00",
472
+ "2002-12-31T23:59:59+00:01",
473
+ "2002-12-31T23:59:59-00:01",
474
+ "2002-12-31T23:59:59-23:59",
475
+ "2002-12-31T23:59:59.00000000000000000001+13:30",
476
+ "2002-12-31T23:59:59.51375Z",
477
+ "2002-12-31T23:59:59.51345+12:34",
478
+ "-2002-05-18T16:52:20Z",
479
+ "-4711-12-31T23:59:59Z",
480
+ "-4713-01-01T12:00:00Z",
481
+ "-19999-12-31T23:59:59Z",
482
+ "-2002-12-31T23:59:59+00:01",
483
+ "-0001-12-31T23:59:59.00000000000000000001+13:30",
484
+ ]
485
+ targets.each do |str|
486
+ assert_parsed_result(SOAP::SOAPDateTime, str)
487
+ end
488
+
489
+ targets = [
490
+ ["2002-12-31T23:59:59.00",
491
+ "2002-12-31T23:59:59Z"],
492
+ ["2002-12-31T23:59:59+00:00",
493
+ "2002-12-31T23:59:59Z"],
494
+ ["2002-12-31T23:59:59-00:00",
495
+ "2002-12-31T23:59:59Z"],
496
+ ["-2002-12-31T23:59:59.00",
497
+ "-2002-12-31T23:59:59Z"],
498
+ ["-2002-12-31T23:59:59+00:00",
499
+ "-2002-12-31T23:59:59Z"],
500
+ ["-2002-12-31T23:59:59-00:00",
501
+ "-2002-12-31T23:59:59Z"],
502
+ ]
503
+ targets.each do |data, expected|
504
+ assert_equal(expected, SOAP::SOAPDateTime.new(data).to_s)
505
+ d = DateTime.parse(data)
506
+ d >>= 12 if d.year < 0 # XSDDateTime.year(-1) == DateTime.year(0)
507
+ assert_equal(expected, SOAP::SOAPDateTime.new(d).to_s)
508
+ end
509
+
510
+ targets = [
511
+ "1-05-18T16:52:20Z",
512
+ "05-18T16:52:20Z",
513
+ "2002-05T16:52:20Z",
514
+ "2002-05-18T16:52Z",
515
+ "",
516
+ ]
517
+ targets.each do |d|
518
+ assert_raises(XSD::ValueSpaceError, d.to_s) do
519
+ SOAP::SOAPDateTime.new(d)
520
+ end
521
+ end
522
+ end
523
+
524
+ def test_SOAPTime
525
+ o = SOAP::SOAPTime.new
526
+ assert_equal(XSD::Namespace, o.type.namespace)
527
+ assert_equal(XSD::TimeLiteral, o.type.name)
528
+ assert_equal(nil, o.data)
529
+ assert_equal(true, o.is_nil)
530
+
531
+ targets = [
532
+ "16:52:20Z",
533
+ "00:00:00Z",
534
+ "23:59:59Z",
535
+ "23:59:59.999Z",
536
+ "23:59:59.001Z",
537
+ "23:59:59.99999999999999999999Z",
538
+ "23:59:59.00000000000000000001Z",
539
+ "23:59:59+09:00",
540
+ "23:59:59+00:01",
541
+ "23:59:59-00:01",
542
+ "23:59:59-23:59",
543
+ "23:59:59.00000000000000000001+13:30",
544
+ "23:59:59.51375Z",
545
+ "23:59:59.51375+12:34",
546
+ "23:59:59+00:01",
547
+ ]
548
+ targets.each do |str|
549
+ assert_parsed_result(SOAP::SOAPTime, str)
550
+ end
551
+
552
+ targets = [
553
+ ["23:59:59.00",
554
+ "23:59:59Z"],
555
+ ["23:59:59+00:00",
556
+ "23:59:59Z"],
557
+ ["23:59:59-00:00",
558
+ "23:59:59Z"],
559
+ ]
560
+ targets.each do |data, expected|
561
+ assert_equal(expected, SOAP::SOAPTime.new(data).to_s)
562
+ end
563
+ end
564
+
565
+ def test_SOAPDate
566
+ o = SOAP::SOAPDate.new
567
+ assert_equal(XSD::Namespace, o.type.namespace)
568
+ assert_equal(XSD::DateLiteral, o.type.name)
569
+ assert_equal(nil, o.data)
570
+ assert_equal(true, o.is_nil)
571
+
572
+ targets = [
573
+ "2002-05-18Z",
574
+ "0001-01-01Z",
575
+ "9999-12-31Z",
576
+ "19999-12-31Z",
577
+ "2002-12-31+09:00",
578
+ "2002-12-31+00:01",
579
+ "2002-12-31-00:01",
580
+ "2002-12-31-23:59",
581
+ "2002-12-31+13:30",
582
+ "-2002-05-18Z",
583
+ "-19999-12-31Z",
584
+ "-2002-12-31+00:01",
585
+ "-0001-12-31+13:30",
586
+ ]
587
+ targets.each do |str|
588
+ assert_parsed_result(SOAP::SOAPDate, str)
589
+ end
590
+
591
+ targets = [
592
+ ["2002-12-31",
593
+ "2002-12-31Z"],
594
+ ["2002-12-31+00:00",
595
+ "2002-12-31Z"],
596
+ ["2002-12-31-00:00",
597
+ "2002-12-31Z"],
598
+ ["-2002-12-31",
599
+ "-2002-12-31Z"],
600
+ ["-2002-12-31+00:00",
601
+ "-2002-12-31Z"],
602
+ ["-2002-12-31-00:00",
603
+ "-2002-12-31Z"],
604
+ ]
605
+ targets.each do |data, expected|
606
+ assert_equal(expected, SOAP::SOAPDate.new(data).to_s)
607
+ d = Date.parse(data)
608
+ d >>= 12 if d.year < 0 # XSDDate.year(-1) == Date.year(0)
609
+ assert_equal(expected, SOAP::SOAPDate.new(d).to_s)
610
+ end
611
+ end
612
+
613
+ def test_SOAPGYearMonth
614
+ o = SOAP::SOAPGYearMonth.new
615
+ assert_equal(XSD::Namespace, o.type.namespace)
616
+ assert_equal(XSD::GYearMonthLiteral, o.type.name)
617
+ assert_equal(nil, o.data)
618
+ assert_equal(true, o.is_nil)
619
+
620
+ targets = [
621
+ "2002-05Z",
622
+ "0001-01Z",
623
+ "9999-12Z",
624
+ "19999-12Z",
625
+ "2002-12+09:00",
626
+ "2002-12+00:01",
627
+ "2002-12-00:01",
628
+ "2002-12-23:59",
629
+ "2002-12+13:30",
630
+ "-2002-05Z",
631
+ "-19999-12Z",
632
+ "-2002-12+00:01",
633
+ "-0001-12+13:30",
634
+ ]
635
+ targets.each do |str|
636
+ assert_parsed_result(SOAP::SOAPGYearMonth, str)
637
+ end
638
+
639
+ targets = [
640
+ ["2002-12",
641
+ "2002-12Z"],
642
+ ["2002-12+00:00",
643
+ "2002-12Z"],
644
+ ["2002-12-00:00",
645
+ "2002-12Z"],
646
+ ["-2002-12",
647
+ "-2002-12Z"],
648
+ ["-2002-12+00:00",
649
+ "-2002-12Z"],
650
+ ["-2002-12-00:00",
651
+ "-2002-12Z"],
652
+ ]
653
+ targets.each do |data, expected|
654
+ assert_equal(expected, SOAP::SOAPGYearMonth.new(data).to_s)
655
+ end
656
+ end
657
+
658
+ def test_SOAPGYear
659
+ o = SOAP::SOAPGYear.new
660
+ assert_equal(XSD::Namespace, o.type.namespace)
661
+ assert_equal(XSD::GYearLiteral, o.type.name)
662
+ assert_equal(nil, o.data)
663
+ assert_equal(true, o.is_nil)
664
+
665
+ targets = [
666
+ "2002Z",
667
+ "0001Z",
668
+ "9999Z",
669
+ "19999Z",
670
+ "2002+09:00",
671
+ "2002+00:01",
672
+ "2002-00:01",
673
+ "2002-23:59",
674
+ "2002+13:30",
675
+ "-2002Z",
676
+ "-19999Z",
677
+ "-2002+00:01",
678
+ "-0001+13:30",
679
+ ]
680
+ targets.each do |str|
681
+ assert_parsed_result(SOAP::SOAPGYear, str)
682
+ end
683
+
684
+ targets = [
685
+ ["2002",
686
+ "2002Z"],
687
+ ["2002+00:00",
688
+ "2002Z"],
689
+ ["2002-00:00",
690
+ "2002Z"],
691
+ ["-2002",
692
+ "-2002Z"],
693
+ ["-2002+00:00",
694
+ "-2002Z"],
695
+ ["-2002-00:00",
696
+ "-2002Z"],
697
+ ]
698
+ targets.each do |data, expected|
699
+ assert_equal(expected, SOAP::SOAPGYear.new(data).to_s)
700
+ end
701
+ end
702
+
703
+ def test_SOAPGMonthDay
704
+ o = SOAP::SOAPGMonthDay.new
705
+ assert_equal(XSD::Namespace, o.type.namespace)
706
+ assert_equal(XSD::GMonthDayLiteral, o.type.name)
707
+ assert_equal(nil, o.data)
708
+ assert_equal(true, o.is_nil)
709
+
710
+ targets = [
711
+ "--05-18Z",
712
+ "--01-01Z",
713
+ "--12-31Z",
714
+ "--12-31+09:00",
715
+ "--12-31+00:01",
716
+ "--12-31-00:01",
717
+ "--12-31-23:59",
718
+ "--12-31+13:30",
719
+ ]
720
+ targets.each do |str|
721
+ assert_parsed_result(SOAP::SOAPGMonthDay, str)
722
+ end
723
+
724
+ targets = [
725
+ ["--12-31",
726
+ "--12-31Z"],
727
+ ["--12-31+00:00",
728
+ "--12-31Z"],
729
+ ["--12-31-00:00",
730
+ "--12-31Z"],
731
+ ]
732
+ targets.each do |data, expected|
733
+ assert_equal(expected, SOAP::SOAPGMonthDay.new(data).to_s)
734
+ end
735
+ end
736
+
737
+ def test_SOAPGDay
738
+ o = SOAP::SOAPGDay.new
739
+ assert_equal(XSD::Namespace, o.type.namespace)
740
+ assert_equal(XSD::GDayLiteral, o.type.name)
741
+ assert_equal(nil, o.data)
742
+ assert_equal(true, o.is_nil)
743
+
744
+ targets = [
745
+ "---18Z",
746
+ "---01Z",
747
+ "---31Z",
748
+ "---31+09:00",
749
+ "---31+00:01",
750
+ "---31-00:01",
751
+ "---31-23:59",
752
+ "---31+13:30",
753
+ ]
754
+ targets.each do |str|
755
+ assert_parsed_result(SOAP::SOAPGDay, str)
756
+ end
757
+
758
+ targets = [
759
+ ["---31",
760
+ "---31Z"],
761
+ ["---31+00:00",
762
+ "---31Z"],
763
+ ["---31-00:00",
764
+ "---31Z"],
765
+ ]
766
+ targets.each do |data, expected|
767
+ assert_equal(expected, SOAP::SOAPGDay.new(data).to_s)
768
+ end
769
+ end
770
+
771
+ def test_SOAPGMonth
772
+ o = SOAP::SOAPGMonth.new
773
+ assert_equal(XSD::Namespace, o.type.namespace)
774
+ assert_equal(XSD::GMonthLiteral, o.type.name)
775
+ assert_equal(nil, o.data)
776
+ assert_equal(true, o.is_nil)
777
+
778
+ targets = [
779
+ "--05Z",
780
+ "--01Z",
781
+ "--12Z",
782
+ "--12+09:00",
783
+ "--12+00:01",
784
+ "--12-00:01",
785
+ "--12-23:59",
786
+ "--12+13:30",
787
+ ]
788
+ targets.each do |str|
789
+ assert_parsed_result(SOAP::SOAPGMonth, str)
790
+ end
791
+
792
+ targets = [
793
+ ["--12",
794
+ "--12Z"],
795
+ ["--12+00:00",
796
+ "--12Z"],
797
+ ["--12-00:00",
798
+ "--12Z"],
799
+ ]
800
+ targets.each do |data, expected|
801
+ assert_equal(expected, SOAP::SOAPGMonth.new(data).to_s)
802
+ end
803
+ end
804
+
805
+ def test_SOAPHexBinary
806
+ o = SOAP::SOAPHexBinary.new
807
+ assert_equal(XSD::Namespace, o.type.namespace)
808
+ assert_equal(XSD::HexBinaryLiteral, o.type.name)
809
+ assert_equal(nil, o.data)
810
+ assert_equal(true, o.is_nil)
811
+
812
+ targets = [
813
+ "abcdef",
814
+ "\xe3\x81\xaa\xe3\x81\xb2",
815
+ "\0",
816
+ "",
817
+ ]
818
+ targets.each do |str|
819
+ assert_equal(str, SOAP::SOAPHexBinary.new(str).string)
820
+ assert_equal(str.unpack("H*")[0].tr('a-f', 'A-F'),
821
+ SOAP::SOAPHexBinary.new(str).data)
822
+ o = SOAP::SOAPHexBinary.new
823
+ o.set_encoded(str.unpack("H*")[0].tr('a-f', 'A-F'))
824
+ assert_equal(str, o.string)
825
+ o.set_encoded(str.unpack("H*")[0].tr('A-F', 'a-f'))
826
+ assert_equal(str, o.string)
827
+ end
828
+
829
+ targets = [
830
+ "0FG7",
831
+ "0fg7",
832
+ ]
833
+ targets.each do |d|
834
+ assert_raises(XSD::ValueSpaceError, d.to_s) do
835
+ o = SOAP::SOAPHexBinary.new
836
+ o.set_encoded(d)
837
+ p o.string
838
+ end
839
+ end
840
+ end
841
+
842
+ def test_SOAPBase64Binary
843
+ o = SOAP::SOAPBase64.new
844
+ assert_equal(SOAP::EncodingNamespace, o.type.namespace)
845
+ assert_equal(SOAP::Base64Literal, o.type.name)
846
+ assert_equal(nil, o.data)
847
+ assert_equal(true, o.is_nil)
848
+
849
+ targets = [
850
+ "abcdef",
851
+ "\xe3\x81\xaa\xe3\x81\xb2",
852
+ "\0",
853
+ "",
854
+ ]
855
+ targets.each do |str|
856
+ assert_equal(str, SOAP::SOAPBase64.new(str).string)
857
+ assert_equal([str].pack("m").chomp, SOAP::SOAPBase64.new(str).data)
858
+ o = SOAP::SOAPBase64.new
859
+ o.set_encoded([str].pack("m").chomp)
860
+ assert_equal(str, o.string)
861
+ end
862
+
863
+ targets = [
864
+ "-",
865
+ "*",
866
+ ]
867
+ targets.each do |d|
868
+ assert_raises(XSD::ValueSpaceError, d.to_s) do
869
+ o = SOAP::SOAPBase64.new
870
+ o.set_encoded(d)
871
+ p o.string
872
+ end
873
+ end
874
+ end
875
+
876
+ def test_SOAPAnyURI
877
+ o = SOAP::SOAPAnyURI.new
878
+ assert_equal(XSD::Namespace, o.type.namespace)
879
+ assert_equal(XSD::AnyURILiteral, o.type.name)
880
+ assert_equal(nil, o.data)
881
+ assert_equal(true, o.is_nil)
882
+
883
+ # Too few tests here I know. Believe uri module. :)
884
+ targets = [
885
+ "foo",
886
+ "http://foo",
887
+ "http://foo/bar/baz",
888
+ "http://foo/bar#baz",
889
+ "http://foo/bar%20%20?a+b",
890
+ "HTTP://FOO/BAR%20%20?A+B",
891
+ ]
892
+ targets.each do |str|
893
+ assert_parsed_result(SOAP::SOAPAnyURI, str)
894
+ end
895
+ end
896
+
897
+ def test_SOAPQName
898
+ o = SOAP::SOAPQName.new
899
+ assert_equal(XSD::Namespace, o.type.namespace)
900
+ assert_equal(XSD::QNameLiteral, o.type.name)
901
+ assert_equal(nil, o.data)
902
+ assert_equal(true, o.is_nil)
903
+
904
+ # More strict test is needed but current implementation allows all non-':'
905
+ # chars like ' ', C0 or C1...
906
+ targets = [
907
+ "foo",
908
+ "foo:bar",
909
+ "a:b",
910
+ ]
911
+ targets.each do |str|
912
+ assert_parsed_result(SOAP::SOAPQName, str)
913
+ end
914
+ end
915
+
916
+
917
+ ###
918
+ ## Derived types
919
+ #
920
+
921
+ def test_SOAPInteger
922
+ o = SOAP::SOAPInteger.new
923
+ assert_equal(XSD::Namespace, o.type.namespace)
924
+ assert_equal(XSD::IntegerLiteral, o.type.name)
925
+ assert_equal(nil, o.data)
926
+ assert_equal(true, o.is_nil)
927
+
928
+ targets = [
929
+ 0,
930
+ 1000000000,
931
+ -9999999999,
932
+ 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
933
+ 12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890,
934
+ -1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789,
935
+ ]
936
+ targets.each do |int|
937
+ assert_equal(int, SOAP::SOAPInteger.new(int).data)
938
+ end
939
+
940
+ targets = [
941
+ "0",
942
+ "1000000000",
943
+ "-9999999999",
944
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
945
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
946
+ "-1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
947
+ ]
948
+ targets.each do |str|
949
+ assert_equal(str, SOAP::SOAPInteger.new(str).to_s)
950
+ end
951
+
952
+ targets = [
953
+ ["-0", "0"],
954
+ ["+0", "0"],
955
+ ["000123", "123"],
956
+ ["-000123", "-123"],
957
+ [
958
+ "+12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
959
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
960
+ ],
961
+ ]
962
+ targets.each do |data, expected|
963
+ assert_equal(expected, SOAP::SOAPInteger.new(data).to_s)
964
+ end
965
+
966
+ targets = [
967
+ "0.0",
968
+ "-5.2",
969
+ "0.000000000000a",
970
+ "+-5",
971
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890."
972
+ ]
973
+ targets.each do |d|
974
+ assert_raises(XSD::ValueSpaceError) do
975
+ SOAP::SOAPInteger.new(d)
976
+ end
977
+ end
978
+ end
979
+
980
+ def test_SOAPLong
981
+ o = SOAP::SOAPLong.new
982
+ assert_equal(XSD::Namespace, o.type.namespace)
983
+ assert_equal(XSD::LongLiteral, o.type.name)
984
+ assert_equal(nil, o.data)
985
+ assert_equal(true, o.is_nil)
986
+
987
+ targets = [
988
+ 0,
989
+ 123,
990
+ -123,
991
+ 9223372036854775807,
992
+ -9223372036854775808,
993
+ ]
994
+ targets.each do |lng|
995
+ assert_equal(lng, SOAP::SOAPLong.new(lng).data)
996
+ end
997
+
998
+ targets = [
999
+ "0",
1000
+ "123",
1001
+ "-123",
1002
+ "9223372036854775807",
1003
+ "-9223372036854775808",
1004
+ ]
1005
+ targets.each do |str|
1006
+ assert_equal(str, SOAP::SOAPLong.new(str).to_s)
1007
+ end
1008
+
1009
+ targets = [
1010
+ ["-0", "0"],
1011
+ ["+0", "0"],
1012
+ ["000123", "123"],
1013
+ ["-000123", "-123"],
1014
+ ]
1015
+ targets.each do |data, expected|
1016
+ assert_equal(expected, SOAP::SOAPLong.new(data).to_s)
1017
+ end
1018
+
1019
+ targets = [
1020
+ 9223372036854775808,
1021
+ -9223372036854775809,
1022
+ "0.0",
1023
+ "-5.2",
1024
+ "0.000000000000a",
1025
+ "+-5",
1026
+ ]
1027
+ targets.each do |d|
1028
+ assert_raises(XSD::ValueSpaceError) do
1029
+ SOAP::SOAPLong.new(d)
1030
+ end
1031
+ end
1032
+ end
1033
+
1034
+ def test_SOAPInt
1035
+ o = SOAP::SOAPInt.new
1036
+ assert_equal(XSD::Namespace, o.type.namespace)
1037
+ assert_equal(XSD::IntLiteral, o.type.name)
1038
+ assert_equal(nil, o.data)
1039
+ assert_equal(true, o.is_nil)
1040
+
1041
+ targets = [
1042
+ 0,
1043
+ 123,
1044
+ -123,
1045
+ 2147483647,
1046
+ -2147483648,
1047
+ ]
1048
+ targets.each do |lng|
1049
+ assert_equal(lng, SOAP::SOAPInt.new(lng).data)
1050
+ end
1051
+
1052
+ targets = [
1053
+ "0",
1054
+ "123",
1055
+ "-123",
1056
+ "2147483647",
1057
+ "-2147483648",
1058
+ ]
1059
+ targets.each do |str|
1060
+ assert_equal(str, SOAP::SOAPInt.new(str).to_s)
1061
+ end
1062
+
1063
+ targets = [
1064
+ ["-0", "0"],
1065
+ ["+0", "0"],
1066
+ ["000123", "123"],
1067
+ ["-000123", "-123"],
1068
+ ]
1069
+ targets.each do |data, expected|
1070
+ assert_equal(expected, SOAP::SOAPInt.new(data).to_s)
1071
+ end
1072
+
1073
+ targets = [
1074
+ 2147483648,
1075
+ -2147483649,
1076
+ "0.0",
1077
+ "-5.2",
1078
+ "0.000000000000a",
1079
+ "+-5",
1080
+ ]
1081
+ targets.each do |d|
1082
+ assert_raises(XSD::ValueSpaceError) do
1083
+ SOAP::SOAPInt.new(d)
1084
+ end
1085
+ end
1086
+ end
1087
+ end
1088
+
1089
+
1090
+ end