Case Data is inserted twice in SpringBoot because 2 different Command scoped entity managers are used when AddDataCaseFileInstanceCommand is called. As a part of its execution, at first processEventSupport.fireAfterVariableChanged() is called, which results in call to NotifyParentCaseEventListener (afterVariableChanged method) which then calls afterCaseDataAdded on all CaseEventListeners. Second, as a part of the command as well, caseEventSupport.fireAfterCaseDataAdded is called which calls afterCaseDataAdded in CaseInstanceAuditEventListener again. On KIE Server it works because there CaseInstanceAuditEventListener will query already inserted data, since it is doing it using the same entity manager. In Springboot, there is each time a different entity manager, so the second run doesn't see already inserted data.
The test which was failing is: