After reading this, I managed to use
Variable variable = executionImpl.getVariableObject(
"test");
HistoryEvent.fire(new VariableCreate(variable));
But now I don't know if it works, at least it does not give any error, but how can I get the history variables from a HistoryProcessInstance?