Search in sources :

Example 1 with FetchEntriesReplyMessage

use of org.apache.geode.internal.cache.partitioned.FetchEntriesMessage.FetchEntriesReplyMessage in project geode by apache.

the class FetchEntriesMessageJUnitTest method testProcessChunk.

@Test
public void testProcessChunk() throws Exception {
    cache = Fakes.cache();
    PartitionedRegion pr = mock(PartitionedRegion.class);
    InternalDistributedSystem system = cache.getInternalDistributedSystem();
    FetchEntriesResponse response = new FetchEntriesResponse(system, pr, null, 0);
    HeapDataOutputStream chunkStream = createDummyChunk();
    FetchEntriesReplyMessage reply = new FetchEntriesReplyMessage(null, 0, 0, chunkStream, 0, 0, 0, false, false);
    reply.chunk = chunkStream.toByteArray();
    response.processChunk(reply);
    assertNull(response.returnRVV);
    assertEquals(2, response.returnValue.size());
    assertTrue(response.returnValue.get("keyWithOutVersionTag").equals("valueWithOutVersionTag"));
    assertTrue(response.returnValue.get("keyWithVersionTag").equals("valueWithVersionTag"));
    assertNull(response.returnVersions.get("keyWithOutVersionTag"));
    assertNotNull(response.returnVersions.get("keyWithVersionTag"));
}
Also used : FetchEntriesResponse(org.apache.geode.internal.cache.partitioned.FetchEntriesMessage.FetchEntriesResponse) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) HeapDataOutputStream(org.apache.geode.internal.HeapDataOutputStream) FetchEntriesReplyMessage(org.apache.geode.internal.cache.partitioned.FetchEntriesMessage.FetchEntriesReplyMessage) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem) Test(org.junit.Test) UnitTest(org.apache.geode.test.junit.categories.UnitTest)

Aggregations

InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)1 HeapDataOutputStream (org.apache.geode.internal.HeapDataOutputStream)1 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)1 FetchEntriesReplyMessage (org.apache.geode.internal.cache.partitioned.FetchEntriesMessage.FetchEntriesReplyMessage)1 FetchEntriesResponse (org.apache.geode.internal.cache.partitioned.FetchEntriesMessage.FetchEntriesResponse)1 UnitTest (org.apache.geode.test.junit.categories.UnitTest)1 Test (org.junit.Test)1