List of usage examples for java.io PrintStream printf
public PrintStream printf(Locale l, String format, Object... args)
From source file:com.xebialabs.xlt.ci.server.XLTestServerImpl.java
private void logInfo(PrintStream logger, String message) { logger.printf(XL_TEST_LOG_FORMAT, "INFO", message); }
From source file:com.xebialabs.xlt.ci.server.XLTestServerImpl.java
private void logWarn(PrintStream logger, String message) { logger.printf(XL_TEST_LOG_FORMAT, "WARN", message); }
From source file:com.hpe.application.automation.tools.run.SvDeployBuilder.java
private void deployServiceFromProject(IProject project, PrintStream logger) throws Exception { IDeployProcessor processor = new DeployProcessor(null); ICommandExecutor commandExecutor = createCommandExecutor(); for (IService service : getServiceList(project)) { logger.printf(" Deploying service '%s' [%s] %n", service.getName(), service.getId()); DeployProcessorInput deployInput = new DeployProcessorInput(model.isForce(), false, project, model.getService(), null); deployInput.setFirstAgentFailover(model.isFirstAgentFallback()); processor.process(deployInput, commandExecutor); }/*w w w.ja va2 s . c o m*/ }
From source file:com.hp.application.automation.tools.run.SvDeployBuilder.java
private void deployServiceFromProject(IProject project, PrintStream logger) throws Exception { IDeployProcessor processor = new DeployProcessor(null, new ServiceAmendingServiceImpl()); ICommandExecutor commandExecutor = createCommandExecutor(); for (IService service : getServiceList(project)) { logger.printf(" Deploying service '%s' [%s] %n", service.getName(), service.getId()); DeployProcessorInput deployInput = new DeployProcessorInput(model.isForce(), false, project, model.getService(), null); deployInput.setFirstAgentFailover(model.isFirstAgentFallback()); processor.process(deployInput, commandExecutor); }/*from w w w . j a va 2s. c om*/ }
From source file:org.apache.whirr.cli.command.RunScriptCommand.java
private int handleScriptOutput(PrintStream out, PrintStream err, Map<? extends NodeMetadata, ExecResponse> responses) { int exitStatus = 0; for (Map.Entry<? extends NodeMetadata, ExecResponse> entry : responses.entrySet()) { out.printf("** Node %s: %s%n", entry.getKey().getId(), Iterables.concat(entry.getKey().getPrivateAddresses(), entry.getKey().getPublicAddresses())); ExecResponse response = entry.getValue(); if (response.getExitCode() != 0) { exitStatus = response.getExitCode(); }// w w w.j a v a 2s. co m out.printf("%s%n", response.getOutput()); err.printf("%s%n", response.getError()); } return exitStatus; }
From source file:net.sourceforge.pmd.util.database.DBTypeTest.java
@Before public void setUp() throws Exception { testProperties = new Properties(); testProperties.put("prop1", "value1"); testProperties.put("prop2", "value2"); testProperties.put("prop3", "value3"); includeProperties = new Properties(); includeProperties.putAll(testProperties); includeProperties.put("prop3", "include3"); PrintStream printStream = null; try {/*www .ja va2s. c om*/ absoluteFile = File.createTempFile("dbtypetest", ".properties"); FileOutputStream fileOutputStream = new FileOutputStream(absoluteFile); printStream = new PrintStream(fileOutputStream); for (Entry<?, ?> entry : testProperties.entrySet()) { printStream.printf("%s=%s\n", entry.getKey(), entry.getValue()); } } finally { IOUtils.closeQuietly(printStream); } }
From source file:cc.kave.commons.pointsto.evaluation.ProjectTrainValidateEvaluation.java
private void printSummary(List<String> names) { double[][] grid = new double[names.size()][names.size()]; for (Map.Entry<ICoReTypeName, List<EvaluationResult>> resultEntry : results.entrySet()) { for (EvaluationResult result : resultEntry.getValue()) { grid[names.indexOf(result.training)][names.indexOf(result.validation)] += result.score; }// w w w . j av a 2 s. c o m } PrintStream printer = System.out; double numTypes = results.size(); for (int i = 0; i < names.size(); ++i) { printer.print(names.get(i)); for (int j = 0; j < names.size(); ++j) { printer.print(' '); printer.printf(Locale.US, "%.3f", grid[i][j] / numTypes); } printer.println(); } }
From source file:org.codice.git.hook.Artifact.java
/** * Prompts for the blacklist artifact info. * * @param in the reader to read user input from * @param out the output stream where to print messages to the user * @throws IOException if an error occurs *//*from w ww . j a va 2s . co m*/ public void promptInfo(BufferedReader in, PrintStream out) throws IOException { this.mvnInfo = null; this.mvnName = null; LOGGER.log(Level.WARNING, "The {0} file was not found.", name); out.printf("%sThe %s file was not found%n", iprefix, name); out.printf("%sDo you wish to download it automatically (y/n) [Y]? ", iprefix); out.flush(); final String yn = StringUtils.lowerCase(StringUtils.trim(in.readLine())); if (!yn.isEmpty() && (yn.charAt(0) == 'n')) { out.printf("%s You can always manually copy the file to: %n", iprefix); out.printf("%s %n", iprefix, file); if (!infofile.exists()) { // make sure we no longer cache the info infofile.delete(); } return; } out.println(iprefix); out.printf("%sPlease provide the maven artifact's coordinates for the %s file:%n", iprefix, name); final String email = handler.getConfigString("user", null, "email"); String dgroup = null; if (StringUtils.isNotEmpty(email)) { final int i = email.indexOf('@'); if (i != -1) { final String domain = email.substring(i + 1); final int j = domain.indexOf('.'); if (j != -1) { dgroup = domain.substring(j + 1) + '.' + domain.substring(0, j); } } } String group; final String id; final String version; final String type; final String classifier; do { if (dgroup == null) { do { out.printf("%s group id: ", iprefix); out.flush(); group = StringUtils.trim(in.readLine()); } while (StringUtils.isEmpty(group)); } else { out.printf("%s group id [%s]: ", iprefix, dgroup); out.flush(); group = StringUtils.defaultIfBlank(StringUtils.trim(in.readLine()), dgroup); } } while (StringUtils.isEmpty(group)); out.printf("%s artifact id [blacklist-words]: ", iprefix); out.flush(); id = StringUtils.defaultIfBlank(StringUtils.trim(in.readLine()), "blacklist-words"); out.printf("%s version [RELEASE]: ", iprefix); out.flush(); version = StringUtils.defaultIfBlank(StringUtils.trim(in.readLine()), "RELEASE"); out.printf("%s type [txt]: ", iprefix); out.flush(); type = StringUtils.defaultIfBlank(StringUtils.trim(in.readLine()), "txt"); out.printf("%s classifier []: ", iprefix); out.flush(); classifier = StringUtils.trim(in.readLine()); this.mvnInfo = group + ':' + id + ':' + version + ':' + type; if (StringUtils.isNotEmpty(classifier)) { this.mvnInfo += ':' + classifier; } this.mvnName = id + '.' + type; }
From source file:com.hp.application.automation.tools.run.SvExportBuilder.java
private void verifyNotLearningBeforeExport(PrintStream logger, ICommandExecutor exec, ServiceInfo serviceInfo) throws CommunicatorException, CommandExecutorException { IService service = exec.findService(serviceInfo.getId(), null); ServiceRuntimeConfiguration info = exec.getServiceRuntimeInfo(service); if (info.getRuntimeMode() == ServiceRuntimeConfiguration.RuntimeMode.LEARNING) { logger.printf( " WARNING: Service '%s' [%s] is in Learning mode. Exported model need not be complete!", serviceInfo.getName(), serviceInfo.getId()); }//from w w w .j a v a 2 s. c o m }
From source file:org.pantsbuild.tools.junit.impl.ConsoleRunnerImpl.java
private void notFoundError(String spec, PrintStream out, Throwable t) { out.printf("FATAL: Error during test discovery for %s: %s\n", spec, t); throw new RuntimeException("Classloading error during test discovery for " + spec, t); }