@Override public String getName() { return this.realRegion.getName(); }
@Override public String getName() { return ((Region) map).getName(); }
public String getName() { return this.region.getName(); }
public String getName() { return region.getName(); }
private void checkForInternalRegion(Region<?, ?> r) { if (r == null) { return; } InternalRegion ir = (InternalRegion) r; if (ir.isInternalRegion() && !r.getName().equals(DynamicRegionFactory.DYNAMIC_REGION_LIST_NAME) && !r.getName().equals(ClientHealthMonitoringRegion.ADMIN_REGION_NAME)) { throw new NotAuthorizedException("The region " + r.getName() + " is an internal region that a client is never allowed to access"); } }
private void authorizeRegionAccess(SecurityService securityService, Object target) { if (target instanceof Region) { String regionName = ((Region) target).getName(); securityService.authorize(ResourcePermission.Resource.DATA, ResourcePermission.Operation.READ, regionName); } } }
/** * Increments the value of the tail key by one. * */ private void incrementTailKey() throws CacheException { this.tailKey.set(inc(this.tailKey.get())); if (logger.isTraceEnabled()) { logger.trace("{}: Incremented TAIL_KEY for region {} to {}", this, this.region.getName(), this.tailKey); } }
/** * Increments the value of the head key by one. * */ private void updateHeadKey(long destroyedKey) throws CacheException { this.headKey = inc(destroyedKey); if (logger.isTraceEnabled()) { logger.trace("{}: Incremented HEAD_KEY for region {} to {}", this, this.region.getName(), this.headKey); } }
/** * A fake region, which contains a fake cache and some other fake attributes */ public static Region region(String name, Cache cache) { Region region = mock(Region.class); RegionAttributes attributes = mock(RegionAttributes.class); DataPolicy policy = mock(DataPolicy.class); when(region.getAttributes()).thenReturn(attributes); when(attributes.getDataPolicy()).thenReturn(policy); when(region.getCache()).thenReturn(cache); when(region.getRegionService()).thenReturn(cache); when(region.getName()).thenReturn(name); when(region.getFullPath()).thenReturn("/" + name); return region; }
private DistributedMemberLock getDistributedLock() { String dlsName = this.regionConfigurationsRegion.getName(); DistributedLockService lockService = initializeDistributedLockService(dlsName); String lockToken = dlsName + "_token"; return new DistributedMemberLock(lockService, lockToken); }
public String getParentRegion() { if (region.getParentRegion() != null) { return region.getParentRegion().getName(); } return null; }
@Before public void setUp() { region1Stub = mock(Region.class); when(region1Stub.getName()).thenReturn(TEST_REGION1); operationHandler = new GetSizeRequestOperationHandler(); }
@Test public void readThrowsIfNoConnectionConfig() throws Exception { @SuppressWarnings("unchecked") Region<Object, Object> region2 = mock(Region.class); when(region2.getName()).thenReturn("region2"); RegionMapping regionMapping2 = mock(RegionMapping.class); when(regionMapping2.getDataSourceName()).thenReturn("bogus data source name"); when(regionMapping2.getRegionName()).thenReturn("region2"); when(connectorService.getMappingForRegion("region2")).thenReturn(regionMapping2); thrown.expect(JdbcConnectorException.class); handler.read(region2, new Object()); }
public RegionSubRegionSnapshot(Region reg) { this(); this.name = reg.getName(); if (reg instanceof PartitionedRegion) { PartitionedRegion p_reg = (PartitionedRegion) reg; this.entryCount = p_reg.entryCount(true); } else { this.entryCount = reg.entrySet().size(); } final LogWriter logger = reg.getCache().getLogger(); if ((logger != null) && logger.fineEnabled()) { logger.fine("RegionSubRegionSnapshot Region entry count =" + this.entryCount + " for region =" + this.name); } }
@SuppressWarnings("unchecked") @Test public void readThrowsIfNoMapping() throws Exception { Region region = mock(Region.class); when(region.getName()).thenReturn("myRegionName"); thrown.expect(JdbcConnectorException.class); thrown.expectMessage( "JDBC mapping for region myRegionName not found. Create the mapping with the gfsh command 'create jdbc-mapping'."); handler.read(region, new Object()); }
@Test public void processReturnsCacheRegions() throws Exception { RegionAttributes regionAttributesStub = mock(RegionAttributes.class); when(cacheStub.getRegion(TEST_REGION1)).thenReturn(region1Stub); when(region1Stub.getName()).thenReturn(TEST_REGION1); when(region1Stub.size()).thenReturn(10); when(region1Stub.getAttributes()).thenReturn(regionAttributesStub); when(regionAttributesStub.getDataPolicy()).thenReturn(DataPolicy.PERSISTENT_REPLICATE); when(regionAttributesStub.getKeyConstraint()).thenReturn(String.class); when(regionAttributesStub.getValueConstraint()).thenReturn(Integer.class); when(regionAttributesStub.getScope()).thenReturn(Scope.DISTRIBUTED_ACK); Result result = operationHandler.process(serializationService, MessageUtil.makeGetSizeRequest(TEST_REGION1), getNoAuthCacheExecutionContext(cacheStub)); RegionAPI.GetSizeResponse response = (RegionAPI.GetSizeResponse) result.getMessage(); Assert.assertEquals(10, response.getSize()); }
public MemoryHog printTenuredSize() { this.cache.getLogger().info( "Tenured data size: " + this.tenuredData.getName() + ": " + this.tenuredData.size()); return this; } }
private void setRegionDetails(final Region<?, ?> region, final DiskStore diskStore, final DiskStoreDetails diskStoreDetails) { if (isUsingDiskStore(region, diskStore)) { String regionFullPath = region.getFullPath(); DiskStoreDetails.RegionDetails regionDetails = new DiskStoreDetails.RegionDetails( regionFullPath, StringUtils.defaultIfBlank(region.getName(), regionFullPath)); regionDetails.setOverflowToDisk(isOverflowToDisk(region)); regionDetails.setPersistent(isPersistent(region)); diskStoreDetails.add(regionDetails); } for (Region<?, ?> subregion : region.subregions(false)) { setRegionDetails(subregion, diskStore, diskStoreDetails); // depth-first, recursive strategy } }
public IndexDetails(final DistributedMember member, final Index index) { this(member.getId(), index.getRegion().getFullPath(), index.getName()); setFromClause(index.getFromClause()); setIndexedExpression(index.getIndexedExpression()); setIndexType(index.getType()); setMemberName(member.getName()); setProjectionAttributes(index.getProjectionAttributes()); setRegionName(index.getRegion().getName()); if (index instanceof AbstractIndex) { setIsValid(((AbstractIndex) index).isValid()); } else { setIsValid(false); } if (index.getStatistics() != null) { setIndexStatisticsDetails(createIndexStatisticsDetails(index.getStatistics())); } }