org.apache.commons.collections.map.CaseInsensitiveMap Java Examples

The following examples show how to use org.apache.commons.collections.map.CaseInsensitiveMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestComponentLibraries.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Test
public void testComponentsAreInSync() throws Exception {
    final Reader reader = ResourceUtils.read("component-libraries.yml");
    final Map map = new Yaml().loadAs(reader, Map.class);
    final CaseInsensitiveMap caseInsensitiveMap = new CaseInsensitiveMap(map);
    for (final Field field : ComponentsDefine.class.getFields()) {
        final OfficialComponent component = (OfficialComponent) field.get(null);
        final String normalizedComponentName = component.getName().replaceAll("\\.", "");
        if (!caseInsensitiveMap.containsKey(normalizedComponentName)) {
            fail("Component " + component.getName() + " is not registered in component-libraries.yml");
        }
        final Map componentInMap = (Map) caseInsensitiveMap.get(normalizedComponentName);
        final int id = (Integer) componentInMap.get("id");
        assertEquals(
            "Component id defined in class ComponentsDefine should be the same as that in component-libraries.yml",
            id, component.getId()
        );
    }
}
 
Example #2
Source File: RabbitMQUtil.java    From mt-flume with Apache License 2.0 6 votes vote down vote up
public static Map<String,String> getHeaders(BasicProperties properties){
    Preconditions.checkArgument(properties!=null, "properties cannot be null.");
    Map<String,String> headers = new CaseInsensitiveMap();
    setTimestamp(headers, properties);
    
    Map<String, Object> rabbitmqHeaders = properties.getHeaders();
    
    if(null!=rabbitmqHeaders){
        for(Map.Entry<String, Object> kvp:rabbitmqHeaders.entrySet()){
            if(!headers.containsKey(kvp.getKey())&&null!=kvp.getValue()){
                if(log.isInfoEnabled())log.info("header=" + kvp.getKey() + " value=" + kvp.getValue());
                headers.put(kvp.getKey(), kvp.getValue().toString());
            }
        }
    }
    
    return headers;
}
 
Example #3
Source File: DropTableService.java    From circus-train with Apache License 2.0 4 votes vote down vote up
private boolean isExternal(Map<String, String> tableParameters) {
  CaseInsensitiveMap caseInsensitiveParams = new CaseInsensitiveMap(tableParameters);
  return IS_EXTERNAL.equalsIgnoreCase((String) caseInsensitiveParams.get(EXTERNAL_KEY));
}