public void PhysicalQuery_LongQuery_Self() { _HubRouter hub = null; TestAck ack; string s; Msg.LoadTypes(Assembly.GetExecutingAssembly()); try { hub = CreateHub("detached", "hub0", group); Thread.Sleep(InitDelay); // Verify a long running q/r between a single router, // verifying that query was not sent multiple times. s = "Hello World!"; ack = (TestAck)hub.Query(hub.RouterEP, new NotCachedMsg("Sleep", s)); Assert.AreEqual(s, ack.Value); Assert.IsTrue(hub.ReceiveCount == 1); } finally { if (hub != null) { hub.Stop(); } Config.SetConfig(null); } }
public void LogicalQueryViaUdpBroadcast_LongQuery_Self() { _HubRouter hub = null; TestAck ack; string s; Msg.LoadTypes(Assembly.GetExecutingAssembly()); try { hub = CreateHub("detached", "hub0", group); Thread.Sleep(InitDelay); // Verify a q/r between two routers s = "Hello World!"; ack = (TestAck)hub.Query("logical://hub", new NotCachedMsg("Sleep", s)); Assert.AreEqual(s, ack.Value); Assert.IsTrue(hub.ReceiveCount > 0); } finally { if (hub != null) { hub.Stop(); } Config.SetConfig(null); } }
public void PhysicalQuery_Cached_Remote() { _HubRouter hub = null; _LeafRouter leaf = null; CachedMsg query; TestAck ack1; TestAck ack2; Msg.LoadTypes(Assembly.GetExecutingAssembly()); try { hub = CreateHub("detached", "hub0", group); leaf = CreateLeaf("detached", "hub0", "leaf0", group); Thread.Sleep(InitDelay); // Verify that sessions and replies are cached query = new CachedMsg("ActionCount", string.Empty); ack1 = (TestAck)leaf.Query(hub.RouterEP, query); Assert.AreEqual(1, hub.ReceiveCount); // Simulate the resending of the query message and wait // for another reply. The second reply should hold the // same value as the first. query = new CachedMsg("ActionCount", string.Empty); query._ToEP = leaf.RouterEP; query._SessionID = ack1._SessionID; query._Flags |= MsgFlag.OpenSession | MsgFlag.ServerSession | MsgFlag.KeepSessionID; ack2 = (TestAck)leaf.Query(hub.RouterEP, query); Assert.AreEqual(1, hub.ReceiveCount); Assert.AreEqual(ack1.Value, ack2.Value); } finally { if (hub != null) { hub.Stop(); } if (leaf != null) { leaf.Stop(); } Config.SetConfig(null); } }
public void PhysicalQuery_Timeout_Remote_Cached() { _LeafRouter leaf = null; _HubRouter hub = null; TestAck ack; Msg.LoadTypes(Assembly.GetExecutingAssembly()); try { hub = CreateHub("detached", "hub0", group); leaf = CreateLeaf("detached", "hub0", "leaf0", group); Thread.Sleep(InitDelay); // Verify that retries and timeout works try { ack = (TestAck)leaf.Query(hub.RouterEP, new CachedMsg("Ignore", string.Empty)); Assert.Fail("Should have seen a TimeoutException"); } catch (TimeoutException) { // Verify that since the CachedMsg handlers are tagged with // [MsgHandler[Idempotent=true)] that we have not // seen any retry messages Assert.AreEqual(1, hub.ReceiveCount); } } finally { if (leaf != null) { leaf.Stop(); } if (hub != null) { hub.Stop(); } Config.SetConfig(null); } }
public void LogicalQueryViaUdpBroadcast_Timeout_Remote() { _LeafRouter leaf = null; _HubRouter hub = null; TestAck ack; Msg.LoadTypes(Assembly.GetExecutingAssembly()); try { hub = CreateHub("detached", "hub0", group); leaf = CreateLeaf("detached", "hub0", "leaf0", group); Thread.Sleep(InitDelay); // Verify that retries and timeout works try { ack = (TestAck)leaf.Query("logical://hub", new NotCachedMsg("Ignore", string.Empty)); Assert.Fail("Should have seen a TimeoutException"); } catch (TimeoutException) { // Verify that since the NotCachedMsg handlers are not tagged with // [MsgHandler[Idempotent=true)] that we should have seen // all of the retry messages as well. Assert.AreEqual(leaf.SessionRetries, hub.ReceiveCount); } } finally { if (leaf != null) { leaf.Stop(); } if (hub != null) { hub.Stop(); } Config.SetConfig(null); } }
public void PhysicalQuery_Exception() { _LeafRouter leaf = null; _HubRouter hub = null; TestAck ack; Msg.LoadTypes(Assembly.GetExecutingAssembly()); try { hub = CreateHub("detached", "hub0", group); leaf = CreateLeaf("detached", "hub0", "leaf0", group); Thread.Sleep(InitDelay); // Verify that retries and timeout works try { ack = (TestAck)leaf.Query(hub.RouterEP, new NotCachedMsg("Exception", "Test Exception")); Assert.Fail("Should have seen a TimeoutException"); } catch (SessionException e) { Assert.AreEqual("Test Exception", e.Message); } } finally { if (leaf != null) { leaf.Stop(); } if (hub != null) { hub.Stop(); } Config.SetConfig(null); } }
public void PhysicalQuery_Basic_Remote_Blast() { _LeafRouter leaf = null; _HubRouter hub = null; TestAck ack; string s; Msg.LoadTypes(Assembly.GetExecutingAssembly()); try { hub = CreateHub("detached", "hub0", group); leaf = CreateLeaf("detached", "hub0", "leaf0", group); Thread.Sleep(InitDelay); for (int i = 0; i < BlastCount; i++) { // Verify a q/r between two routers s = "Hello World: " + i.ToString(); ack = (TestAck)hub.Query(leaf.RouterEP, new NotCachedMsg("Normal", s)); Assert.AreEqual(s, ack.Value); } } finally { if (leaf != null) { leaf.Stop(); } if (hub != null) { hub.Stop(); } Config.SetConfig(null); } }
public void PhysicalQueryViaUdpBroadcast_LongQuery_Remote() { _LeafRouter leaf = null; _HubRouter hub = null; TestAck ack; string s; Msg.LoadTypes(Assembly.GetExecutingAssembly()); try { hub = CreateHub("detached", "hub0", group); leaf = CreateLeaf("detached", "hub0", "leaf0", group); Thread.Sleep(InitDelay); // Verify a long running q/r between two routers, // verifying that the query was not sent multiple times. s = "Hello World!"; ack = (TestAck)hub.Query(leaf.RouterEP, new NotCachedMsg("Sleep", s)); Assert.AreEqual(s, ack.Value); Assert.IsTrue(leaf.ReceiveCount == 1); } finally { if (leaf != null) { leaf.Stop(); } if (hub != null) { hub.Stop(); } Config.SetConfig(null); } }
public void LogicalQueryViaUdpBroadcast_Basic_Remote() { _LeafRouter leaf = null; _HubRouter hub = null; TestAck ack; string s; Msg.LoadTypes(Assembly.GetExecutingAssembly()); try { hub = CreateHub("detached", "hub0", group); leaf = CreateLeaf("detached", "hub0", "leaf0", group); Thread.Sleep(InitDelay); // Verify a q/r between two routers s = "Hello World!"; ack = (TestAck)hub.Query("logical://leaf", new NotCachedMsg("Normal", s)); Assert.AreEqual(s, ack.Value); } finally { if (leaf != null) { leaf.Stop(); } if (hub != null) { hub.Stop(); } Config.SetConfig(null); } }