use of org.apache.geode.internal.cache.PartitionedRegion in project geode by apache.
the class StreamingPartitionOperationOneDUnitTest method testStreamingPartitionOneProviderNoExceptions.
@Test
public void testStreamingPartitionOneProviderNoExceptions() throws Exception {
// final String name = this.getUniqueName();
// ask another VM to connect to the distributed system
// this will be the data provider, and get their member id at the same time
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
// get the other member id that connected
InternalDistributedMember otherId = (InternalDistributedMember) vm0.invoke(new IDGetter(), "getMemberId");
vm0.invoke(createPrRegionWithDS_DACK);
// also create the PR here so we can get the regionId
createPrRegionWithDS_DACK.run2();
int regionId = ((PartitionedRegion) getCache().getRegion("PR1")).getPRId();
Set setOfIds = Collections.singleton(otherId);
TestStreamingPartitionOperationOneProviderNoExceptions streamOp = new TestStreamingPartitionOperationOneProviderNoExceptions(getSystem(), regionId);
try {
streamOp.getPartitionedDataFrom(setOfIds);
} catch (VirtualMachineError e) {
SystemFailure.initiateFailure(e);
throw e;
} catch (Throwable t) {
Assert.fail("getPartitionedDataFrom failed", t);
}
assertTrue(streamOp.dataValidated);
}
use of org.apache.geode.internal.cache.PartitionedRegion in project geode by apache.
the class PersistentPartitionedRegionTestBase method moveBucket.
protected boolean moveBucket(final int bucketId, VM source, VM target) {
SerializableCallable getId = new SerializableCallable("Get Id") {
public Object call() throws Exception {
Cache cache = getCache();
return cache.getDistributedSystem().getDistributedMember();
}
};
final InternalDistributedMember sourceId = (InternalDistributedMember) source.invoke(getId);
SerializableCallable move = new SerializableCallable("move bucket") {
public Object call() {
Cache cache = getCache();
PartitionedRegion region = (PartitionedRegion) cache.getRegion(PR_REGION_NAME);
return region.getDataStore().moveBucket(bucketId, sourceId, false);
}
};
return (Boolean) target.invoke(move);
}
use of org.apache.geode.internal.cache.PartitionedRegion in project geode by apache.
the class FixedPartitioningTestBase method putShipmentPartitionedRegion_Persistence.
public static void putShipmentPartitionedRegion_Persistence(String partitionedRegionName) {
assertNotNull(cache);
Region partitionedregion = cache.getRegion(Region.SEPARATOR + partitionedRegionName);
assertNotNull(partitionedregion);
for (int i = 1; i <= 20; i++) {
CustId custid = new CustId(i);
for (int j = 1; j <= 10; j++) {
int oid = (i * 10) + j;
OrderId orderId = new OrderId(oid, custid);
for (int k = 1; k <= 10; k++) {
int sid = (oid * 10) + k;
ShipmentId shipmentId = new ShipmentId(sid, orderId);
Shipment shipment = new Shipment("Shipment" + sid);
try {
partitionedregion.put(shipmentId, shipment);
} catch (Exception e) {
org.apache.geode.test.dunit.Assert.fail("putShipmentPartitionedRegion : failed while doing put operation in ShipmentPartitionedRegion ", e);
}
LogWriterUtils.getLogWriter().info("Shipment :- { " + shipmentId + " : " + shipment + " }");
}
}
}
}
use of org.apache.geode.internal.cache.PartitionedRegion in project geode by apache.
the class FixedPartitioningTestBase method getForColocation.
public static void getForColocation(String customerRegion, String order, String shipment) {
Region region_Cust = (PartitionedRegion) cache.getRegion(customerRegion);
assertNotNull(region_Cust);
for (int i = 1; i <= 20; i++) {
CustId custid = new CustId(i);
Customer customer = new Customer("name" + i, "Address" + i);
try {
assertEquals(customer, region_Cust.get(custid));
} catch (Exception e) {
org.apache.geode.test.dunit.Assert.fail("getForColocation : failed while doing get operation in CustomerPartitionedRegion ", e);
}
}
Region region_Ord = (PartitionedRegion) cache.getRegion(order);
assertNull(region_Ord);
Region region_Ship = (PartitionedRegion) cache.getRegion(shipment);
assertNull(region_Ship);
}
use of org.apache.geode.internal.cache.PartitionedRegion in project geode by apache.
the class FixedPartitioningTestBase method putCustomerPartitionedRegion_Persistence2.
public static void putCustomerPartitionedRegion_Persistence2(String partitionedRegionName) {
assertNotNull(cache);
Region partitionedregion = cache.getRegion(Region.SEPARATOR + partitionedRegionName);
assertNotNull(partitionedregion);
for (int i = 1; i <= 20; i++) {
if (i % 2 == 1) {
CustId custid = new CustId(i);
Customer customer = new Customer("name" + i, "Address" + i);
try {
partitionedregion.put(custid, customer);
} catch (Exception e) {
org.apache.geode.test.dunit.Assert.fail("putCustomerPartitionedRegion : failed while doing put operation in CustomerPartitionedRegion ", e);
}
LogWriterUtils.getLogWriter().info("Customer :- { " + custid + " : " + customer + " }");
}
}
}
Aggregations