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:io.fabric8.maven.plugin.mojo.build.ResourceMojo.java
private Map<String, String> getAnnotations(HasMetadata item) { ObjectMeta meta = item.getMetadata(); if (meta == null) { return Collections.EMPTY_MAP; }/*from w ww . j av a2s . c o m*/ Map<String, String> annos = meta.getAnnotations(); if (annos == null) { return Collections.EMPTY_MAP; } return annos; }
From source file:org.apache.axiom.om.impl.SwitchingWrapper.java
/** * Method getNamespaceContext./*from ww w. j a v a 2 s. c o m*/ * * @return Returns NamespaceContext. */ public NamespaceContext getNamespaceContext() { if (state == SWITCHED) { return parser.getNamespaceContext(); } return new MapBasedNamespaceContext( currentEvent == END_DOCUMENT ? Collections.EMPTY_MAP : getAllNamespaces(lastNode)); }
From source file:org.apache.atlas.web.integration.EntityJerseyResourceIT.java
@Test public void testDeleteEntitiesViaRestApi() throws Exception { // Create 2 database entities Referenceable db1 = new Referenceable(DATABASE_TYPE_BUILTIN); String dbName = randomString(); db1.set(NAME, dbName);/*w w w . java2 s . c o m*/ db1.set(DESCRIPTION, randomString()); db1.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName); db1.set("owner", "user1"); db1.set(CLUSTER_NAME, "cl1"); db1.set("parameters", Collections.EMPTY_MAP); db1.set("location", "/tmp"); Id db1Id = createInstance(db1); Referenceable db2 = new Referenceable(DATABASE_TYPE_BUILTIN); String dbName2 = randomString(); db2.set(NAME, dbName2); db2.set(QUALIFIED_NAME, dbName2); db2.set(CLUSTER_NAME, randomString()); db2.set(DESCRIPTION, randomString()); db2.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName2); db2.set("owner", "user2"); db2.set(CLUSTER_NAME, "cl1"); db2.set("parameters", Collections.EMPTY_MAP); db2.set("location", "/tmp"); Id db2Id = createInstance(db2); // Delete the database entities MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); queryParams.add(AtlasClient.GUID.toLowerCase(), db1Id._getId()); queryParams.add(AtlasClient.GUID.toLowerCase(), db2Id._getId()); JSONObject response = atlasClientV1.callAPIWithQueryParams(AtlasClient.API.DELETE_ENTITIES, queryParams); List<String> deletedGuidsList = EntityResult.fromString(response.toString()).getDeletedEntities(); Assert.assertTrue(deletedGuidsList.contains(db1Id._getId())); Assert.assertTrue(deletedGuidsList.contains(db2Id._getId())); // Verify entities were deleted from the repository. for (String guid : deletedGuidsList) { Referenceable entity = atlasClientV1.getEntity(guid); assertEquals(entity.getId().getState(), Id.EntityState.DELETED); } }
From source file:com.xpn.xwiki.plugin.invitationmanager.impl.InvitationManagerImpl.java
/** * {@inheritDoc}/*from w w w. ja v a2s . c o m*/ * * @see InvitationManager#requestMembership(String, String, List, XWikiContext) */ public void requestMembership(String space, String message, List roles, XWikiContext context) throws InvitationManagerException { requestMembership(space, message, roles, Collections.EMPTY_MAP, context); }
From source file:org.apache.atlas.web.integration.EntityJerseyResourceIT.java
@Test public void testDeleteEntitiesViaClientApi() throws Exception { // Create 2 database entities Referenceable db1 = new Referenceable(DATABASE_TYPE_BUILTIN); String dbName = randomString(); db1.set("name", dbName); db1.set("description", randomString()); db1.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName); db1.set("owner", "user1"); db1.set(CLUSTER_NAME, "cl1"); db1.set("parameters", Collections.EMPTY_MAP); db1.set("location", "/tmp"); Id db1Id = createInstance(db1);/*from w ww . j av a 2s .co m*/ Referenceable db2 = new Referenceable(DATABASE_TYPE_BUILTIN); String dbName2 = randomString(); db2.set("name", dbName2); db2.set(QUALIFIED_NAME, dbName2); db2.set(CLUSTER_NAME, randomString()); db2.set("description", randomString()); db2.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName2); db2.set("owner", "user2"); db2.set("clusterName", "cl1"); db2.set("parameters", Collections.EMPTY_MAP); db2.set("location", "/tmp"); Id db2Id = createInstance(db2); // Delete the database entities List<String> deletedGuidsList = atlasClientV1.deleteEntities(db1Id._getId(), db2Id._getId()) .getDeletedEntities(); // Verify that deleteEntities() response has database entity guids Assert.assertEquals(deletedGuidsList.size(), 2); Assert.assertTrue(deletedGuidsList.contains(db1Id._getId())); Assert.assertTrue(deletedGuidsList.contains(db2Id._getId())); // Verify entities were deleted from the repository. for (String guid : deletedGuidsList) { Referenceable entity = atlasClientV1.getEntity(guid); assertEquals(entity.getId().getState(), Id.EntityState.DELETED); } }
From source file:org.hyperic.hq.measurement.server.session.AvailabilityManagerImpl.java
@SuppressWarnings("unchecked") /**/*from ww w.j av a 2 s.c o m*/ * get AvailabilityDataRLEs for the given DataPoints' Measurement IDs, with endData within the last 7 days. * If several AvailabilityDataRLEs exist for the same Measurement, they are listed in ascending order. * @param outOfOrderAvail * @param updateList * @return */ private Map<Integer, TreeSet<AvailabilityDataRLE>> createCurrAvails(final List<DataPoint> outOfOrderAvail, final List<DataPoint> updateList) { Map<Integer, TreeSet<AvailabilityDataRLE>> currAvails = null; final StopWatch watch = new StopWatch(); try { if (outOfOrderAvail.size() == 0 && updateList.size() == 0) { currAvails = Collections.EMPTY_MAP; } long now = TimingVoodoo.roundDownTime(System.currentTimeMillis(), 60000); HashSet<Integer> mids = getMidsWithinAllowedDataWindow(updateList, now); mids.addAll(getMidsWithinAllowedDataWindow(outOfOrderAvail, now)); if (mids.size() <= 0) { currAvails = Collections.EMPTY_MAP; } Integer[] mIds = (Integer[]) mids.toArray(new Integer[0]); currAvails = availabilityDataDAO.getHistoricalAvailMap(mIds, now - MAX_DATA_BACKLOG_TIME, false); return currAvails; } finally { if (log.isDebugEnabled()) { log.debug("AvailabilityInserter setCurrAvails: " + watch + ", size=" + currAvails.size()); } } }
From source file:amfservices.actions.PGServicesAction.java
public Map<String, Object> addWhiteListAction(List<String> whiteList) { String[] whiteArr = whiteList.toArray(new String[whiteList.size()]); UserList.getList(UserList.ListType.WHITE_LIST).add(whiteArr); return Collections.EMPTY_MAP; }
From source file:de.hybris.platform.test.TransactionTest.java
private void testIsolationInternal(final boolean rollbackChanges) throws ConsistencyCheckException { final Country country = jaloSession.getC2LManager().createCountry("code1"); try {//from w ww .j a v a 2 s. c o m assertEquals("code1", country.getIsoCode()); final RunnerCreator<IsolationTestRunnable> creator = new RunnerCreator<TransactionTest.IsolationTestRunnable>() { final CyclicBarrier txSync = new CyclicBarrier(2); final CountDownLatch waitForWrite = new CountDownLatch(1); final CountDownLatch codeWritten = new CountDownLatch(1); @Override public IsolationTestRunnable newRunner(final int threadNumber) { return new IsolationTestRunnable(country, threadNumber == 0, rollbackChanges, waitForWrite, codeWritten, txSync); } }; final TestThreadsHolder<IsolationTestRunnable> threads = new TestThreadsHolder<TransactionTest.IsolationTestRunnable>( 2, creator); threads.startAll(); assertTrue("not all threads have finished properly", threads.waitAndDestroy(30)); assertEquals(Collections.EMPTY_MAP, threads.getErrors()); } finally { if (country != null && country.isAlive()) { try { country.remove(); } catch (final Exception e) { // for several reasons this may fail without meaning harm so we ignore it here } } } }
From source file:amfservices.actions.PGServicesAction.java
public Map<String, Object> addSystemListAction(List<String> sysList) { String[] sysArr = sysList.toArray(new String[sysList.size()]); UserList.getList(UserList.ListType.SYSTEM_ACCOUNT).add(sysArr); return Collections.EMPTY_MAP; }
From source file:org.apache.atlas.web.integration.EntityJerseyResourceIT.java
@Test public void testDeleteEntityByUniqAttribute() throws Exception { // Create database entity Referenceable db1 = new Referenceable(DATABASE_TYPE_BUILTIN); String dbName = randomString(); db1.set(NAME, dbName);//from w w w . j a v a 2 s . c om db1.set(QUALIFIED_NAME, dbName); db1.set(CLUSTER_NAME, randomString()); db1.set(DESCRIPTION, randomString()); db1.set(AtlasClient.REFERENCEABLE_ATTRIBUTE_NAME, dbName); db1.set("owner", "user1"); db1.set(CLUSTER_NAME, "cl1"); db1.set("parameters", Collections.EMPTY_MAP); db1.set("location", "/tmp"); Id db1Id = createInstance(db1); // Delete the database entity List<String> deletedGuidsList = atlasClientV1.deleteEntity(DATABASE_TYPE_BUILTIN, QUALIFIED_NAME, dbName) .getDeletedEntities(); // Verify that deleteEntities() response has database entity guids Assert.assertEquals(deletedGuidsList.size(), 1); Assert.assertTrue(deletedGuidsList.contains(db1Id._getId())); // Verify entities were deleted from the repository. for (String guid : deletedGuidsList) { Referenceable entity = atlasClientV1.getEntity(guid); assertEquals(entity.getId().getState(), Id.EntityState.DELETED); } }