Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public void start() throws Exception {
args.add(path);
args.add("-Dquarkus.http.port=" + port);
args.add("-Dtest.url=" + TestHTTPResourceManager.getUri());
args.add("-Dquarkus.log.file.path=target/quarkus.log");
//args.add("-Dquarkus.log.file.path=target/quarkus.log");
PropertyTestUtil.setLogFileProperty();

System.out.println("Executing " + args);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright 2019 Red Hat, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.quarkus.test.common;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class PropertyTestUtil {

public static void setLogFileProperty() {
if (Files.isDirectory(Paths.get("build"))) {
System.setProperty("quarkus.log.file.path", "build" + File.separator + "quarkus.log");
} else
System.setProperty("quarkus.log.file.path", "target" + File.separator + "quarkus.log");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import io.quarkus.runner.RuntimeRunner;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.test.common.PropertyTestUtil;

public class QuarkusTest extends AbstractQuarkusTestRunner {

Expand All @@ -43,7 +44,7 @@ private static class QuarkusRunListener extends AbstractQuarkusRunListener {

@Override
protected void startQuarkus() {
System.setProperty("quarkus.log.file.path", "target/quarkus.log");
PropertyTestUtil.setLogFileProperty();
runtimeRunner = RuntimeRunner.builder()
.setLaunchMode(LaunchMode.TEST)
.setClassLoader(getClass().getClassLoader())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import io.quarkus.runner.RuntimeRunner;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.test.common.PathTestHelper;
import io.quarkus.test.common.PropertyTestUtil;
import io.quarkus.test.common.RestAssuredURLManager;
import io.quarkus.test.common.TestResourceManager;
import io.quarkus.test.common.http.TestHTTPResourceManager;
Expand Down Expand Up @@ -160,7 +161,7 @@ public void beforeAll(ExtensionContext extensionContext) throws Exception {
throw new RuntimeException("QuarkusUnitTest does not have archive producer set");
}

System.setProperty("quarkus.log.file.path", "target/quarkus.log");
PropertyTestUtil.setLogFileProperty();
ExtensionContext.Store store = extensionContext.getRoot().getStore(ExtensionContext.Namespace.GLOBAL);
if (store.get(TestResourceManager.class.getName()) == null) {
TestResourceManager manager = new TestResourceManager(extensionContext.getRequiredTestClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static io.quarkus.test.common.PathTestHelper.getTestClassesLocation;

import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -52,6 +53,7 @@
import io.quarkus.runner.TransformerTarget;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.test.common.NativeImageLauncher;
import io.quarkus.test.common.PropertyTestUtil;
import io.quarkus.test.common.RestAssuredURLManager;
import io.quarkus.test.common.TestInjectionManager;
import io.quarkus.test.common.TestResourceManager;
Expand All @@ -64,7 +66,7 @@ public void beforeAll(ExtensionContext context) throws Exception {
ExtensionContext root = context.getRoot();
ExtensionContext.Store store = root.getStore(ExtensionContext.Namespace.GLOBAL);
ExtensionState state = (ExtensionState) store.get(ExtensionState.class.getName());
System.setProperty("quarkus.log.file.path", "target/quarkus.log");
PropertyTestUtil.setLogFileProperty();
boolean substrateTest = context.getRequiredTestClass().isAnnotationPresent(SubstrateTest.class);
if (state == null) {
TestResourceManager testResourceManager = new TestResourceManager(context.getRequiredTestClass());
Expand Down