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);
}
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);
}
Aggregations