mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
#65 daemon mode default output
This commit is contained in:
parent
f4509fd097
commit
8aa93158d1
3 changed files with 23 additions and 13 deletions
|
|
@ -300,7 +300,7 @@ public class InputFactory {
|
|||
*/
|
||||
public static Input read(final InputStream inputStream, final String name, final String digestAlgorithm) {
|
||||
checkNull(inputStream);
|
||||
return read(new StreamSource(inputStream, name), digestAlgorithm);
|
||||
return read(new StreamSource(inputStream, name), name, digestAlgorithm);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -123,12 +123,15 @@ public class Validator {
|
|||
private static int startDaemonMode(final CommandLine cmd) {
|
||||
final Option[] unavailable = new Option[] { PRINT, CHECK_ASSERTIONS, DEBUG, OUTPUT, EXTRACT_HTML, REPORT_POSTFIX, REPORT_PREFIX };
|
||||
warnUnusedOptions(cmd, unavailable, true);
|
||||
final ConfigurationLoader config = Configuration.load(determineDefinition(cmd), determineRepository(cmd));
|
||||
final ConfigurationLoader config = getConfiguration(cmd);
|
||||
final Daemon validDaemon = new Daemon(determineHost(cmd), determinePort(cmd), determineThreads(cmd));
|
||||
if (cmd.hasOption(DISABLE_GUI.getOpt())) {
|
||||
validDaemon.setGuiEnabled(false);
|
||||
}
|
||||
validDaemon.startServer(config.build());
|
||||
final Configuration configuration = config.build();
|
||||
printScenarios(configuration);
|
||||
Printer.writeOut("\nStarting daemon mode ...");
|
||||
validDaemon.startServer(configuration);
|
||||
return DAEMON_SIGNAL;
|
||||
}
|
||||
|
||||
|
|
@ -146,11 +149,8 @@ public class Validator {
|
|||
long start = System.currentTimeMillis();
|
||||
final Option[] unavailable = new Option[] { HOST, PORT, WORKER_COUNT, DISABLE_GUI };
|
||||
warnUnusedOptions(cmd, unavailable, false);
|
||||
final URI scenarioLocation = determineDefinition(cmd);
|
||||
final URI repositoryLocation = determineRepository(cmd);
|
||||
reportConfiguration(scenarioLocation, repositoryLocation);
|
||||
final Configuration config = Configuration.load(scenarioLocation, repositoryLocation).build();
|
||||
|
||||
final Configuration config = getConfiguration(cmd).build();
|
||||
printScenarios(config);
|
||||
final InternalCheck check = new InternalCheck(config);
|
||||
final Path outputDirectory = determineOutputDirectory(cmd);
|
||||
|
||||
|
|
@ -173,7 +173,6 @@ public class Validator {
|
|||
if (cmd.hasOption(PRINT_MEM_STATS.getOpt())) {
|
||||
check.getCheckSteps().add(new PrintMemoryStats());
|
||||
}
|
||||
printScenarios(check.getConfiguration());
|
||||
log.info("Setup completed in {}ms\n", System.currentTimeMillis() - start);
|
||||
|
||||
final Collection<Path> targets = determineTestTargets(cmd);
|
||||
|
|
@ -207,6 +206,13 @@ public class Validator {
|
|||
}
|
||||
}
|
||||
|
||||
private static ConfigurationLoader getConfiguration(final CommandLine cmd) {
|
||||
final URI scenarioLocation = determineDefinition(cmd);
|
||||
final URI repositoryLocation = determineRepository(cmd);
|
||||
reportConfiguration(scenarioLocation, repositoryLocation);
|
||||
return Configuration.load(scenarioLocation, repositoryLocation);
|
||||
}
|
||||
|
||||
private static void reportConfiguration(final URI scenarioLocation, final URI repositoryLocation) {
|
||||
Printer.writeOut("Loading scenarios from {0}", scenarioLocation);
|
||||
Printer.writeOut("Using repository {0}", repositoryLocation);
|
||||
|
|
|
|||
|
|
@ -44,16 +44,18 @@ public class Daemon {
|
|||
|
||||
/**
|
||||
* Create a new daemon.
|
||||
*
|
||||
* @param hostname the interface to bind to
|
||||
* @param port the port to expose
|
||||
* @param threadCount the number of working threads
|
||||
*/
|
||||
public Daemon(final String hostname, final int port, final int threadCount) {
|
||||
this.bindAddress = hostname;
|
||||
this.port = port;
|
||||
this.port = port;
|
||||
this.threadCount = threadCount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Methode zum Starten des Servers
|
||||
*
|
||||
|
|
@ -73,9 +75,7 @@ public class Daemon {
|
|||
server.setExecutor(createExecutor());
|
||||
server.start();
|
||||
log.info("Server {} started", server.getAddress());
|
||||
if (!log.isInfoEnabled()) {
|
||||
writeOut("Server {0} started", server.getAddress());
|
||||
}
|
||||
writeOut("Daemon started. Visit http://{0}", this.bindAddress + ":" + this.port);
|
||||
} catch (final IOException e) {
|
||||
log.error("Error starting HttpServer for Valdidator: {}", e.getMessage(), e);
|
||||
}
|
||||
|
|
@ -101,4 +101,8 @@ public class Daemon {
|
|||
private InetSocketAddress getSocket() {
|
||||
return new InetSocketAddress(defaultIfBlank(this.bindAddress, DEFAULT_HOST), this.port > 0 ? this.port : DEFAULT_PORT);
|
||||
}
|
||||
|
||||
public static void shutdown() {
|
||||
System.out.println("bla");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue