Example usage for java.util Locale ROOT

List of usage examples for java.util Locale ROOT

Introduction

In this page you can find the example usage for java.util Locale ROOT.

Prototype

Locale ROOT

To view the source code for java.util Locale ROOT.

Click Source Link

Document

Useful constant for the root locale.

Usage

From source file:com.grayfox.server.dao.RecommendationDaoTest.java

@Test
@Transactional//from www .  j a  v  a2 s . c  o  m
public void testFetchNearestByCategoriesLiked() {
    loadMockDataForFetchNearestByCategoriesLiked();

    Category c1 = new Category();
    c1.setFoursquareId("1");
    c1.setIconUrl("url1");
    c1.setName("CAT_1");

    Category c3 = new Category();
    c3.setFoursquareId("3");
    c3.setIconUrl("url3");
    c3.setName("CAT_3");

    Poi p1 = new Poi();
    p1.setFoursquareId("1");
    p1.setFoursquareRating(9.2);
    p1.setLocation(Location.parse("19.044,-98.197753"));
    p1.setName("POI_1");
    p1.setCategories(new HashSet<>(Arrays.asList(c1)));

    Poi p2 = new Poi();
    p2.setFoursquareId("2");
    p2.setFoursquareRating(8.5);
    p2.setLocation(Location.parse("19.043148,-98.198354"));
    p2.setName("POI_2");
    p2.setCategories(new HashSet<>(Arrays.asList(c3)));

    Recommendation r1 = new Recommendation();
    r1.setPoi(p1);
    r1.setType(Recommendation.Type.SELF);
    r1.setReason(Messages.get("recommendation.self.reason", c1.getName()));

    Recommendation r2 = new Recommendation();
    r2.setPoi(p2);
    r2.setType(Recommendation.Type.SELF);
    r2.setReason(Messages.get("recommendation.self.reason", c3.getName()));

    List<Recommendation> expectedRecommendations = Arrays.asList(r1, r2);
    List<Recommendation> actualRecommendations = recommendationDao.findNearestByCategoriesLiked("fakeToken",
            Location.parse("19.043635,-98.197947"), 100, Locale.ROOT);

    assertThat(actualRecommendations).isNotNull().isNotEmpty().doesNotContainNull()
            .hasSameSizeAs(expectedRecommendations).containsExactlyElementsOf(expectedRecommendations);
}

From source file:com.puppycrawl.tools.checkstyle.internal.XdocsPagesTest.java

private static boolean isPresent(String availableChecks, String checkName) {
    final String linkPattern = String.format(Locale.ROOT, LINK_TEMPLATE, checkName);
    return availableChecks.matches(linkPattern);
}

From source file:com.puppycrawl.tools.checkstyle.JavadocPropertiesGeneratorTest.java

@Test
public void testNoInputSpecified() throws Exception {
    JavadocPropertiesGenerator.main("--destfile", DESTFILE.getAbsolutePath());

    final String expected = String.format(Locale.ROOT, "Missing required parameter: <inputFile>%n") + USAGE;
    assertEquals("Unexpected error log", expected, systemErr.getLog());
    assertEquals("Unexpected output log", "", systemOut.getLog());
}

From source file:business.security.control.OwmClient.java

/**
 * Find current weather around a city coordinates
 *
 * @param lat is the latitude of the geographic point of interest
 * (North/South coordinate)//from  w  w  w.  j  a  v  a  2  s .  co m
 * @param lon is the longitude of the geographic point of interest
 * (East/West coordinate)
 * @param cnt is the requested number of weather stations to retrieve (the
 * actual answer might be less than the requested).
 * @throws JSONException if the response from the OWM server can't be parsed
 * @throws IOException if there's some network error or the OWM server
 * replies with a error.
 */
public WeatherStatusResponse currentWeatherAtCity(float lat, float lon, int cnt)
        throws IOException, JSONException { //, boolean cluster, OwmClient.Lang lang) {
    String subUrl = String.format(Locale.ROOT, "find/city?lat=%f&lon=%f&cnt=%d&cluster=yes", Float.valueOf(lat),
            Float.valueOf(lon), Integer.valueOf(cnt));
    JSONObject response = doQuery(subUrl);
    return new WeatherStatusResponse(response);
}

From source file:com.puppycrawl.tools.checkstyle.api.LocalizedMessageTest.java

@Test
public void testEnforceEnglishLanguageBySettingRootLocale() {
    Locale.setDefault(Locale.FRENCH);
    LocalizedMessage.setLocale(Locale.ROOT);
    LocalizedMessage localizedMessage = createSampleLocalizedMessage();

    assertEquals("Empty statement.", localizedMessage.getMessage());
}

From source file:com.newrelic.agent.deps.org.apache.http.conn.ssl.DefaultHostnameVerifier.java

static void matchDNSName(final String host, final List<String> subjectAlts,
        final PublicSuffixMatcher publicSuffixMatcher) throws SSLException {
    final String normalizedHost = host.toLowerCase(Locale.ROOT);
    for (int i = 0; i < subjectAlts.size(); i++) {
        final String subjectAlt = subjectAlts.get(i);
        final String normalizedSubjectAlt = subjectAlt.toLowerCase(Locale.ROOT);
        if (matchIdentityStrict(normalizedHost, normalizedSubjectAlt, publicSuffixMatcher)) {
            return;
        }//  www  .  j  a  va  2 s . co m
    }
    throw new SSLException("Certificate for <" + host + "> doesn't match any "
            + "of the subject alternative names: " + subjectAlts);
}

From source file:org.apache.calcite.adapter.elasticsearch.EmbeddedElasticsearchPolicy.java

void insertBulk(String index, List<ObjectNode> documents) throws IOException {
    Objects.requireNonNull(index, "index");
    Objects.requireNonNull(documents, "documents");

    if (documents.isEmpty()) {
        // nothing to process
        return;/*w  ww.j  a  va  2  s .  com*/
    }

    List<String> bulk = new ArrayList<>(documents.size() * 2);
    for (ObjectNode doc : documents) {
        bulk.add("{\"index\": {} }"); // index/type will be derived from _bulk URI
        bulk.add(mapper().writeValueAsString(doc));
    }

    final StringEntity entity = new StringEntity(String.join("\n", bulk) + "\n", ContentType.APPLICATION_JSON);

    final String uri = String.format(Locale.ROOT, "/%s/%s/_bulk?refresh", index, index);

    restClient().performRequest("POST", uri, Collections.emptyMap(), entity);
}

From source file:com.joyent.http.signature.apache.httpclient.HttpSignatureAuthScheme.java

@Override
public String toString() {
    return getSchemeName().toUpperCase(Locale.ROOT);
}

From source file:com.useekm.indexing.postgis.PostgisIndexMatcher.java

private static boolean matches(String toMatch, String matched, boolean normalize) {
    Validate.notNull(toMatch);//from   w  ww  .  j  a va  2 s  .c o  m
    if (NULL.equals(toMatch)) // only matches null
        return matched == null;
    else if (normalize)
        return matched != null && matched.toLowerCase(Locale.ROOT).equals(toMatch);
    return matched != null && matched.equals(toMatch);
}

From source file:de.ks.text.AsciiDocParser.java

public void renderToFile(String input, AsciiDocBackend backend, File file) {
    if (file.exists()) {
        log.info("Removing existing render target {}", file);
        file.delete();//  w  w  w  .j a  va2 s  . c  o m
    }
    File dataDir = createDataDir(file);
    String mathjaxDir = "./" + dataDir.getName() + "/" + AsciiDocMetaData.MATHJAX + "/";
    boolean needsMathJax = needsMathJax(input);
    metaData.copyToDir(dataDir, needsMathJax);

    AttributesBuilder attributes = getDefaultAttributes();
    attributes.stylesDir(dataDir.getName());
    attributes.tableOfContents(true);
    //    attributes.imagesDir(dataDir.getName());

    OptionsBuilder options = getDefaultOptions(attributes);
    options.backend(backend.name().toLowerCase(Locale.ROOT));

    String parse = parse(input, false, needsMathJax, mathjaxDir, options);
    try {
        parse = copyFiles(parse, dataDir);
        Files.write(parse, file, Charsets.UTF_8);
    } catch (IOException e) {
        log.error("Could not write to file {}", file, e);
        throw new RuntimeException(e);
    }
}