apache_felix_webconsole_client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,57 @@
1
+ =begin
2
+ #Apache Felix WebConsole
3
+
4
+ #Client for Apache Felix Web Console API. List bundles, configure services, etc.
5
+
6
+ OpenAPI spec version: 4.3.0
7
+ Contact: bryan.stopp@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'spec_helper'
13
+ require 'json'
14
+
15
+ # Unit tests for ApacheFelix::DefaultApi
16
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
17
+ # Please update as you see appropriate
18
+ describe 'DefaultApi' do
19
+ before do
20
+ # run before each test
21
+ @instance = ApacheFelix::DefaultApi.new
22
+ end
23
+
24
+ after do
25
+ # run after each test
26
+ end
27
+
28
+ describe 'test an instance of DefaultApi' do
29
+ it 'should create an instact of DefaultApi' do
30
+ expect(@instance).to be_instance_of(ApacheFelix::DefaultApi)
31
+ end
32
+ end
33
+
34
+ # unit tests for bundle_info
35
+ # Bundle Info
36
+ # Display all information about a bundle. Same response structure as bundle listing; only one entry exists in the list.
37
+ # @param bundle_id The symbolic name or id of the bundle.
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [BundleList]
40
+ describe 'bundle_info test' do
41
+ it "should work" do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ # unit tests for bundles
47
+ # List bundles
48
+ # List all the bundles in the Felix system. Properties for a bundle will not be populated.
49
+ # @param [Hash] opts the optional parameters
50
+ # @return [BundleList]
51
+ describe 'bundles test' do
52
+ it "should work" do
53
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
54
+ end
55
+ end
56
+
57
+ end
@@ -0,0 +1,225 @@
1
+ =begin
2
+ #Apache Felix WebConsole
3
+
4
+ #Client for Apache Felix Web Console API. List bundles, configure services, etc.
5
+
6
+ OpenAPI spec version: 4.3.0
7
+ Contact: bryan.stopp@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'spec_helper'
13
+
14
+ describe ApacheFelix::ApiClient do
15
+ context 'initialization' do
16
+ context 'URL stuff' do
17
+ context 'host' do
18
+ it 'removes http from host' do
19
+ ApacheFelix.configure { |c| c.host = 'http://example.com' }
20
+ expect(ApacheFelix::Configuration.default.host).to eq('example.com')
21
+ end
22
+
23
+ it 'removes https from host' do
24
+ ApacheFelix.configure { |c| c.host = 'https://wookiee.com' }
25
+ expect(ApacheFelix::ApiClient.default.config.host).to eq('wookiee.com')
26
+ end
27
+
28
+ it 'removes trailing path from host' do
29
+ ApacheFelix.configure { |c| c.host = 'hobo.com/v4' }
30
+ expect(ApacheFelix::Configuration.default.host).to eq('hobo.com')
31
+ end
32
+ end
33
+
34
+ context 'base_path' do
35
+ it "prepends a slash to base_path" do
36
+ ApacheFelix.configure { |c| c.base_path = 'v4/dog' }
37
+ expect(ApacheFelix::Configuration.default.base_path).to eq('/v4/dog')
38
+ end
39
+
40
+ it "doesn't prepend a slash if one is already there" do
41
+ ApacheFelix.configure { |c| c.base_path = '/v4/dog' }
42
+ expect(ApacheFelix::Configuration.default.base_path).to eq('/v4/dog')
43
+ end
44
+
45
+ it "ends up as a blank string if nil" do
46
+ ApacheFelix.configure { |c| c.base_path = nil }
47
+ expect(ApacheFelix::Configuration.default.base_path).to eq('')
48
+ end
49
+ end
50
+ end
51
+ end
52
+
53
+ describe "params_encoding in #build_request" do
54
+ let(:config) { ApacheFelix::Configuration.new }
55
+ let(:api_client) { ApacheFelix::ApiClient.new(config) }
56
+
57
+ it "defaults to nil" do
58
+ expect(ApacheFelix::Configuration.default.params_encoding).to eq(nil)
59
+ expect(config.params_encoding).to eq(nil)
60
+
61
+ request = api_client.build_request(:get, '/test')
62
+ expect(request.options[:params_encoding]).to eq(nil)
63
+ end
64
+
65
+ it "can be customized" do
66
+ config.params_encoding = :multi
67
+ request = api_client.build_request(:get, '/test')
68
+ expect(request.options[:params_encoding]).to eq(:multi)
69
+ end
70
+ end
71
+
72
+ describe "timeout in #build_request" do
73
+ let(:config) { ApacheFelix::Configuration.new }
74
+ let(:api_client) { ApacheFelix::ApiClient.new(config) }
75
+
76
+ it "defaults to 0" do
77
+ expect(ApacheFelix::Configuration.default.timeout).to eq(0)
78
+ expect(config.timeout).to eq(0)
79
+
80
+ request = api_client.build_request(:get, '/test')
81
+ expect(request.options[:timeout]).to eq(0)
82
+ end
83
+
84
+ it "can be customized" do
85
+ config.timeout = 100
86
+ request = api_client.build_request(:get, '/test')
87
+ expect(request.options[:timeout]).to eq(100)
88
+ end
89
+ end
90
+
91
+ describe "#deserialize" do
92
+ it "handles Array<Integer>" do
93
+ api_client = ApacheFelix::ApiClient.new
94
+ headers = {'Content-Type' => 'application/json'}
95
+ response = double('response', headers: headers, body: '[12, 34]')
96
+ data = api_client.deserialize(response, 'Array<Integer>')
97
+ expect(data).to be_instance_of(Array)
98
+ expect(data).to eq([12, 34])
99
+ end
100
+
101
+ it "handles Array<Array<Integer>>" do
102
+ api_client = ApacheFelix::ApiClient.new
103
+ headers = {'Content-Type' => 'application/json'}
104
+ response = double('response', headers: headers, body: '[[12, 34], [56]]')
105
+ data = api_client.deserialize(response, 'Array<Array<Integer>>')
106
+ expect(data).to be_instance_of(Array)
107
+ expect(data).to eq([[12, 34], [56]])
108
+ end
109
+
110
+ it "handles Hash<String, String>" do
111
+ api_client = ApacheFelix::ApiClient.new
112
+ headers = {'Content-Type' => 'application/json'}
113
+ response = double('response', headers: headers, body: '{"message": "Hello"}')
114
+ data = api_client.deserialize(response, 'Hash<String, String>')
115
+ expect(data).to be_instance_of(Hash)
116
+ expect(data).to eq({:message => 'Hello'})
117
+ end
118
+ end
119
+
120
+ describe "#object_to_hash" do
121
+ it "ignores nils and includes empty arrays" do
122
+ # uncomment below to test object_to_hash for model
123
+ #api_client = ApacheFelix::ApiClient.new
124
+ #_model = ApacheFelix::ModelName.new
125
+ # update the model attribute below
126
+ #_model.id = 1
127
+ # update the expected value (hash) below
128
+ #expected = {id: 1, name: '', tags: []}
129
+ #expect(api_client.object_to_hash(_model)).to eq(expected)
130
+ end
131
+ end
132
+
133
+ describe "#build_collection_param" do
134
+ let(:param) { ['aa', 'bb', 'cc'] }
135
+ let(:api_client) { ApacheFelix::ApiClient.new }
136
+
137
+ it "works for csv" do
138
+ expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
139
+ end
140
+
141
+ it "works for ssv" do
142
+ expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
143
+ end
144
+
145
+ it "works for tsv" do
146
+ expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
147
+ end
148
+
149
+ it "works for pipes" do
150
+ expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
151
+ end
152
+
153
+ it "works for multi" do
154
+ expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
155
+ end
156
+
157
+ it "fails for invalid collection format" do
158
+ expect(proc { api_client.build_collection_param(param, :INVALID) }).to raise_error(RuntimeError, 'unknown collection format: :INVALID')
159
+ end
160
+ end
161
+
162
+ describe "#json_mime?" do
163
+ let(:api_client) { ApacheFelix::ApiClient.new }
164
+
165
+ it "works" do
166
+ expect(api_client.json_mime?(nil)).to eq false
167
+ expect(api_client.json_mime?('')).to eq false
168
+
169
+ expect(api_client.json_mime?('application/json')).to eq true
170
+ expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
171
+ expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
172
+
173
+ expect(api_client.json_mime?('application/xml')).to eq false
174
+ expect(api_client.json_mime?('text/plain')).to eq false
175
+ expect(api_client.json_mime?('application/jsonp')).to eq false
176
+ end
177
+ end
178
+
179
+ describe "#select_header_accept" do
180
+ let(:api_client) { ApacheFelix::ApiClient.new }
181
+
182
+ it "works" do
183
+ expect(api_client.select_header_accept(nil)).to be_nil
184
+ expect(api_client.select_header_accept([])).to be_nil
185
+
186
+ expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
187
+ expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
188
+ expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
189
+
190
+ expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
191
+ expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
192
+ end
193
+ end
194
+
195
+ describe "#select_header_content_type" do
196
+ let(:api_client) { ApacheFelix::ApiClient.new }
197
+
198
+ it "works" do
199
+ expect(api_client.select_header_content_type(nil)).to eq('application/json')
200
+ expect(api_client.select_header_content_type([])).to eq('application/json')
201
+
202
+ expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
203
+ expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
204
+ expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
205
+ expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
206
+ expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
207
+ end
208
+ end
209
+
210
+ describe "#sanitize_filename" do
211
+ let(:api_client) { ApacheFelix::ApiClient.new }
212
+
213
+ it "works" do
214
+ expect(api_client.sanitize_filename('sun')).to eq('sun')
215
+ expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
216
+ expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
217
+ expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
218
+ expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
219
+ expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
220
+ expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
221
+ expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
222
+ expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
223
+ end
224
+ end
225
+ end
@@ -0,0 +1,41 @@
1
+ =begin
2
+ #Apache Felix WebConsole
3
+
4
+ #Client for Apache Felix Web Console API. List bundles, configure services, etc.
5
+
6
+ OpenAPI spec version: 4.3.0
7
+ Contact: bryan.stopp@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'spec_helper'
13
+
14
+ describe ApacheFelix::Configuration do
15
+ let(:config) { ApacheFelix::Configuration.default }
16
+
17
+ before(:each) do
18
+ # uncomment below to setup host and base_path
19
+ #require 'URI'
20
+ #uri = URI.parse("http://localhost:8080/system/console")
21
+ #ApacheFelix.configure do |c|
22
+ # c.host = uri.host
23
+ # c.base_path = uri.path
24
+ #end
25
+ end
26
+
27
+ describe '#base_url' do
28
+ it 'should have the default value' do
29
+ # uncomment below to test default value of the base path
30
+ #expect(config.base_url).to eq("http://localhost:8080/system/console")
31
+ end
32
+
33
+ it 'should remove trailing slashes' do
34
+ [nil, '', '/', '//'].each do |base_path|
35
+ config.base_path = base_path
36
+ # uncomment below to test trailing slashes
37
+ #expect(config.base_url).to eq("http://localhost:8080/system/console")
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,53 @@
1
+ =begin
2
+ #Apache Felix WebConsole
3
+
4
+ #Client for Apache Felix Web Console API. List bundles, configure services, etc.
5
+
6
+ OpenAPI spec version: 4.3.0
7
+ Contact: bryan.stopp@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'spec_helper'
13
+ require 'json'
14
+ require 'date'
15
+
16
+ # Unit tests for ApacheFelix::BundleList
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'BundleList' do
20
+ before do
21
+ # run before each test
22
+ @instance = ApacheFelix::BundleList.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of BundleList' do
30
+ it 'should create an instact of BundleList' do
31
+ expect(@instance).to be_instance_of(ApacheFelix::BundleList)
32
+ end
33
+ end
34
+ describe 'test attribute "status"' do
35
+ it 'should work' do
36
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
37
+ end
38
+ end
39
+
40
+ describe 'test attribute "s"' do
41
+ it 'should work' do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ describe 'test attribute "data"' do
47
+ it 'should work' do
48
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
49
+ end
50
+ end
51
+
52
+ end
53
+
@@ -0,0 +1,47 @@
1
+ =begin
2
+ #Apache Felix WebConsole
3
+
4
+ #Client for Apache Felix Web Console API. List bundles, configure services, etc.
5
+
6
+ OpenAPI spec version: 4.3.0
7
+ Contact: bryan.stopp@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'spec_helper'
13
+ require 'json'
14
+ require 'date'
15
+
16
+ # Unit tests for ApacheFelix::BundleProps
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'BundleProps' do
20
+ before do
21
+ # run before each test
22
+ @instance = ApacheFelix::BundleProps.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of BundleProps' do
30
+ it 'should create an instact of BundleProps' do
31
+ expect(@instance).to be_instance_of(ApacheFelix::BundleProps)
32
+ end
33
+ end
34
+ describe 'test attribute "key"' do
35
+ it 'should work' do
36
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
37
+ end
38
+ end
39
+
40
+ describe 'test attribute "value"' do
41
+ it 'should work' do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ end
47
+
@@ -0,0 +1,93 @@
1
+ =begin
2
+ #Apache Felix WebConsole
3
+
4
+ #Client for Apache Felix Web Console API. List bundles, configure services, etc.
5
+
6
+ OpenAPI spec version: 4.3.0
7
+ Contact: bryan.stopp@gmail.com
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'spec_helper'
13
+ require 'json'
14
+ require 'date'
15
+
16
+ # Unit tests for ApacheFelix::Bundle
17
+ # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
18
+ # Please update as you see appropriate
19
+ describe 'Bundle' do
20
+ before do
21
+ # run before each test
22
+ @instance = ApacheFelix::Bundle.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of Bundle' do
30
+ it 'should create an instact of Bundle' do
31
+ expect(@instance).to be_instance_of(ApacheFelix::Bundle)
32
+ end
33
+ end
34
+ describe 'test attribute "id"' do
35
+ it 'should work' do
36
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
37
+ end
38
+ end
39
+
40
+ describe 'test attribute "name"' do
41
+ it 'should work' do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ describe 'test attribute "fragment"' do
47
+ it 'should work' do
48
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
49
+ end
50
+ end
51
+
52
+ describe 'test attribute "state_raw"' do
53
+ it 'should work' do
54
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
55
+ end
56
+ end
57
+
58
+ describe 'test attribute "state"' do
59
+ it 'should work' do
60
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
61
+ #validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["Uninstalled", "Installed", "Resolved", "Starting", "Stopping", "Active", "Fragment"])
62
+ #validator.allowable_values.each do |value|
63
+ # expect { @instance.state = value }.not_to raise_error
64
+ #end
65
+ end
66
+ end
67
+
68
+ describe 'test attribute "version"' do
69
+ it 'should work' do
70
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
71
+ end
72
+ end
73
+
74
+ describe 'test attribute "symbolic_name"' do
75
+ it 'should work' do
76
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
77
+ end
78
+ end
79
+
80
+ describe 'test attribute "category"' do
81
+ it 'should work' do
82
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
83
+ end
84
+ end
85
+
86
+ describe 'test attribute "props"' do
87
+ it 'should work' do
88
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
89
+ end
90
+ end
91
+
92
+ end
93
+