Overview
TheDeployable interface defines the contract for managing the complete lifecycle of a service deployment in TNB. It extends JUnit’s BeforeAllCallback and AfterAllCallback to integrate seamlessly with test execution.
Package: software.tnb.common.deployment
Extends: BeforeAllCallback, AfterAllCallback
Core methods
deploy()
This method is called automatically by
beforeAll() when used as a JUnit extension.undeploy()
This method is called automatically by
afterAll() when used as a JUnit extension.openResources()
This method is called after
deploy() completes successfully.closeResources()
This method is called before
undeploy() is invoked.getLogs()
The service logs as a string.
Lifecycle methods
beforeAll()
deploy() followed by openResources().
The JUnit extension context.
afterAll()
closeResources() followed by undeploy().
The JUnit extension context.
Utility methods
restart()
The restart sequence is:
closeResources() → undeploy() → deploy() → openResources()enabled()
Returns
true by default, indicating the deployable is enabled.priority()
Returns
0 by default, indicating neutral priority.Usage example
Implementation notes
Implementations must provide concrete behavior for all abstract methods:
deploy(), undeploy(), openResources(), closeResources(), and getLogs().The interface provides sensible defaults for JUnit lifecycle hooks, making it easy to use deployables as test extensions.