4
4
import com .google .gson .JsonObject ;
5
5
import com .google .gson .reflect .TypeToken ;
6
6
import java .lang .reflect .Type ;
7
+ import java .util .LinkedList ;
7
8
import java .util .Map ;
8
9
import java .util .Properties ;
9
10
import org .apache .http .client .methods .HttpGet ;
@@ -33,14 +34,14 @@ public void createPool(String poolName) throws Exception {
33
34
poolBody .addProperty (Constants .POOL_NAME_KEY , poolName );
34
35
StringEntity body = new StringEntity (poolBody .toString ());
35
36
36
- String jsonResponse = HttpWrapper .doRequest (HttpPost .METHOD_NAME , url , null , body );
37
+ String jsonResponse = HttpWrapper .doRequest (HttpPost .METHOD_NAME , url , new LinkedList <>() , body );
37
38
JsonObject response = this .jsonUtil .fromJson (jsonResponse , JsonObject .class );
38
39
logger .info ("Response message: " + response .get (Constants .MSG_KEY ));
39
40
}
40
41
41
42
public Pool getPool (String poolName ) throws Exception {
42
43
String url = String .format (serviceBaseUrl + Endpoint .POOL , poolName );
43
- String jsonResponse = HttpWrapper .doRequest (HttpGet .METHOD_NAME , url , null );
44
+ String jsonResponse = HttpWrapper .doRequest (HttpGet .METHOD_NAME , url , new LinkedList <>() );
44
45
Pool pool = this .jsonUtil .fromJson (jsonResponse , Pool .class );
45
46
return pool ;
46
47
}
@@ -53,7 +54,7 @@ public void addNode(String poolName, String nodeAddress) throws Exception {
53
54
nodeBody .addProperty (Constants .ADDRESS_KEY , nodeAddress );
54
55
StringEntity body = new StringEntity (nodeBody .toString ());
55
56
56
- String jsonResponse = HttpWrapper .doRequest (HttpPost .METHOD_NAME , url , null , body );
57
+ String jsonResponse = HttpWrapper .doRequest (HttpPost .METHOD_NAME , url , new LinkedList <>() , body );
57
58
JsonObject response = this .jsonUtil .fromJson (jsonResponse , JsonObject .class );
58
59
logger .info ("Response message: " + response .get (Constants .MSG_KEY ));
59
60
}
@@ -62,7 +63,7 @@ public boolean containsPool(String poolName) throws Exception {
62
63
boolean answer = false ;
63
64
String url = serviceBaseUrl + Endpoint .POOLS ;
64
65
Type type = new TypeToken <Map <String , Pool >>() {}.getType ();
65
- String jsonResponse = HttpWrapper .doRequest (HttpGet .METHOD_NAME , url , null );
66
+ String jsonResponse = HttpWrapper .doRequest (HttpGet .METHOD_NAME , url , new LinkedList <>() );
66
67
Map <String , Pool > pools = this .jsonUtil .fromJson (jsonResponse , type );
67
68
if (pools .containsKey (poolName )) {
68
69
answer = true ;
0 commit comments