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.xpack.ml.integration.MlPluginDisabledIT.java
/** * Check that when the ml plugin is disabled, you cannot create a job as the * rest handler is not registered//from w w w .j ava2 s.co m */ public void testActionsFail() throws Exception { XContentBuilder xContentBuilder = jsonBuilder(); xContentBuilder.startObject(); xContentBuilder.field("actions-fail-job", "foo"); xContentBuilder.field("description", "Analysis of response time by airline"); xContentBuilder.startObject("analysis_config"); xContentBuilder.field("bucket_span", "3600s"); xContentBuilder.startArray("detectors"); xContentBuilder.startObject(); xContentBuilder.field("function", "metric"); xContentBuilder.field("field_name", "responsetime"); xContentBuilder.field("by_field_name", "airline"); xContentBuilder.endObject(); xContentBuilder.endArray(); xContentBuilder.endObject(); xContentBuilder.startObject("data_description"); xContentBuilder.field("format", "xcontent"); xContentBuilder.field("time_field", "time"); xContentBuilder.field("time_format", "epoch"); xContentBuilder.endObject(); xContentBuilder.endObject(); ResponseException exception = expectThrows(ResponseException.class, () -> client().performRequest("put", MachineLearning.BASE_PATH + "anomaly_detectors/foo", Collections.emptyMap(), new StringEntity(Strings.toString(xContentBuilder), ContentType.APPLICATION_JSON))); assertThat(exception.getMessage(), containsString("no handler found for uri [/_xpack/ml/anomaly_detectors/foo] and method [PUT]")); }
From source file:org.kurento.tutorial.helloworld.RepositoryManager.java
private RepositoryItemRecorder newRepoItem() { RepositoryItemRecorder repoItem = new RepositoryItemRecorder(); try {//from w w w. j ava 2 s . co m System.out.println(ANSI_RED + "RECYCLING REPOSITORY CLIENT" + ANSI_RESET); Map<String, String> metadata = Collections.emptyMap(); synchronized (repositoryClient) { repoItem = repositoryClient.createRepositoryItem(metadata); } System.out.println(ANSI_RED + "REPOSITORY RECYCLED" + ANSI_RESET); } catch (Exception e) { log.warn("Unable to create kurento repository items", e); } return repoItem; }
From source file:fr.ortolang.diffusion.indexing.OrtolangIndexableContent.java
public OrtolangIndexableContent(String index, String type, String id) { this.index = index; this.type = type; this.id = id; this.update = false; this.script = null; this.scriptParams = Collections.emptyMap(); }
From source file:org.apache.calcite.adapter.elasticsearch.ElasticSearchAdapterTest.java
/** * Used to create {@code zips} index and insert zip data in bulk. * @throws Exception when instance setup failed */// ww w . ja v a 2s . c o m @BeforeClass public static void setupInstance() throws Exception { // hardcoded mapping definition final String mapping = String.format(Locale.ROOT, "{'mappings':{'%s':{'properties':" + "{'city':{'type':'keyword'},'state':{'type':'keyword'},'pop':{'type':'long'}}" + "}}}", ZIPS).replace('\'', '"'); // create index and mapping final HttpEntity entity = new StringEntity(mapping, ContentType.APPLICATION_JSON); NODE.restClient().performRequest("PUT", "/" + ZIPS, Collections.emptyMap(), entity); // load records from file final List<String> bulk = new ArrayList<>(); Resources.readLines(ElasticSearchAdapterTest.class.getResource("/zips-mini.json"), StandardCharsets.UTF_8, new LineProcessor<Void>() { @Override public boolean processLine(String line) throws IOException { bulk.add("{\"index\": {} }"); // index/type will be derived from _bulk URI line = line.replaceAll("_id", "id"); // _id is a reserved attribute in ES bulk.add(line); return true; } @Override public Void getResult() { return null; } }); if (bulk.isEmpty()) { throw new IllegalStateException("No records to index. Empty file ?"); } final String uri = String.format(Locale.ROOT, "/%s/%s/_bulk?refresh", ZIPS, ZIPS); Response response = NODE.restClient().performRequest("POST", uri, Collections.emptyMap(), new StringEntity(String.join("\n", bulk) + "\n", ContentType.APPLICATION_JSON)); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { final String error = EntityUtils.toString(response.getEntity()); final String message = String.format(Locale.ROOT, "Couldn't bulk insert %d elements into %s (%s/%s). Error was %s\n%s\n", bulk.size(), ZIPS, response.getHost(), response.getRequestLine(), response.getStatusLine(), error); throw new IllegalStateException(message); } }
From source file:io.github.carlomicieli.footballdb.starter.parsers.PlayerProfileParser.java
protected static Map<String, String> extractBirth(Optional<String> str) { return str.map(val -> { Matcher matcher = patternMatchString(birthPattern(), val); Map<String, String> v = newMap(); if (matcher.find()) { v.put("birth_date", matcher.group(1)); v.put("city", matcher.group(2)); v.put("state", matcher.group(3)); }/*from w ww. j a v a2s . co m*/ return unmodifiableMap(v); }).orElse(Collections.emptyMap()); }
From source file:org.openmrs.module.metadatasharing.handler.impl.PrivilegeHandler.java
@Override public Map<String, Object> getProperties(Privilege object) { return Collections.emptyMap(); }
From source file:net.praqma.jenkins.plugin.prqa.PRQARemoteToolCheck.java
/** * Expands the environment if the environment field for this object is set. * This is only done when the user uses a product configuration. *//*ww w .j ava 2 s . c o m*/ public static Map<String, String> expandEnvironment(Map<String, String> environment, PRQAApplicationSettings appSettings, ReportSettings reportSetting, boolean isUnix) throws PrqaSetupException { if (environment == null) { return Collections.emptyMap(); } String delimiter = System.getProperty("file.separator"); String pathSep = System.getProperty("path.separator"); String product = reportSetting.getProduct(); if (Strings.isNullOrEmpty(product)) { environment.put(QACli.QAF_BIN_PATH, PRQAApplicationSettings.addSlash(environment.get(QACli.QAF_INSTALL_PATH), delimiter) + "common" + delimiter + "bin"); return environment; } String pathVar = ""; Map<String, String> localEnv = System.getenv(); for (String s : localEnv.keySet()) { if (s.equalsIgnoreCase(PATH)) { pathVar = s; break; } } String currentPath = localEnv.get(pathVar); if (reportSetting.getProduct().equalsIgnoreCase("qac")) { String slashPath = PRQAApplicationSettings.addSlash(environment.get("QACPATH"), delimiter); environment.put("QACPATH", slashPath); String qacBin = PRQAApplicationSettings.addSlash(environment.get("QACPATH"), delimiter) + "bin"; environment.put("QACBIN", qacBin); environment.put("QACHELPFILES", environment.get("QACPATH") + "help"); currentPath = environment.get("QACBIN") + pathSep + currentPath; environment.put("QACTEMP", System.getProperty("java.io.tmpdir")); } else { String slashPath = PRQAApplicationSettings.addSlash(environment.get("QACPPPATH"), delimiter); environment.put("QACPPPATH", slashPath); String qacppBin = PRQAApplicationSettings.addSlash(environment.get("QACPPPATH"), delimiter) + "bin"; environment.put("QACPPBIN", qacppBin); environment.put("QACPPHELPFILES", environment.get("QACPPPATH") + "help"); currentPath = environment.get("QACPPBIN") + pathSep + currentPath; environment.put("QACPPTEMP", System.getProperty("java.io.tmpdir")); } String qarPath = PRQAApplicationSettings.addSlash(appSettings.qarHome, delimiter) + "bin"; File qarFolder = new File(qarPath); if (!qarFolder.exists()) { throw new PrqaSetupException( String.format("Non existent QAR home directory (%s) - Check your tool settings", qarPath)); } currentPath = qarPath + pathSep + currentPath; if (StringUtils.isBlank(appSettings.qavClientHome) && reportSetting.publishToQAV()) { throw new PrqaSetupException( "You have not configured QAVerify client home - Check your tool settings"); } if (!StringUtils.isBlank(appSettings.qavClientHome) && reportSetting.publishToQAV()) { String qavClientHome = null; if (isUnix) { qavClientHome = PRQAApplicationSettings.addSlash(appSettings.qavClientHome, delimiter) + "bin"; } else { qavClientHome = appSettings.qavClientHome; } File qavClientFolder = new File(qavClientHome); if (!qavClientFolder.exists()) { throw new PrqaSetupException(String.format( "Non existent QA Verify client home directory (%s) - Check your tool settings", qavClientHome)); } currentPath = qavClientHome + pathSep + currentPath; } String qawHome = PRQAApplicationSettings.addSlash(appSettings.qawHome, delimiter) + "bin"; File qawHomeFolder = new File(qawHome); if (!qawHomeFolder.exists()) { throw new PrqaSetupException( String.format("Non existent QAW home directory (%s) - Check your tool settings", qawHome)); } currentPath = qawHome + pathSep + currentPath; environment.put(pathVar, currentPath); return environment; }
From source file:org.nuxeo.apidoc.introspection.BundleGroupImpl.java
public BundleGroupImpl(String key, String version) { this(key, version, Collections.emptyMap()); }
From source file:org.elasticsearch.http.HttpCompressionIT.java
public void testUncompressedResponseByDefault() throws IOException { RestClient client = client();/*w w w. j a va 2 s . c o m*/ Response response = client.performRequest("GET", "/"); assertEquals(200, response.getStatusLine().getStatusCode()); assertNull(response.getHeader(HttpHeaders.CONTENT_ENCODING)); response = client.performRequest("POST", "/company/employees/1", Collections.emptyMap(), SAMPLE_DOCUMENT); assertEquals(201, response.getStatusLine().getStatusCode()); assertNull(response.getHeader(HttpHeaders.CONTENT_ENCODING)); }
From source file:com.couchbase.workshop.QueryController.java
@RequestMapping("/parameterized") public Map<String, Object> parameterized(@RequestParam String faa) { // IMPLEMENT ME return Collections.emptyMap(); }