List of usage examples for java.util Locale ROOT
Locale ROOT
To view the source code for java.util Locale ROOT.
Click Source Link
From source file:com.gargoylesoftware.htmlunit.javascript.host.html.HTMLInputElement.java
/** * Returns the {@code type} property./*from w ww . ja v a 2 s.c o m*/ * @return the {@code type} property */ @JsxGetter public String getType() { return getDomNodeOrDie().getTypeAttribute().toLowerCase(Locale.ROOT); }
From source file:com.xpn.xwiki.plugin.wikimanager.WikiManagerTest.java
@Override protected void setUp() throws Exception { super.setUp(); getContext().setDatabase(MAIN_WIKI_NAME); getContext().setMainXWiki(MAIN_WIKI_NAME); this.databases.put(MAIN_WIKI_NAME, new HashMap<String, XWikiDocument>()); Mock mockLocalizationContext = registerMockComponent(LocalizationContext.class); mockLocalizationContext.stubs().method("getCurrentLocale").will(returnValue(Locale.ROOT)); mockXWiki = mock(XWiki.class, new Class[] {}, new Object[] {}); mockXWiki.stubs().method("Param").will(returnValue("")); Mock mockXWikiStore = mock(XWikiHibernateStore.class, new Class[] { XWiki.class, XWikiContext.class }, new Object[] { mockXWiki.proxy(), getContext() }); mockXWikiRightService = mock(XWikiRightServiceImpl.class, new Class[] {}, new Object[] {}); mockXWiki.stubs().method("getDocument").with(isA(DocumentReference.class), ANYTHING) .will(new CustomStub("Implements XWiki.getDocument") { @Override//from ww w .ja v a2 s .c o m public Object invoke(Invocation invocation) throws Throwable { return getDocument((DocumentReference) invocation.parameterValues.get(0)); } }); mockXWiki.stubs().method("getDocument").with(isA(String.class), ANYTHING) .will(new CustomStub("Implements XWiki.getDocument") { @Override public Object invoke(Invocation invocation) throws Throwable { return getDocument((String) invocation.parameterValues.get(0)); } }); mockXWiki.stubs().method("saveDocument").will(new CustomStub("Implements XWiki.saveDocument") { @Override public Object invoke(Invocation invocation) throws Throwable { saveDocument((XWikiDocument) invocation.parameterValues.get(0)); return null; } }); mockXWiki.stubs().method("getXClass").will(new CustomStub("Implements XWiki.getClass") { @Override public Object invoke(Invocation invocation) throws Throwable { DocumentReference classReference = (DocumentReference) invocation.parameterValues.get(0); XWikiContext context = (XWikiContext) invocation.parameterValues.get(1); XWikiDocument doc = context.getWiki().getDocument(classReference, context); return doc.getXClass(); } }); mockXWiki.stubs().method("clearName").will(new CustomStub("Implements XWiki.clearName") { @Override public Object invoke(Invocation invocation) throws Throwable { return invocation.parameterValues.get(0); } }); mockXWiki.stubs().method("getStore").will(returnValue(mockXWikiStore.proxy())); mockXWiki.stubs().method("getRightService").will(returnValue(mockXWikiRightService.proxy())); getContext().setWiki((XWiki) mockXWiki.proxy()); mockXWikiStore.stubs().method("createWiki") .will(new CustomStub("Implements XWikiStoreInterface.createWiki") { @Override public Object invoke(Invocation invocation) throws Throwable { String wikiName = (String) invocation.parameterValues.get(0); if (databases.containsKey(wikiName)) throw new XWikiException(XWikiException.MODULE_XWIKI_STORE, XWikiException.ERROR_XWIKI_STORE_HIBERNATE_CREATE_DATABASE, "Database " + wikiName + " already exists."); databases.put(wikiName, new HashMap<String, XWikiDocument>()); return null; } }); mockXWikiRightService.stubs().method("hasProgrammingRights").will(returnValue(true)); this.wikiManager = new WikiManager(); }
From source file:alba.components.FilteredShowFileRequestHandler.java
public static Set<String> initHidden(SolrParams invariants) { Set<String> hiddenRet = new HashSet<>(); // Build a list of hidden files if (invariants != null) { String[] hidden = invariants.getParams(HIDDEN); if (hidden != null) { for (String s : hidden) { hiddenRet.add(s.toUpperCase(Locale.ROOT)); }/*from www . j a va 2 s . c o m*/ } } return hiddenRet; }
From source file:br.ufrj.ppgi.jemf.mobile.bean.Victim.java
/** * Set the status as String value.//from ww w . j a va2s . co m * @param status */ public void setStatusString(String status) { setStatus(EnumVictimStatus.valueOf(status.toUpperCase(Locale.ROOT))); }
From source file:com.puppycrawl.tools.checkstyle.AllChecksTest.java
@Test public void testDefaultTokensAreSubsetOfAcceptableTokens() throws Exception { Set<Class<?>> checkstyleChecks = getCheckstyleChecks(); for (Class<?> check : checkstyleChecks) { if (Check.class.isAssignableFrom(check)) { final Check testedCheck = (Check) check.getDeclaredConstructor().newInstance(); final int[] defaultTokens = testedCheck.getDefaultTokens(); final int[] acceptableTokens = testedCheck.getAcceptableTokens(); if (!isSubset(defaultTokens, acceptableTokens)) { String errorMessage = String.format(Locale.ROOT, "%s's default tokens must be a subset" + " of acceptable tokens.", check.getName()); Assert.fail(errorMessage); }/*from ww w .j a v a 2 s. c o m*/ } } }
From source file:fr.lepellerin.ecole.web.controller.LoginController.java
/** * traitement username oubli.//from w ww. ja v a2 s . c om * * @param email * email * @param model * le model spring * @return <code>String</code> nom de la vue */ @RequestMapping(value = "/forgottenUsername", method = RequestMethod.POST) public String sendUsernamePage(@RequestParam final String email, final Model model) { // find family by email. final List<String> accounts = this.utilisateurService.getUserNameByEmail(email); final Context ctx = new Context(Locale.ROOT); ctx.setVariable("accounts", accounts); try { this.emailService.sendSimpleMail("[Ecole notre dame] - Identifiant", email, "no-reply@ecole-lepellerin.com", "forgottenUsername", ctx); } catch (final MessagingException e) { LOGGER.error("ERROR sending email", e); } model.addAttribute("confirm", "Email avec identifiant envoy."); return "accueil/forgottenUsername"; }
From source file:com.grayfox.server.service.PoiServiceTest.java
@Test @Transactional/*w w w . j a v a 2s .c o m*/ public void testGetCategoriesLikeName() { Category c1 = new Category(); c1.setFoursquareId("4bf58dd8d48988d188941735"); c1.setIconUrl("https://ss3.4sqi.net/img/categories_v2/arts_entertainment/default_88.png"); c1.setName("Estadio de ftbol"); Category c2 = new Category(); c2.setFoursquareId("4bf58dd8d48988d18c941735"); c2.setIconUrl("https://ss3.4sqi.net/img/categories_v2/arts_entertainment/default_88.png"); c2.setName("Estadio de bisbol"); List<Category> expectedCategories = Arrays.asList(c1, c2); assertThat(poiService.getCategoriesLikeName("estadio", Locale.ROOT)).isNotNull().isNotEmpty() .usingElementComparatorIgnoringFields("id").containsOnlyElementsOf(expectedCategories); }
From source file:com.puppycrawl.tools.checkstyle.filters.SuppressWarningsFilterTest.java
@Override protected Checker createChecker(Configuration checkConfig) throws Exception { final DefaultConfiguration checkerConfig = new DefaultConfiguration("configuration"); final DefaultConfiguration checksConfig = createCheckConfig(TreeWalker.class); final DefaultConfiguration holderConfig = createCheckConfig(SuppressWarningsHolder.class); holderConfig.addAttribute("aliasList", "com.puppycrawl.tools.checkstyle.checks.sizes." + "ParameterNumberCheck=paramnum"); checksConfig.addChild(holderConfig); checksConfig.addChild(createCheckConfig(MemberNameCheck.class)); checksConfig.addChild(createCheckConfig(ConstantNameCheck.class)); checksConfig.addChild(createCheckConfig(ParameterNumberCheck.class)); checksConfig.addChild(createCheckConfig(IllegalCatchCheck.class)); checkerConfig.addChild(checksConfig); if (checkConfig != null) { checkerConfig.addChild(checkConfig); }/*from w ww. java2 s.c om*/ final Checker checker = new Checker(); final Locale locale = Locale.ROOT; checker.setLocaleCountry(locale.getCountry()); checker.setLocaleLanguage(locale.getLanguage()); checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader()); checker.configure(checkerConfig); checker.addListener(new BriefLogger(stream)); return checker; }
From source file:com.gargoylesoftware.htmlunit.javascript.host.geo.Geolocation.java
private void doGetPosition() { final String os = System.getProperty("os.name").toLowerCase(Locale.ROOT); String wifiStringString = null; if (os.contains("win")) { wifiStringString = getWifiStringWindows(); }// w w w . j a va 2 s . c o m if (wifiStringString != null) { String url = PROVIDER_URL_; if (url.contains("?")) { url += '&'; } else { url += '?'; } url += "browser=firefox&sensor=true"; url += wifiStringString; while (url.length() >= 1900) { url = url.substring(0, url.lastIndexOf("&wifi=")); } if (LOG.isInfoEnabled()) { LOG.info("Invoking URL: " + url); } try (final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_38)) { final Page page = webClient.getPage(url); final String content = page.getWebResponse().getContentAsString(); if (LOG.isDebugEnabled()) { LOG.debug("Receieved Content: " + content); } final double latitude = Double.parseDouble(getJSONValue(content, "lat")); final double longitude = Double.parseDouble(getJSONValue(content, "lng")); final double accuracy = Double.parseDouble(getJSONValue(content, "accuracy")); final Coordinates coordinates = new Coordinates(latitude, longitude, accuracy); coordinates.setPrototype(getPrototype(coordinates.getClass())); final Position position = new Position(coordinates); position.setPrototype(getPrototype(position.getClass())); final JavaScriptEngine jsEngine = getWindow().getWebWindow().getWebClient().getJavaScriptEngine(); jsEngine.callFunction((HtmlPage) getWindow().getWebWindow().getEnclosedPage(), successHandler_, this, getParentScope(), new Object[] { position }); } catch (final Exception e) { LOG.error("", e); } } else { LOG.error("Operating System not supported: " + os); } }
From source file:com.gargoylesoftware.htmlunit.DefaultPageCreator.java
/** * Create a Page object for the specified web response. * * @param webResponse the response from the server * @param webWindow the window that this page will be loaded into * @exception IOException if an IO problem occurs * @return the new page object/*from w w w . j a v a2 s . c o m*/ */ @Override public Page createPage(final WebResponse webResponse, final WebWindow webWindow) throws IOException { final String contentType = determineContentType(webResponse.getContentType().toLowerCase(Locale.ROOT), webResponse.getContentAsStream()); final PageType pageType = determinePageType(contentType); switch (pageType) { case HTML: return createHtmlPage(webResponse, webWindow); case JAVASCRIPT: return createJavaScriptPage(webResponse, webWindow); case XML: final SgmlPage sgmlPage = createXmlPage(webResponse, webWindow); final DomElement doc = sgmlPage.getDocumentElement(); if (doc != null && HTMLParser.XHTML_NAMESPACE.equals(doc.getNamespaceURI())) { return createXHtmlPage(webResponse, webWindow); } return sgmlPage; case TEXT: return createTextPage(webResponse, webWindow); default: return createUnexpectedPage(webResponse, webWindow); } }