List of usage examples for java.util Collections emptyMap
@SuppressWarnings("unchecked") public static final <K, V> Map<K, V> emptyMap()
From source file:org.elasticsearch.rest.action.main.RestMainActionIT.java
public void testGetRequest() throws IOException { try (Response response = getRestClient().performRequest("GET", "/", Collections.emptyMap(), null)) { assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertNotNull(response.getEntity()); assertThat(EntityUtils.toString(response.getEntity()), containsString("cluster_name")); }/*from w w w. j av a 2s. co m*/ }
From source file:com.openshift.internal.restclient.model.build.BuildConfigBuilderTest.java
@Before public void setUp() throws Exception { bcImpl = new BuildConfig(new ModelNode(), client, Collections.emptyMap()); when(client.getResourceFactory()).thenReturn(factory); when(factory.stub(eq(ResourceKind.BUILD_CONFIG), anyString(), anyString())).thenReturn(bcImpl); }
From source file:com.frank.search.solr.core.ResultHelper.java
static Map<String, List<TermsFieldEntry>> convertTermsQueryResponseToTermsMap(QueryResponse response) { if (response == null || response.getTermsResponse() == null || response.getTermsResponse().getTermMap() == null) { return Collections.emptyMap(); }/*ww w . j a v a2s. c o m*/ TermsResponse termsResponse = response.getTermsResponse(); Map<String, List<TermsFieldEntry>> result = new LinkedHashMap<String, List<TermsFieldEntry>>( termsResponse.getTermMap().size()); for (Entry<String, List<Term>> entry : termsResponse.getTermMap().entrySet()) { List<TermsFieldEntry> terms = new ArrayList<TermsFieldEntry>(entry.getValue().size()); for (Term term : entry.getValue()) { SimpleTermsFieldEntry termsEntry = new SimpleTermsFieldEntry(term.getTerm(), term.getFrequency()); termsEntry.setField(entry.getKey()); terms.add(termsEntry); } result.put(entry.getKey(), terms); } return result; }
From source file:com.netflix.spinnaker.igor.travis.TravisCache.java
public Map<String, Integer> getQueuedJob(String master, int queueNumber) { Map<String, String> result = redisClientDelegate.withCommandsClient(c -> { return c.hgetAll(makeKey(master, queueNumber)); });//from w w w . j a va2 s . com if (result.isEmpty()) { return Collections.emptyMap(); } Map<String, Integer> converted = new HashMap<>(); converted.put("requestId", Integer.parseInt(result.get("requestId"))); converted.put("repositoryId", Integer.parseInt(result.get("repositoryId"))); return converted; }
From source file:org.hawkular.apm.server.api.utils.zipkin.BinaryAnnotationMappingStorage.java
/** * Default storage. It loads mappings from jboss configuration directory. *//*from w w w . j av a 2 s . c om*/ public BinaryAnnotationMappingStorage() { String jbossConfigDir = System.getProperties().getProperty("jboss.server.config.dir"); if (jbossConfigDir == null) { log.errorf("Property jboss.server.config.dir is not set, Binary Annotation mapping rules set to empty"); keyBasedMappings = Collections.emptyMap(); return; } String path = System.getProperty("jboss.server.config.dir") + File.separatorChar + HAWKULAR_ZIPKIN_BINARY_ANNOTATION_MAPPING; loadMappings(path); }
From source file:com.exzogeni.dk.http.HttpTask.java
@NonNull private static Map<String, List<String>> getHeaderFields(HttpURLConnection cn) { final Map<String, List<String>> headers = cn.getHeaderFields(); if (headers != null) { final Map<String, List<String>> localHeaders = new HashMap<>(headers); localHeaders.remove(null);//w w w.ja v a 2 s . co m return Collections.unmodifiableMap(localHeaders); } return Collections.emptyMap(); }
From source file:edu.indiana.d2i.htrc.security.JWTServletFilterConfiguration.java
public Map<String, String> getClaimMappings() { if (config.hasPath(CONFIG_CLAIM_MAPPINGS)) { Map<String, String> mappings = new HashMap<>(); config.getConfig(CONFIG_CLAIM_MAPPINGS).entrySet().stream().forEach((entry) -> { mappings.put(entry.getKey(), (String) entry.getValue().unwrapped()); });/*from w ww. j a v a 2s . com*/ return mappings; } return Collections.emptyMap(); }
From source file:org.springframework.social.facebook.api.impl.json.StoryTagMapDeserializer.java
@SuppressWarnings("unchecked") @Override/* w w w . j av a 2 s. c o m*/ public Map<Integer, List<StoryTag>> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new FacebookModule()); jp.setCodec(mapper); if (jp.hasCurrentToken()) { JsonNode dataNode = jp.readValueAs(JsonNode.class); if (dataNode != null) { return (Map<Integer, List<StoryTag>>) mapper .reader(new TypeReference<Map<Integer, List<StoryTag>>>() { }).readValue(dataNode); } } return Collections.emptyMap(); }
From source file:org.springframework.social.facebook.api.impl.json.MessageTagMapDeserializer.java
@SuppressWarnings("unchecked") @Override//from w w w .j av a 2 s .c om public Map<Integer, List<MessageTag>> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new FacebookModule()); jp.setCodec(mapper); if (jp.hasCurrentToken()) { JsonNode dataNode = jp.readValueAs(JsonNode.class); if (dataNode != null) { return (Map<Integer, List<MessageTag>>) mapper .reader(new TypeReference<Map<Integer, List<MessageTag>>>() { }).readValue(dataNode); } } return Collections.emptyMap(); }
From source file:org.elasticsearch.test.rest.yaml.ClientYamlTestExecutionContextTests.java
public void testHeadersSupportStashedValueReplacement() throws IOException { final AtomicReference<Map<String, String>> headersRef = new AtomicReference<>(); final ClientYamlTestExecutionContext context = new ClientYamlTestExecutionContext(null, randomBoolean()) { @Override// ww w . jav a2 s . c o m ClientYamlTestResponse callApiInternal(String apiName, Map<String, String> params, HttpEntity entity, Map<String, String> headers) { headersRef.set(headers); return null; } }; final Map<String, String> headers = new HashMap<>(); headers.put("foo", "$bar"); headers.put("foo1", "baz ${c}"); context.stash().stashValue("bar", "foo2"); context.stash().stashValue("c", "bar1"); assertNull(headersRef.get()); context.callApi("test", Collections.emptyMap(), Collections.emptyList(), headers); assertNotNull(headersRef.get()); assertNotEquals(headers, headersRef.get()); assertEquals("foo2", headersRef.get().get("foo")); assertEquals("baz bar1", headersRef.get().get("foo1")); }