Search in sources :

Example 1 with SetKeyRequestProducer

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());
}
Also used : Quote(com.questdb.model.Quote) IndexedJournalKey(com.questdb.net.ha.model.IndexedJournalKey) SetKeyRequestProducer(com.questdb.net.ha.protocol.commands.SetKeyRequestProducer) SetKeyRequestConsumer(com.questdb.net.ha.protocol.commands.SetKeyRequestConsumer) Test(org.junit.Test)

Aggregations

Quote (com.questdb.model.Quote)1 IndexedJournalKey (com.questdb.net.ha.model.IndexedJournalKey)1 SetKeyRequestConsumer (com.questdb.net.ha.protocol.commands.SetKeyRequestConsumer)1 SetKeyRequestProducer (com.questdb.net.ha.protocol.commands.SetKeyRequestProducer)1 Test (org.junit.Test)1