Exemplo n.º 1
0
 public void StopClient()
 {
     Ignition.StopAll(true);
 }
Exemplo n.º 2
0
        public void TearDown()
        {
            IgniteProcess.KillAll();

            Ignition.StopAll(true);
        }
Exemplo n.º 3
0
 public void StopClient()
 {
     Ignition.StopAll(true);
     IgniteProcess.KillAll();
 }
Exemplo n.º 4
0
 public void TestFixtureTearDown()
 {
     Ignition.StopAll(true);
 }
Exemplo n.º 5
0
 public void StopGrids()
 {
     Ignition.StopAll(true);
 }
Exemplo n.º 6
0
 public void FixtureTearDown()
 {
     _ignite.GetCompute().ExecuteJavaTask <object>(StopTask, _javaNodeName);
     Ignition.StopAll(true);
 }
 public void TearDown()
 {
     Ignition.StopAll(true);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Stops the grids.
        /// </summary>
        private void StopGrids()
        {
            _grid1 = null;

            Ignition.StopAll(true);
        }
Exemplo n.º 9
0
        public void TestFailover()
        {
            // Start 3 nodes.
            Ignition.Start(TestUtils.GetTestConfiguration(name: "0"));
            Ignition.Start(TestUtils.GetTestConfiguration(name: "1"));
            Ignition.Start(TestUtils.GetTestConfiguration(name: "2"));

            // Connect client.
            var port = IgniteClientConfiguration.DefaultPort;
            var cfg  = new IgniteClientConfiguration
            {
                Endpoints = new[]
                {
                    "localhost",
                    string.Format("127.0.0.1:{0}..{1}", port + 1, port + 2)
                }
            };

            // ReSharper disable AccessToDisposedClosure
            using (var client = Ignition.StartClient(cfg))
            {
                Assert.AreEqual(0, client.GetCacheNames().Count);

                Action checkReconnect = () =>
                {
                    // First operation may fail or may not.
                    // Sometimes the client will switch to another socket in background due to
                    // OnAffinityTopologyVersionChange callback.
                    var timeout = DateTime.Now.AddSeconds(0.3);

                    while (DateTime.Now < timeout)
                    {
                        try
                        {
                            Assert.AreEqual(0, client.GetCacheNames().Count);
                            break;
                        }
                        catch (Exception e)
                        {
                            Assert.IsNotNull(GetSocketException(e));
                        }
                    }
                };

                // Stop first node.
                var nodeId = ((IPEndPoint)client.RemoteEndPoint).Port - port;
                Ignition.Stop(nodeId.ToString(), true);

                checkReconnect();

                // Stop second node.
                nodeId = ((IPEndPoint)client.RemoteEndPoint).Port - port;
                Ignition.Stop(nodeId.ToString(), true);

                checkReconnect();

                // Stop all nodes.
                Ignition.StopAll(true);

                Assert.IsNotNull(GetSocketException(Assert.Catch(() => client.GetCacheNames())));
                Assert.IsNotNull(GetSocketException(Assert.Catch(() => client.GetCacheNames())));
            }
        }
 public void GlobalCleanup()
 {
     Ignition.StopAll(true);
 }
Exemplo n.º 11
0
        public void TestFixtureTearDown()
        {
            Ignition.StopAll(true);

            TestUtils.KillProcesses();
        }
Exemplo n.º 12
0
        public void TearDown()
        {
            Ignition.StopAll(true);

            UnloadDomains();
        }
Exemplo n.º 13
0
 public static void StopAll() => Ignition.StopAll(false);
Exemplo n.º 14
0
 public virtual void GlobalCleanup()
 {
     Client.Dispose();
     Ignition.StopAll(true);
 }
Exemplo n.º 15
0
 public void FixtureTearDown()
 {
     Ignition.StopAll(true);
     Client.Dispose();
 }
Exemplo n.º 16
0
        public void TestFailoverWithRetryPolicyCompletesOperationWithoutException(
            [Values(true, false)] bool async,
            [Values(true, false)] bool partitionAware)
        {
            // Start 3 nodes.
            Func <string, IgniteConfiguration> getConfig = name =>
                                                           new IgniteConfiguration(TestUtils.GetTestConfiguration(name: name))
            {
                ClientConnectorConfiguration = new ClientConnectorConfiguration
                {
                    ThinClientConfiguration = new ThinClientConfiguration
                    {
                        MaxActiveComputeTasksPerConnection = 1
                    }
                }
            };

            Ignition.Start(getConfig("0"));
            Ignition.Start(getConfig("1"));
            Ignition.Start(getConfig("2"));

            // Connect client.
            var port = IgniteClientConfiguration.DefaultPort;
            var cfg  = new IgniteClientConfiguration
            {
                Endpoints = new[]
                {
                    "localhost",
                    string.Format("127.0.0.1:{0}..{1}", port + 1, port + 2)
                },
                RetryPolicy = new ClientRetryAllPolicy(),
                RetryLimit  = 3,
                EnablePartitionAwareness = partitionAware
            };

            // ReSharper disable AccessToDisposedClosure
            using (var client = Ignition.StartClient(cfg))
            {
                var cache = client.GetOrCreateCache <int, int>("c");

                // Check all DoOp overloads.
                Action checkOperation = partitionAware
                    ? async
                        ? (Action)(() => Assert.IsFalse(cache.ContainsKeyAsync(1).Result))
                        : () => Assert.IsFalse(cache.ContainsKey(1))
                    : async
                        ? (Action)(() => Assert.IsNotNull(client.GetCompute().ExecuteJavaTaskAsync <object>(
                                                              ComputeClientTests.TestTask, null).Result))
                        : () => Assert.AreEqual(1, client.GetCacheNames().Count);

                checkOperation();

                // Stop first node.
                var nodeId = ((IPEndPoint)client.RemoteEndPoint).Port - port;
                Ignition.Stop(nodeId.ToString(), true);

                checkOperation();

                // Stop second node.
                nodeId = ((IPEndPoint)client.RemoteEndPoint).Port - port;
                Ignition.Stop(nodeId.ToString(), true);

                checkOperation();

                // Stop all nodes.
                Ignition.StopAll(true);

                Assert.IsNotNull(GetSocketException(Assert.Catch(() => client.GetCacheNames())));
                Assert.IsNotNull(GetSocketException(Assert.Catch(() => client.GetCacheNames())));
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Stops the grids.
        /// </summary>
        private void StopGrids()
        {
            Grid1 = Grid2 = Grid3 = null;

            Ignition.StopAll(true);
        }
Exemplo n.º 18
0
 public virtual void FixtureTearDown()
 {
     Ignition.StopAll(true);
 }
Exemplo n.º 19
0
 public virtual void AfterTests()
 {
     Ignition.StopAll(true);
 }
Exemplo n.º 20
0
        public void TestStartGetStop()
        {
            var cfgs = new List <string> {
                "config\\start-test-grid1.xml", "config\\start-test-grid2.xml", "config\\start-test-grid3.xml"
            };

            var cfg = new IgniteConfiguration
            {
                SpringConfigUrl = cfgs[0],
                JvmOptions      = TestUtils.TestJavaOptions(),
                JvmClasspath    = TestUtils.CreateTestClasspath()
            };

            var grid1 = Ignition.Start(cfg);

            Assert.AreEqual("grid1", grid1.Name);

            cfg.SpringConfigUrl = cfgs[1];

            var grid2 = Ignition.Start(cfg);

            Assert.AreEqual("grid2", grid2.Name);

            cfg.SpringConfigUrl = cfgs[2];

            var grid3 = Ignition.Start(cfg);

            Assert.IsNull(grid3.Name);

            Assert.AreSame(grid1, Ignition.GetIgnite("grid1"));
            Assert.AreSame(grid1, Ignition.TryGetIgnite("grid1"));

            Assert.AreSame(grid2, Ignition.GetIgnite("grid2"));
            Assert.AreSame(grid2, Ignition.TryGetIgnite("grid2"));

            Assert.AreSame(grid3, Ignition.GetIgnite(null));
            Assert.AreSame(grid3, Ignition.TryGetIgnite(null));

            Assert.Throws <IgniteException>(() => Ignition.GetIgnite("invalid_name"));
            Assert.IsNull(Ignition.TryGetIgnite("invalid_name"));


            Assert.IsTrue(Ignition.Stop("grid1", true));
            Assert.Throws <IgniteException>(() => Ignition.GetIgnite("grid1"));

            grid2.Dispose();
            Assert.Throws <IgniteException>(() => Ignition.GetIgnite("grid2"));

            grid3.Dispose();
            Assert.Throws <IgniteException>(() => Ignition.GetIgnite("grid3"));

            foreach (var cfgName in cfgs)
            {
                cfg.SpringConfigUrl = cfgName;
                cfg.JvmOptions      = TestUtils.TestJavaOptions();

                Ignition.Start(cfg);
            }

            foreach (var gridName in new List <string> {
                "grid1", "grid2", null
            })
            {
                Assert.IsNotNull(Ignition.GetIgnite(gridName));
            }

            Ignition.StopAll(true);

            foreach (var gridName in new List <string> {
                "grid1", "grid2", null
            })
            {
                Assert.Throws <IgniteException>(() => Ignition.GetIgnite(gridName));
            }
        }
Exemplo n.º 21
0
        public void TearDown()
        {
            Ignition.StopAll(true);

            Directory.Delete(TempDir, true);
        }
Exemplo n.º 22
0
 /** <inheritDoc /> */
 protected override void OnStop()
 {
     Ignition.StopAll(true);
 }
Exemplo n.º 23
0
 public void TearDown()
 {
     TestUtils.KillProcesses();
     Ignition.StopAll(true);
 }
Exemplo n.º 24
0
 public void SetUp()
 {
     Ignition.StopAll(true);
     IgniteProcess.KillAll();
 }
Exemplo n.º 25
0
 public void FixtureSetUp()
 {
     Ignition.StopAll(true);
 }
Exemplo n.º 26
0
 public void TearDown()
 {
     Ignition.StopAll(true);
     IgniteProcess.KillAll();
     Ignition.ClientMode = false;
 }
Exemplo n.º 27
0
        public void FixtureTearDown()
        {
            Ignition.StopAll(true);

            Directory.Delete(_tempDir, true);
        }
Exemplo n.º 28
0
 public static void ClassCleanup()
 {
     Ignition.StopAll(true);
 }