|
@@ -30,12 +30,12 @@ import org.slf4j.LoggerFactory;
|
|
*/
|
|
*/
|
|
public class RetryTestTokenProvider implements CustomTokenProviderAdaptee {
|
|
public class RetryTestTokenProvider implements CustomTokenProviderAdaptee {
|
|
|
|
|
|
- // Need to track first token fetch otherwise will get counted as a retry too.
|
|
|
|
- private static boolean isThisFirstTokenFetch = true;
|
|
|
|
- public static int reTryCount = 0;
|
|
|
|
|
|
+ private static final Logger LOG = LoggerFactory.getLogger(
|
|
|
|
+ RetryTestTokenProvider.class);
|
|
|
|
|
|
- private static final Logger LOG = LoggerFactory
|
|
|
|
- .getLogger(RetryTestTokenProvider.class);
|
|
|
|
|
|
+ // Need to track first token fetch otherwise will get counted as a retry too.
|
|
|
|
+ private boolean isThisFirstTokenFetch = true;
|
|
|
|
+ private int retryCount = 0;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void initialize(Configuration configuration, String accountName)
|
|
public void initialize(Configuration configuration, String accountName)
|
|
@@ -43,9 +43,13 @@ public class RetryTestTokenProvider implements CustomTokenProviderAdaptee {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public static void ResetStatusToFirstTokenFetch() {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Clear earlier retry details and reset RetryTestTokenProvider instance to
|
|
|
|
+ * state of first access token fetch call.
|
|
|
|
+ */
|
|
|
|
+ public void resetStatusToFirstTokenFetch() {
|
|
isThisFirstTokenFetch = true;
|
|
isThisFirstTokenFetch = true;
|
|
- reTryCount = 0;
|
|
|
|
|
|
+ retryCount = 0;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -53,7 +57,7 @@ public class RetryTestTokenProvider implements CustomTokenProviderAdaptee {
|
|
if (isThisFirstTokenFetch) {
|
|
if (isThisFirstTokenFetch) {
|
|
isThisFirstTokenFetch = false;
|
|
isThisFirstTokenFetch = false;
|
|
} else {
|
|
} else {
|
|
- reTryCount++;
|
|
|
|
|
|
+ retryCount++;
|
|
}
|
|
}
|
|
|
|
|
|
LOG.debug("RetryTestTokenProvider: Throw an exception in fetching tokens");
|
|
LOG.debug("RetryTestTokenProvider: Throw an exception in fetching tokens");
|
|
@@ -64,4 +68,13 @@ public class RetryTestTokenProvider implements CustomTokenProviderAdaptee {
|
|
public Date getExpiryTime() {
|
|
public Date getExpiryTime() {
|
|
return new Date();
|
|
return new Date();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static RetryTestTokenProvider getCurrentRetryTestProviderInstance(
|
|
|
|
+ AccessTokenProvider customTokenProvider) {
|
|
|
|
+ return (RetryTestTokenProvider) ((CustomTokenProviderAdapter) customTokenProvider).getCustomTokenProviderAdaptee();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public int getRetryCount() {
|
|
|
|
+ return retryCount;
|
|
|
|
+ }
|
|
}
|
|
}
|