wasabi-ng-1.6 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +9 -0
  5. data/CHANGELOG.md +90 -0
  6. data/Gemfile +6 -0
  7. data/LICENSE +20 -0
  8. data/README.md +60 -0
  9. data/Rakefile +7 -0
  10. data/lib/wasabi.rb +12 -0
  11. data/lib/wasabi/core_ext/string.rb +21 -0
  12. data/lib/wasabi/document.rb +166 -0
  13. data/lib/wasabi/parser.rb +304 -0
  14. data/lib/wasabi/resolver.rb +54 -0
  15. data/lib/wasabi/version.rb +5 -0
  16. data/spec/fixtures/authentication.wsdl +63 -0
  17. data/spec/fixtures/economic.wsdl +65660 -0
  18. data/spec/fixtures/encoded_endpoint.wsdl +52 -0
  19. data/spec/fixtures/geotrust.wsdl +156 -0
  20. data/spec/fixtures/import_port_types.wsdl +86 -0
  21. data/spec/fixtures/inherited.wsdl +46 -0
  22. data/spec/fixtures/juniper.wsdl +215 -0
  23. data/spec/fixtures/lower_camel.wsdl +52 -0
  24. data/spec/fixtures/multiple_namespaces.wsdl +61 -0
  25. data/spec/fixtures/multiple_types.wsdl +60 -0
  26. data/spec/fixtures/namespaced_actions.wsdl +307 -0
  27. data/spec/fixtures/no_message_parts.wsdl +59 -0
  28. data/spec/fixtures/no_namespace.wsdl +115 -0
  29. data/spec/fixtures/savon295.wsdl +52 -0
  30. data/spec/fixtures/soap12.wsdl +11 -0
  31. data/spec/fixtures/symbolic_endpoint.wsdl +190 -0
  32. data/spec/fixtures/two_bindings.wsdl +24 -0
  33. data/spec/spec_helper.rb +19 -0
  34. data/spec/support/fixture.rb +40 -0
  35. data/spec/support/profiling.rb +18 -0
  36. data/spec/wasabi/core_ext/string_spec.rb +37 -0
  37. data/spec/wasabi/document/authentication_spec.rb +23 -0
  38. data/spec/wasabi/document/economic_spec.rb +13 -0
  39. data/spec/wasabi/document/encoded_endpoint_spec.rb +11 -0
  40. data/spec/wasabi/document/geotrust_spec.rb +24 -0
  41. data/spec/wasabi/document/inherited_spec.rb +38 -0
  42. data/spec/wasabi/document/multiple_namespaces_spec.rb +35 -0
  43. data/spec/wasabi/document/namespaced_actions_spec.rb +25 -0
  44. data/spec/wasabi/document/no_namespace_spec.rb +25 -0
  45. data/spec/wasabi/document/savon295_spec.rb +15 -0
  46. data/spec/wasabi/document/soap12_spec.rb +11 -0
  47. data/spec/wasabi/document/two_bindings_spec.rb +21 -0
  48. data/spec/wasabi/document_spec.rb +58 -0
  49. data/spec/wasabi/parser/get_servicename_spec.rb +19 -0
  50. data/spec/wasabi/parser/import_port_types_spec.rb +22 -0
  51. data/spec/wasabi/parser/juniper_spec.rb +23 -0
  52. data/spec/wasabi/parser/multiple_namespaces_spec.rb +40 -0
  53. data/spec/wasabi/parser/no_message_parts_spec.rb +26 -0
  54. data/spec/wasabi/parser/no_namespace_spec.rb +26 -0
  55. data/spec/wasabi/parser/no_target_namespace_spec.rb +36 -0
  56. data/spec/wasabi/parser/symbolic_endpoint_spec.rb +24 -0
  57. data/spec/wasabi/resolver_spec.rb +40 -0
  58. data/spec/wasabi/wasabi_spec.rb +12 -0
  59. data/wasabi.gemspec +27 -0
  60. metadata +159 -0
@@ -0,0 +1,22 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Parser do
4
+ context "with: import_port_types.wsdl" do
5
+
6
+ subject do
7
+ parser = Wasabi::Parser.new Nokogiri::XML(xml)
8
+ parser.parse
9
+ parser
10
+ end
11
+
12
+ let(:xml) { fixture(:import_port_types).read }
13
+
14
+ it "does blow up when portTypes are imported" do
15
+ get_customer = subject.operations[:get_customer]
16
+
17
+ get_customer[:input].should == "GetCustomer"
18
+ get_customer[:namespace_identifier].should be_nil
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,23 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Parser do
4
+ context 'with: juniper.wsdl' do
5
+
6
+ subject do
7
+ parser = Wasabi::Parser.new Nokogiri::XML(xml)
8
+ parser.parse
9
+ parser
10
+ end
11
+
12
+ let(:xml) { fixture(:juniper).read }
13
+
14
+ it 'does not blow up when an extension base element is defined in an import' do
15
+ request = subject.operations[:get_system_info_request]
16
+
17
+ request[:input].should == 'GetSystemInfoRequest'
18
+ request[:action].should == 'urn:#GetSystemInfoRequest'
19
+ request[:namespace_identifier].should == 'impl'
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,40 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Parser do
4
+ context "with: multiple_namespaces.wsdl" do
5
+
6
+ subject do
7
+ parser = Wasabi::Parser.new Nokogiri::XML(xml)
8
+ parser.parse
9
+ parser
10
+ end
11
+
12
+ let(:xml) { fixture(:multiple_namespaces).read }
13
+
14
+ it "lists the types" do
15
+ subject.types.keys.sort.should == ["Article", "Save"]
16
+ end
17
+
18
+ it "records the namespace for each type" do
19
+ subject.types["Save"][:namespace].should == "http://example.com/actions"
20
+ end
21
+
22
+ it "records the fields under a type" do
23
+ subject.types["Save"].keys.should =~ ["article", :namespace, :order!]
24
+ end
25
+
26
+ it "records multiple fields when there are more than one" do
27
+ subject.types["Article"].keys.should =~ ["Title", "Author", :namespace, :order!]
28
+ end
29
+
30
+ it "records the type of a field" do
31
+ subject.types["Save"]["article"][:type].should == "article:Article"
32
+ subject.namespaces["article"].should == "http://example.com/article"
33
+ end
34
+
35
+ it "lists the order of the type elements" do
36
+ subject.types["Article"][:order!].should == ["Author", "Title"]
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,26 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Parser do
4
+ context "with: no_message_parts.wsdl" do
5
+
6
+ subject do
7
+ parser = Wasabi::Parser.new Nokogiri::XML(xml)
8
+ parser.parse
9
+ parser
10
+ end
11
+
12
+ let(:xml) { fixture(:no_message_parts).read }
13
+
14
+ it "falls back to using the message type in the port element" do
15
+ # Operation's input has no part element in the message, so using the message type.
16
+ subject.operations[:save][:input].should == "SaveSoapIn"
17
+
18
+ # Operation's output has part element in the message, so using part element's type.
19
+ subject.operations[:save][:output].should == "SaveResponse"
20
+ end
21
+
22
+ it "falls back to using the namespace ID in the port element" do
23
+ subject.operations[:save][:namespace_identifier].should == "actions"
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Parser do
4
+ context "with: no_namespace.wsdl" do
5
+
6
+ subject do
7
+ parser = Wasabi::Parser.new Nokogiri::XML(xml)
8
+ parser.parse
9
+ parser
10
+ end
11
+
12
+ let(:xml) { fixture(:no_namespace).read }
13
+
14
+ it "lists the types" do
15
+ subject.types.keys.sort.should == ["McContact", "McContactArray", "MpUser", "MpUserArray"]
16
+ end
17
+
18
+ it "ignores xsd:all" do
19
+ keys = subject.types["MpUser"].keys
20
+ keys.size.should == 2
21
+
22
+ keys.should include(:namespace)
23
+ keys.should include(:order!)
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,36 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Parser do
4
+ context "with a WSDL defining xs:schema without targetNamespace" do
5
+
6
+ subject do
7
+ parser = Wasabi::Parser.new Nokogiri::XML(xml)
8
+ parser.parse
9
+ parser
10
+ end
11
+
12
+ let(:xml) do
13
+ %Q{
14
+ <definitions xmlns='http://schemas.xmlsoap.org/wsdl/'
15
+ xmlns:xs='http://www.w3.org/2001/XMLSchema'
16
+ targetNamespace='http://def.example.com'>
17
+ <types>
18
+ <xs:schema elementFormDefault='qualified'>
19
+ <xs:element name='Save'>
20
+ <xs:complexType></xs:complexType>
21
+ </xs:element>
22
+ </xs:schema>
23
+ </types>
24
+ </definitions>
25
+ }
26
+ end
27
+
28
+ # Don't know if real WSDL files omit targetNamespace from xs:schema,
29
+ # but I suppose we should do something reasonable if they do.
30
+
31
+ it "defaults to the target namespace from xs:definitions" do
32
+ subject.types["Save"][:namespace].should == "http://def.example.com"
33
+ end
34
+
35
+ end
36
+ end
@@ -0,0 +1,24 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Parser do
4
+ context "with: symbolic_endpoint.wsdl" do
5
+
6
+ subject do
7
+ parser = Wasabi::Parser.new Nokogiri::XML(xml)
8
+ parser.parse
9
+ parser
10
+ end
11
+
12
+ let(:xml) { fixture(:symbolic_endpoint).read }
13
+
14
+ it "allows symbolic endpoints" do
15
+ subject.endpoint.should be_nil
16
+ end
17
+
18
+ it "should position base class attributes before subclass attributes in :order! array" do
19
+ type = subject.types["ROPtsLiesListe"]
20
+ type[:order!].should == ["messages", "returncode", "listenteil"]
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,40 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi::Resolver do
4
+
5
+ describe "#resolve" do
6
+ it "resolves remote documents" do
7
+ HTTPI.should_receive(:get) { HTTPI::Response.new(200, {}, "wsdl") }
8
+ xml = Wasabi::Resolver.new("http://example.com?wsdl").resolve
9
+ xml.should == "wsdl"
10
+ end
11
+
12
+ it "resolves local documents" do
13
+ xml = Wasabi::Resolver.new(fixture(:authentication).path).resolve
14
+ xml.should == fixture(:authentication).read
15
+ end
16
+
17
+ it "simply returns raw XML" do
18
+ xml = Wasabi::Resolver.new("<xml/>").resolve
19
+ xml.should == "<xml/>"
20
+ end
21
+
22
+ it "raises HTTPError when #load_from_remote gets a response error" do
23
+ code = 404
24
+ headers = {
25
+ "content-type" => "text/html"
26
+ }
27
+ body = "<html><head><title>404 Not Found</title></head><body>Oops!</body></html>"
28
+ failed_response = HTTPI::Response.new(code, headers, body)
29
+ HTTPI.stub(:get => failed_response)
30
+ lambda do
31
+ Wasabi::Resolver.new("http://example.com?wsdl").resolve
32
+ end.should raise_error { |ex|
33
+ ex.should be_a(Wasabi::Resolver::HTTPError)
34
+ ex.message.should == "Error: #{code}"
35
+ ex.response.should == failed_response
36
+ }
37
+ end
38
+ end
39
+
40
+ end
@@ -0,0 +1,12 @@
1
+ require "spec_helper"
2
+
3
+ describe Wasabi do
4
+
5
+ describe ".document" do
6
+ it "should return a new Wasabi::Document" do
7
+ document = Wasabi.document fixture(:authentication).read
8
+ document.should be_a(Wasabi::Document)
9
+ end
10
+ end
11
+
12
+ end
data/wasabi.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "wasabi/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "wasabi-ng-1.6"
7
+ s.version = Wasabi::VERSION
8
+ s.authors = ["Rafael Reggiani Manzo"]
9
+ s.email = ["rr.manzo@gmail.com"]
10
+ s.homepage = "https://github.com/rafamanzo/wasabi"
11
+ s.summary = "This a fork from Daniel Harrington's Wasabi with nokogiri updated to 1.6"
12
+ s.description = s.summary
13
+
14
+ s.rubyforge_project = s.name
15
+ s.license = 'MIT'
16
+
17
+ s.add_dependency "httpi", "~> 2.0"
18
+ s.add_dependency "nokogiri", ">= 1.4.0"
19
+
20
+ s.add_development_dependency "rake", "~> 0.9"
21
+ s.add_development_dependency "rspec", "~> 2.10"
22
+
23
+ s.files = `git ls-files`.split("\n")
24
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
26
+ s.require_paths = ["lib"]
27
+ end
metadata ADDED
@@ -0,0 +1,159 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wasabi-ng-1.6
3
+ version: !ruby/object:Gem::Version
4
+ version: 3.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Rafael Reggiani Manzo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httpi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.4.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.4.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '0.9'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '0.9'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.10'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '2.10'
69
+ description: This a fork from Daniel Harrington's Wasabi with nokogiri updated to
70
+ 1.6
71
+ email:
72
+ - rr.manzo@gmail.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - .rspec
79
+ - .travis.yml
80
+ - CHANGELOG.md
81
+ - Gemfile
82
+ - LICENSE
83
+ - README.md
84
+ - Rakefile
85
+ - lib/wasabi.rb
86
+ - lib/wasabi/core_ext/string.rb
87
+ - lib/wasabi/document.rb
88
+ - lib/wasabi/parser.rb
89
+ - lib/wasabi/resolver.rb
90
+ - lib/wasabi/version.rb
91
+ - spec/fixtures/authentication.wsdl
92
+ - spec/fixtures/economic.wsdl
93
+ - spec/fixtures/encoded_endpoint.wsdl
94
+ - spec/fixtures/geotrust.wsdl
95
+ - spec/fixtures/import_port_types.wsdl
96
+ - spec/fixtures/inherited.wsdl
97
+ - spec/fixtures/juniper.wsdl
98
+ - spec/fixtures/lower_camel.wsdl
99
+ - spec/fixtures/multiple_namespaces.wsdl
100
+ - spec/fixtures/multiple_types.wsdl
101
+ - spec/fixtures/namespaced_actions.wsdl
102
+ - spec/fixtures/no_message_parts.wsdl
103
+ - spec/fixtures/no_namespace.wsdl
104
+ - spec/fixtures/savon295.wsdl
105
+ - spec/fixtures/soap12.wsdl
106
+ - spec/fixtures/symbolic_endpoint.wsdl
107
+ - spec/fixtures/two_bindings.wsdl
108
+ - spec/spec_helper.rb
109
+ - spec/support/fixture.rb
110
+ - spec/support/profiling.rb
111
+ - spec/wasabi/core_ext/string_spec.rb
112
+ - spec/wasabi/document/authentication_spec.rb
113
+ - spec/wasabi/document/economic_spec.rb
114
+ - spec/wasabi/document/encoded_endpoint_spec.rb
115
+ - spec/wasabi/document/geotrust_spec.rb
116
+ - spec/wasabi/document/inherited_spec.rb
117
+ - spec/wasabi/document/multiple_namespaces_spec.rb
118
+ - spec/wasabi/document/namespaced_actions_spec.rb
119
+ - spec/wasabi/document/no_namespace_spec.rb
120
+ - spec/wasabi/document/savon295_spec.rb
121
+ - spec/wasabi/document/soap12_spec.rb
122
+ - spec/wasabi/document/two_bindings_spec.rb
123
+ - spec/wasabi/document_spec.rb
124
+ - spec/wasabi/parser/get_servicename_spec.rb
125
+ - spec/wasabi/parser/import_port_types_spec.rb
126
+ - spec/wasabi/parser/juniper_spec.rb
127
+ - spec/wasabi/parser/multiple_namespaces_spec.rb
128
+ - spec/wasabi/parser/no_message_parts_spec.rb
129
+ - spec/wasabi/parser/no_namespace_spec.rb
130
+ - spec/wasabi/parser/no_target_namespace_spec.rb
131
+ - spec/wasabi/parser/symbolic_endpoint_spec.rb
132
+ - spec/wasabi/resolver_spec.rb
133
+ - spec/wasabi/wasabi_spec.rb
134
+ - wasabi.gemspec
135
+ homepage: https://github.com/rafamanzo/wasabi
136
+ licenses:
137
+ - MIT
138
+ metadata: {}
139
+ post_install_message:
140
+ rdoc_options: []
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - '>='
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ requirements: []
154
+ rubyforge_project: wasabi-ng-1.6
155
+ rubygems_version: 2.0.3
156
+ signing_key:
157
+ specification_version: 4
158
+ summary: This a fork from Daniel Harrington's Wasabi with nokogiri updated to 1.6
159
+ test_files: []