Search in sources :

Example 1 with ClientCQImpl

use of org.apache.geode.cache.query.internal.cq.ClientCQImpl in project geode by apache.

the class ClientCQPostAuthorizationDUnitTest method checkCQListeners.

private boolean checkCQListeners(final int numOfUsers, final boolean[] expectedListenerInvocation, final int createEventsSize, final int updateEventsSize, final boolean closeCache) {
    for (int i = 0; i < numOfUsers; i++) {
        String cqName = "CQ_" + i;
        QueryService qService = getProxyCaches(i).getQueryService();
        ClientCQImpl cqQuery = (ClientCQImpl) qService.getCq(cqName);
        if (expectedListenerInvocation[i]) {
            for (CqListener listener : cqQuery.getCqListeners()) {
                assertEquals(createEventsSize, ((CqQueryTestListener) listener).getCreateEventCount());
                assertEquals(updateEventsSize, ((CqQueryTestListener) listener).getUpdateEventCount());
            }
        } else {
            for (CqListener listener : cqQuery.getCqListeners()) {
                assertEquals(0, ((CqQueryTestListener) listener).getTotalEventCount());
            }
        }
        if (closeCache) {
            getProxyCaches(i).close();
        }
    }
    return true;
}
Also used : ClientCQImpl(org.apache.geode.cache.query.internal.cq.ClientCQImpl) QueryService(org.apache.geode.cache.query.QueryService) CqListener(org.apache.geode.cache.query.CqListener)

Example 2 with ClientCQImpl

use of org.apache.geode.cache.query.internal.cq.ClientCQImpl in project geode by apache.

the class MultiUserDurableCQAuthzDUnitTest method waitForLastKey.

private void waitForLastKey(final int cqIndex, final boolean isCreate) {
    String cqName = "CQ_" + cqIndex;
    QueryService qService = getProxyCaches(cqIndex).getQueryService();
    ClientCQImpl cqQuery = (ClientCQImpl) qService.getCq(cqName);
    if (isCreate) {
        ((CqQueryTestListener) cqQuery.getCqListeners()[cqIndex]).waitForCreated("LAST_KEY");
    } else {
        ((CqQueryTestListener) cqQuery.getCqListeners()[cqIndex]).waitForUpdated("LAST_KEY");
    }
}
Also used : ClientCQImpl(org.apache.geode.cache.query.internal.cq.ClientCQImpl) CqQueryTestListener(org.apache.geode.cache.query.cq.dunit.CqQueryTestListener) QueryService(org.apache.geode.cache.query.QueryService)

Example 3 with ClientCQImpl

use of org.apache.geode.cache.query.internal.cq.ClientCQImpl in project geode by apache.

the class ClientCQPostAuthorizationDUnitTest method waitForLastKey.

private void waitForLastKey(final int cqIndex) {
    String cqName = "CQ_" + cqIndex;
    QueryService qService = getProxyCaches(cqIndex).getQueryService();
    ClientCQImpl cqQuery = (ClientCQImpl) qService.getCq(cqName);
    ((CqQueryTestListener) cqQuery.getCqListeners()[0]).waitForCreated("LAST_KEY");
}
Also used : ClientCQImpl(org.apache.geode.cache.query.internal.cq.ClientCQImpl) CqQueryTestListener(org.apache.geode.cache.query.cq.dunit.CqQueryTestListener) QueryService(org.apache.geode.cache.query.QueryService)

Example 4 with ClientCQImpl

use of org.apache.geode.cache.query.internal.cq.ClientCQImpl in project geode by apache.

the class ClientCQPostAuthorizationDUnitTest method waitForLastKeyUpdate.

private void waitForLastKeyUpdate(final int cqIndex) {
    String cqName = "CQ_" + cqIndex;
    QueryService qService = getProxyCaches(cqIndex).getQueryService();
    ClientCQImpl cqQuery = (ClientCQImpl) qService.getCq(cqName);
    ((CqQueryTestListener) cqQuery.getCqListeners()[0]).waitForUpdated("LAST_KEY");
}
Also used : ClientCQImpl(org.apache.geode.cache.query.internal.cq.ClientCQImpl) CqQueryTestListener(org.apache.geode.cache.query.cq.dunit.CqQueryTestListener) QueryService(org.apache.geode.cache.query.QueryService)

Example 5 with ClientCQImpl

use of org.apache.geode.cache.query.internal.cq.ClientCQImpl in project geode by apache.

the class MultiUserDurableCQAuthzDUnitTest method checkCQListeners.

private void checkCQListeners(final int numOfUsers, final boolean[] expectedListenerInvocation, final int createEventsSize, final int updateEventsSize) {
    for (int i = 0; i < numOfUsers; i++) {
        String cqName = "CQ_" + i;
        QueryService qService = getProxyCaches(i).getQueryService();
        ClientCQImpl cqQuery = (ClientCQImpl) qService.getCq(cqName);
        if (expectedListenerInvocation[i]) {
            for (CqListener listener : cqQuery.getCqListeners()) {
                assertEquals(createEventsSize, ((CqQueryTestListener) listener).getCreateEventCount());
                assertEquals(updateEventsSize, ((CqQueryTestListener) listener).getUpdateEventCount());
            }
        } else {
            for (CqListener listener : cqQuery.getCqListeners()) {
                assertEquals(0, ((CqQueryTestListener) listener).getTotalEventCount());
            }
        }
    }
}
Also used : ClientCQImpl(org.apache.geode.cache.query.internal.cq.ClientCQImpl) QueryService(org.apache.geode.cache.query.QueryService) CqListener(org.apache.geode.cache.query.CqListener)

Aggregations

QueryService (org.apache.geode.cache.query.QueryService)5 ClientCQImpl (org.apache.geode.cache.query.internal.cq.ClientCQImpl)5 CqQueryTestListener (org.apache.geode.cache.query.cq.dunit.CqQueryTestListener)3 CqListener (org.apache.geode.cache.query.CqListener)2