11/*
2- * Copyright © 2016, 2020 IBM Corp. All rights reserved.
2+ * Copyright © 2016, 2021 IBM Corp. All rights reserved.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
55 * except in compliance with the License. You may obtain a copy of the License at
1414
1515package com .cloudant .tests ;
1616
17- import static com .cloudant .http .internal .interceptors .IamCookieInterceptor .IAM_TOKEN_SERVER_URL_PROPERTY_KEY ;
1817import static com .cloudant .tests .util .MockWebServerResources .IAM_API_KEY ;
1918import static com .cloudant .tests .util .MockWebServerResources .IAM_TOKEN ;
2019import static com .cloudant .tests .util .MockWebServerResources .OK_IAM_COOKIE ;
2322
2423import com .cloudant .client .api .ClientBuilder ;
2524import com .cloudant .client .api .CloudantClient ;
25+ import com .cloudant .tests .extensions .MockIamWebServerExtension ;
2626import com .cloudant .tests .extensions .MockWebServerExtension ;
2727import com .cloudant .tests .util .HttpFactoryParameterizedTest ;
2828import com .cloudant .tests .util .MockWebServerResources ;
@@ -57,7 +57,7 @@ public class CloudFoundryServiceTest {
5757 public MockWebServerExtension mockWebServerExt = new MockWebServerExtension ();
5858
5959 @ RegisterExtension
60- public MockWebServerExtension mockIamServerExt = new MockWebServerExtension ();
60+ public MockWebServerExtension mockIamServerExt = new MockIamWebServerExtension ();
6161
6262 public MockWebServer server ;
6363 public MockWebServer mockIamServer ;
@@ -74,14 +74,6 @@ public void beforeEach() {
7474 mockServerHostPort = String .format ("%s:%s/" , server .getHostName (), server .getPort ());
7575 //setup mock IAM server
7676 mockIamServer = mockIamServerExt .get ();
77- // Override the default IAM token server with our test mock server
78- System .setProperty (IAM_TOKEN_SERVER_URL_PROPERTY_KEY , mockIamServer .url (iamTokenEndpoint )
79- .toString ());
80- }
81-
82- @ AfterEach
83- public void clearIAMMock () {
84- System .clearProperty (IAM_TOKEN_SERVER_URL_PROPERTY_KEY );
8577 }
8678
8779 private static class VCAPGenerator {
@@ -98,7 +90,7 @@ private static class VCAPGenerator {
9890 cloudantServices = new ArrayList <HashMap <String , Object >>();
9991 vcap .put (serviceName , cloudantServices );
10092 }
101-
93+
10294 private void addService (String name , String username , String password ,
10395 String host , String apikey ) {
10496 HashMap <String , Object > cloudantService = new HashMap <String , Object >();
0 commit comments