Skip to content

Commit d825d57

Browse files
committed
Fixed style
1 parent f2f75d0 commit d825d57

File tree

5 files changed

+63
-11
lines changed

5 files changed

+63
-11
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/407240ec7ee34a70bc4d5eb4517273fd)](https://www.codacy.com/manual/berkesa/moleculer-java-httpclient?utm_source=github.com&utm_medium=referral&utm_content=moleculer-java/moleculer-java-httpclient&utm_campaign=Badge_Grade)
33
[![codecov](https://codecov.io/gh/moleculer-java/moleculer-java-httpclient/branch/master/graph/badge.svg)](https://codecov.io/gh/moleculer-java/moleculer-java-httpclient)
44

5-
# [WIP] moleculer-java-httpclient
5+
# (WIP) moleculer-java-httpclient
66
Non-blocking, Promise-based HTTP client for Moleculer Applications.

src/main/java/services/moleculer/httpclient/HttpClient.java

+4-6
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,8 @@ public Promise rest(String url, Tree request) {
161161
// --- WEBSOCKET LISTENER / RECEIVER ---
162162

163163
public WebSocketConnection ws(String url) {
164-
if (url.startsWith("http")) {
165-
url = "ws" + url.substring(4);
166-
}
167-
return new WebSocketConnection(client, url, scheduler);
164+
String u = url.startsWith("http") ? "ws" + url.substring(4) : url;
165+
return new WebSocketConnection(client, u, scheduler);
168166
}
169167

170168
// --- BUILDER-STYLE HTTP METHODS ---
@@ -237,7 +235,7 @@ public HttpClient setRealm(Realm realm) {
237235
return this;
238236
}
239237

240-
public HttpClient setRealm(org.asynchttpclient.Realm.Builder realmBuilder) {
238+
public HttpClient setRealm(Realm.Builder realmBuilder) {
241239
builder.setRealm(realmBuilder);
242240
return this;
243241
}
@@ -282,7 +280,7 @@ public HttpClient setProxyServer(ProxyServer proxyServer) {
282280
return this;
283281
}
284282

285-
public HttpClient setProxyServer(org.asynchttpclient.proxy.ProxyServer.Builder proxyServerBuilder) {
283+
public HttpClient setProxyServer(ProxyServer.Builder proxyServerBuilder) {
286284
builder.setProxyServer(proxyServerBuilder);
287285
return this;
288286
}

src/main/java/services/moleculer/httpclient/RequestSetter.java

+25-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/**
2+
* THIS SOFTWARE IS LICENSED UNDER MIT LICENSE.<br>
3+
* <br>
4+
* Copyright 2019 Andras Berkes [andras.berkes@programmer.net]<br>
5+
* <br>
6+
* Permission is hereby granted, free of charge, to any person obtaining
7+
* a copy of this software and associated documentation files (the
8+
* "Software"), to deal in the Software without restriction, including
9+
* without limitation the rights to use, copy, modify, merge, publish,
10+
* distribute, sublicense, and/or sell copies of the Software, and to
11+
* permit persons to whom the Software is furnished to do so, subject to
12+
* the following conditions:<br>
13+
* <br>
14+
* The above copyright notice and this permission notice shall be
15+
* included in all copies or substantial portions of the Software.<br>
16+
* <br>
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24+
*/
125
package services.moleculer.httpclient;
226

327
import java.io.File;
@@ -242,7 +266,7 @@ public RequestSetter setProxyServer(Builder proxyServerBuilder) {
242266
return this;
243267
}
244268

245-
public RequestSetter setRealm(org.asynchttpclient.Realm.Builder realm) {
269+
public RequestSetter setRealm(Realm.Builder realm) {
246270
builder.setRealm(realm);
247271
return this;
248272
}

src/main/java/services/moleculer/httpclient/WebSocketConnection.java

+30
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/**
2+
* THIS SOFTWARE IS LICENSED UNDER MIT LICENSE.<br>
3+
* <br>
4+
* Copyright 2019 Andras Berkes [andras.berkes@programmer.net]<br>
5+
* <br>
6+
* Permission is hereby granted, free of charge, to any person obtaining
7+
* a copy of this software and associated documentation files (the
8+
* "Software"), to deal in the Software without restriction, including
9+
* without limitation the rights to use, copy, modify, merge, publish,
10+
* distribute, sublicense, and/or sell copies of the Software, and to
11+
* permit persons to whom the Software is furnished to do so, subject to
12+
* the following conditions:<br>
13+
* <br>
14+
* The above copyright notice and this permission notice shall be
15+
* included in all copies or substantial portions of the Software.<br>
16+
* <br>
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21+
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23+
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24+
*/
125
package services.moleculer.httpclient;
226

327
import java.util.HashMap;
@@ -88,14 +112,20 @@ public WebSocketConnection addMessageListener(Consumer<Tree> listener) {
88112

89113
@Override
90114
public void onOpen(WebSocket websocket) {
115+
116+
// Do nothing
91117
}
92118

93119
@Override
94120
public void onError(Throwable t) {
121+
122+
// Do nothing
95123
}
96124

97125
@Override
98126
public void onClose(WebSocket websocket, int code, String reason) {
127+
128+
// Do nothing
99129
}
100130

101131
@Override

src/test/java/services/moleculer/httpclient/HttpClientTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ public class HttpClientTest extends TestCase {
5050

5151
// --- VARIABLES ---
5252

53-
AtomicReference<Context> lastCtx = new AtomicReference<>();
54-
HttpClient cl = new HttpClient();
55-
ServiceBroker br;
53+
protected AtomicReference<Context> lastCtx = new AtomicReference<>();
54+
protected HttpClient cl = new HttpClient();
55+
protected ServiceBroker br;
5656

5757
// --- INIT / DESTROY TEST ---
5858

0 commit comments

Comments
 (0)