Search in sources :

Example 1 with LookupCall

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

the class StatementProcessorTest method testLookupCall.

@Test
public void testLookupCall() throws Exception {
    LookupCall call = new LookupCall() {

        private static final long serialVersionUID = 1L;
    };
    // 
    AbstractSqlService sqlService = new AbstractSqlService() {
    };
    BeanInstanceUtil.initializeBeanInstance(sqlService);
    StatementProcessor sp = new StatementProcessor(sqlService, "SELECT P.PERSON_NR,P.NAME" + " FROM PERSON P " + " WHERE P.PERSON_NR=:key " + " AND P.NAME like '%'||:text||'%'", new Object[] { call });
    sp.simulate();
    String sqlPlainTextDump = sp.createSqlDump(false, true);
    assertFalse(sqlPlainTextDump.contains("UNPARSED"));
}
Also used : LookupCall(org.eclipse.scout.rt.shared.services.lookup.LookupCall) AbstractSqlService(org.eclipse.scout.rt.server.jdbc.AbstractSqlService) Test(org.junit.Test)

Example 2 with LookupCall

use of org.eclipse.scout.rt.shared.services.lookup.LookupCall 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)

Aggregations

LookupCall (org.eclipse.scout.rt.shared.services.lookup.LookupCall)2 Test (org.junit.Test)2 AbstractSqlService (org.eclipse.scout.rt.server.jdbc.AbstractSqlService)1 BatchLookupCall (org.eclipse.scout.rt.shared.services.lookup.BatchLookupCall)1 ILookupCall (org.eclipse.scout.rt.shared.services.lookup.ILookupCall)1