Search in sources :

Example 11 with BatchLookupCall

use of org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall in project scout.rt by eclipse.

the class BatchNormalizerTest method testCacheable.

/**
 * <ul>
 * <li>Calls: not null</li>
 * <li>Keys: not null</li>
 * <li>Cacheable: only some</li>
 * </ul>
 */
@SuppressWarnings("unchecked")
@Test
public void testCacheable() throws Exception {
    BatchLookupCall batchCall = new BatchLookupCall();
    for (int i = 0; i < 1000; i++) {
        boolean cacheable = (i % 2 == 0);
        LookupCall call = (cacheable ? new FruitLookupCall() : new FruitLookupCallNonCacheable());
        long key = (i / 100) + 1;
        call.setKey(key);
        batchCall.addLookupCall((LookupCall) call);
    }
    testInternal(batchCall, 10 + 500, 10 + 500, 0, 1000);
}
Also used : ILookupCall(org.eclipse.scout.rt.shared.services.lookup.ILookupCall) BatchLookupCall(org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall) LookupCall(org.eclipse.scout.rt.shared.services.lookup.LookupCall) BatchLookupCall(org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall) Test(org.junit.Test)

Example 12 with BatchLookupCall

use of org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall in project scout.rt by eclipse.

the class BatchNormalizerTest method testNullKeys.

/**
 * <ul>
 * <li>Calls: not null</li>
 * <li>Keys: some null</li>
 * <li>Cacheable: all</li>
 * </ul>
 */
@SuppressWarnings("unchecked")
@Test
public void testNullKeys() throws Exception {
    BatchLookupCall batchCall = new BatchLookupCall();
    for (int i = 0; i < 1000; i++) {
        FruitLookupCall call = new FruitLookupCall();
        long key = (i / 100) + 1;
        call.setKey(key);
        if (key == 5L || key == 6L || key == 9L) {
            call.setKey(null);
        }
        batchCall.addLookupCall((LookupCall) call);
    }
    testInternal(batchCall, 8, 7, 0, 700);
}
Also used : BatchLookupCall(org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall) Test(org.junit.Test)

Aggregations

BatchLookupCall (org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall)12 ArrayList (java.util.ArrayList)8 List (java.util.List)8 ILookupCall (org.eclipse.scout.rt.shared.services.lookup.ILookupCall)7 BatchLookupResultCache (org.eclipse.scout.rt.shared.services.lookup.BatchLookupResultCache)6 ILookupRow (org.eclipse.scout.rt.shared.services.lookup.ILookupRow)6 IBatchLookupService (org.eclipse.scout.rt.shared.services.lookup.IBatchLookupService)4 Test (org.junit.Test)4 ITableRow (org.eclipse.scout.rt.client.ui.basic.table.ITableRow)2 BatchLookupNormalizer (org.eclipse.scout.rt.shared.services.lookup.BatchLookupNormalizer)2 LocalLookupCall (org.eclipse.scout.rt.shared.services.lookup.LocalLookupCall)2 BatchLookupService (org.eclipse.scout.rt.server.services.lookup.BatchLookupService)1 LookupCall (org.eclipse.scout.rt.shared.services.lookup.LookupCall)1