use of org.apache.geode.internal.cache.execute.data.Order in project geode by apache.
the class RemoteCQTransactionDUnitTest method createRegion.
void createRegion(boolean accessor, int redundantCopies, InterestPolicy interestPolicy) {
AttributesFactory af = new AttributesFactory();
af.setScope(Scope.DISTRIBUTED_ACK);
af.setDataPolicy(DataPolicy.REPLICATE);
af.setConcurrencyChecksEnabled(getConcurrencyChecksEnabled());
getCache().createRegion(D_REFERENCE, af.create());
af = new AttributesFactory();
af.setConcurrencyChecksEnabled(getConcurrencyChecksEnabled());
if (interestPolicy != null) {
af.setSubscriptionAttributes(new SubscriptionAttributes(interestPolicy));
}
af.setPartitionAttributes(new PartitionAttributesFactory<CustId, Customer>().setTotalNumBuckets(4).setLocalMaxMemory(accessor ? 0 : 1).setPartitionResolver(new CustomerIDPartitionResolver("resolver1")).setRedundantCopies(redundantCopies).create());
getCache().createRegion(CUSTOMER, af.create());
af.setPartitionAttributes(new PartitionAttributesFactory<OrderId, Order>().setTotalNumBuckets(4).setLocalMaxMemory(accessor ? 0 : 1).setPartitionResolver(new CustomerIDPartitionResolver("resolver2")).setRedundantCopies(redundantCopies).setColocatedWith(CUSTOMER).create());
getCache().createRegion(ORDER, af.create());
}
use of org.apache.geode.internal.cache.execute.data.Order in project geode by apache.
the class RemoteCQTransactionDUnitTest method populateData.
void populateData() {
Region custRegion = getCache().getRegion(CUSTOMER);
Region orderRegion = getCache().getRegion(ORDER);
Region refRegion = getCache().getRegion(D_REFERENCE);
for (int i = 0; i < 5; i++) {
CustId custId = new CustId(i);
Customer customer = new Customer("customer" + i, "address" + i);
OrderId orderId = new OrderId(i, custId);
Order order = new Order("order" + i);
custRegion.put(custId, customer);
orderRegion.put(orderId, order);
refRegion.put(custId, customer);
}
}
use of org.apache.geode.internal.cache.execute.data.Order in project geode by apache.
the class WANTestBase method updateOrderPartitionedRegion.
public static Map updateOrderPartitionedRegion(int numPuts) {
assertNotNull(cache);
assertNotNull(orderRegion);
Map orderKeyValues = new HashMap();
for (int i = 1; i <= numPuts; i++) {
CustId custid = new CustId(i);
int oid = i + 1;
OrderId orderId = new OrderId(oid, custid);
Order order = new Order("ORDER" + oid + "_update");
try {
orderRegion.put(orderId, order);
orderKeyValues.put(orderId, order);
assertTrue(orderRegion.containsKey(orderId));
assertEquals(order, orderRegion.get(orderId));
} catch (Exception e) {
org.apache.geode.test.dunit.Assert.fail("updateOrderPartitionedRegion : failed while doing put operation in OrderPartitionedRegion ", e);
}
LogWriterUtils.getLogWriter().info("Order :- { " + orderId + " : " + order + " }");
}
return orderKeyValues;
}
use of org.apache.geode.internal.cache.execute.data.Order in project geode by apache.
the class WANTestBase method putOrderPartitionedRegionUsingCustId.
public static Map putOrderPartitionedRegionUsingCustId(int numPuts) {
assertNotNull(cache);
assertNotNull(orderRegion);
Map orderKeyValues = new HashMap();
for (int i = 1; i <= numPuts; i++) {
CustId custid = new CustId(i);
Order order = new Order("ORDER" + i);
try {
orderRegion.put(custid, order);
orderKeyValues.put(custid, order);
assertTrue(orderRegion.containsKey(custid));
assertEquals(order, orderRegion.get(custid));
} catch (Exception e) {
org.apache.geode.test.dunit.Assert.fail("putOrderPartitionedRegionUsingCustId : failed while doing put operation in OrderPartitionedRegion ", e);
}
LogWriterUtils.getLogWriter().info("Order :- { " + custid + " : " + order + " }");
}
return orderKeyValues;
}
use of org.apache.geode.internal.cache.execute.data.Order in project geode by apache.
the class PartitionResolverDUnitTest method populateData.
void populateData() {
Region custRegion = getCache().getRegion(CUSTOMER);
Region orderRegion = getCache().getRegion(ORDER);
for (int i = 0; i < 5; i++) {
CustId custId = new CustId(i);
Customer customer = new Customer("customer" + i, "address" + i);
OrderId orderId = new OrderId(i, custId);
Order order = new Order("order" + i);
custRegion.put(custId, customer);
orderRegion.put(orderId, order);
}
}
Aggregations