use of org.neo4j.kernel.impl.transaction.log.InMemoryClosableChannel in project neo4j by neo4j.
the class InMemoryCountsStoreSnapshotDeserializerTest method correctlyDeserializeIndexStatistics.
@Test
public void correctlyDeserializeIndexStatistics() throws IOException {
//GIVEN
long indexId = 1;
serializedBytes = ByteBuffer.allocate(1000);
InMemoryClosableChannel logChannel = new InMemoryClosableChannel(serializedBytes.array(), false);
writeSimpleHeader(logChannel);
logChannel.put(INDEX_STATISTICS.code);
logChannel.putLong(indexId);
logChannel.putLong(1);
logChannel.putLong(1);
//WHEN
IndexStatisticsKey expectedNode = CountsKeyFactory.indexStatisticsKey(indexId);
CountsSnapshot countsSnapshot = deserialize(logChannel);
//THEN
assertNotNull(countsSnapshot.getMap().get(expectedNode));
assertArrayEquals(new long[] { 1, 1 }, countsSnapshot.getMap().get(expectedNode));
}
Aggregations