List of usage examples for org.apache.commons.lang3 StringUtils repeat
public static String repeat(final char ch, final int repeat)
From source file:co.runrightfast.vertx.core.application.RunRightFastVertxApplicationLauncherTest.java
/** * Test of run method, of class RunRightFastVertxApplicationLauncher. *///from w w w .j a v a 2s. c o m @Test public void testVersionOption() { System.out.println(String.format("\n\n%s%s%s%s%s", StringUtils.repeat('*', 10), StringUtils.repeat(' ', 3), "testVersionOption -v", StringUtils.repeat(' ', 3), StringUtils.repeat('*', 10))); RunRightFastVertxApplicationLauncher.run(() -> app, "-v"); System.out.println(String.format("\n\n%s%s%s%s%s", StringUtils.repeat('*', 10), StringUtils.repeat(' ', 3), "testVersionOption --version", StringUtils.repeat(' ', 3), StringUtils.repeat('*', 10))); RunRightFastVertxApplicationLauncher.run(() -> app, "--version"); }
From source file:cop.raml.utils.Utils.java
public static String offs(String str, int offs, boolean strict) { if (StringUtils.isBlank(str) || offs < 0) return str; String tmp = StringUtils.repeat(StringUtils.SPACE, offs); String[] lines = Arrays.stream(splitLine(str)).map(line -> tmp + (strict ? line : line.trim())) .map(line -> StringUtils.isBlank(line) ? StringUtils.EMPTY : line).toArray(String[]::new); return String.join("\n", lines); }
From source file:com.baidu.oped.apm.common.buffer.FixedBufferTest.java
@Test public void testPadString_Error() throws Exception { Buffer buffer1_1 = new FixedBuffer(32); try {/* w w w . jav a2 s . c om*/ buffer1_1.putPadString(StringUtils.repeat('a', 11), 10); } catch (IndexOutOfBoundsException ignore) { } Buffer buffer1_2 = new FixedBuffer(32); try { buffer1_2.putPadString(StringUtils.repeat('a', 20), 10); Assert.fail("error"); } catch (IndexOutOfBoundsException ignore) { } Buffer buffer2 = new FixedBuffer(32); buffer2.putPadString(StringUtils.repeat('a', 10), 10); }
From source file:com.gmarciani.gmparser.commons.TestNonDeterministicFunction.java
@Test public void createIncompleteFunction() { System.out.println("#createIncompleteFunction"); GSet<Character> domainX = new GSet<Character>(); domainX.add('a'); domainX.add('b'); domainX.add('c'); GSet<Integer> domainY = new GSet<Integer>(); domainY.add(1);// w ww .j a va 2s . co m domainY.add(2); domainY.add(3); GSet<String> domainZ = new GSet<String>(); for (Character c : domainX) for (Integer n : domainY) domainZ.add(StringUtils.repeat(c, n)); Function<Character, Integer, String> function = new NonDeterministicFunction<Character, Integer, String>( domainX, domainY, domainZ); function.add('a', 1, "a"); function.add('b', 2, "bb"); function.add('c', 3, "ccc"); System.out.println(function); System.out.println(function.toFormattedFunction()); }
From source file:co.runrightfast.vertx.core.application.RunRightFastVertxApplicationLauncherTest.java
/** * Test of run method, of class RunRightFastVertxApplicationLauncher. *//*from w ww.j a v a2 s .c o m*/ @Test public void testConfigOption() throws UnsupportedEncodingException { System.out.println(String.format("\n\n%s%s%s%s%s", StringUtils.repeat('*', 10), StringUtils.repeat(' ', 3), "testConfigOption -c", StringUtils.repeat(' ', 3), StringUtils.repeat('*', 10))); final ByteArrayOutputStream bos = new ByteArrayOutputStream(); final PrintStream sysout = System.out; try { System.setOut(new PrintStream(bos)); RunRightFastVertxApplicationLauncher.run(() -> app, "-c"); final String configAsString = bos.toString("UTF-8"); log.info(configAsString); final Config config = ConfigFactory.parseString(configAsString); } finally { System.setOut(sysout); } System.out.println(String.format("\n\n%s%s%s%s%s", StringUtils.repeat('*', 10), StringUtils.repeat(' ', 3), "testConfigOption --config", StringUtils.repeat(' ', 3), StringUtils.repeat('*', 10))); RunRightFastVertxApplicationLauncher.run(() -> app, "--config"); }
From source file:com.microsoft.azure.storage.queue.CloudQueueEncryptionTests.java
@Test public void testQueueAddEncrypted64KMessage() throws StorageException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { // Create the Key to be used for wrapping. SymmetricKey aesKey = TestHelper.getSymmetricKey(); String inputMessage = StringUtils.repeat('a', 64 * 1024); CloudQueueMessage message = new CloudQueueMessage(inputMessage); this.queue.setShouldEncodeMessage(false); QueueRequestOptions options = new QueueRequestOptions(); options.setEncryptionPolicy(new QueueEncryptionPolicy(aesKey, null)); // add message this.queue.addMessage(message); // add encrypted Message try {/* ww w . j ava 2 s .c o m*/ this.queue.addMessage(message, 0, 0, options, null); fail("Adding an encrypted message that exceeds message limits should throw."); } catch (IllegalArgumentException e) { } }
From source file:com.github.chenxiaolong.dualbootpatcher.switcher.service.FlashZipsTask.java
private void printSeparator() { printBoldText(Color.WHITE, StringUtils.repeat('-', 16) + "\n"); }
From source file:edu.illinois.cs.cogcomp.transliteration.CSPTransliteration.java
public static SparseDoubleVector<Triple<String, String, String>> PSegGivenFlatOccurence( SparseDoubleVector<Triple<String, String, String>> segCounts, List<Triple<String, String, Double>> examples, int contextSize) { SparseDoubleVector<Triple<String, String, String>> counts = new SparseDoubleVector<>(); for (Triple<String, String, Double> example : examples) { String word = StringUtils.repeat('_', contextSize) + example.getFirst() + StringUtils.repeat('_', contextSize); for (int i = contextSize; i < word.length() - contextSize; i++) { for (int j = i; j < word.length() - contextSize; j++) { Triple<String, String, String> gct = GetContextTriple(word, i, j - i + 1, contextSize); counts.put(gct, counts.get(gct) + example.getThird()); }/* w w w.j a va 2s . c o m*/ } } return segCounts.divide(counts); }
From source file:com.cloudera.impala.catalog.ScalarType.java
@Override protected String prettyPrint(int lpad) { return StringUtils.repeat(' ', lpad) + toSql(); }
From source file:io.github.robwin.markup.builder.markdown.MarkdownBuilder.java
@Override public MarkupDocBuilder tableWithColumnSpecs(List<MarkupTableColumn> columnSpecs, List<List<String>> cells) { Validate.notEmpty(columnSpecs);//from www.j av a2 s . c om newLine(); Collection<String> headerList = Collections2.transform(columnSpecs, new Function<MarkupTableColumn, String>() { public String apply(final MarkupTableColumn header) { return escapeTableCell(defaultString(header.header)); } }); documentBuilder.append(Markdown.TABLE_COLUMN_DELIMITER) .append(join(headerList, Markdown.TABLE_COLUMN_DELIMITER.toString())) .append(Markdown.TABLE_COLUMN_DELIMITER).append(newLine); documentBuilder.append(Markdown.TABLE_COLUMN_DELIMITER); for (MarkupTableColumn col : columnSpecs) { documentBuilder.append(StringUtils.repeat(Markdown.TABLE_ROW.toString(), 3)); documentBuilder.append(Markdown.TABLE_COLUMN_DELIMITER); } documentBuilder.append(newLine); for (List<String> row : cells) { Collection<String> cellList = Collections2.transform(row, new Function<String, String>() { public String apply(final String cell) { return escapeTableCell(cell); } }); documentBuilder.append(Markdown.TABLE_COLUMN_DELIMITER) .append(join(cellList, Markdown.TABLE_COLUMN_DELIMITER.toString())) .append(Markdown.TABLE_COLUMN_DELIMITER).append(newLine); } newLine(); return this; }