Skip to content

Commit

Permalink
Fix UnsupportedOperationException (eclipse-tycho#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 committed Oct 22, 2023
1 parent 31f701b commit 9c345fa
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 9c345fa

Please sign in to comment.