DATAMONGO-717 - Forward port of test case.

Added a testcase to show the lifecycle callbacks are invoked in the appropriate order.