public void TestRetryTimeout() { Environment.SetEnvironmentVariable("hazelcast.client.invocation.timeout.seconds", "2"); var client = new HazelcastClientFactory().CreateClient(c => c.GetNetworkConfig().AddAddress("127.0.0.1:5701")); try { var map = client.GetMap <string, string>(TestSupport.RandomString()); Cluster.RemoveNode(); var resetEvent = new ManualResetEventSlim(); Task.Factory.StartNew(() => { Logging.Logger.GetLogger("ClientRetryTest").Info("Calling map.Put"); map.Put("key", "value"); }).ContinueWith(t => { if (t.IsFaulted) { resetEvent.Set(); } else { Assert.Fail("Method invocation did not fail as expected"); } }); Assert.IsTrue(resetEvent.Wait(4000), "Did not get an exception within seconds"); } finally { Environment.SetEnvironmentVariable("hazelcast.client.invocation.timeout.seconds", null); client.Shutdown(); } }
private static void AssertClientWithAddress(string address) { var client = new HazelcastClientFactory().CreateClient(config => { config.GetNetworkConfig().AddAddress(address); }); var map = client.GetMap<string, string>("ipv6"); map.Put("key", "val"); Assert.AreEqual("val", map.Get("key")); map.Destroy(); client.Shutdown(); }
private static void AssertClientWithAddress(string address) { var client = new HazelcastClientFactory().CreateClient(config => { config.GetNetworkConfig().AddAddress(address); }); var map = client.GetMap <string, string>("ipv6"); map.Put("key", "val"); Assert.AreEqual("val", map.Get("key")); map.Destroy(); client.Shutdown(); }
public void TestRetryTimeout() { var member = _remoteController.startMember(_cluster.Id); Environment.SetEnvironmentVariable("hazelcast.client.invocation.timeout.seconds", "2"); var client = new HazelcastClientFactory().CreateClient(c => c.GetNetworkConfig().AddAddress("127.0.0.1:5701")); try { var map = client.GetMap<string, string>(TestSupport.RandomString()); StopMember(_remoteController, _cluster, member); var resetEvent = new ManualResetEventSlim(); Task.Factory.StartNew(() => { Logger.GetLogger("ClientRetryTest").Info("Calling map.Put"); map.Put("key", "value"); }).ContinueWith(t => { var e = t.Exception;//observe the exception if (t.IsFaulted) resetEvent.Set(); else Assert.Fail("Method invocation did not fail as expected"); }); Assert.IsTrue(resetEvent.Wait(4000), "Did not get an exception within seconds"); } finally { Environment.SetEnvironmentVariable("hazelcast.client.invocation.timeout.seconds", null); client.Shutdown(); } }