Skip to content

Commit

Permalink
Fix UnsupportedOperationException (#2938)
Browse files Browse the repository at this point in the history
OfflineModeTest fails with UnsupportedOperationException as HttpServer
no longer allows direct access to access logs. Change OfflineModeTest to
dedicated and limited mutation API for access logs.
  • Loading branch information
basilevs authored and laeubi committed Oct 22, 2023
1 parent e2de795 commit 5c928ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private void runAndVerifyOnlineBuild(Verifier verifier) throws VerificationExcep
verifier.executeGoal("integration-test");
verifier.verifyErrorFreeLog();
assertFalse(server.getAccessedUrls("test").isEmpty());
server.getAccessedUrls("test").clear();
server.clear();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,17 @@ public List<String> getAccessedUrls(String contextName) {
}
}

/**
* Reset state.
*
* Clear access logs. Does not affect configuration.
**/
public void clear() {
synchronized (contextName2accessedUrls) {
contextName2accessedUrls.clear();
}
}

private void registerContext(ServletContextHandler context) {
context.addFilter(new FilterHolder(new Monitoring()), "*", EnumSet.of(DispatcherType.REQUEST));
contexts.addHandler(context);
Expand Down

0 comments on commit 5c928ae

Please sign in to comment.