Example usage for org.apache.commons.lang StringUtils repeat

List of usage examples for org.apache.commons.lang StringUtils repeat

Introduction

In this page you can find the example usage for org.apache.commons.lang StringUtils repeat.

Prototype

public static String repeat(String str, int repeat) 

Source Link

Document

Repeat a String repeat times to form a new String.

Usage

From source file:adalid.core.expressions.AbstractDataAggregateX.java

@Override
protected String fieldsToString(int n, String key, boolean verbose, boolean fields, boolean maps) {
    String tab = verbose ? StringUtils.repeat(" ", 4) : "";
    String fee = verbose ? StringUtils.repeat(tab, n) : "";
    String faa = " = ";
    String foo = verbose ? EOL : ", ";
    String string = super.fieldsToString(n, key, verbose, fields, maps);
    if (fields || verbose) {
        string += fee + tab + "operands" + faa + _operands.length + foo;
        if (verbose) {
            string += fee + tab + "operator" + faa + _operator + foo;
        }//from w  ww . ja  v  a2  s.c  om
    }
    return string;
}

From source file:com.adobe.acs.commons.util.InfoWriterTest.java

@Test
public void testTitle_NoMessage() throws Exception {
    String expected = LS + StringUtils.repeat("-", 80);

    iw.title();// www  .  j  a  v a 2  s .  c  om

    assertEquals(expected.concat(LS), iw.toString());
}

From source file:au.id.hazelwood.sos.model.user.UserValidationTest.java

@Test
public void testEmailValidation() throws Exception {
    assertValidation("email", "abcdefghijklmnopqrtsuvwxyz@b.com");
    assertValidation("email", "1234567890@b.com");
    assertValidation("email", "a.z@b.com");
    assertValidation("email", "!#$%&'*+/=?^_`{|}~-.!#$%&'*+/=?^_`{|}~-@b.com");
    assertValidation("email", "a@b-c.com");
    assertValidation("email", "a@test-host.com");
    assertValidation("email", "a@test.host.com");
    assertValidation("email", "a@192.168.0.1");
    assertValidation("email", null, "may not be null");
    assertValidation("email", "", "size must be between 1 and 254", "not a well-formed email address");
    assertValidation("email", StringUtils.repeat("a", 255), "size must be between 1 and 254",
            "not a well-formed email address");
    assertValidation("email", "a", "not a well-formed email address");
    assertValidation("email", "a@b", "not a well-formed email address");
    assertValidation("email", "a@b.c", "not a well-formed email address");
    assertValidation("email", ".@b.com", "not a well-formed email address");
    assertValidation("email", "a.@b.com", "not a well-formed email address");
    assertValidation("email", "a@b-.com", "not a well-formed email address");
    assertValidation("email", "a@-b.com", "not a well-formed email address");
    assertValidation("email", "a@b_.com", "not a well-formed email address");
    assertValidation("email", "a@_b.com", "not a well-formed email address");
}

From source file:adalid.core.DisplaySet.java

@Override
protected String fieldsToString(int n, String key, boolean verbose, boolean fields, boolean maps) {
    String tab = verbose ? StringUtils.repeat(" ", 4) : "";
    String fee = verbose ? StringUtils.repeat(tab, n) : "";
    String faa = " = ";
    String foo = verbose ? EOL : ", ";
    String string = super.fieldsToString(n, key, verbose, fields, maps);
    if (fields || verbose) {
        if (verbose) {
            if (_entity != null) {
                string += fee + tab + "entity" + faa + _entity + foo;
            }//from   w  ww.  ja  va 2s. c om
            if (_reference != null) {
                string += fee + tab + "_reference" + faa + _reference + foo;
            }
            if (_master != null) {
                string += fee + tab + "_master" + faa + _master + foo;
            }
        }
    }
    return string;
}

From source file:com.uber.jenkins.phabricator.RemoteFileFetcherTest.java

@Test
public void testLargeFile() throws Exception {
    testWithContent(StringUtils.repeat("a", 10000), "10000");
}

From source file:com.legit.globalrep.chat.Message.java

public void sendHelp(Player player) {
    player.sendMessage(ChatColor.AQUA + "m" + StringUtils.repeat(" ", 31) + ChatColor.GREEN + ChatColor.BOLD
            + " Global Rep " + ChatColor.RESET + ChatColor.AQUA + "m" + StringUtils.repeat(" ", 31));
    player.sendMessage(/*from  w ww.ja  va 2s  .  c  o m*/
            ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("MESSAGES.HELP_CHECK")));
    player.sendMessage(ChatColor.translateAlternateColorCodes('&',
            plugin.getConfig().getString("MESSAGES.HELP_POSITIVE")));
    player.sendMessage(ChatColor.translateAlternateColorCodes('&',
            plugin.getConfig().getString("MESSAGES.HELP_NEGATIVE")));
    if (player.hasPermission("rep.delete.self"))
        player.sendMessage(ChatColor.translateAlternateColorCodes('&',
                plugin.getConfig().getString("MESSAGES.HELP_DELETE_SELF")));
    if (player.hasPermission("rep.delete") || player.hasPermission("rep.delete.others"))
        player.sendMessage(ChatColor.translateAlternateColorCodes('&',
                plugin.getConfig().getString("MESSAGES.HELP_DELETE_OTHERS")));
    printLine(player);
}

From source file:adalid.core.data.types.StringData.java

@Override
protected String fieldsToString(int n, String key, boolean verbose, boolean fields, boolean maps) {
    String tab = verbose ? StringUtils.repeat(" ", 4) : "";
    String fee = verbose ? StringUtils.repeat(tab, n) : "";
    String faa = " = ";
    String foo = verbose ? EOL : ", ";
    String string = super.fieldsToString(n, key, verbose, fields, maps);
    if (fields || verbose) {
        if (verbose) {
            string += fee + tab + "minLength" + faa + _minLength + foo;
            if (_maxLength != null) {
                string += fee + tab + "maxLength" + faa + _maxLength + foo;
            }//from  w  w w.jav a2 s.  c  o m
        }
    }
    return string;
}

From source file:net.bible.service.format.osistohtml.taghandler.LHandler.java

@Override
public void start(Attributes attrs) {
    // Refer to Gen 3:14 in ESV for example use of type=x-indent
    String type = attrs.getValue(OSISUtil.OSIS_ATTR_TYPE);
    int level = TagHandlerHelper.getAttribute(OSISUtil.OSIS_ATTR_LEVEL, attrs, 1);
    // make numIndents default to zero
    int numIndents = Math.max(0, level - 1);

    LType ltype = LType.IGNORE;//from   ww  w .j  a v  a  2 s  .  com
    if (TagHandlerHelper.isAttr(OSISUtil.OSIS_ATTR_EID, attrs)) {
        // e.g. Isaiah 40:12
        writer.write(HTML.BR);
        ltype = LType.BR;
    } else if (StringUtils.isNotEmpty(type)) {
        if (type.contains("indent")) {
            // this tag is specifically for indenting so ensure there is an indent
            numIndents = numIndents + 1;
            writer.write(StringUtils.repeat(indent_html, numIndents));
            ltype = LType.INDENT;
        } else if (type.contains("br")) {
            writer.write(HTML.BR);
            ltype = LType.BR;
        } else {
            ltype = LType.IGNORE;
            log.debug("Unknown <l> tag type:" + type);
        }
    } else if (TagHandlerHelper.isAttr(OSISUtil.OSIS_ATTR_SID, attrs)) {
        writer.write(StringUtils.repeat(indent_html, numIndents));
        ltype = LType.IGNORE;
    } else {
        //simple <l>
        writer.write(StringUtils.repeat(indent_html, numIndents));
        ltype = LType.END_BR;
    }
    stack.push(ltype);
}

From source file:com.tesora.dve.sql.LargeMaxPktTest.java

@Test
public void testPE1512() throws Throwable {
    final ExtendedPacketTester tester = new ExtendedPacketTester(67108864);
    tester.add(new StatementMirrorProc("CREATE TABLE `pe1512` (`data` longblob)"));
    tester.add(new StatementMirrorProc(
            "INSERT INTO `pe1512` VALUES ('" + StringUtils.repeat("0", 17000000) + "')"));
    tester.add(new StatementMirrorFun("SELECT length(data) FROM `pe1512`"));

    tester.add(new StatementMirrorFun("SELECT data FROM `pe1512`"));

    tester.runTests();/*w w w  .  j av  a 2s.  c  o m*/
}

From source file:net.codjo.dataprocess.server.treatmenthelper.TreatmentHelper.java

public static void initRepository(Connection con, List<RepositoryDescriptor> repositoryDescList)
        throws Exception {
    try {//from  ww  w . j a v a2s . co  m
        con.setAutoCommit(false);

        LOG.info("Ajout des rfrentiels de traitement suivants :");
        for (RepositoryDescriptor repositoryDesc : repositoryDescList) {
            deleteRepository(con, repositoryDesc.getRepositoryId());
            insertAllRepositoryContent(con, repositoryDesc.getRepositoryId(),
                    repositoryDesc.getRepositoryName(), repositoryDesc.getRepositoryPath());
            insertRepository(con, repositoryDesc.getRepositoryId(), repositoryDesc.getRepositoryName());
        }
        List<TreatmentFragment> treatmentFragmentList = checkIntegrityRepositoryContent(con);
        if (!treatmentFragmentList.isEmpty()) {
            String message = " est trop long ! : ";
            int maxLength = maxLengthTreatmentId(treatmentFragmentList) + message.length() + LENGTH;
            StringBuilder errorMessage = new StringBuilder();
            errorMessage.append("\n").append(StringUtils.repeat("#", maxLength));
            errorMessage.append("\n").append(StringUtils.repeat("+", maxLength));
            for (TreatmentFragment treatmentFragment : treatmentFragmentList) {
                errorMessage.append("\n").append(treatmentFragment.getTreatmentId()).append(message)
                        .append(treatmentFragment.getContentFragment());
            }
            errorMessage.append("\n").append(StringUtils.repeat("+", maxLength));
            errorMessage.append("\n").append(StringUtils.repeat("#", maxLength));
            throw new TreatmentException(errorMessage.toString());
        } else {
            con.commit();
            LOG.info("Ajout termin avec succs !");
        }
    } catch (Exception ex) {
        con.rollback();
        LOG.error("\nErreur durant l'ajout des rfrentiels de traitement.\n!!! Rollback effectu !!!\n", ex);
        throw ex;
    } finally {
        con.setAutoCommit(true);
    }
}