protected virtual IHazelcastInstance CreateClient()
        {
            var clientFactory = new HazelcastClientFactory();
            var resetEvent    = new ManualResetEventSlim();
            var listener      = new ListenerConfig(new LifecycleListener(l =>
            {
                if (l.GetState() == LifecycleEvent.LifecycleState.ClientConnected)
                {
                    resetEvent.Set();
                }
            }));
            var client = clientFactory.CreateClient(c =>
            {
                ConfigureClient(c);
                c.AddListenerConfig(listener);
            });

            Assert.IsTrue(resetEvent.Wait(30 * 1000), "Client did not start after 30 seconds");
            return(client);
        }
示例#2
0
 public void TestCredentialConfig_Credentials_Factory()
 {
     Assert.Catch <ConfigurationException>(() =>
     {
         _clientFactory.CreateClient(clientConfig =>
         {
             clientConfig.GetSecurityConfig().SetCredentials(new UsernamePasswordCredentials(_cluster.Id, _cluster.Id));
             clientConfig.GetSecurityConfig().GetCredentialsFactoryConfig()
             .SetImplementation(new UsernamePasswordCredentialsFactory());
         });
     });
 }
 protected virtual IHazelcastInstance CreateClient()
 {
     var clientFactory = new HazelcastClientFactory();
     var resetEvent = new ManualResetEventSlim();
     var listener = new ListenerConfig(new LifecycleListener(l =>
     {
         if (l.GetState() == LifecycleEvent.LifecycleState.ClientConnected)
         {
             resetEvent.Set();
         }
     }));
     var client = clientFactory.CreateClient(c =>
     {
         ConfigureClient(c);
         c.AddListenerConfig(listener);
     });
     Assert.IsTrue(resetEvent.Wait(30*1000), "Client did not start after 30 seconds");
     return client;
 }