You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geode.apache.org by Kevin Duling <kd...@pivotal.io> on 2016/06/22 15:43:09 UTC

Creating & Destroying Regions programmatically

I'm trying to figure out how to exercise the CreateRegion and
DestoryRegion classes from a client in order to test authorization.  I
can't figure out what the API would be for a client to trigger the
cmdExecute() call on the server.

For example, I was able to hit it in ClearRegion by having the client
execute the Region.clear() method.  Here's a snippet from the unit
test:

SerializableRunnable clearAuthorized = new SerializableRunnable() {
  @Override
  public void run() {
    Cache cache =
SecurityTestUtils.createCacheClient("authRegionUser", "1234567",
serverPort, SecurityTestUtils.NO_EXCEPTION);
    final Region region = cache.getRegion(SecurityTestUtils.REGION_NAME);
    region.clear();
    cache.close();
  }
};
client2.invoke(clearAuthorized);

Re: Creating & Destroying Regions programmatically

Posted by Swapnil Bawaskar <sb...@pivotal.io>.
Hi Kevin,
You can use com.gemstone.gemfire.cache.DynamicRegionFactory from the client
to exercise CreateRegion and DestroyRegion.

On Wed, Jun 22, 2016 at 8:43 AM, Kevin Duling <kd...@pivotal.io> wrote:

> I'm trying to figure out how to exercise the CreateRegion and
> DestoryRegion classes from a client in order to test authorization.  I
> can't figure out what the API would be for a client to trigger the
> cmdExecute() call on the server.
>
> For example, I was able to hit it in ClearRegion by having the client
> execute the Region.clear() method.  Here's a snippet from the unit
> test:
>
> SerializableRunnable clearAuthorized = new SerializableRunnable() {
>   @Override
>   public void run() {
>     Cache cache =
> SecurityTestUtils.createCacheClient("authRegionUser", "1234567",
> serverPort, SecurityTestUtils.NO_EXCEPTION);
>     final Region region = cache.getRegion(SecurityTestUtils.REGION_NAME);
>     region.clear();
>     cache.close();
>   }
> };
> client2.invoke(clearAuthorized);
>