Skip to content

Commit

Permalink
Map test classes the highest priority
Browse files Browse the repository at this point in the history
This means application.properties will be
picked up from src/test rather than src/main.
  • Loading branch information
stuartwdouglas committed May 3, 2021
1 parent 1d32f5e commit 2561bdf
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.quarkus.deployment.dev.testing;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
Expand All @@ -9,9 +11,9 @@

import org.jboss.logging.Logger;

import io.quarkus.bootstrap.app.AdditionalDependency;
import io.quarkus.bootstrap.app.CuratedApplication;
import io.quarkus.bootstrap.app.QuarkusBootstrap;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.deployment.dev.CompilationProvider;
import io.quarkus.deployment.dev.DevModeContext;
import io.quarkus.deployment.dev.QuarkusCompiler;
Expand Down Expand Up @@ -115,16 +117,17 @@ public void init() {
}
if (testCuratedApplication == null) {
try {
List<Path> paths = new ArrayList<>();
paths.add(Paths.get(context.getApplicationRoot().getTest().get().getClassesPath()));
paths.addAll(curatedApplication.getQuarkusBootstrap().getApplicationRoot().toList());
testCuratedApplication = curatedApplication.getQuarkusBootstrap().clonedBuilder()
.setMode(QuarkusBootstrap.Mode.TEST)
.setDisableClasspathCache(false)
.setIsolateDeployment(true)
.setBaseClassLoader(getClass().getClassLoader())
.setTest(true)
.setAuxiliaryApplication(true)
.addAdditionalApplicationArchive(new AdditionalDependency(
Paths.get(context.getApplicationRoot().getTest().get().getClassesPath()), true,
true))
.setApplicationRoot(PathsCollection.from(paths))
.build()
.bootstrap();
compiler = new QuarkusCompiler(testCuratedApplication, compilationProviders, context);
Expand Down

0 comments on commit 2561bdf

Please sign in to comment.