diff --git a/pom.xml b/pom.xml index ebf0ea5c..3ec5902b 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ UTF-8 quarkus-bom io.quarkus - 3.5.2 + 3.6.0 999-SNAPSHOT true 3.2.2 diff --git a/src/test/java/io/quarkus/search/app/fetching/FetchingServiceTest.java b/src/test/java/io/quarkus/search/app/fetching/FetchingServiceTest.java index c1e63ff0..affbafa9 100644 --- a/src/test/java/io/quarkus/search/app/fetching/FetchingServiceTest.java +++ b/src/test/java/io/quarkus/search/app/fetching/FetchingServiceTest.java @@ -9,9 +9,6 @@ import java.util.Set; import java.util.function.Consumer; -import io.quarkus.search.app.hibernate.InputProvider; -import io.quarkus.search.app.quarkusio.QuarkusIO; -import io.quarkus.search.app.quarkusio.QuarkusIOConfig; import jakarta.inject.Inject; import org.apache.commons.io.file.PathUtils; @@ -19,16 +16,16 @@ import org.assertj.core.api.SoftAssertions; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; +import org.eclipse.jgit.revwalk.RevCommit; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import org.eclipse.jgit.revwalk.RevCommit; -import org.mockito.Mockito; - import io.quarkus.search.app.entity.Guide; +import io.quarkus.search.app.hibernate.InputProvider; +import io.quarkus.search.app.quarkusio.QuarkusIO; import io.quarkus.search.app.testsupport.GitTestUtils; import io.quarkus.search.app.util.CloseableDirectory; import io.quarkus.test.component.QuarkusComponentTestExtension; @@ -106,15 +103,7 @@ static void deleteTmpDir() throws IOException { @RegisterExtension static final QuarkusComponentTestExtension extension = QuarkusComponentTestExtension.builder() - // It seems injecting config mappings isn't supported at the moment; - // see https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/QuarkusComponentTest.20and.20ConfigMapping - .mock(QuarkusIOConfig.class) - .createMockitoMock(mock -> { - Mockito.when(mock.gitUri()) - .thenReturn(tmpDir.path().toUri()); - Mockito.when(mock.webUri()) - .thenReturn(QuarkusIOConfig.WEB_URI_DEFAULT); - }) + .configProperty("quarkusio.git-uri", tmpDir.path().toString()) .build(); @Inject diff --git a/src/test/java/io/quarkus/search/app/testsupport/GitTestUtils.java b/src/test/java/io/quarkus/search/app/testsupport/GitTestUtils.java index f84e0cbf..381edf1a 100644 --- a/src/test/java/io/quarkus/search/app/testsupport/GitTestUtils.java +++ b/src/test/java/io/quarkus/search/app/testsupport/GitTestUtils.java @@ -1,20 +1,11 @@ package io.quarkus.search.app.testsupport; -import java.io.IOException; -import java.nio.file.CopyOption; -import java.nio.file.FileSystem; -import java.nio.file.FileSystems; -import java.nio.file.FileVisitResult; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.SimpleFileVisitor; -import java.nio.file.attribute.BasicFileAttributes; -import java.util.Map; +import org.eclipse.jgit.lib.Config; +import org.eclipse.jgit.lib.StoredConfig; +import org.eclipse.jgit.util.SystemReader; import org.jboss.logging.Logger; -import org.eclipse.jgit.util.SystemReader; - public final class GitTestUtils { private static final Logger LOG = Logger.getLogger(GitTestUtils.class); @@ -24,9 +15,23 @@ private GitTestUtils() { public static void cleanGitUserConfig() { try { - SystemReader.getInstance().getUserConfig().clear(); + clearRecursively(SystemReader.getInstance().getUserConfig()); } catch (Exception e) { - LOG.warn("Unable to clear the Git user config"); + LOG.warn("Unable to get Git user config"); + } + } + + private static void clearRecursively(Config config) { + if (config == null) { + return; + } + if (config instanceof StoredConfig) { + try { + ((StoredConfig) config).clear(); + } catch (Exception e) { + LOG.warnf("Unable to clear Git config %s", config); + } } + clearRecursively(config.getBaseConfig()); } }