public void Fetch2Test()
        {
            InMemoryWindowStore store1 = new InMemoryWindowStore("store", TimeSpan.FromDays(1), 1000 * 10);
            InMemoryWindowStore store2 = new InMemoryWindowStore("store", TimeSpan.FromDays(1), 1000 * 10);
            var dt          = DateTime.Now;
            var valueSerdes = new ValueAndTimestampSerDes <string>(new StringSerDes());
            var bytes       = new Bytes(Encoding.UTF8.GetBytes("test"));
            var provider    =
                new MockStateProvider <string, string>(1000 * 10, new StringSerDes(), new StringSerDes(), store1,
                                                       store2);
            var composite =
                new CompositeReadOnlyWindowStore <string, string>(provider, new WindowStoreType <string, string>(),
                                                                  "store");

            store1.Put(bytes,
                       valueSerdes.Serialize(ValueAndTimestamp <string> .Make("coucou1", dt.GetMilliseconds()),
                                             new SerializationContext()), dt.GetMilliseconds());
            var result = composite.Fetch("test", dt.AddSeconds(-2), dt.AddSeconds(2));

            Assert.IsNotNull(result);
            var items = result.ToList();

            Assert.AreEqual(1, items.Count);
            var c1 = items.FirstOrDefault(kp => kp.Value.Equals("coucou1"));

            Assert.IsNotNull(c1);
        }
Exemplo n.º 2
0
        public void FetchTest()
        {
            InMemoryWindowStore store1 = new InMemoryWindowStore("store", TimeSpan.FromDays(1), 1000 * 10);
            InMemoryWindowStore store2 = new InMemoryWindowStore("store", TimeSpan.FromDays(1), 1000 * 10);
            var dt          = DateTime.Now.GetMilliseconds();
            var valueSerdes = new ValueAndTimestampSerDes <string>(new StringSerDes());
            var bytes       = new Bytes(Encoding.UTF8.GetBytes("test"));
            var provider    = new MockStateProvider <string, string>(1000 * 10, new StringSerDes(), new StringSerDes(), store1, store2);
            var composite   = new CompositeReadOnlyWindowStore <string, string>(provider, new WindowStoreType <string, string>(), "store");

            store1.Put(bytes, valueSerdes.Serialize(ValueAndTimestamp <string> .Make("coucou1", dt)), dt);
            var result = composite.Fetch("test", dt);

            Assert.IsNotNull(result);
            Assert.AreEqual("coucou1", result);
        }