Don't log requests when rebuilding cache

This commit is contained in:
dotasek 2022-01-26 09:31:58 -05:00
parent 39e30a10c4
commit fdc6e02b49
1 changed files with 18 additions and 11 deletions

View File

@ -10,11 +10,14 @@ public class CacheVerificationLogger implements ToolingClientLogger {
public static final String FHIR_TXCACHE_REBUILD = "fhir.txcache.rebuild";
public static final String isRebuildingCache = System.getProperty(FHIR_TXCACHE_REBUILD);
@Getter
int requests = 0;
@Override
public void logRequest(String method, String url, List<String> headers, byte[] body) {
if (!isRebuildingCache()) {
System.err.println("Unexpected request to server");
System.err.println(method);
System.err.println(url);
@ -24,6 +27,7 @@ public class CacheVerificationLogger implements ToolingClientLogger {
System.err.println("Body");
System.err.println("----");
System.err.println(new String(body, StandardCharsets.UTF_8));
}
requests++;
}
@ -42,10 +46,13 @@ public class CacheVerificationLogger implements ToolingClientLogger {
}
public boolean verifyHasNoRequests() {
String isRebuildingCache = System.getProperty(FHIR_TXCACHE_REBUILD);
private boolean isRebuildingCache() {
return isRebuildingCache != null && "TRUE".equals(isRebuildingCache.toUpperCase());
}
if (isRebuildingCache != null && "TRUE".equals(isRebuildingCache.toUpperCase())) {
public boolean verifyHasNoRequests() {
if (isRebuildingCache()) {
return true;
} else {
if (requests != 0) {