/** * will keep on putting till region overflows */ protected void putTillOverFlow(Region<Object, Object> region) { for (int i = 0; i < 1010; i++) { region.put(i + 200, i + 200); } }
public void populateRegion(String regionName, Map<?, ?> entries) { Region r = cache.getRegion("/" + regionName); entries.entrySet().forEach(e -> { r.put(e.getKey(), e.getValue()); }); }
/** * put an entry in local monitoring region * * @param name MBean name * @param data The value part of the Map */ public void putEntryInLocalMonitoringRegion(String name, Object data) { if (localMonitoringRegion != null && !localMonitoringRegion.isDestroyed()) { localMonitoringRegion.put(name, data); } }
private void doInitializeList(ByteArrayWrapper key, Region r) { r.put("head", 0); r.put("tail", 0); String fullpath = r.getFullPath(); HashMap<Enum<?>, Query> queryList = new HashMap<>(); for (ListQuery lq : ListQuery.values()) { String queryString = lq.getQueryString(fullpath); Query query = this.queryService.newQuery(queryString); queryList.put(lq, query); } this.preparedQueries.put(key, queryList); }
/** * {@inheritDoc} */ @Override public void putSession(HttpSession session) { sessionCache.getOperatingRegion().put(session.getId(), session); mbean.incRegionUpdates(); }
@Override public Status update(String table, String key, Map<String, ByteIterator> values) { getRegion(table).put(key, convertToBytearrayMap(values)); return Status.OK; }
@Override public Status insert(String table, String key, Map<String, ByteIterator> values) { getRegion(table).put(key, convertToBytearrayMap(values)); return Status.OK; }
public static void doHeavyPuts(String regionName, int numPuts) { Region r = cache.getRegion(Region.SEPARATOR + regionName); assertNotNull(r); for (long i = 0; i < numPuts; i++) { r.put(i, new byte[1024 * 1024]); } }
@Override public <K, V> void put(String regionName, K key, V value) { security.authorize(DATA, WRITE, regionName, key); Region<K, V> region = getRegion(regionName); region.put(key, value); }
@Override public Object call() throws RegionNotFoundException, CqExistsException, IndexExistsException, IndexNameConflictException { getCache().getRegion("/" + regionName).put(key, value); return true; } });
@Override public void run2() throws CacheException { Region<Object, Object> region = getRootRegion().getSubregion(name); region.put(key, newValue); assertThat(writer().wasInvoked()).isTrue(); } });
private static void prepareNotDeserializableDataForRegion(String regionPath) { InternalCache cache = ClusterStartupRule.getCache(); Region dataRegion = cache.getRegion(regionPath); for (int j = 0; j < 10; j++) { dataRegion.put(new Integer(j), new shouldFailSerializationFilter(j)); } }
@BeforeClass public static void populateRegions() { Cache cache = server.getCache(); Region<String, String> simpleRegion = cache.getRegion("simpleRegion"); Region<String, Customer> complexRegion = cache.getRegion("complexRegion"); for (int i = 0; i < Gfsh.DEFAULT_APP_FETCH_SIZE + 1; i++) { String key = "key" + i; simpleRegion.put(key, "value" + i); complexRegion.put(key, new Customer("name" + i, "Main Street " + i, "Hometown")); } }
static void putForClient() { Cache cache = new ClientServerMiscDUnitTestBase().getCache(); Region r2 = cache.getRegion(Region.SEPARATOR + REGION_NAME2); if (r2 == null) { r2 = cache.createRegionFactory(RegionShortcut.REPLICATE).create(REGION_NAME2); } r2.put(k1, "client2_k1"); r2.put(k2, "client2_k2"); }
@Override public void apply(Cache cache) { Region<String, CachedDeserializable> region = getRegion(cache); region.put(this.key, CachedDeserializableFactory.create(this.gatewayDelta, (InternalCache) cache), true); if (cache.getLogger().fineEnabled()) { StringBuilder builder = new StringBuilder(); builder.append("Applied ").append(this); cache.getLogger().fine(builder.toString()); } }
@Override public void run2() throws CacheException { Region<Object, Object> region = getRootRegion().getSubregion(name); region.put(key, newValue); flushIfNecessary(region); } });
@Before public void setUp() throws Exception { regionMock = mock(Region.class); when(regionMock.put(TEST_INVALID_KEY, TEST_INVALID_VALUE)) .thenThrow(new ClassCastException(EXCEPTION_TEXT)); when(cacheStub.getRegion(TEST_REGION)).thenReturn(regionMock); operationHandler = new PutAllRequestOperationHandler(); }
protected void putIntoRegion(VM vm, Object[] keys, Object[] values, String regionName) { vm.invoke(() -> { Region region = getClientCache().getRegion(regionName); assertEquals( "Bad region put. The list of keys does not have the same length as the list of values.", keys.length, values.length); for (int i = 0; i < keys.length; i++) { region.put(keys[i], values[i]); } }); }
@Test public void processWithNoEntriesPasses() throws Exception { Result result = operationHandler.process(serializationService, generateTestRequest(false, false), getNoAuthCacheExecutionContext(cacheStub)); assertTrue(result instanceof Success); verify(regionMock, times(0)).put(any(), any()); }