eclipse-ee4j / eclipse-ee4j/jersey

InMemoryTestContainer does not call "onStartup" and "onShutdown"

Open
#3,230 3 comments 0 reactions 0 assignees View on GitHub
Priority: Major Type: Bug
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

In the "start" and "stop" methods of the TestContainer, the internal ApplicationHandler's "onStartup" and onShutdown" methods need to be called to make sure that registered ContainerLifecycleListeners are executed.

```
@Override
public void start() {
if (started.compareAndSet(false, true)) {
LOGGER.log(Level.FINE, "Starting InMemoryContainer...");
// this line needs to be added:
appHandler.onStartup(null);
} else {
LOGGER.log(Level.WARNING, "Ignoring start request - InMemoryTestContainer is already started.");
}
}

@Override
public void stop() {
if (started.compareAndSet(true, false)) {
LOGGER.log(Level.FINE, "Stopping InMemoryContainer...");
// this line needs to be added:
appHandler.onShutdown(null);
} else {
LOGGER.log(Level.WARNING, "Ignoring stop request - InMemoryTestContainer is already stopped.");
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.