Search in sources :

Example 1 with Shipment

use of org.apache.geode.internal.cache.execute.data.Shipment 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 + " }");
            }
        }
    }
}
Also used : ShipmentId(org.apache.geode.internal.cache.execute.data.ShipmentId) CustId(org.apache.geode.internal.cache.execute.data.CustId) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) Region(org.apache.geode.cache.Region) Shipment(org.apache.geode.internal.cache.execute.data.Shipment) OrderId(org.apache.geode.internal.cache.execute.data.OrderId) IgnoredException(org.apache.geode.test.dunit.IgnoredException) IOException(java.io.IOException) CacheException(org.apache.geode.cache.CacheException)

Example 2 with Shipment

use of org.apache.geode.internal.cache.execute.data.Shipment 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 + " }");
                }
            }
        }
    }
}
Also used : ShipmentId(org.apache.geode.internal.cache.execute.data.ShipmentId) CustId(org.apache.geode.internal.cache.execute.data.CustId) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) HARegion(org.apache.geode.internal.cache.HARegion) Region(org.apache.geode.cache.Region) Shipment(org.apache.geode.internal.cache.execute.data.Shipment) OrderId(org.apache.geode.internal.cache.execute.data.OrderId) ParseException(java.text.ParseException) IOException(java.io.IOException)

Example 3 with Shipment

use of org.apache.geode.internal.cache.execute.data.Shipment in project geode by apache.

the class PerfFunction method execute.

public void execute(FunctionContext context) {
    RegionFunctionContext ctx = (RegionFunctionContext) context;
    Region customerPR = ctx.getDataSet();
    Region orderPR = customerPR.getCache().getRegion(PRColocationDUnitTest.OrderPartitionedRegionName);
    Region shipmentPR = customerPR.getCache().getRegion(PRColocationDUnitTest.ShipmentPartitionedRegionName);
    ArrayList args = (ArrayList) ctx.getArguments();
    for (int i = 0; i < args.size() / 4; i++) {
        OrderId orderId = (OrderId) args.get(i * 4);
        Order order = (Order) args.get(i * 4 + 1);
        ShipmentId shipmentId = (ShipmentId) args.get(i * 4 + 2);
        Shipment shipment = (Shipment) args.get(i * 4 + 3);
        orderPR.put(orderId, order);
        shipmentPR.put(shipmentId, shipment);
    }
    context.getResultSender().lastResult(null);
}
Also used : Order(org.apache.geode.internal.cache.execute.data.Order) ShipmentId(org.apache.geode.internal.cache.execute.data.ShipmentId) ArrayList(java.util.ArrayList) Region(org.apache.geode.cache.Region) Shipment(org.apache.geode.internal.cache.execute.data.Shipment) RegionFunctionContext(org.apache.geode.cache.execute.RegionFunctionContext) OrderId(org.apache.geode.internal.cache.execute.data.OrderId)

Example 4 with Shipment

use of org.apache.geode.internal.cache.execute.data.Shipment in project geode by apache.

the class PerfTxFunction method execute.

public void execute(FunctionContext context) {
    RegionFunctionContext ctx = (RegionFunctionContext) context;
    Region customerPR = ctx.getDataSet();
    Region orderPR = customerPR.getCache().getRegion(PRColocationDUnitTest.OrderPartitionedRegionName);
    Region shipmentPR = customerPR.getCache().getRegion(PRColocationDUnitTest.ShipmentPartitionedRegionName);
    ArrayList args = (ArrayList) ctx.getArguments();
    // put the entries
    CacheTransactionManager mgr = customerPR.getCache().getCacheTransactionManager();
    mgr.begin();
    for (int i = 0; i < args.size() / 4; i++) {
        OrderId orderId = (OrderId) args.get(i * 4);
        Order order = (Order) args.get(i * 4 + 1);
        ShipmentId shipmentId = (ShipmentId) args.get(i * 4 + 2);
        Shipment shipment = (Shipment) args.get(i * 4 + 3);
        orderPR.put(orderId, order);
        shipmentPR.put(shipmentId, shipment);
    }
    mgr.commit();
    context.getResultSender().lastResult(null);
}
Also used : Order(org.apache.geode.internal.cache.execute.data.Order) ShipmentId(org.apache.geode.internal.cache.execute.data.ShipmentId) ArrayList(java.util.ArrayList) Region(org.apache.geode.cache.Region) Shipment(org.apache.geode.internal.cache.execute.data.Shipment) RegionFunctionContext(org.apache.geode.cache.execute.RegionFunctionContext) OrderId(org.apache.geode.internal.cache.execute.data.OrderId) CacheTransactionManager(org.apache.geode.cache.CacheTransactionManager)

Example 5 with Shipment

use of org.apache.geode.internal.cache.execute.data.Shipment 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 + " }");
            }
        }
    }
}
Also used : ShipmentId(org.apache.geode.internal.cache.execute.data.ShipmentId) CustId(org.apache.geode.internal.cache.execute.data.CustId) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) HARegion(org.apache.geode.internal.cache.HARegion) Region(org.apache.geode.cache.Region) Shipment(org.apache.geode.internal.cache.execute.data.Shipment) OrderId(org.apache.geode.internal.cache.execute.data.OrderId) ParseException(java.text.ParseException) IOException(java.io.IOException)

Aggregations

Shipment (org.apache.geode.internal.cache.execute.data.Shipment)13 CustId (org.apache.geode.internal.cache.execute.data.CustId)11 OrderId (org.apache.geode.internal.cache.execute.data.OrderId)11 ShipmentId (org.apache.geode.internal.cache.execute.data.ShipmentId)11 IOException (java.io.IOException)9 Region (org.apache.geode.cache.Region)8 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)6 IgnoredException (org.apache.geode.test.dunit.IgnoredException)5 ParseException (java.text.ParseException)4 HashMap (java.util.HashMap)4 Map (java.util.Map)4 ExecutionException (java.util.concurrent.ExecutionException)4 CacheClosedException (org.apache.geode.cache.CacheClosedException)4 RegionDestroyedException (org.apache.geode.cache.RegionDestroyedException)4 PartitionOfflineException (org.apache.geode.cache.persistence.PartitionOfflineException)4 ForceReattemptException (org.apache.geode.internal.cache.ForceReattemptException)4 HARegion (org.apache.geode.internal.cache.HARegion)4 Order (org.apache.geode.internal.cache.execute.data.Order)4 PRLocallyDestroyedException (org.apache.geode.internal.cache.partitioned.PRLocallyDestroyedException)4 ArrayList (java.util.ArrayList)3