Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Current testing is often plagued with random OOM or ApplicationRegistry shutdowns at the end of the full ant test cycle.
Removing the old NullApplicationRegistry(NAR) that was a legacy Mock object will help us prevent such rouge application registries hanging around and consuming memory.
This will require a fair few changes to existing tests that assume there will be a running ApplicationRegistry. However, in most cases it will simply be a change from using TestCase to InternalBrokerBaseCase(IBBC).
The main problem with the NAR is that it sets most of the broker components to Null ... hence the name. However, with the scale of changes to the Java broker over the last 12 months the use of ApplicationRegistry.getInstance() as started appearting thoroughout the main broker code base and assumptions have been made that the returned instance will be fully configured. So no Null checks are performed.
Removing the NAR will not be major issue as it will actually clean up the code base as a number of test relied on to start the broker and then performed some configuration themselves. Now they can rely on IBBC to do the heavy lifting and override the configure() method if they need to make specifc changes to the way the broker runs. AMQQueueAlertTest is one such example. This test requires an increase in the Alerting period. This was historically tucked in to NAR so ALL test would run this thread every 200ms. Which in turn resulted in OOME issues during full tests runs. The solution at the time was to exclude the extra logging via log4j.
Now we can hae the AMQQAT simply up the alerting rate for its own purposes.
The use of IBBC will also allow a level of test somewhere between pure unit tests and test that use a client in systests. Tests that require a configured broker but really don't want to have to connect a client to exercise the broker and rely on the client code returning the right exceptions.
Hopefully will find some time to more fully document how we can leaverage the IBBC to create and integrogate components of the broker during a test.