List of usage examples for org.apache.commons.lang StringUtils join
public static String join(Collection<?> collection, String separator)
Joins the elements of the provided Collection
into a single String containing the provided elements.
From source file:io.gatling.jenkins.steps.GatlingArchiverStepTest.java
/** * Test archiving of gatling reports/*from ww w.j a va 2 s. c om*/ */ @Test public void archive() throws Exception { // job setup WorkflowJob foo = j.jenkins.createProject(WorkflowJob.class, "foo"); foo.setDefinition(new CpsFlowDefinition(StringUtils.join(Arrays.asList("node {", " writeFile file: 'results/foo-1234/js/global_stats.json', text: '{}'", " writeFile file: 'results/bar-5678/js/global_stats.json', text: '{}'", " gatlingArchive()", "}"), "\n"))); // get the build going, and wait until workflow pauses WorkflowRun b = j.assertBuildStatusSuccess(foo.scheduleBuild2(0).get()); File fooArchiveDir = new File(b.getRootDir(), "simulations/foo-1234"); assertTrue("foo archive dir doesn't exist: " + fooArchiveDir, fooArchiveDir.isDirectory()); File barArchiveDir = new File(b.getRootDir(), "simulations/bar-5678"); assertTrue("bar archive dir doesn't exist: " + barArchiveDir, barArchiveDir.isDirectory()); List<GatlingBuildAction> gbas = new ArrayList<>(); for (Action a : b.getAllActions()) { if (a instanceof GatlingBuildAction) { gbas.add((GatlingBuildAction) a); } } assertEquals("Should be exactly one GatlingBuildAction", 1, gbas.size()); GatlingBuildAction buildAction = gbas.get(0); assertEquals("BuildAction should have exactly one ProjectAction", 1, buildAction.getProjectActions().size()); }
From source file:com.googlesource.gerrit.plugins.hooks.workflow.action.AddComment.java
@Override public void execute(String issue, ActionRequest actionRequest, Set<Property> properties) throws IOException { String[] parameters = actionRequest.getParameters(); String comment = StringUtils.join(parameters, " "); if (!Strings.isNullOrEmpty(comment)) { its.addComment(issue, comment);//ww w . jav a 2 s .c om } }
From source file:com.hihframework.core.utils.CollectionUtils.java
/** * ????,??.//from w w w .j ava2s .co m * * @param collection * ???. * @param propertyName * ??????. * @param separator * . */ public static String fetchPropertyToString(Collection<Object> collection, String propertyName, String separator) throws Exception { List<Object> list = fetchPropertyToList(collection, propertyName); return StringUtils.join(list, separator); }
From source file:edu.cuhk.hccl.IDConverter.java
private static void processFile(File inFile, File outFile) throws IOException { List<String> lines = FileUtils.readLines(inFile, "UTF-8"); List<String> buffer = new ArrayList<String>(); for (String line : lines) { String[] cols = line.split("\t"); cols[0] = String.valueOf(mapping.getUserID(cols[0])); cols[1] = String.valueOf(mapping.getItemID(cols[1])); buffer.add(StringUtils.join(cols, '\t')); }/* ww w .ja va2s .c om*/ Collections.sort(buffer); FileUtils.writeLines(outFile, buffer, false); System.out.printf("ID Converting finished for file: %s.\n", inFile.getAbsolutePath()); }
From source file:edu.scripps.fl.pubchem.web.entrez.ELinkWebSession.java
public static ELinkWebSession newInstance(String dbFrom, List<String> linkNames, EntrezHistoryKey key, String term) throws Exception { ELinkWebSession session = new ELinkWebSession(); session.setDbFrom(dbFrom);/*from w w w .jav a 2s . com*/ session.setDb(key.getDatabase()); session.setLinkName(StringUtils.join(linkNames, ",")); session.setKey(key); session.setTerm(term); return session; }
From source file:me.Laubi.MineMaze.SubCommands.java
@SubCommand(alias = "list", console = true, permission = "worldedit.minemaze.list", author = "Laubi", description = "List all aviable MazeGenerators") public static void listmazes(LocalPlayer player, CommandHandler handler, MineMazePlugin plugin) { if (plugin.getMazeGenerators().isEmpty()) { player.printError("No mazes are registrated!"); return;/* w ww . ja va 2 s . com*/ } Iterator<Method> it = plugin.getMazeGenerators().iterator(); player.print("Registrated maze generators:"); while (it.hasNext()) { MazeGenerator cur = it.next().getAnnotation(MazeGenerator.class); String msg = " 9%1 => a%2"; msg = msg.replace("%1", cur.fullName()).replace("%2", StringUtils.join(cur.alias(), '|')); player.print(msg); } }
From source file:io.viewserver.operators.table.TableKeyDefinition.java
public String getValue(HashMap<String, Object> values) { List<Object> keyValues = new ArrayList<>(); int count = this.keys.size(); for (int i = 0; i < count; i++) { keyValues.add(values.get(keys.get(i))); }//from w w w .ja v a 2 s . com return StringUtils.join(keyValues, SEPARATOR); }
From source file:com.incapture.slate.model.node.description.table.TableRowNode.java
@Override public String getContent() { return StringUtils.join(values, " | "); }
From source file:com.pureinfo.ark.interaction.util.ActionFormUtilTest.java
public void testCleanEmpty() { class TData { public String[] values; public String[] expect; public TData(String[] _values, String[] _result) { this.values = _values; this.expect = _result; }/*from w w w .j ava2 s. com*/ } TData[] data = { // new TData(new String[] { "1", "2", "3" }, new String[] { "1", "2", "3" }), // new TData(new String[] { "", "2", "3" }, new String[] { "2", "3" }), // new TData(new String[] { "1", "", "3" }, new String[] { "1", "3" }), // new TData(new String[] { "1", " ", "3" }, new String[] { "1", " ", "3" }), // new TData(new String[] { "1", null, "3" }, new String[] { "1", "3" }), // new TData(new String[] { "1", "2", "" }, new String[] { "1", "2" }), // }; for (int i = 0; i < data.length; i++) { System.out.println("[" + i + "]" + StringUtils.join(data[i].values, ",")); String[] result = ActionFormUtil.cleanEmpty(data[i].values); System.out.println( " " + StringUtils.join(data[i].values, ",") + "-->Result:" + StringUtils.join(result, ",")); String[] expect = data[i].expect; assertEquals(StringUtils.join(expect, ","), StringUtils.join(result, ",")); } }
From source file:com.collective.celos.ci.testing.fixtures.convert.FixTableToJsonFileConverter.java
@Override public FixFile convert(TestRun tr, FixTable ff) throws Exception { List<String> jsonStrs = Lists.newArrayList(); for (FixTable.FixRow fr : ff.getRows()) { jsonStrs.add(gson.toJson(fr.getCells())); }/*from w w w .j av a2s. c om*/ return new FixFile(IOUtils.toInputStream(StringUtils.join(jsonStrs, "\n"))); }