use of org.apache.geode.internal.cache.execute.data.OrderId in project geode by apache.
the class PRColocationDUnitTest method putOrderPartitionedRegion.
public static void putOrderPartitionedRegion(String partitionedRegionName, int numOfCust) {
assertNotNull(basicGetCache());
Region partitionedregion = basicGetCache().getRegion(Region.SEPARATOR + partitionedRegionName);
assertNotNull(partitionedregion);
for (int i = 1; i <= numOfCust; i++) {
CustId custid = new CustId(i);
for (int j = 1; j <= 10; j++) {
int oid = (i * 10) + j;
OrderId orderId = new OrderId(oid, custid);
Order order = new Order("OREDR" + oid);
try {
partitionedregion.put(orderId, order);
assertTrue(partitionedregion.containsKey(orderId));
assertEquals(order, partitionedregion.get(orderId));
} catch (Exception e) {
Assert.fail("putOrderPartitionedRegion : failed while doing put operation in OrderPartitionedRegion ", e);
}
LogWriterUtils.getLogWriter().info("Order :- { " + orderId + " : " + order + " }");
}
}
}
use of org.apache.geode.internal.cache.execute.data.OrderId in project geode by apache.
the class PRColocationDUnitTest method putShipmentPartitionedRegion.
public static void putShipmentPartitionedRegion(String partitionedRegionName) {
assertNotNull(basicGetCache());
Region partitionedregion = basicGetCache().getRegion(Region.SEPARATOR + partitionedRegionName);
assertNotNull(partitionedregion);
for (int i = 1; i <= 10; 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);
assertTrue(partitionedregion.containsKey(shipmentId));
assertEquals(shipment, partitionedregion.get(shipmentId));
} catch (Exception e) {
Assert.fail("putShipmentPartitionedRegion : failed while doing put operation in ShipmentPartitionedRegion ", e);
}
LogWriterUtils.getLogWriter().info("Shipment :- { " + shipmentId + " : " + shipment + " }");
}
}
}
}
use of org.apache.geode.internal.cache.execute.data.OrderId in project geode by apache.
the class PRColocationDUnitTest method putOrderPartitionedRegion2.
public static void putOrderPartitionedRegion2(String partitionedRegionName) {
assertNotNull(basicGetCache());
Region partitionedregion = basicGetCache().getRegion(Region.SEPARATOR + partitionedRegionName);
assertNotNull(partitionedregion);
for (int i = 11; i <= 100; i++) {
CustId custid = new CustId(i);
for (int j = 1; j <= 10; j++) {
int oid = (i * 10) + j;
OrderId orderId = new OrderId(oid, custid);
Order order = new Order("OREDR" + oid);
try {
partitionedregion.put(orderId, order);
assertTrue(partitionedregion.containsKey(orderId));
assertEquals(order, partitionedregion.get(orderId));
} catch (Exception e) {
Assert.fail("putOrderPartitionedRegion : failed while doing put operation in OrderPartitionedRegion ", e);
}
LogWriterUtils.getLogWriter().info("Order :- { " + orderId + " : " + order + " }");
}
}
}
use of org.apache.geode.internal.cache.execute.data.OrderId in project geode by apache.
the class FixedPartitioningTestBase method putShipmentPartitionedRegion_Persistence2.
public static void putShipmentPartitionedRegion_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);
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.execute.data.OrderId in project geode by apache.
the class ClientServerTransactionDUnitTest method testPutallRollbackInServer.
@Test
public void testPutallRollbackInServer() throws Exception {
Host host = Host.getHost(0);
VM server = host.getVM(0);
VM client = host.getVM(1);
int port1 = createRegionsAndStartServer(server, false);
createClientRegionAndPopulateData(client, port1, false);
server.invoke(new SerializableCallable("verify tx") {
public Object call() throws Exception {
TXManagerImpl mgr = getGemfireCache().getTxManager();
Region<OrderId, Order> orderRegion = getCache().getRegion(ORDER);
mgr.begin();
CustId custId = new CustId(1);
OrderId orderId = new OrderId(1000, custId);
Order expectedOrder = new Order("fooOrder");
Map map = new HashMap();
map.put(orderId, expectedOrder);
orderRegion.putAll(map);
mgr.rollback();
assertNull(orderRegion.get(orderId));
return null;
}
});
}
Aggregations