use of com.questdb.net.ha.protocol.commands.SetKeyRequestProducer in project questdb by bluestreak01.
the class SetKeyTest method testProducerConsumer.
@Test
public void testProducerConsumer() throws Exception {
SetKeyRequestProducer producer = new SetKeyRequestProducer();
SetKeyRequestConsumer consumer = new SetKeyRequestConsumer();
IndexedJournalKey key = new IndexedJournalKey(0, new JournalKey<>(Quote.class, "loc1", PartitionBy.DAY, 100, true));
producer.setValue(key);
producer.write(channel);
consumer.read(channel);
Assert.assertEquals(key, consumer.getValue());
IndexedJournalKey key2 = new IndexedJournalKey(1, new JournalKey<>(Quote.class, "longer_location", PartitionBy.DAY, 1000, true));
producer.setValue(key2);
producer.write(channel);
consumer.read(channel);
Assert.assertEquals(key2, consumer.getValue());
IndexedJournalKey key3 = new IndexedJournalKey(2, new JournalKey<>(Quote.class, "shorter_loc", PartitionBy.DAY, 1000, true));
producer.setValue(key3);
producer.write(channel);
consumer.read(channel);
Assert.assertEquals(key3, consumer.getValue());
}
Aggregations