TIBCO Streaming module JUnit tests with Query Tables report TransactionalMemoryLeakException
book
Article ID: KB0075306
calendar_today
Updated On:
Description
My JUnit tests for StreamBase modules which use Query Tables work when the table "Type" is "on heap" but fail with the following error when "In transactional memory":
INFO com.tibco.ep.dtm.stdout: com.tibco.ep.testing.framework.TransactionalMemoryLeakException: Managed object "default.QueryTableTest" leaked 1 instances
INFO com.tibco.ep.dtm.stdout: Managed object "default.ItemQT" leaked 1 instances
INFO com.tibco.ep.dtm.stdout: at com.tibco.ep.testing.framework.LeakDetect.end(LeakDetect.java:268)
INFO com.tibco.ep.dtm.stdout: at com.tibco.ep.testing.framework.UnitTest.complete(UnitTest.java:198)
Issue/Introduction
Set disableTransactionalMemoryLeakDetection for tests that leave rows in Query Tables
Resolution
The JUnit framework (com.tibco.ep.testing.framework.UnitTest) from which test classes inherit include a number of tests. One test is for objects left in Transactional Memory after the test. When a Query Table is "in transactional memory", its rows are objects in Transactional Memory and any rows remaining in the table at the end of the test trigger this leak failure.
You do not need to alter your StreamBase EventFlow module to remove all rows in order to be tested. Instead, modify the test code to skip this check by using:
this.disableTransactionalMemoryLeakDetection();
at the beginning of each test that needs it.
Additional controls are available in the Java API Guide
TIBCO Streaming > API Guide > API Guide Contents
"Java Client API"
Feedback
thumb_up
Yes
thumb_down
No