public void testLocaleIndependence() { Locale orig = Locale.getDefault(); Locale[] locales = { Locale.ENGLISH, new Locale("tr"), Locale.getDefault() }; String[][] data = { { "i", "I" }, { "\u03C2", "\u03C3" }, { "\u03A3", "\u03C2" }, { "\u03A3", "\u03C3" }, }; try { for (int i = 0; i < locales.length; i++) { Locale.setDefault(locales[i]); for (int j = 0; j < data.length; j++) { assertTrue("Test data corrupt: " + j, data[j][0].equalsIgnoreCase(data[j][1])); CaseInsensitiveMap map = new CaseInsensitiveMap(); map.put(data[j][0], "value"); assertEquals(Locale.getDefault() + ": " + j, "value", map.get(data[j][1])); } } } finally { Locale.setDefault(orig); } }
public void testClone() { CaseInsensitiveMap map = new CaseInsensitiveMap(10); map.put("1", "1"); Map cloned = (Map) map.clone(); assertEquals(map.size(), cloned.size()); assertSame(map.get("1"), cloned.get("1")); }
public void set(String name, Object value) { map.put(name, value); }
private String getUniqueName(final String name, final ClassifierResult result) { final Integer currentSeq = (Integer) result.sequenceMap.get(name); if (currentSeq == null) { // name is unique, so return the original name final Integer n = -1; result.sequenceMap.put(name, n); return name; } // create a new name final Integer newSeq = currentSeq + 1; final String newName = name + newSeq; result.sequenceMap.put(name, newSeq); result.sequenceMap.put(newName, -1); return newName; }
/** * Creates a CapabilitesRequest based on a Map (HTTP_GET) * * @param ciMap * The client input * @throws ExceptionReport */ public CapabilitiesRequest(CaseInsensitiveMap ciMap) throws ExceptionReport { super(ciMap); //Fix for https://bugzilla.52north.org/show_bug.cgi?id=907 String providedAcceptVersionsString = Request.getMapValue("acceptversions", ciMap, false); if (providedAcceptVersionsString != null) { String[] providedAcceptVersions = providedAcceptVersionsString.split(","); if (providedAcceptVersions != null) { map.put("version", providedAcceptVersions); } } }
/** * Helper method to ensure unique output column names. If allowDupsWithRename is set to true, the original name * will be appended with a suffix number to ensure uniqueness. Otherwise, the original column would not be renamed even * even if it has been used * * @param origName the original input name of the column * @param result the data structure to keep track of the used names and decide what output name should be * to ensure uniqueness * @param allowDupsWithRename if the original name has been used, is renaming allowed to ensure output name unique */ private void addToResultMaps(final String origName, final ClassifierResult result, final boolean allowDupsWithRename) { String name = origName; if (allowDupsWithRename) { name = getUniqueName(origName, result); } if (!result.outputMap.containsKey(name)) { result.outputNames.add(name); result.outputMap.put(name, name); } else { result.outputNames.add(EMPTY_STRING); } }
log.info("document candidate foreign key column: " + colName); docTableCols.put(colName, rsmd.getColumnType(i));
log.info("document candidate foreign key column: " + colName); docTableCols.put(colName, rsmd.getColumnType(i));
/** * Register a theme with the registry. * * @param theme The theme to register. * @throws DuplicateThemeException In case of a duplicate theme */ void registerTheme(final Theme theme) throws Exception { if (themes.get(theme.getName()) != null) { throw new DuplicateThemeException("newcode.theme.register.duplicate.name", theme.getName()); } themes.put(theme.getName(), theme); }
if (!result.outputMap.containsKey(incomingName)) { result.outputNames.set(k, incomingName); result.outputMap.put(incomingName, incomingName);