Skip to content

Commit

Permalink
Diagnostic removal of ability to do test config :(
Browse files Browse the repository at this point in the history
  • Loading branch information
holly-cummins committed Dec 19, 2024
1 parent 8f86e16 commit 66daf33
Showing 1 changed file with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import org.eclipse.microprofile.config.ConfigProvider;
import org.junit.jupiter.api.ClassOrderer;
import org.junit.jupiter.api.ClassOrdererContext;
import org.junit.platform.commons.util.ReflectionUtils;

import io.quarkus.deployment.dev.testing.TestConfig;
import io.smallrye.config.SmallRyeConfig;

/**
Expand All @@ -16,15 +14,22 @@ public class QuarkusClassOrderer implements ClassOrderer {
private final ClassOrderer delegate;

public QuarkusClassOrderer() {
System.out.println("HOLLY class orderer TCCL is " + Thread.currentThread().getContextClassLoader());
System.out.println("HOLLY I AM " + this.getClass().getClassLoader());
ClassLoader original = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
SmallRyeConfig config = ConfigProvider.getConfig().unwrap(SmallRyeConfig.class);
TestConfig testConfig = config.getConfigMapping(TestConfig.class);

delegate = testConfig.classOrderer()
.map(klass -> ReflectionUtils.tryToLoadClass(klass)
.andThenTry(ReflectionUtils::newInstance)
.andThenTry(instance -> (ClassOrderer) instance)
.toOptional().orElse(EMPTY))
.orElse(EMPTY);
// TODO obviously a bad idea, diagnostic
delegate = EMPTY;
// TestConfig testConfig = config.getConfigMapping(TestConfig.class);
//
// delegate = testConfig.classOrderer()
// .map(klass -> ReflectionUtils.tryToLoadClass(klass)
// .andThenTry(ReflectionUtils::newInstance)
// .andThenTry(instance -> (ClassOrderer) instance)
// .toOptional().orElse(EMPTY))
// .orElse(EMPTY);
Thread.currentThread().setContextClassLoader(original);
}

@Override
Expand Down

0 comments on commit 66daf33

Please sign in to comment.