Don't log requests when rebuilding cache
This commit is contained in:
parent
39e30a10c4
commit
fdc6e02b49
|
@ -10,20 +10,24 @@ public class CacheVerificationLogger implements ToolingClientLogger {
|
||||||
|
|
||||||
public static final String FHIR_TXCACHE_REBUILD = "fhir.txcache.rebuild";
|
public static final String FHIR_TXCACHE_REBUILD = "fhir.txcache.rebuild";
|
||||||
|
|
||||||
|
public static final String isRebuildingCache = System.getProperty(FHIR_TXCACHE_REBUILD);
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
int requests = 0;
|
int requests = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void logRequest(String method, String url, List<String> headers, byte[] body) {
|
public void logRequest(String method, String url, List<String> headers, byte[] body) {
|
||||||
System.err.println("Unexpected request to server");
|
if (!isRebuildingCache()) {
|
||||||
System.err.println(method);
|
System.err.println("Unexpected request to server");
|
||||||
System.err.println(url);
|
System.err.println(method);
|
||||||
for (String header : headers) {
|
System.err.println(url);
|
||||||
System.err.println("Header: " + header);
|
for (String header : headers) {
|
||||||
|
System.err.println("Header: " + header);
|
||||||
|
}
|
||||||
|
System.err.println("Body");
|
||||||
|
System.err.println("----");
|
||||||
|
System.err.println(new String(body, StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
System.err.println("Body");
|
|
||||||
System.err.println("----");
|
|
||||||
System.err.println(new String(body, StandardCharsets.UTF_8));
|
|
||||||
requests++;
|
requests++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,10 +46,13 @@ public class CacheVerificationLogger implements ToolingClientLogger {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean verifyHasNoRequests() {
|
private boolean isRebuildingCache() {
|
||||||
String isRebuildingCache = System.getProperty(FHIR_TXCACHE_REBUILD);
|
return isRebuildingCache != null && "TRUE".equals(isRebuildingCache.toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
if (isRebuildingCache != null && "TRUE".equals(isRebuildingCache.toUpperCase())) {
|
public boolean verifyHasNoRequests() {
|
||||||
|
|
||||||
|
if (isRebuildingCache()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (requests != 0) {
|
if (requests != 0) {
|
||||||
|
|
Loading…
Reference in New Issue