@Inject
private Event<CleanupDataUsingScript> cleanUpDataUsingScriptEvent;
public void prepareDatabase(@Observes(precedence = 40) BeforePersistenceTest beforePersistenceTest)
{
final PersistenceExtensionFeatureResolver persistenceExtensionFeatureResolver = persistenceExtensionFeatureResolverInstance.get();
if (persistenceExtensionFeatureResolver.shouldCleanupBefore())
{
cleanUpDataEvent.fire(new CleanupData(beforePersistenceTest, persistenceExtensionFeatureResolver.getCleanupStragety()));
}
if (persistenceExtensionFeatureResolver.shouldCleanupUsingScriptBefore())
{
final SqlScriptProvider<CleanupUsingScript> scriptsProvider = createScriptProvider();
cleanUpDataUsingScriptEvent.fire(new CleanupDataUsingScript(beforePersistenceTest, scriptsProvider.getDescriptorsDefinedFor(beforePersistenceTest.getTestMethod())));
}
}