Skip to content

Commit

Permalink
create databases before tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt committed Sep 13, 2023
1 parent 82bca8a commit 289f4ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ public void afterAll(ExtensionContext extensionContext) throws Exception {
extension.afterTestExecution(extensionContext);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,20 @@
import org.eclipse.edc.junit.annotations.PostgresqlDbIntegrationTest;
import org.eclipse.edc.junit.extensions.EdcClassRuntimesExtension;
import org.eclipse.edc.junit.extensions.EdcRuntimeExtension;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.RegisterExtension;

import java.io.IOException;
import java.sql.SQLException;
import java.util.HashMap;

import static org.eclipse.edc.test.e2e.PostgresUtil.createDatabase;

@PostgresqlDbIntegrationTest
class EndToEndTransferPostgresqlTest extends AbstractEndToEndTransfer {

@RegisterExtension
static CreateDatabase createDatabase = new CreateDatabase();

@RegisterExtension
static EdcClassRuntimesExtension runtimes = new EdcClassRuntimesExtension(
new EdcRuntimeExtension(
Expand Down Expand Up @@ -66,10 +68,13 @@ class EndToEndTransferPostgresqlTest extends AbstractEndToEndTransfer {
)
);

@BeforeAll
static void beforeAll() throws SQLException, IOException, ClassNotFoundException {
createDatabase(CONSUMER);
createDatabase(PROVIDER);
private static class CreateDatabase implements BeforeAllCallback {

@Override
public void beforeAll(ExtensionContext context) throws Exception {
createDatabase(CONSUMER);
createDatabase(PROVIDER);
}
}

}

0 comments on commit 289f4ec

Please sign in to comment.