Skip to content

Commit

Permalink
Merge pull request #19899 from rsvoboda/DevServicesContext
Browse files Browse the repository at this point in the history
Use DevServicesContext instead of deprecated QuarkusIntegrationTest.Context
  • Loading branch information
geoand authored Oct 12, 2021
2 parents 2bd5fb0 + db46a03 commit c74474c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import io.quarkus.test.common.DevServicesContext;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@QuarkusIntegrationTest
@DisabledOnOs(OS.WINDOWS)
class MongoDbRestDataPanacheIT extends MongoDbRestDataPanacheTest {

QuarkusIntegrationTest.Context context;
DevServicesContext context;

@Test
public void testDevServicesProperties() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

import org.junit.jupiter.api.Test;

import io.quarkus.test.common.DevServicesContext;
import io.quarkus.test.junit.QuarkusIntegrationTest;

@QuarkusIntegrationTest
public class BearerTokenAuthorizationInGraalITCase extends BearerTokenAuthorizationTest {

QuarkusIntegrationTest.Context context;
DevServicesContext context;

@Test
public void testDevServicesProperties() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void injectTestContext(Object testInstance) {
Class<?> c = testInstance.getClass();
while (c != Object.class) {
for (Field f : c.getDeclaredFields()) {
if (f.getType().equals(QuarkusIntegrationTest.Context.class)) {
if (f.getType().equals(DevServicesContext.class)) {
try {
f.setAccessible(true);
f.set(testInstance, createTestContext());
Expand All @@ -242,7 +242,7 @@ private void injectTestContext(Object testInstance) {
}
}

private QuarkusIntegrationTest.Context createTestContext() {
private DevServicesContext createTestContext() {
Map<String, String> devServicesPropsCopy = devServicesProps.isEmpty() ? Collections.emptyMap()
: Collections.unmodifiableMap(devServicesProps);
return new DefaultQuarkusIntegrationTestContext(devServicesPropsCopy);
Expand Down Expand Up @@ -293,7 +293,7 @@ public ArtifactLauncher.InitContext.DevServicesLaunchResult devServicesLaunchRes
}
}

private static class DefaultQuarkusIntegrationTestContext implements QuarkusIntegrationTest.Context {
private static class DefaultQuarkusIntegrationTestContext implements DevServicesContext {

private final Map<String, String> map;

Expand Down

0 comments on commit c74474c

Please sign in to comment.