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:eu.openanalytics.rsb.RestJobsITCase.java
@Test @SuppressWarnings("unchecked") public void submitInvalidZipJob() throws Exception { final String applicationName = newTestApplicationName(); try {/*from w ww . ja va2s .co m*/ doTestSubmitZipJob(applicationName, getTestData("invalid-job-subdir.zip"), Collections.EMPTY_MAP); fail("an exception should have been raised"); } catch (final HttpException he) { assertEquals(400, he.getResponseCode()); } }
From source file:org.codehaus.groovy.grails.web.util.WebUtils.java
/** * @see org.codehaus.groovy.grails.web.util.WebUtils#forwardRequestForUrlMappingInfo(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.codehaus.groovy.grails.web.mapping.UrlMappingInfo, java.util.Map) */// w w w.java 2s . c om public static String forwardRequestForUrlMappingInfo(HttpServletRequest request, HttpServletResponse response, UrlMappingInfo info) throws ServletException, IOException { return forwardRequestForUrlMappingInfo(request, response, info, Collections.EMPTY_MAP); }
From source file:edu.uci.ics.jung.io.GraphMLWriter.java
/** * Adds a new graph data specification./*from ww w . j a va2s . c o m*/ */ public void addGraphData(String id, String description, String default_value, Transformer<Hypergraph<V, E>, String> graph_transformer) { if (graph_data.equals(Collections.EMPTY_MAP)) graph_data = new HashMap<String, GraphMLMetadata<Hypergraph<V, E>>>(); graph_data.put(id, new GraphMLMetadata<Hypergraph<V, E>>(description, default_value, graph_transformer)); }
From source file:com.redhat.rhn.common.db.datasource.test.AdvDataSourceTest.java
public void testMaxRowsWithElaboration() throws Exception { int startId = 1000; int endId = startId + 50; for (int i = startId; i < endId; i++) { insert("foobar" + TestUtils.randomString(), i); }// w w w .j a va2 s . c o m SelectMode m = ModeFactory.getMode("test_queries", "find_all_in_table"); m.setMaxRows(10); DataResult<AdvDataSourceDto> dr = m.execute(Collections.EMPTY_MAP); assertEquals(10, dr.size()); dr.elaborate(); assertTrue(dr.size() <= 10); for (AdvDataSourceDto row : dr) { assertNotNull(row.getTestColumn()); assertNotNull(row.getPin()); assertNotNull(row.getFoobar()); } }
From source file:org.apache.tiles.definition.TestUrlDefinitionsFactory.java
/** * Tests the isContextProcessed method./*from ww w . j ava 2s. co m*/ * * @throws Exception If something goes wrong. */ @SuppressWarnings("unchecked") public void testIsContextProcessed() throws Exception { MockPublicUrlDefinitionsFactory factory = new MockPublicUrlDefinitionsFactory(); // Set up multiple data sources. URL url1 = this.getClass().getClassLoader().getResource("org/apache/tiles/config/defs1.xml"); assertNotNull("Could not load defs1 file.", url1); factory.init(Collections.EMPTY_MAP); factory.addSource(url1); // Parse files. Definitions definitions = factory.readDefinitions(); TilesRequestContext tilesContext = new MockOnlyLocaleTilesContext(Locale.US); assertFalse("Locale should not be processed.", factory.isContextProcessed(tilesContext)); factory.addDefinitions(definitions, tilesContext); assertTrue("Locale should be processed.", factory.isContextProcessed(tilesContext)); }
From source file:org.alfresco.module.org_alfresco_module_rm.report.generator.DeclarativeReportGenerator.java
/** * @see org.alfresco.module.org_alfresco_module_rm.report.generator.BaseReportGenerator#generateReportTemplateContext(org.alfresco.service.cmr.repository.NodeRef) */// w ww .j a v a 2s. c o m @SuppressWarnings("unchecked") @Override protected Map<String, Serializable> generateReportTemplateContext(NodeRef reportedUponNodeRef) { return Collections.EMPTY_MAP; }
From source file:eu.openanalytics.rsb.RestJobsITCase.java
@Test public void submitValidZipJobWithCatalogRef() throws Exception { final String applicationName = newTestApplicationName(); @SuppressWarnings("unchecked") final Document resultDoc = doTestSubmitZipJob(applicationName, getTestData("r-job-catalog-ref.zip"), Collections.EMPTY_MAP); final String resultUri = getResultUri(resultDoc); ponderRetrieveAndValidateZipResult(resultUri); }
From source file:edu.uci.ics.jung.io.GraphMLWriter.java
/** * Adds a new vertex data specification. *///from w w w . ja v a 2s . co m public void addVertexData(String id, String description, String default_value, Transformer<V, String> vertex_transformer) { if (vertex_data.equals(Collections.EMPTY_MAP)) vertex_data = new HashMap<String, GraphMLMetadata<V>>(); vertex_data.put(id, new GraphMLMetadata<V>(description, default_value, vertex_transformer)); }
From source file:fr.inria.atlanmod.neoemf.map.datastore.MapPersistenceBackendFactoryTest.java
/** * Test if {@link MapPersistenceBackend.copyBackend} creates the persistent * data stores from the transient ones. Only empty backends are tested. * @throws InvalidDataStoreException/*from w w w .j a v a 2 s . c om*/ */ @Test public void testCopyBackend() throws InvalidDataStoreException { PersistenceBackend transientBackend = persistenceBackendFactory.createTransientBackend(); assert transientBackend instanceof MapPersistenceBackend : "Transient backend is not an instance of MapPersistenceBackend"; MapPersistenceBackend transientMap = (MapPersistenceBackend) transientBackend; SearcheableResourceEStore transientEStore = persistenceBackendFactory.createTransientEStore(null, transientBackend); PersistenceBackend persistentBackend = persistenceBackendFactory.createPersistentBackend(testFile, Collections.EMPTY_MAP); assert persistentBackend instanceof MapPersistenceBackend : "Persistent backend is not an instance of MapPersistenceBackend"; MapPersistenceBackend persistentMap = (MapPersistenceBackend) persistentBackend; SearcheableResourceEStore persistentEStore = persistenceBackendFactory.createPersistentEStore(null, persistentBackend, options); persistenceBackendFactory.copyBackend(transientMap, persistentMap); for (String tKey : transientMap.getAll().keySet()) { assert persistentMap.getAll().containsKey(tKey) : "Persistent backend does not contain the key " + tKey; assert persistentMap.getAll().get(tKey).equals(transientMap.get(tKey)) : "Persistent backend structure " + tKey + " is not equal to transient one"; } }
From source file:net.netheos.pcsapi.providers.hubic.Swift.java
/** * Return map of CFile in given folder. Key is file CPath * * @param path the CFolder object or CPath to be listed * @return/* ww w .ja v a2s .c om*/ */ public CFolderContent listFolder(CPath path) throws CStorageException { JSONArray array = listObjectsWithinFolder(path, "/"); CFile file; if (array == null || array.length() == 0) { // List is empty ; can be caused by a really empty folder, // a non existing folder, or a blob // Distinguish the different cases : file = getFile(path); if (file == null) { // Nothing at that path return null; } if (file.isBlob()) { // It is a blob : error ! throw new CInvalidFileTypeException(path, false); } return new CFolderContent(Collections.EMPTY_MAP); } Map<CPath, CFile> ret = new HashMap<CPath, CFile>(); boolean detailed; JSONObject obj; for (int i = 0; i < array.length(); i++) { obj = array.getJSONObject(i); if (obj.has("subdir")) { // indicates a non empty sub directory // There are two cases here : provider uses directory-markers, or not. // - if yes, another entry should exist in json with more detailed informations. // - if not, this will be the only entry that indicates a sub folder, // so we keep this file, but we'll memorize it only if it is not already present // in returned value. file = new CFolder(new CPath(obj.getString("subdir"))); detailed = false; } else { detailed = true; if (!CONTENT_TYPE_DIRECTORY.equals(obj.getString("content_type"))) { file = new CBlob(new CPath(obj.getString("name")), obj.getLong("bytes"), obj.getString("content_type"), parseLastModified(obj), null); // we do not have this detailed information } else { file = new CFolder(new CPath(obj.getString("name")), parseLastModified(obj), null); // we do not have this detailed information } } if (detailed || !ret.containsKey(path)) { // If we got a detailed file, we always store it // If we got only rough description, we keep it only if no detailed info already exists ret.put(file.getPath(), file); } } return new CFolderContent(ret); }