|
38 | 38 | import org.eclipse.edc.junit.annotations.EndToEndTest;
|
39 | 39 | import org.eclipse.edc.junit.annotations.PostgresqlIntegrationTest;
|
40 | 40 | import org.eclipse.edc.spi.result.Result;
|
| 41 | +import org.eclipse.edc.sql.testfixtures.PostgresqlEndToEndExtension; |
41 | 42 | import org.eclipse.edc.validator.spi.ValidationResult;
|
42 | 43 | import org.hamcrest.Matchers;
|
43 | 44 | import org.jetbrains.annotations.NotNull;
|
44 | 45 | import org.junit.jupiter.api.BeforeAll;
|
45 | 46 | import org.junit.jupiter.api.Nested;
|
| 47 | +import org.junit.jupiter.api.Order; |
46 | 48 | import org.junit.jupiter.api.Test;
|
| 49 | +import org.junit.jupiter.api.extension.BeforeAllCallback; |
47 | 50 | import org.junit.jupiter.api.extension.RegisterExtension;
|
48 | 51 |
|
49 | 52 | import java.time.Duration;
|
|
52 | 55 | import static io.restassured.http.ContentType.JSON;
|
53 | 56 | import static org.assertj.core.api.Assertions.assertThat;
|
54 | 57 | import static org.awaitility.Awaitility.await;
|
| 58 | +import static org.eclipse.edc.identityhub.tests.dcp.fixtures.IssuanceFlowConfig.identityHubConfig; |
| 59 | +import static org.eclipse.edc.identityhub.tests.dcp.fixtures.IssuanceFlowConfig.issuerConfig; |
55 | 60 | import static org.eclipse.edc.identityhub.tests.fixtures.common.TestFunctions.base64Encode;
|
56 | 61 | import static org.mockito.ArgumentMatchers.any;
|
57 | 62 | import static org.mockito.ArgumentMatchers.eq;
|
@@ -214,13 +219,30 @@ class InMemory extends Tests {
|
214 | 219 | @PostgresqlIntegrationTest
|
215 | 220 | class Postgres extends Tests {
|
216 | 221 |
|
| 222 | + @Order(0) |
217 | 223 | @RegisterExtension
|
218 |
| - static IssuerServiceEndToEndExtension issuerService = IssuerServiceEndToEndExtension.Postgres |
219 |
| - .withConfig(IssuanceFlowConfig::issuerConfig); |
| 224 | + static final PostgresqlEndToEndExtension POSTGRESQL_EXTENSION = new PostgresqlEndToEndExtension(); |
| 225 | + private static final String ISSUER = "issuer"; |
| 226 | + |
| 227 | + @Order(2) |
| 228 | + @RegisterExtension |
| 229 | + static final IssuerServiceEndToEndExtension ISSUER_SERVICE = IssuerServiceEndToEndExtension.Postgres |
| 230 | + .withConfig(cfg -> |
| 231 | + issuerConfig(cfg).merge(POSTGRESQL_EXTENSION.configFor(ISSUER))); |
| 232 | + private static final String IDENTITY_HUB = "identityhub"; |
| 233 | + @Order(1) // must be the first extension to be evaluated since it starts the DB server |
| 234 | + @RegisterExtension |
| 235 | + static final BeforeAllCallback POSTGRES_CONTAINER_STARTER = context -> { |
| 236 | + POSTGRESQL_EXTENSION.createDatabase(ISSUER); |
| 237 | + POSTGRESQL_EXTENSION.createDatabase(IDENTITY_HUB); |
| 238 | + }; |
220 | 239 |
|
| 240 | + @Order(2) |
221 | 241 | @RegisterExtension
|
222 |
| - static IdentityHubEndToEndExtension credentialService = IdentityHubEndToEndExtension.Postgres |
223 |
| - .withConfig(IssuanceFlowConfig::identityHubConfig); |
| 242 | + static final IdentityHubEndToEndExtension CREDENTIAL_SERVICE = IdentityHubEndToEndExtension.Postgres |
| 243 | + .withConfig((cfg) -> |
| 244 | + identityHubConfig(cfg).merge(POSTGRESQL_EXTENSION.configFor(IDENTITY_HUB))); |
| 245 | + |
224 | 246 |
|
225 | 247 | }
|
226 | 248 | }
|
0 commit comments