@Test public void testWrite() throws Exception { File logFile = temporaryFolder.newFile("keyout.log"); KeyOutWriter writer = new KeyOutWriter( ImmutableList.<String>of(), true, false, logFile.getAbsolutePath(), null, null, null, null, ImmutableMap.<String, Object>of() ); Server server = dummyServer(); Query query = dummyQuery(); writer.validateSetup(server, query); writer.doWrite(server, query, singleNumericResult()); String log = Files.toString(logFile, Charset.forName("UTF-8")); assertThat(log.trim()).isEqualTo("host_example_net_4321.MemoryAlias.ObjectPendingFinalizationCount\t10\t0"); }
@Override public void validateSetup(Server server, Query query) throws ValidationException { Logger logger; if (loggers.containsKey(outputFile)) { logger = getLogger(outputFile); }else{ try { logger = buildLogger(outputFile); loggers.put(outputFile, logger); } catch (IOException e) { throw new ValidationException("Failed to setup logback", query, e); } } logwriter = new LogWriter(logger,delimiter); }
KeyOutWriter extends BaseOutputWriter { @Override public void validateSetup(Server server, Query query) throws ValidationException { Logger logger; if (loggers.containsKey(outputFile)) { logger = getLogger(outputFile); }else{ try { logger = buildLogger(outputFile); loggers.put(outputFile, logger); } catch (IOException e) { throw new ValidationException("Failed to setup logback", query, e); } } logwriter = new LogWriter(logger,delimiter); } }
KeyOutWriter extends BaseOutputWriter { @Override public void validateSetup(Server server, Query query) throws ValidationException { Logger logger; if (loggers.containsKey(outputFile)) { logger = getLogger(outputFile); }else{ try { logger = buildLogger(outputFile); loggers.put(outputFile, logger); } catch (IOException e) { throw new ValidationException("Failed to setup logback", query, e); } } logwriter = new LogWriter(logger,delimiter); } @JsonCreator  KeyOutWriter(
			@JsonProperty("typeNames") ImmutableList<String> typeNames,
			@JsonProperty("booleanAsNumber") boolean booleanAsNumber,
			@JsonProperty("debug") Boolean debugEnabled,
			@JsonProperty("outputFile") String outputFile,
			@JsonProperty("maxLogFileSize") String maxLogFileSize,
			@JsonProperty("maxLogBackupFiles") Integer maxLogBackupFiles,
			@JsonProperty("logPattern") String logPattern,
			@JsonProperty("delimiter") String delimiter,
			@JsonProperty("settings") Map<String, Object> settings); }
KeyOutWriter extends BaseOutputWriter { @Override public void validateSetup(Server server, Query query) throws ValidationException { Logger logger; if (loggers.containsKey(outputFile)) { logger = getLogger(outputFile); }else{ try { logger = buildLogger(outputFile); loggers.put(outputFile, logger); } catch (IOException e) { throw new ValidationException("Failed to setup logback", query, e); } } logwriter = new LogWriter(logger,delimiter); } @JsonCreator  KeyOutWriter(
			@JsonProperty("typeNames") ImmutableList<String> typeNames,
			@JsonProperty("booleanAsNumber") boolean booleanAsNumber,
			@JsonProperty("debug") Boolean debugEnabled,
			@JsonProperty("outputFile") String outputFile,
			@JsonProperty("maxLogFileSize") String maxLogFileSize,
			@JsonProperty("maxLogBackupFiles") Integer maxLogBackupFiles,
			@JsonProperty("logPattern") String logPattern,
			@JsonProperty("delimiter") String delimiter,
			@JsonProperty("settings") Map<String, Object> settings); @Override void validateSetup(Server server, Query query); @Override void internalWrite(Server server, Query query, ImmutableList<Result> results); @Override void close(); String getMaxLogFileSize(); Integer getMaxLogBackupFiles(); String getDelimiter(); String getOutputFile(); }
KeyOutWriter extends BaseOutputWriter { @Override public void validateSetup(Server server, Query query) throws ValidationException { Logger logger; if (loggers.containsKey(outputFile)) { logger = getLogger(outputFile); }else{ try { logger = buildLogger(outputFile); loggers.put(outputFile, logger); } catch (IOException e) { throw new ValidationException("Failed to setup logback", query, e); } } logwriter = new LogWriter(logger,delimiter); } @JsonCreator  KeyOutWriter(
			@JsonProperty("typeNames") ImmutableList<String> typeNames,
			@JsonProperty("booleanAsNumber") boolean booleanAsNumber,
			@JsonProperty("debug") Boolean debugEnabled,
			@JsonProperty("outputFile") String outputFile,
			@JsonProperty("maxLogFileSize") String maxLogFileSize,
			@JsonProperty("maxLogBackupFiles") Integer maxLogBackupFiles,
			@JsonProperty("logPattern") String logPattern,
			@JsonProperty("delimiter") String delimiter,
			@JsonProperty("settings") Map<String, Object> settings); @Override void validateSetup(Server server, Query query); @Override void internalWrite(Server server, Query query, ImmutableList<Result> results); @Override void close(); String getMaxLogFileSize(); Integer getMaxLogBackupFiles(); String getDelimiter(); String getOutputFile();  }