38
38
import com .emc .rest .smart .LoadBalancer ;
39
39
import com .emc .rest .smart .ecs .Vdc ;
40
40
import com .emc .rest .smart .ecs .VdcHost ;
41
- import com .sun .jersey .api .client .ClientHandler ;
42
- import com .sun .jersey .api .client .ClientHandlerException ;
43
41
import com .sun .jersey .api .client .ClientRequest ;
44
42
import com .sun .jersey .api .client .ClientResponse ;
45
43
import com .sun .jersey .api .client .filter .Filterable ;
@@ -65,7 +63,10 @@ public class GeoPinningTest extends AbstractS3ClientTest {
65
63
@ Override
66
64
protected S3Config createS3Config () throws Exception {
67
65
S3Config s3Config = super .createS3Config ();
66
+
67
+ // won't work with VHost or if smart-client is disabled
68
68
Assume .assumeFalse (s3Config .isUseVHost ());
69
+ Assume .assumeTrue (s3Config .isSmartClient ());
69
70
70
71
// just going to use the same VDC thrice for lack of a geo env.
71
72
List <? extends Host > hosts = s3Config .getVdcs ().get (0 ).getHosts ();
@@ -94,7 +95,7 @@ protected S3Client createS3Client() throws Exception {
94
95
}
95
96
96
97
@ Test
97
- public void testGuidExtraction () throws Exception {
98
+ public void testGuidExtraction () {
98
99
Assert .assertEquals ("my/object/key" , GeoPinningUtil .getGeoId (getTestBucket (), "my/object/key" ));
99
100
Assert .assertEquals ("/my/object/key" , GeoPinningUtil .getGeoId (getTestBucket (), "/my/object/key" ));
100
101
@@ -123,7 +124,7 @@ public void testGeoPinningAlgorithm() {
123
124
public void testVetoRule () {
124
125
Vdc good = new Vdc ("good1" , "good2" , "good3" );
125
126
Vdc bad = new Vdc ("bad1" , "bad2" , "bad3" );
126
- Map <String , Object > properties = new HashMap <String , Object >();
127
+ Map <String , Object > properties = new HashMap <>();
127
128
properties .put (GeoPinningRule .PROP_GEO_PINNED_VDC , good );
128
129
129
130
HostVetoRule geoPinningRule = new GeoPinningRule ();
@@ -255,22 +256,17 @@ protected void testBucketDistribution(String bucket, int vdcIndex) {
255
256
}
256
257
}
257
258
258
- private class DummyClient extends Filterable {
259
+ private static class DummyClient extends Filterable {
259
260
public DummyClient () {
260
- super (new ClientHandler () {
261
- @ Override
262
- public ClientResponse handle (ClientRequest cr ) throws ClientHandlerException {
263
- return new ClientResponse (200 , new InBoundHeaders (), new ByteArrayInputStream (new byte [0 ]), new DummyWorkers ());
264
- }
265
- });
261
+ super (cr -> new ClientResponse (200 , new InBoundHeaders (), new ByteArrayInputStream (new byte [0 ]), new DummyWorkers ()));
266
262
}
267
263
268
264
public ClientResponse handle (ClientRequest request ) {
269
265
return getHeadHandler ().handle (request );
270
266
}
271
267
}
272
268
273
- private class DummyWorkers implements MessageBodyWorkers {
269
+ private static class DummyWorkers implements MessageBodyWorkers {
274
270
@ Override
275
271
public Map <MediaType , List <MessageBodyReader >> getReaders (MediaType mediaType ) {
276
272
return null ;
0 commit comments