public void testBasicSnapshotOperation() { final FireHose fireHose = new FireHose(); final FireHoseLiveDataServer liveDataServer = new FireHoseLiveDataServer(ExternalSchemes.SURF, fireHose); liveDataServer.start(); try { final MutableFudgeMsg msg = FudgeContext.GLOBAL_DEFAULT.newMessage(); msg.add("X", "Y"); fireHose.storeValue("Foo", msg); assertEquals(liveDataServer.doSnapshot("Foo").getString("X"), "Y"); } finally { liveDataServer.stop(); } }
public void testBasicSubscription() throws InterruptedException { final FireHose fireHose = new FireHose(); final FireHoseLiveDataServer liveDataServer = new FireHoseLiveDataServer(ExternalSchemes.SURF, fireHose); final BlockingQueue<LiveDataValueUpdateBean> updates = connect(liveDataServer, Integer.MAX_VALUE); liveDataServer.start(); try { final MutableFudgeMsg msg = FudgeContext.GLOBAL_DEFAULT.newMessage(); msg.add("X", "Y"); fireHose.storeValue("Foo", msg); assertNotNull(liveDataServer.subscribe("Foo")); final LiveDataValueUpdateBean update = updates.poll(Timeout.standardTimeoutMillis(), TimeUnit.MILLISECONDS); assertNotNull(update); assertEquals(update.getFields().getString("X"), "Y"); } finally { liveDataServer.stop(); } }