Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package io.quarkus.test.bootstrap;
import static io.quarkus.runtime.util.StringUtil.hyphenate;
import static io.quarkus.test.utils.AwaitilityUtils.AwaitilitySettings;
import static io.quarkus.test.utils.AwaitilityUtils.untilIsTrue;
import static io.quarkus.test.utils.TestExecutionProperties.isThisCliApp;
import static io.quarkus.test.utils.TestExecutionProperties.isThisStartedCliApp;
import static io.quarkus.test.utils.TestExecutionProperties.rememberThisAppStarted;
import static org.junit.jupiter.api.Assertions.fail;
import java.nio.file.Path;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;
import io.quarkus.test.configuration.Configuration;
import io.quarkus.test.logging.Log;
import io.quarkus.test.services.URILike;
import io.quarkus.test.utils.FileUtils;
import io.quarkus.test.utils.LogsVerifier;
import io.quarkus.test.utils.PropertiesUtils;
import io.quarkus.test.utils.TestExecutionProperties;
public class BaseService implements Service {
public static final String SERVICE_STARTUP_TIMEOUT = "startup.timeout";
public static final Duration SERVICE_STARTUP_TIMEOUT_DEFAULT = Duration.ofMinutes(5);
public static final String DELETE_FOLDER_ON_EXIT = "delete.folder.on.exit";
private static final String SERVICE_STARTUP_CHECK_POLL_INTERVAL = "startup.check-poll-interval";
private static final Duration SERVICE_STARTUP_CHECK_POLL_INTERVAL_DEFAULT = Duration.ofSeconds(2);
protected ServiceContext context;
private final ServiceLoader listeners = ServiceLoader.load(ServiceListener.class);
private final List onPreStartActions = new LinkedList<>();
private final List onPreStopActions = new LinkedList<>();
private final List onPostStartActions = new LinkedList<>();
private final Map properties = new HashMap<>();
private final List futureProperties = new LinkedList<>();
private ManagedResourceBuilder managedResourceBuilder;
private ManagedResource managedResource;
private String serviceName;
private Configuration configuration;
private boolean autoStart = true;
@Override
public String getScenarioId() {
return context.getScenarioId();
}
@Override
public String getName() {
return serviceName;
}
@Override
public String getDisplayName() {
return managedResource.getDisplayName();
}
@Override
public Configuration getConfiguration() {
return configuration;
}
@Override
public boolean isAutoStart() {
return autoStart;
}
public T onPreStart(Action action) {
onPreStartActions.add(action);
return (T) this;
}
public T onPreStop(Action action) {
onPreStopActions.add(action);
return (T) this;
}
public T onPostStart(Action action) {
onPostStartActions.add(action);
return (T) this;
}
public T setAutoStart(boolean autoStart) {
this.autoStart = autoStart;
return (T) this;
}
/**
* The runtime configuration property to be used if the built artifact is
* configured to be run.
*/
public T withProperties(String... propertiesFiles) {
properties.clear();
Stream.of(propertiesFiles).map(PropertiesUtils::toMap).forEach(properties::putAll);
return (T) this;
}
/**
* The runtime configuration property to be used if the built artifact is
* configured to be run.
*
* NOTE: unlike other {@link this::withProperties}, here we add new properties and keep the old ones
*/
public T withProperties(Supplier