List of usage examples for java.util.stream Collectors joining
public static Collector<CharSequence, ?, String> joining(CharSequence delimiter)
From source file:com.epam.ta.reportportal.core.launch.impl.FinishLaunchHandler.java
private void validate(final String launchId, Launch launch, FinishExecutionRQ finishExecutionRQ) { expect(launch, notNull()).verify(LAUNCH_NOT_FOUND, launchId); expect(launch, not(Preconditions.LAUNCH_FINISHED)).verify(FINISH_LAUNCH_NOT_ALLOWED, formattedSupplier( "Launch '{}' already finished with status '{}'", launch.getId(), launch.getStatus())); expect(finishExecutionRQ, Preconditions.finishSameTimeOrLater(launch.getStartTime())).verify( FINISH_TIME_EARLIER_THAN_START_TIME, finishExecutionRQ.getEndTime(), launch.getStartTime(), launchId);//w ww . jav a 2s. c om final List<TestItem> items = testItemRepository.findByLaunch(launch); expect(items, not(Preconditions.HAS_IN_PROGRESS_ITEMS)).verify(FINISH_LAUNCH_NOT_ALLOWED, new Supplier<String>() { @Override public String get() { String[] values = { launchId, DbUtils.toIds(getInProgressItems(items)).stream().collect(Collectors.joining(",")), IN_PROGRESS.name() }; return MessageFormatter.arrayFormat("Launch '{}' has items '[{}]' with '{}' status", values) .getMessage(); } @Override public String toString() { return get(); } }); }
From source file:it.cnr.istc.iloc.gui.StateVariableVisualizer.java
private static String toString(Atom[] atoms) { switch (atoms.length) { case 0:// www.j av a 2s . c om return ""; case 1: return toString(atoms[0]); default: return Stream.of(atoms).map(tk -> toString(tk)).collect(Collectors.joining(", ")); } }
From source file:eu.stamp_project.automaticbuilder.MavenAutomaticBuilder.java
private int runGoals(String pathToRootOfProject, String... goals) { InvocationRequest request = new DefaultInvocationRequest(); request.setGoals(Arrays.asList(goals)); request.setPomFile(new File(pathToRootOfProject + FILE_SEPARATOR + POM_FILE)); request.setJavaHome(new File(System.getProperty("java.home"))); Properties properties = new Properties(); properties.setProperty("enforcer.skip", "true"); properties.setProperty("checkstyle.skip", "true"); properties.setProperty("cobertura.skip", "true"); properties.setProperty("skipITs", "true"); properties.setProperty("rat.skip", "true"); properties.setProperty("license.skip", "true"); properties.setProperty("findbugs.skip", "true"); properties.setProperty("gpg.skip", "true"); request.setProperties(properties);// ww w . ja v a 2s . c o m Invoker invoker = new DefaultInvoker(); invoker.setMavenHome(new File(this.mavenHome)); LOGGER.info(String.format("run maven %s", Arrays.stream(goals).collect(Collectors.joining(" ")))); if (Main.verbose) { invoker.setOutputHandler(System.out::println); invoker.setErrorHandler(System.err::println); } else { invoker.setOutputHandler(null); invoker.setErrorHandler(null); } try { return invoker.execute(request).getExitCode(); } catch (MavenInvocationException e) { throw new RuntimeException(e); } }
From source file:dk.dma.msinm.web.OsmStaticMap.java
public String serializeParams(MapImageCtx ctx) { return Arrays.asList(ctx.zoom, ctx.lat, ctx.lon, ctx.width, ctx.height).stream().map(String::valueOf) .collect(Collectors.joining("&")); }
From source file:org.springframework.cloud.deployer.spi.cloudfoundry.CloudFoundry2620AndEarlierTaskLauncher.java
private String getCommand(Droplet droplet, AppDeploymentRequest request) { String defaultCommand = ((StagedResult) droplet.getResult()).getProcessTypes().get("web"); return Stream.concat(Stream.of(defaultCommand), request.getCommandlineArguments().stream()) .collect(Collectors.joining(" ")); }
From source file:com.firewallid.networkanalysis.NetworkAnalysis.java
public void saveNAFileNodes(JavaPairRDD<String, List<Tuple2<String, Long>>> nodes, String prefixFileName) { String docDelimiter = StringEscapeUtils.unescapeJava(firewallConf.get(DOC_DELIMITER)); String naFolder = firewallConf.get(NETWORKANALYSIS_FOLDER); String nameDelimiter = firewallConf.get(NAME_DELIMITER); nodes.mapToPair(node -> new Tuple2<>(node._1(), "id" + docDelimiter + "node" + docDelimiter + "size" + System.lineSeparator() + StreamUtils.zipWithIndex(node._2().parallelStream()).parallel() .map(nodeItem -> nodeItem.getIndex() + docDelimiter + nodeItem.getValue()._1() + docDelimiter + nodeItem.getValue()._2()) .collect(Collectors.joining(System.lineSeparator())))) .foreach(node -> FIFile.writeStringToHDFSFile( FIFile.generateFullPath(naFolder, prefixFileName + nameDelimiter + node._1() + nameDelimiter + "node.csv"), node._2()));// w w w .j a va 2 s . c o m }
From source file:io.fabric8.vertx.maven.plugin.mojos.AbstractRunMojo.java
/** * This will build the Vertx specific arguments that needs to be passed to the runnable process * * @param argsList - the existing collection of arguments to which the vertx arguments will be added *///from ww w. j a v a 2 s .co m protected void addVertxArgs(List<String> argsList) { Objects.requireNonNull(launcher); if (IO_VERTX_CORE_LAUNCHER.equals(launcher)) { argsList.add(IO_VERTX_CORE_LAUNCHER); } else { argsList.add(launcher); } argsList.add(vertxCommand); //Since Verticles will be deployed from custom launchers we dont pass this as argument if (verticle != null && !VERTX_COMMAND_STOP.equals(vertxCommand)) { argsList.add(verticle); } if (redeploy && !(VERTX_COMMAND_START.equals(vertxCommand) || VERTX_COMMAND_STOP.equals(vertxCommand))) { getLog().info("Vert.x application redeploy enabled"); StringBuilder redeployArg = new StringBuilder(); redeployArg.append(VERTX_ARG_REDEPLOY); //fix for redeploy to work computeOutputDirsWildcard(redeployArg); argsList.add(redeployArg.toString()); addRedeployExtraArgs(argsList); if (jvmArgs != null && !jvmArgs.isEmpty()) { String javaOpts = jvmArgs.stream().collect(Collectors.joining(" ")); argsList.add(VERTX_ARG_JAVA_OPT + "=" + javaOpts); } } if (!VERTX_COMMAND_STOP.equals(vertxCommand)) { String argLauncherClass = VERTX_ARG_LAUNCHER_CLASS + "=\"" + launcher + "\""; argsList.add(argLauncherClass); if (config != null && config.exists() && config.isFile()) { getLog().info("Using configuration from file: " + config.toString()); argsList.add(VERTX_ARG_CONF); argsList.add(config.toString()); } } }
From source file:ddf.camel.component.catalog.content.ContentProducerDataAccessObject.java
protected void logIds(List<Metacard> metacards, String action) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("content item(s) {} with id = {}", action, metacards.stream().map(Metacard::getId) .filter(Objects::nonNull).collect(Collectors.joining(", "))); }/* w w w .j av a2 s .co m*/ }
From source file:ddf.catalog.metacard.duplication.DuplicationValidator.java
private String collectionToString(final Collection collection) { return (String) collection.stream().map(Object::toString).sorted().collect(Collectors.joining(", ")); }