Example usage for org.apache.commons.io IOUtils LINE_SEPARATOR_UNIX

List of usage examples for org.apache.commons.io IOUtils LINE_SEPARATOR_UNIX

Introduction

In this page you can find the example usage for org.apache.commons.io IOUtils LINE_SEPARATOR_UNIX.

Prototype

String LINE_SEPARATOR_UNIX

To view the source code for org.apache.commons.io IOUtils LINE_SEPARATOR_UNIX.

Click Source Link

Document

The Unix line separator string.

Usage

From source file:org.sonar.plugins.plsqltoad.PlSqlToadRulesRepositoryTest.java

@Test
public void createRulesSpecificRuleTest() {
    String key = "4201";

    for (Rule rule : rules) {
        if (rule.getKey().equals(key)) {
            assertThat(rule.getName(), is("IF - Limit a CASE statement or expression to 128 choices"));
            assertThat(//w  ww .  ja va 2s.  c  om
                    rule.getDescription().replace(IOUtils.LINE_SEPARATOR_WINDOWS, " ")
                            .replace(IOUtils.LINE_SEPARATOR_UNIX, " "),
                    is("<p>Although not enforced by Oracle it is a good idea to limit the number of choices to avoid performance penalties.</p>"));
            assertThat(rule.getSeverity(), is(RulePriority.BLOCKER));
            return;
        }
    }

    throw new IllegalArgumentException("Unable to find a rule with " + key + " as key in the repository!");
}

From source file:org.xwiki.extension.repository.internal.DefaultExtensionSerializer.java

private void addLicenses(Document document, Element parentElement, Extension extension) {
    if (extension.getLicenses() != null && !extension.getLicenses().isEmpty()) {
        Element licensesElement = document.createElement(ELEMENT_LICENSES);
        parentElement.appendChild(licensesElement);

        for (ExtensionLicense license : extension.getLicenses()) {
            Element licenseElement = document.createElement(ELEMENT_LLICENSE);
            licensesElement.appendChild(licenseElement);

            addElement(document, licenseElement, ELEMENT_LLNAME, license.getName());
            if (this.licenseManager.getLicense(license.getName()) == null && license.getContent() != null) {
                // Only store content if it's a custom license (license content is pretty big generally)
                StringWriter content = new StringWriter();
                try {
                    IOUtils.writeLines(license.getContent(), IOUtils.LINE_SEPARATOR_UNIX, content);
                } catch (IOException e) {
                    // That should never happen
                }/*from   ww w.j  a  v a 2 s.  com*/
                addElement(document, licenseElement, ELEMENT_LLCONTENT, content.toString());
            }
        }
    }
}