@@ -521,10 +521,11 @@ public void testJmxManagement()
521521 .findFirst () .orElse (new LinkedHashMap ());
522522 String sJmxURl = (String ) mapJmxManagement .get ("href" );
523523
524- response = m_client .target (sJmxURl ).request ().get ();
524+ target = m_client .target (sJmxURl );
525+ response = target .request ().get ();
525526 assertThat (response .getStatus (), is (Response .Status .OK .getStatusCode ()));
526527
527- mapResponse = new LinkedHashMap (response . readEntity (LinkedHashMap . class ));
528+ mapResponse = new LinkedHashMap (readEntity (target , response ));
528529 assertThat (mapResponse , notNullValue ());
529530 assertThat (mapResponse .get ("refreshOnQuery" ), is (false ));
530531 assertThat (mapResponse .get ("expiryDelay" ), is (1000 ));
@@ -639,11 +640,12 @@ public void testMembers()
639640
640641 String sJmxURl = getLink (mapEntity , "members" );
641642
642- response = m_client .target (sJmxURl ).request ().get ();
643+ target = m_client .target (sJmxURl );
644+ response = target .request ().get ();
643645
644646 assertThat (response .getStatus (), is (Response .Status .OK .getStatusCode ()));
645647
646- LinkedHashMap mapResponse = new LinkedHashMap (response . readEntity (LinkedHashMap . class ));
648+ LinkedHashMap mapResponse = new LinkedHashMap (readEntity (target , response ));
647649 assertThat (mapEntity , notNullValue ());
648650
649651 List <LinkedHashMap > listMemberMaps = (List <LinkedHashMap >) mapResponse .get ("items" );
@@ -662,13 +664,12 @@ public void testMembers()
662664 Object oMemberLinks = mapMember .get ("links" );
663665 assertThat (oMemberLinks , instanceOf (List .class ));
664666
665- String sMemberUrl = getSelfLink (mapMember );
666-
667- response = m_client .target (sMemberUrl ).request ().get ();
667+ target = m_client .target (getSelfLink (mapMember ));
668+ response = target .request ().get ();
668669
669670 assertThat (response .getStatus (), is (Response .Status .OK .getStatusCode ()));
670671
671- mapResponse = new LinkedHashMap (response . readEntity (LinkedHashMap . class ));
672+ mapResponse = new LinkedHashMap (readEntity (target , response ));
672673 assertThat (mapResponse .get ("id" ), is (oId ));
673674 }
674675 }
@@ -995,12 +996,11 @@ public void testServiceInfo()
995996 assertThat (mapDistScheme .get ("name" ), is (SERVICE_NAME ));
996997 assert (((Collection ) mapDistScheme .get ("type" )).contains (SERVICE_TYPE ));
997998
998- String sSelfLink = getSelfLink (mapDistScheme );
999-
1000- response = m_client .target (sSelfLink ).request ().get ();
999+ target = m_client .target (getSelfLink (mapDistScheme ));
1000+ response = target .request ().get ();
10011001 assertThat (response .getStatus (), is (Response .Status .OK .getStatusCode ()));
10021002
1003- LinkedHashMap mapService = new LinkedHashMap (response . readEntity (LinkedHashMap . class ));
1003+ LinkedHashMap mapService = new LinkedHashMap (readEntity (target , response ));
10041004 assertThat (mapService , notNullValue ());
10051005 assertThat (mapService .get ("name" ), is (mapDistScheme .get ("name" )));
10061006
@@ -1009,11 +1009,10 @@ public void testServiceInfo()
10091009 assertThat (mapProxyScheme .get ("name" ), is (sMoRESTProxy ));
10101010 assertThat ((Collection <String >) mapProxyScheme .get ("type" ), Matchers .hasItem ("Proxy" ));
10111011
1012- sSelfLink = getSelfLink (mapProxyScheme );
1013-
1014- response = m_client .target (sSelfLink ).request ().get ();
1012+ target = m_client .target (getSelfLink (mapProxyScheme ));
1013+ response = target .request ().get ();
10151014 assertThat (response .getStatus (), is (Response .Status .OK .getStatusCode ()));
1016- mapService = new LinkedHashMap (response . readEntity (LinkedHashMap . class ));
1015+ mapService = new LinkedHashMap (readEntity (target , response ));
10171016 assertThat (mapService , notNullValue ());
10181017 String sName = (String ) mapService .get ("name" );
10191018 assertThat (sName , is (mapProxyScheme .get ("name" )));
@@ -1086,9 +1085,10 @@ public void testPartitionInfo()
10861085
10871086 String sSelfUrl = getSelfLink (mapResponse );
10881087
1089- response = m_client .target (sSelfUrl ).request ().get ();
1088+ target = m_client .target (sSelfUrl );
1089+ response = target .request ().get ();
10901090 assertThat (response .getStatus (), is (Response .Status .OK .getStatusCode ()));
1091- LinkedHashMap mapPartitionResponse = new LinkedHashMap (response . readEntity (LinkedHashMap . class ));
1091+ LinkedHashMap mapPartitionResponse = new LinkedHashMap (readEntity (target , response ));
10921092 assertThat (mapPartitionResponse , is (mapResponse ));
10931093 }
10941094
@@ -1794,10 +1794,11 @@ public void testFrontCaches()
17941794 LinkedHashMap mapResponse = new LinkedHashMap (readEntity (target , response ));
17951795
17961796 String sMembersUrl = getLink (mapResponse , "members" );
1797- response = m_client .target (sMembersUrl ).queryParam ("tier" , "front" ).request ().get ();
1797+ target = m_client .target (sMembersUrl ).queryParam ("tier" , "front" );
1798+ response = target .request ().get ();
17981799 assertThat (response .getStatus (), is (Response .Status .OK .getStatusCode ()));
17991800
1800- LinkedHashMap mapCacheMembers = new LinkedHashMap (response . readEntity (LinkedHashMap . class ));
1801+ LinkedHashMap mapCacheMembers = new LinkedHashMap (readEntity (target , response ));
18011802 assertThat (mapCacheMembers , notNullValue ());
18021803
18031804 List <LinkedHashMap > listCacheMembers = (List <LinkedHashMap >) mapCacheMembers .get ("items" );
@@ -1822,10 +1823,11 @@ public void testFrontAndBackCaches()
18221823 LinkedHashMap mapResponse = new LinkedHashMap (readEntity (target , response ));
18231824
18241825 String sMembersUrl = getLink (mapResponse , "members" );
1825- response = m_client .target (sMembersUrl ).request ().get ();
1826+ target = m_client .target (sMembersUrl );
1827+ response = target .request ().get ();
18261828 assertThat (response .getStatus (), is (Response .Status .OK .getStatusCode ()));
18271829
1828- LinkedHashMap mapCacheMembers = new LinkedHashMap (response . readEntity (LinkedHashMap . class ));
1830+ LinkedHashMap mapCacheMembers = new LinkedHashMap (readEntity (target , response ));
18291831 assertThat (mapCacheMembers , notNullValue ());
18301832
18311833 List <LinkedHashMap > listCacheMembers = (List <LinkedHashMap >) mapCacheMembers .get ("items" );
@@ -2566,9 +2568,9 @@ private void testCachesResponse(WebTarget target, Response response)
25662568 assertThat (Integer .valueOf ((Integer ) mapCache .get ("size" )), greaterThan (0 ));
25672569 }
25682570
2569- Response cachesResponse = getBaseTarget ().path ("caches" ).queryParam ("fields" , "totalPuts" )
2570- .request ().get ();
2571- mapResponse = new LinkedHashMap (cachesResponse . readEntity (LinkedHashMap . class ));
2571+ WebTarget cachesTarget = getBaseTarget ().path ("caches" ).queryParam ("fields" , "totalPuts" );
2572+ Response cachesResponse = cachesTarget .request ().get ();
2573+ mapResponse = new LinkedHashMap (readEntity (cachesTarget , cachesResponse ));
25722574 listCacheMaps = (List <LinkedHashMap >) mapResponse .get ("items" );
25732575 assertThat (listCacheMaps , notNullValue ());
25742576 assertThat (listCacheMaps .size (), greaterThan (1 ));
@@ -2579,9 +2581,9 @@ private void testCachesResponse(WebTarget target, Response response)
25792581 assertThat ((Integer ) mapCache .get ("totalPuts" ), greaterThan (0 ));
25802582 }
25812583
2582- cachesResponse = getBaseTarget ().path ("caches" ).queryParam ("fields" , "units" )
2583- .request ().get ();
2584- mapResponse = new LinkedHashMap (cachesResponse . readEntity (LinkedHashMap . class ));
2584+ cachesTarget = getBaseTarget ().path ("caches" ).queryParam ("fields" , "units" );
2585+ cachesResponse = cachesTarget .request ().get ();
2586+ mapResponse = new LinkedHashMap (readEntity (cachesTarget , cachesResponse ));
25852587 listCacheMaps = (List <LinkedHashMap >) mapResponse .get ("items" );
25862588 assertThat (listCacheMaps , notNullValue ());
25872589
@@ -2598,9 +2600,9 @@ private void testCachesResponse(WebTarget target, Response response)
25982600 }
25992601 }
26002602
2601- cachesResponse = getBaseTarget ().path ("caches" ).queryParam ("fields" , "insertCount" )
2602- .request ().get ();
2603- mapResponse = new LinkedHashMap (cachesResponse . readEntity (LinkedHashMap . class ));
2603+ cachesTarget = getBaseTarget ().path ("caches" ).queryParam ("fields" , "insertCount" );
2604+ cachesResponse = cachesTarget .request ().get ();
2605+ mapResponse = new LinkedHashMap (readEntity (cachesTarget , cachesResponse ));
26042606 listCacheMaps = (List <LinkedHashMap >) mapResponse .get ("items" );
26052607 assertThat (listCacheMaps , notNullValue ());
26062608
@@ -2828,11 +2830,11 @@ protected void testDistServicesInfo(LinkedHashMap mapResponse)
28282830 }
28292831 assertThat (cServices , is (2 ));
28302832
2831- response = getBaseTarget ().path ("services" ).queryParam ("fields" , "taskCount" )
2833+ target = getBaseTarget ().path ("services" ).queryParam ("fields" , "taskCount" )
28322834 .queryParam ("collector" , "list" )
2833- .queryParam ("role" , "*" )
2834- .request ().get ();
2835- mapResponse = new LinkedHashMap (response . readEntity (LinkedHashMap . class ));
2835+ .queryParam ("role" , "*" );
2836+ response = target .request ().get ();
2837+ mapResponse = new LinkedHashMap (readEntity (target , response ));
28362838 listServiceMaps = (List <LinkedHashMap >) mapResponse .get ("items" );
28372839 assertThat (listServiceMaps , notNullValue ());
28382840 assertThat (listServiceMaps .size (), greaterThan (1 ));
0 commit comments