Additional testing of reverse workflow

* Added engine based tests for reverse workflow
* Fixed workflow handler tests
* Fixed the algorithm of searching next workflow tasks

Change-Id: I0ae430e9f4238a366b0c20abbf3e05753826e363