List of usage examples for java.util Collections EMPTY_MAP
Map EMPTY_MAP
To view the source code for java.util Collections EMPTY_MAP.
Click Source Link
From source file:org.apache.tiles.definition.TestUrlDefinitionsFactory.java
/** * Tests the readDefinitions method under normal conditions. * * @throws Exception If something goes wrong. *//*from ww w .ja v a 2s . c o m*/ @SuppressWarnings("unchecked") public void testReadDefinitions() throws Exception { DefinitionsFactory factory = new UrlDefinitionsFactory(); // Set up multiple data sources. URL url1 = this.getClass().getClassLoader().getResource("org/apache/tiles/config/defs1.xml"); assertNotNull("Could not load defs1 file.", url1); URL url2 = this.getClass().getClassLoader().getResource("org/apache/tiles/config/defs2.xml"); assertNotNull("Could not load defs2 file.", url2); URL url3 = this.getClass().getClassLoader().getResource("org/apache/tiles/config/defs3.xml"); assertNotNull("Could not load defs3 file.", url3); factory.init(Collections.EMPTY_MAP); factory.addSource(url1); factory.addSource(url2); factory.addSource(url3); // Parse files. Definitions definitions = factory.readDefinitions(); assertNotNull("test.def1 definition not found.", definitions.getDefinition("test.def1")); assertNotNull("test.def2 definition not found.", definitions.getDefinition("test.def2")); assertNotNull("test.def3 definition not found.", definitions.getDefinition("test.def3")); }
From source file:URISupport.java
@SuppressWarnings("unchecked") private static Map<String, String> emptyMap() { return Collections.EMPTY_MAP; }
From source file:com.tuplejump.stargate.lucene.query.function.AggregateFunction.java
@Override public List<Row> process(ResultMapper resultMapper, ColumnFamilyStore table, RowIndex currentIndex) throws Exception { Options options = resultMapper.searchSupport.getOptions(); if (aggregates.length == 1 && !aggregates[0].distinct && "count".equalsIgnoreCase(aggregates[0].getType()) && groupBy == null) { //this means it is a count-star. we can simply return the size of the index results Count count = new Count(aggregates[0], false); count.count = resultMapper.collector.docs().size(); group.groups.put(new Tuple(options.nestedFields, Collections.EMPTY_MAP, simpleExpressions), count); Row row = resultMapper.tableMapper.getRowWithMetaColumn(group.toByteBuffer()); return Collections.singletonList(row); }//from w ww . j a v a 2s . c o m Tuple tuple = createTuple(options); if (resultMapper.collector.canByPassRowFetch()) { for (IndexEntryCollector.IndexEntry indexEntry : resultMapper.collector.docs()) { load(tuple, indexEntry); group.addTuple(tuple); } } else { RowFetcher rowFetcher = new RowFetcher(resultMapper); for (Row row : rowFetcher.fetchRows()) { resultMapper.tableMapper.load(positions, tuple, row); group.addTuple(tuple); } } Utils.SimpleTimer timer3 = Utils.getStartedTimer(SearchSupport.logger); ByteBuffer groupBuffer = group.toByteBuffer(); timer3.endLogTime("Aggregation serialization [" + group.groups.size() + "] results"); Row row = resultMapper.tableMapper.getRowWithMetaColumn(groupBuffer); return Collections.singletonList(row); }
From source file:org.jhk.pulsing.search.elasticsearch.client.ESRestClient.java
public Optional<String> putDocument(String index, String type, long id, Map<String, String> jsonObject) { String endpoint = new StringJoiner("/").add(index).add(type).add(id + "").toString(); _LOGGER.debug("ESRestClient.putDocument: " + endpoint + " - " + jsonObject); try {/*from w w w .j a v a2 s .c om*/ Optional<Response> response = performRequest("PUT", endpoint, Collections.EMPTY_MAP, new NStringEntity(_objectMapper.writeValueAsString(jsonObject)), EMPTY_HEADER); if (response.isPresent()) { HttpEntity hEntity = response.get().getEntity(); String result = EntityUtils.toString(hEntity); _LOGGER.debug("ESRestClient.putDocument: result - " + result); return Optional.of(result); } } catch (IOException iException) { iException.printStackTrace(); } return Optional.empty(); }
From source file:de.hybris.platform.util.config.ConfigPerformanceIntTest.java
protected void runAccessor(final int threads, final String callType, final TestThreadsHolder<PropertyAccessor> randomAccessHolder) { randomAccessHolder.startAll();/*from w w w . j a v a 2 s . com*/ try { Thread.sleep(WAIT_SECONDS * 1000); } catch (final InterruptedException e) { Thread.currentThread().interrupt(); } assertTrue("not all test threads shut down orderly", randomAccessHolder.stopAndDestroy(30)); assertEquals("found worker errors", Collections.EMPTY_MAP, randomAccessHolder.getErrors()); long totalCalls = 0; for (final PropertyAccessor r : randomAccessHolder.getRunners()) { totalCalls += r.getAccessCount(); if (!r.occurredErrors.isEmpty()) { for (final Throwable t : r.occurredErrors) { LOG.error(t); Assert.fail(t.getMessage()); } } } assertTrue(totalCalls > 0); final String[] header = { callType, "duration [sec]", "threads", "opers/sec" }; ASCIITable.getInstance().printTable(header, new String[][] { { // String.valueOf(totalCalls), String.valueOf(WAIT_SECONDS), String.valueOf(threads), String.valueOf(totalCalls / WAIT_SECONDS), // } // }); }
From source file:org.apache.cocoon.components.treeprocessor.variables.VariableResolver.java
/** * Build a <code>Map</code> from a Map of named <code>ListOfMapResolver</code>s and * a list of Maps used for resolution./* www. jav a 2 s . c om*/ * * @return a fully resolved <code>Map</code>. */ public static Map buildMap(Map expressions, InvokeContext context, Map objectModel) throws PatternException { int size; if (expressions == null || (size = expressions.size()) == 0) { return Collections.EMPTY_MAP; } Map result; if (expressions instanceof Locatable) { result = new SitemapParameters.LocatedHashMap(((Locatable) expressions).getLocation(), size); } else { result = new HashMap(size); } Iterator iter = expressions.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); result.put(((VariableResolver) entry.getKey()).resolve(context, objectModel), ((VariableResolver) entry.getValue()).resolve(context, objectModel)); } return result; }
From source file:architecture.ee.web.community.struts2.action.ajax.MySocialNetworkAction.java
protected Map<Media, SocialNetwork> getConnectedSocialNetworkMap() { if (getUser().isAnonymous()) return Collections.EMPTY_MAP; Map<Media, SocialNetwork> map = new HashMap<Media, SocialNetwork>(); for (SocialNetwork network : getConnectedSocialNetworks()) { map.put(network.getSocialServiceProvider().getMedia(), network); }/* w w w. j a v a2 s .c o m*/ return map; }
From source file:com.adobe.acs.commons.mcp.impl.processes.renovator.RenovatorTest.java
@Test(expected = RepositoryException.class) public void testRequiredFields() throws LoginException, DeserializeException, RepositoryException { assertEquals("Renovator: relocator test", instance.getName()); instance.init(rr, Collections.EMPTY_MAP); tool.buildProcess(instance, rr);// w w w .ja va 2 s .co m fail("That should have thrown an error"); }
From source file:org.codehaus.griffon.plugins.DefaultGriffonPlugin.java
public DefaultGriffonPlugin(Class pluginClass, Resource resource, GriffonContext application) { super(pluginClass, application); // create properties this.dependencies = Collections.EMPTY_MAP; this.pluginDescriptor = resource; this.resolver = new PathMatchingResourcePatternResolver(); initialisePlugin(pluginClass);//from w w w . j av a 2 s . c o m }
From source file:net.di2e.ecdr.describe.endpoint.rest.CDRRestDescribeService.java
@Override public Map<String, String> getProperties() { return Collections.EMPTY_MAP; }