jruby-cxf 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/jruby-cxf-1.0.jar +0 -0
- data/lib/jruby_cxf.rb +6 -20
- data/spec/jruby_cxf/examples/test_web_service.rb +29 -0
- data/spec/jruby_cxf/examples/web_service_with_endpoint_name_set.rb +6 -0
- data/spec/jruby_cxf/examples/web_service_with_exposed_methods.rb +15 -0
- data/spec/jruby_cxf/examples/web_service_with_exposed_methods_having_labels.rb +15 -0
- data/spec/jruby_cxf/examples/web_service_with_exposed_methods_having_out_parameter_name_set.rb +15 -0
- data/spec/jruby_cxf/examples/web_service_with_exposed_methods_having_response_wrapper_name_set.rb +15 -0
- data/spec/jruby_cxf/examples/web_service_with_service_name_set.rb +5 -0
- data/spec/jruby_cxf/examples/web_service_with_service_namespace_set.rb +5 -0
- data/spec/jruby_cxf/web_sevice_servlet_spec.rb +136 -0
- metadata +22 -4
data/lib/jruby-cxf-1.0.jar
CHANGED
Binary file
|
data/lib/jruby_cxf.rb
CHANGED
@@ -1,24 +1,10 @@
|
|
1
|
-
# Copyright 2013 Claude Mamo
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
|
15
1
|
require 'jruby-cxf-1.0.jar'
|
16
2
|
require 'complex_type'
|
17
3
|
require 'web_service_servlet'
|
18
4
|
|
19
5
|
module CXF
|
20
6
|
|
21
|
-
private
|
7
|
+
private
|
22
8
|
|
23
9
|
def get_java_type(type)
|
24
10
|
case type
|
@@ -41,16 +27,16 @@ module CXF
|
|
41
27
|
when :double
|
42
28
|
java.lang.Double
|
43
29
|
when :boolean
|
44
|
-
java.lang.Boolean
|
30
|
+
java.lang.Boolean
|
45
31
|
when :datetime
|
46
|
-
java.util.Date
|
32
|
+
java.util.Date
|
47
33
|
when :nil
|
48
34
|
java.lang.Void
|
49
35
|
else
|
50
36
|
Kernel.const_get(type.to_s).become_java!(false)
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
54
40
|
|
55
41
|
end
|
56
42
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'jruby_cxf'
|
2
|
+
require 'httparty'
|
3
|
+
|
4
|
+
class TestWebService
|
5
|
+
include CXF::WebServiceServlet
|
6
|
+
|
7
|
+
def wsdl
|
8
|
+
HTTParty.get("http://localhost:8080/#{@path}?wsdl").parsed_response
|
9
|
+
end
|
10
|
+
|
11
|
+
def publish
|
12
|
+
@server = org.eclipse.jetty.server.Server.new(8080)
|
13
|
+
contexts = org.eclipse.jetty.server.handler.ContextHandlerCollection.new
|
14
|
+
@server.set_handler(contexts)
|
15
|
+
rootContext = org.eclipse.jetty.servlet.ServletContextHandler.new(contexts, "/")
|
16
|
+
rootContext.addServlet(org.eclipse.jetty.servlet.ServletHolder.new(self), "/*")
|
17
|
+
|
18
|
+
@server.start
|
19
|
+
end
|
20
|
+
|
21
|
+
def teardown
|
22
|
+
@server.stop
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
@path = 'web-service'
|
27
|
+
super('/' + @path)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_web_service'
|
2
|
+
|
3
|
+
class WebServiceWithExposedMethods < TestWebService
|
4
|
+
|
5
|
+
expose :say_hello, {:expects => [{:name => :string}], :returns => :string}
|
6
|
+
expose :give_age, {:expects => [{:age => :int}], :returns => :int}
|
7
|
+
|
8
|
+
def say_hello(name)
|
9
|
+
return 'Hello ' + name
|
10
|
+
end
|
11
|
+
|
12
|
+
def give_age(age)
|
13
|
+
return 'Your age is ' + age.to_s
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_web_service'
|
2
|
+
|
3
|
+
class WebServiceWithExposedMethodsHavingLabels < TestWebService
|
4
|
+
|
5
|
+
expose :say_hello, {:expects => [{:name => :string}], :returns => :string}, :label => :SayHello
|
6
|
+
expose :give_age, {:expects => [{:age => :int}], :returns => :int}, :label => :GiveAge
|
7
|
+
|
8
|
+
def say_hello(name)
|
9
|
+
return 'Hello ' + name
|
10
|
+
end
|
11
|
+
|
12
|
+
def give_age(age)
|
13
|
+
return 'Your age is ' + age.to_s
|
14
|
+
end
|
15
|
+
end
|
data/spec/jruby_cxf/examples/web_service_with_exposed_methods_having_out_parameter_name_set.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_web_service'
|
2
|
+
|
3
|
+
class WebServiceWithExposedMethodsHavingOutParameterNameSet < TestWebService
|
4
|
+
|
5
|
+
expose :say_hello, {:expects => [{:name => :string}], :returns => :string}, :out_parameter_name => :OutSayHello
|
6
|
+
expose :give_age, {:expects => [{:age => :int}], :returns => :int}, :out_parameter_name => :OutGiveAge
|
7
|
+
|
8
|
+
def say_hello(name)
|
9
|
+
return 'Hello ' + name
|
10
|
+
end
|
11
|
+
|
12
|
+
def give_age(age)
|
13
|
+
return 'Your age is ' + age.to_s
|
14
|
+
end
|
15
|
+
end
|
data/spec/jruby_cxf/examples/web_service_with_exposed_methods_having_response_wrapper_name_set.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_web_service'
|
2
|
+
|
3
|
+
class WebServiceWithExposedMethodsHavingResponseWrapperNameSet < TestWebService
|
4
|
+
|
5
|
+
expose :say_hello, {:expects => [{:name => :string}], :returns => :string}, :response_wrapper_name => :SayHelloResponseWrapper
|
6
|
+
expose :give_age, {:expects => [{:age => :int}], :returns => :int}, :response_wrapper_name => :GiveAgeResponseWrapper
|
7
|
+
|
8
|
+
def say_hello(name)
|
9
|
+
return 'Hello ' + name
|
10
|
+
end
|
11
|
+
|
12
|
+
def give_age(age)
|
13
|
+
return 'Your age is ' + age.to_s
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
require 'jruby_cxf'
|
2
|
+
Dir.glob(File.dirname(File.absolute_path(__FILE__)) + '/examples/*', &method(:require))
|
3
|
+
|
4
|
+
describe CXF::WebServiceServlet do
|
5
|
+
|
6
|
+
context WebServiceWithExposedMethodsHavingResponseWrapperNameSet do
|
7
|
+
subject(:wsdl) { @web_service.wsdl }
|
8
|
+
|
9
|
+
before(:all) do
|
10
|
+
@web_service = WebServiceWithExposedMethodsHavingResponseWrapperNameSet.new
|
11
|
+
@web_service.publish
|
12
|
+
end
|
13
|
+
|
14
|
+
after(:all) do
|
15
|
+
@web_service.teardown
|
16
|
+
end
|
17
|
+
|
18
|
+
it "gives a WSDL with response wrapper elements named according to given response wrapper names" do
|
19
|
+
wsdl['definitions']['types']['schema']['complexType'][1]['name'].should eq 'GiveAgeResponseWrapper'
|
20
|
+
wsdl['definitions']['types']['schema']['complexType'][3]['name'].should eq 'SayHelloResponseWrapper'
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
context WebServiceWithExposedMethodsHavingOutParameterNameSet do
|
26
|
+
subject(:wsdl) { @web_service.wsdl }
|
27
|
+
|
28
|
+
before(:all) do
|
29
|
+
@web_service = WebServiceWithExposedMethodsHavingOutParameterNameSet.new
|
30
|
+
@web_service.publish
|
31
|
+
end
|
32
|
+
|
33
|
+
after(:all) do
|
34
|
+
@web_service.teardown
|
35
|
+
end
|
36
|
+
|
37
|
+
it "gives a WSDL with return value elements named according to given out parameter names" do
|
38
|
+
wsdl['definitions']['types']['schema']['complexType'][1]['sequence']['element']['name'].should eq 'OutGiveAge'
|
39
|
+
wsdl['definitions']['types']['schema']['complexType'][3]['sequence']['element']['name'].should eq 'OutSayHello'
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
context WebServiceWithExposedMethodsHavingLabels do
|
45
|
+
subject(:wsdl) { @web_service.wsdl }
|
46
|
+
|
47
|
+
before(:all) do
|
48
|
+
@web_service = WebServiceWithExposedMethodsHavingLabels.new
|
49
|
+
@web_service.publish
|
50
|
+
end
|
51
|
+
|
52
|
+
after(:all) do
|
53
|
+
@web_service.teardown
|
54
|
+
end
|
55
|
+
|
56
|
+
it "gives a WSDL that has its operations name according to labels given" do
|
57
|
+
wsdl['definitions']['binding']['operation'][0]['name'].should eq 'GiveAge'
|
58
|
+
wsdl['definitions']['binding']['operation'][1]['name'].should eq 'SayHello'
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
context WebServiceWithExposedMethods do
|
64
|
+
subject(:wsdl) { @web_service.wsdl }
|
65
|
+
|
66
|
+
before(:all) do
|
67
|
+
@web_service = WebServiceWithExposedMethods.new
|
68
|
+
@web_service.publish
|
69
|
+
end
|
70
|
+
|
71
|
+
after(:all) do
|
72
|
+
@web_service.teardown
|
73
|
+
end
|
74
|
+
|
75
|
+
it "gives a WSDL with declared methods exposed" do
|
76
|
+
wsdl['definitions']['types']['schema']['complexType'][0]['sequence']['element']['type'].should eq 'xsd:int'
|
77
|
+
wsdl['definitions']['types']['schema']['complexType'][1]['sequence']['element']['type'].should eq 'xsd:int'
|
78
|
+
wsdl['definitions']['types']['schema']['complexType'][2]['sequence']['element']['type'].should eq 'xsd:string'
|
79
|
+
wsdl['definitions']['types']['schema']['complexType'][3]['sequence']['element']['type'].should eq 'xsd:string'
|
80
|
+
wsdl['definitions']['binding']['operation'][0]['name'].should eq 'give_age'
|
81
|
+
wsdl['definitions']['binding']['operation'][1]['name'].should eq 'say_hello'
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context WebServiceWithServiceNameSet do
|
86
|
+
subject(:wsdl) { @web_service.wsdl }
|
87
|
+
|
88
|
+
before(:all) do
|
89
|
+
@web_service = WebServiceWithServiceNameSet.new
|
90
|
+
@web_service.publish
|
91
|
+
end
|
92
|
+
|
93
|
+
after(:all) do
|
94
|
+
@web_service.teardown
|
95
|
+
end
|
96
|
+
|
97
|
+
it "gives a WSDL with the configured service name" do
|
98
|
+
wsdl['definitions']['service']['name'].should eq 'FooService'
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context WebServiceWithEndpointNameSet do
|
103
|
+
subject(:wsdl) { @web_service.wsdl }
|
104
|
+
|
105
|
+
before(:all) do
|
106
|
+
@web_service = WebServiceWithEndpointNameSet.new
|
107
|
+
@web_service.publish
|
108
|
+
end
|
109
|
+
|
110
|
+
after(:all) do
|
111
|
+
@web_service.teardown
|
112
|
+
end
|
113
|
+
|
114
|
+
it "gives a WSDL with the port name matching the configured endpoint name" do
|
115
|
+
wsdl['definitions']['service']['port']['name'].should eq 'FooPort'
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
context WebServiceWithServiceNamespaceSet do
|
120
|
+
subject(:wsdl) { @web_service.wsdl }
|
121
|
+
|
122
|
+
before(:all) do
|
123
|
+
@web_service = WebServiceWithServiceNamespaceSet.new
|
124
|
+
@web_service.publish
|
125
|
+
end
|
126
|
+
|
127
|
+
after(:all) do
|
128
|
+
@web_service.teardown
|
129
|
+
end
|
130
|
+
|
131
|
+
it "gives a WSDL with the service target namespace matching the configured service namespace" do
|
132
|
+
wsdl['definitions']['targetNamespace'].should eq 'http://jruby-cxf.org'
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby-cxf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,10 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-12 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: JRuby CXF is a JRuby gem that wraps the Apache CXF framework to provide
|
15
|
-
a
|
15
|
+
a friendlier API for publishing Web Services.
|
16
16
|
email: claude.mamo@gmail.com
|
17
17
|
executables: []
|
18
18
|
extensions: []
|
@@ -25,6 +25,15 @@ files:
|
|
25
25
|
- lib/web_service_definition.rb
|
26
26
|
- lib/web_service_servlet.rb
|
27
27
|
- lib/jruby-cxf-1.0.jar
|
28
|
+
- spec/jruby_cxf/examples/test_web_service.rb
|
29
|
+
- spec/jruby_cxf/examples/web_service_with_endpoint_name_set.rb
|
30
|
+
- spec/jruby_cxf/examples/web_service_with_exposed_methods.rb
|
31
|
+
- spec/jruby_cxf/examples/web_service_with_exposed_methods_having_labels.rb
|
32
|
+
- spec/jruby_cxf/examples/web_service_with_exposed_methods_having_out_parameter_name_set.rb
|
33
|
+
- spec/jruby_cxf/examples/web_service_with_exposed_methods_having_response_wrapper_name_set.rb
|
34
|
+
- spec/jruby_cxf/examples/web_service_with_service_name_set.rb
|
35
|
+
- spec/jruby_cxf/examples/web_service_with_service_namespace_set.rb
|
36
|
+
- spec/jruby_cxf/web_sevice_servlet_spec.rb
|
28
37
|
homepage: http://github.com/claudemamo/jruby-cxf
|
29
38
|
licenses:
|
30
39
|
- Apache License, Version 2.0
|
@@ -50,4 +59,13 @@ rubygems_version: 1.8.23
|
|
50
59
|
signing_key:
|
51
60
|
specification_version: 3
|
52
61
|
summary: A wrapper for Apache CXF
|
53
|
-
test_files:
|
62
|
+
test_files:
|
63
|
+
- spec/jruby_cxf/examples/test_web_service.rb
|
64
|
+
- spec/jruby_cxf/examples/web_service_with_endpoint_name_set.rb
|
65
|
+
- spec/jruby_cxf/examples/web_service_with_exposed_methods.rb
|
66
|
+
- spec/jruby_cxf/examples/web_service_with_exposed_methods_having_labels.rb
|
67
|
+
- spec/jruby_cxf/examples/web_service_with_exposed_methods_having_out_parameter_name_set.rb
|
68
|
+
- spec/jruby_cxf/examples/web_service_with_exposed_methods_having_response_wrapper_name_set.rb
|
69
|
+
- spec/jruby_cxf/examples/web_service_with_service_name_set.rb
|
70
|
+
- spec/jruby_cxf/examples/web_service_with_service_namespace_set.rb
|
71
|
+
- spec/jruby_cxf/web_sevice_servlet_spec.rb
|