Package org.apache.hedwig

Examples of org.apache.hedwig.StubScanCallback


    }

    @Test
    public void testScanSingleMessage() throws Exception {
        StubScanCallback callback = new StubScanCallback();
        ScanRequest request = new ScanRequest(topic, 1, callback, null);
        stubPersistenceManager.failure = true;

        cacheBasedPersistenceManager.scanSingleMessage(request);
        assertTrue(callback.isFailed());
        assertTrue(0 == cacheBasedPersistenceManager.cache.size());

        stubPersistenceManager.failure = false;
        cacheBasedPersistenceManager.scanSingleMessage(request);
        assertTrue(myConf.readAheadCount == cacheBasedPersistenceManager.cache.size());

        persistMessage(messages.get(0));
        assertTrue(callback.isSuccess());

    }
View Full Code Here


    }

    @Test
    public void testDoReadAhead() {
        StubScanCallback callback = new StubScanCallback();
        ScanRequest request = new ScanRequest(topic, 1, callback, null);
        cacheBasedPersistenceManager.doReadAhead(request);

        assertEquals(myConf.readAheadCount, cacheBasedPersistenceManager.cache.size());
View Full Code Here

    public void testReadAheadSizeLimit() throws Exception {
        for (Message m : messages) {
            persistMessage(m);
        }
        cacheBasedPersistenceManager.cache.clear();
        StubScanCallback callback = new StubScanCallback();
        ScanRequest request = new ScanRequest(topic, 1, callback, null);
        cacheBasedPersistenceManager.scanSingleMessage(request);

        assertTrue(callback.isSuccess());
        assertEquals((int) Math.ceil(myConf.readAheadSize / (MSG_SIZE + 0.0)), cacheBasedPersistenceManager.cache
                     .size());

    }
View Full Code Here

        int start = 1;
        RangeScanRequest readAheadRequest = cacheBasedPersistenceManager.doReadAheadStartingFrom(topic, start,
                                            readAheadCount);
        assertNull(readAheadRequest);

        StubScanCallback callback = new StubScanCallback();
        int end = 100;
        ScanRequest request = new ScanRequest(topic, end, callback, null);
        cacheBasedPersistenceManager.doReadAhead(request);

        int pos = 98;
View Full Code Here

    }

    @Test(timeout=60000)
    public void testScanSingleMessage() throws Exception {
        StubScanCallback callback = new StubScanCallback();
        ScanRequest request = new ScanRequest(topic, 1, callback, null);
        stubPersistenceManager.failure = true;

        cacheBasedPersistenceManager.scanSingleMessage(request);
        assertTrue(callback.isFailed());
        assertTrue(0 == cacheBasedPersistenceManager.cache.size());

        stubPersistenceManager.failure = false;
        cacheBasedPersistenceManager.scanSingleMessage(request);
        assertTrue(myConf.readAheadCount == cacheBasedPersistenceManager.cache.size());

        persistMessage(messages.get(0));
        assertTrue(callback.isSuccess());

    }
View Full Code Here

    }

    @Test(timeout=60000)
    public void testDoReadAhead() {
        StubScanCallback callback = new StubScanCallback();
        ScanRequest request = new ScanRequest(topic, 1, callback, null);
        cacheBasedPersistenceManager.doReadAhead(request);

        assertEquals(myConf.readAheadCount, cacheBasedPersistenceManager.cache.size());
View Full Code Here

    public void testReadAheadSizeLimit() throws Exception {
        for (Message m : messages) {
            persistMessage(m);
        }
        cacheBasedPersistenceManager.cache.clear();
        StubScanCallback callback = new StubScanCallback();
        ScanRequest request = new ScanRequest(topic, 1, callback, null);
        cacheBasedPersistenceManager.scanSingleMessage(request);

        assertTrue(callback.isSuccess());
        assertEquals((int) Math.ceil(myConf.readAheadSize / (MSG_SIZE + 0.0)), cacheBasedPersistenceManager.cache
                     .size());

    }
View Full Code Here

        int start = 1;
        RangeScanRequest readAheadRequest = cacheBasedPersistenceManager.doReadAheadStartingFrom(topic, start,
                                            readAheadCount);
        assertNull(readAheadRequest);

        StubScanCallback callback = new StubScanCallback();
        int end = 100;
        ScanRequest request = new ScanRequest(topic, end, callback, null);
        cacheBasedPersistenceManager.doReadAhead(request);

        int pos = 98;
View Full Code Here

TOP

Related Classes of org.apache.hedwig.StubScanCallback

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.