/** * This test performs following operations: <br> * 1. Create multiple Partition Regions in 4 VMs</br><br> * 2. Validates the Partitioned region metadata by checking sizes of allPartition Region, * bucket2Node.</br><br> * 3. Performs put()operations on all the partitioned region from all the VM's </br><br> * 4. Performs get() operations on all partitioned region and check the returned values.</br> */ public void testPartitionedRegionPutAndGet() throws Throwable { Host host = Host.getHost(0); /** creating 4 VMs */ VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); VM vm2 = host.getVM(2); VM vm3 = host.getVM(3); /** Prefix will be used for naming the partititon Region */ prPrefix = "testPartitionedRegionPutAndGet"; /** these indices represents range of partition regions present in each VM */ int startIndexForRegion = 0; int endIndexForRegion = MAX_REGIONS; /** creationg and performing put(),get() operations on Partition Region */ createMultiplePartitionRegion(vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info("testPartitionedRegionPutAndGet() - Partition Regions Successfully Created "); validateMultiplePartitionedRegions(vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info("testPartitionedRegionPutAndGet() - Partition Regions Successfully Validated "); putInMultiplePartitionedRegion(vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info( "testPartitionedRegionPutAndGet() - Put() Operation done Successfully in Partition Regions "); getInMultiplePartitionedRegion(vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info("testPartitionedRegionPutAndGet() - Partition Regions Successfully Validated "); }
/** * This test performs following operations: <br> * 1. Create multiple Partition Regions in 4 VMs</br><br> * 2. Performs put()operations on all the partitioned region from all the VM's </br><br> * 3. Performs destroy(key)operations for some of the keys of all the partitioned region from all * the VM's</br><br> * 4. Chekcs containsKey and ContainsValueForKey APIs</br> */ public void testPartitionedRegionDestroyAndContainsAPI() throws Throwable { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); VM vm2 = host.getVM(2); VM vm3 = host.getVM(3); prPrefix = "testPartitionedRegionDestroyAndContainsAPI"; int startIndexForRegion = 0; int endIndexForRegion = MAX_REGIONS; int AsyncInvocationArrSize = 4; AsyncInvocation[] async = new AsyncInvocation[AsyncInvocationArrSize]; /** creating Partition Regions and testing for the APIs contains() */ createMultiplePartitionRegion(vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info( "testPartitionedRegionDestroyAndContainsAPI() - Partition Regions Successfully Created "); validateMultiplePartitionedRegions(vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info( "testPartitionedRegionDestroyAndContainsAPI() - Partition Regions Successfully Validated "); putInMultiplePartitionedRegion(vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info( "testPartitionedRegionDestroyAndContainsAPI() - Put() Operation done Successfully in Partition Regions "); destroyInMultiplePartitionedRegion(vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info( "testPartitionedRegionDestroyAndContainsAPI() - Destroy(Key) Operation done Successfully in Partition Regions "); async[0] = vm0.invokeAsync( validateContainsAPIForPartitionRegion(startIndexForRegion, endIndexForRegion)); async[1] = vm1.invokeAsync( validateContainsAPIForPartitionRegion(startIndexForRegion, endIndexForRegion)); async[2] = vm2.invokeAsync( validateContainsAPIForPartitionRegion(startIndexForRegion, endIndexForRegion)); async[3] = vm3.invokeAsync( validateContainsAPIForPartitionRegion(startIndexForRegion, endIndexForRegion)); for (int count = 0; count < AsyncInvocationArrSize; count++) { DistributedTestCase.join(async[count], 120 * 1000, getLogWriter()); } for (int count = 0; count < AsyncInvocationArrSize; count++) { if (async[count].exceptionOccurred()) { fail("exception during " + count, async[count].getException()); } } getLogWriter() .info( "testPartitionedRegionDestroyAndContainsAPI() - Validation of Contains APIs done Successfully in Partition Regions "); }
/** * This test performs following operations: <br> * 1. Create multiple Partition Regions in 4 VMs</br><br> * 2. Performs put()operations on all the partitioned region from all the VM's </br><br> * 3. Performs destroy(key)operations for some of the keys of all the partitioned region from all * the VM's</br><br> * 4. Performs get() operations for destroyed keys on all partitioned region and checks the * returned values is null .</br><br> * 5. Performs put()operations for the destroyed keys on all the partitioned region from all the * VM's</br><br> * 4. Performs get() operations for destroyed keys on all partitioned region and checks the * returned values is not null .</br> */ public void testPartitionedRegionDestroyKeys() throws Throwable { Host host = Host.getHost(0); /** creating 4 VM's */ VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); VM vm2 = host.getVM(2); VM vm3 = host.getVM(3); prPrefix = "testPartitionedRegionDestroyKeys"; int startIndexForRegion = 0; int endIndexForRegion = MAX_REGIONS; int afterPutFlag = 0; /** * creating Partition Regions and performing put(), destroy(),get(),put() operations in the * sequence */ createMultiplePartitionRegion(vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info("testPartitionedRegionDestroyKeys() - Partition Regions Successfully Created "); validateMultiplePartitionedRegions(vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info("testPartitionedRegionDestroyKeys() - Partition Regions Successfully Validated "); putInMultiplePartitionedRegion(vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info( "testPartitionedRegionDestroyKeys() - Put() Operation done Successfully in Partition Regions "); destroyInMultiplePartitionedRegion(vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info( "testPartitionedRegionDestroyKeys() - Destroy(Key) Operation done Successfully in Partition Regions "); getDestroyedEntryInMultiplePartitionedRegion( vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion, afterPutFlag); getLogWriter() .info( "testPartitionedRegionDestroyKeys() - Get() Operation after destoy keys done Successfully in Partition Regions "); putDestroyedEntryInMultiplePartitionedRegion( vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion); getLogWriter() .info( "testPartitionedRegionDestroyKeys() - Put() Operation after destroy keys done Successfully in Partition Regions "); afterPutFlag = 1; getDestroyedEntryInMultiplePartitionedRegion( vm0, vm1, vm2, vm3, startIndexForRegion, endIndexForRegion, afterPutFlag); getLogWriter() .info( "testPartitionedRegionDestroyKeys() - Get() Operation after Put() done Successfully in Partition Regions "); }