List of usage examples for java.util Map equals
boolean equals(Object o);
From source file:com.tweak.client.request.DeleteRequest.java
@Override public Map<String, String> getHeaders() throws AuthFailureError { Map<String, String> headers = super.getHeaders(); if (headers == null || headers.equals(Collections.emptyMap())) { headers = new HashMap<String, String>(); }/*www . j av a 2 s .c om*/ if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) { headers.putAll(apiHeaders); } if (contentType != null) { headers.put("Content-Type", contentType); } return headers; }
From source file:net.nelz.simplesm.test.ReadThroughMultiCacheTest.java
@Test public void testMemcached() { final MemcachedClientIF cache = (MemcachedClientIF) context.getBean("memcachedClient"); final List<String> keys = new ArrayList<String>(); final Map<String, String> answerMap = new HashMap<String, String>(); final Long now = new Date().getTime(); final String alphabet = "abcdefghijklmnopqrstuvwxyz"; for (int ix = 0; ix < 5; ix++) { final String key = alphabet.charAt(ix) + now.toString(); final String value = alphabet.toUpperCase().charAt(ix) + "00000"; cache.set(key, 30, value);/*from www . j ava 2s . c om*/ keys.add(key); answerMap.put(key, value); } final Map<String, Object> memcachedSez = cache.getBulk(keys); assertTrue(memcachedSez.equals(answerMap)); }
From source file:cd.go.contrib.elasticagents.docker.executors.ShouldAssignWorkRequestExecutor.java
@Override public GoPluginApiResponse execute() { DockerContainer instance = agentInstances.find(request.agent().elasticAgentId()); if (instance == null) { return DefaultGoPluginApiResponse.success("false"); }/* www .j ava 2 s . com*/ boolean environmentMatches = stripToEmpty(request.environment()) .equalsIgnoreCase(stripToEmpty(instance.environment())); Map<String, String> containerProperties = instance.properties() == null ? new HashMap<String, String>() : instance.properties(); Map<String, String> requestProperties = request.properties() == null ? new HashMap<String, String>() : request.properties(); boolean propertiesMatch = requestProperties.equals(containerProperties); if (environmentMatches && propertiesMatch) { return DefaultGoPluginApiResponse.success("true"); } return DefaultGoPluginApiResponse.success("false"); }
From source file:cd.go.contrib.elasticagents.dockerswarm.elasticagent.executors.ShouldAssignWorkRequestExecutor.java
@Override public GoPluginApiResponse execute() { DockerService instance = agentInstances.find(request.agent().elasticAgentId()); if (instance == null) { return DefaultGoPluginApiResponse.success("false"); }//w ww. j a v a2s. co m boolean environmentMatches = stripToEmpty(request.environment()) .equalsIgnoreCase(stripToEmpty(instance.environment())); Map<String, String> containerProperties = instance.properties() == null ? new HashMap<String, String>() : instance.properties(); Map<String, String> requestProperties = request.properties() == null ? new HashMap<String, String>() : request.properties(); boolean propertiesMatch = requestProperties.equals(containerProperties); if (environmentMatches && propertiesMatch) { return DefaultGoPluginApiResponse.success("true"); } return DefaultGoPluginApiResponse.success("false"); }
From source file:com.example.elasticagent.executors.ShouldAssignWorkRequestExecutor.java
@Override public GoPluginApiResponse execute() { ExampleInstance instance = agentInstances.find(request.agent().elasticAgentId()); if (instance == null) { return DefaultGoPluginApiResponse.success("false"); }/*from w w w .j a va2 s .com*/ boolean environmentMatches = stripToEmpty(request.environment()) .equalsIgnoreCase(stripToEmpty(instance.environment())); Map<String, String> containerProperties = instance.properties() == null ? new HashMap<String, String>() : instance.properties(); Map<String, String> requestProperties = request.properties() == null ? new HashMap<String, String>() : request.properties(); boolean propertiesMatch = requestProperties.equals(containerProperties); if (environmentMatches && propertiesMatch) { return DefaultGoPluginApiResponse.success("true"); } return DefaultGoPluginApiResponse.success("false"); }
From source file:com.gayakwad.gocd.elasticagent.mesos.executors.ShouldAssignWorkRequestExecutor.java
@Override public GoPluginApiResponse execute() { MesosInstance instance = agentInstances.find(request.agent().elasticAgentId()); if (instance == null) { return DefaultGoPluginApiResponse.success("false"); }//w w w. j a v a 2 s.c o m boolean environmentMatches = stripToEmpty(request.environment()) .equalsIgnoreCase(stripToEmpty(instance.environment())); Map<String, String> containerProperties = instance.properties() == null ? new HashMap<String, String>() : instance.properties(); Map<String, String> requestProperties = request.properties() == null ? new HashMap<String, String>() : request.properties(); boolean propertiesMatch = requestProperties.equals(containerProperties); if (environmentMatches && propertiesMatch) { return DefaultGoPluginApiResponse.success("true"); } return DefaultGoPluginApiResponse.success("false"); }
From source file:com.google.code.ssm.test.ReadThroughMultiCacheTest.java
@Test public void testMemcached() throws TimeoutException, CacheException { // final MemcachedClientIF cache = (MemcachedClientIF) context.getBean("memcachedClient"); final List<String> keys = new ArrayList<String>(); final Map<String, String> answerMap = new HashMap<String, String>(); final Long now = new Date().getTime(); final String alphabet = "abcdefghijklmnopqrstuvwxyz"; for (int ix = 0; ix < 5; ix++) { final String key = alphabet.charAt(ix) + now.toString(); final String value = alphabet.toUpperCase().charAt(ix) + "00000"; cache.set(key, 30, value, null); keys.add(key);/*from w ww . j a v a 2s. co m*/ answerMap.put(key, value); } final Map<String, Object> memcachedSez = cache.getBulk(keys, null); assertTrue(memcachedSez.equals(answerMap)); }
From source file:io.fabric8.spring.cloud.kubernetes.reload.ConfigurationChangeDetector.java
/** * Determines if two property sources are different. */// ww w .ja v a2 s .c o m protected boolean changed(MapPropertySource mp1, MapPropertySource mp2) { if (mp1 == mp2) return false; if (mp1 == null && mp2 != null || mp1 != null && mp2 == null) return true; Map<String, Object> s1 = mp1.getSource(); Map<String, Object> s2 = mp2.getSource(); return s1 == null ? s2 != null : !s1.equals(s2); }
From source file:com.wso2.mobile.mdm.utils.ServerUtilities.java
public static Map<String, String> sendWithTimeWait(String epPostFix, Map<String, String> params, String option, Context context) {/*from w w w .j ava2s. co m*/ Map<String, String> response = null; Map<String, String> responseFinal = null; long backoff = BACKOFF_MILLI_SECONDS + random.nextInt(1000); for (int i = 1; i <= MAX_ATTEMPTS; i++) { Log.d(TAG, "Attempt #" + i + " to register"); try { //response = sendToServer(epPostFix, params, option, context); response = postData(context, epPostFix, params); if (response != null && !response.equals(null)) { responseFinal = response; } GCMRegistrar.setRegisteredOnServer(context, true); String message = context.getString(R.string.server_registered); Log.v("Check Reg Success", message.toString()); return responseFinal; } catch (Exception e) { Log.e(TAG, "Failed to register on attempt " + i, e); if (i == MAX_ATTEMPTS) { break; } return responseFinal; } } String message = context.getString(R.string.server_register_error, MAX_ATTEMPTS); return responseFinal; }
From source file:org.molasdin.wbase.jsf.storage.adapters.AbstractLazyDataModelCursorWrapper.java
/** * Add filters to cursor// w w w .j av a2s . c o m * @param stringStringMap */ public void addFilters(Map<String, Object> stringStringMap) { if (stringStringMap.size() > 0) { if (!stringStringMap.equals(filters)) { for (String key : stringStringMap.keySet()) { result.filters().put(key, new ImmutablePair<FilteringMode, String>(FilteringMode.START, ObjectUtils.toString(stringStringMap.get(key)))); } countRetrieved = false; } } else { if (filters != null && filters.size() > 0) { countRetrieved = false; } result.filters().clear(); } filters = stringStringMap; }