예제 #1
0
        /// <summary>
        /// Tests the example with standalone Apache.Ignite.exe nodes.
        /// </summary>
        /// <param name="example">The example to run.</param>
        /// <param name="clientMode">Client mode flag.</param>
        private static void TestRemoteNodes(Example example, bool clientMode)
        {
            // Exclude CrossPlatformExample and LifecycleExample
            if (string.IsNullOrEmpty(example.SpringConfigUrl))
            {
                Assert.IsTrue(new[] { "CrossPlatformExample", "LifecycleExample" }.Contains(example.Name));

                return;
            }

            // First node to start in current process defines JVM options.
            var gridConfig = new IgniteConfiguration
            {
                SpringConfigUrl = example.SpringConfigUrl,
                JvmOptions      =
                    new[]
                {
                    "-Xms512m", "-Xmx1024m", "-Xdebug", "-Xnoagent", "-Djava.compiler=NONE",
                    "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
                }
            };

            // Try with multiple standalone nodes
            for (var i = 0; i < 2; i++)
            {
                // Start a grid to monitor topology
                // Stop it after topology check so we don't interfere with example
                Ignition.ClientMode = false;

                using (var ignite = Ignition.Start(gridConfig))
                {
                    var args = new List <string> {
                        "-springConfigUrl=" + example.SpringConfigUrl
                    };

                    if (example.NeedsTestDll)
                    {
                        args.Add(" -assembly=" + typeof(AverageSalaryJob).Assembly.Location);
                    }

                    var proc = new IgniteProcess(args.ToArray());

                    Assert.IsTrue(ignite.WaitTopology(i + 2, 30000));
                    Assert.IsTrue(proc.Alive);
                }

                Ignition.ClientMode = clientMode;

                // Run twice to catch issues with standalone node state
                example.Run();
                example.Run();
            }
        }
예제 #2
0
        /// <summary>
        /// Tests the example with standalone Apache.Ignite.exe nodes.
        /// </summary>
        /// <param name="example">The example to run.</param>
        /// <param name="clientMode">Client mode flag.</param>
        private void TestRemoteNodes(Example example, bool clientMode)
        {
            Assert.IsTrue(PathUtil.ExamplesAppConfigPath.EndsWith(example.ConfigPath,
                                                                  StringComparison.OrdinalIgnoreCase), "All examples should use the same app.config.");

            Assert.IsTrue(example.NeedsTestDll || NoDllExamples.Contains(example.Name),
                          "Examples that allow standalone nodes should mention test dll.");

            StartRemoteNodes();

            Ignition.ClientMode = clientMode;

            // Run twice to catch issues with standalone node state
            example.Run();
            example.Run();
        }
예제 #3
0
        public void TestThinExample(Example example)
        {
            Assert.IsTrue(example.IsThin);

            example.Run();

            CheckOutput(example);
        }
예제 #4
0
        public void TestThickExample(Example example)
        {
            Assert.IsFalse(example.IsThin);

            example.Run();

            CheckOutput(example, "Ignite node started OK", "Topology snapshot [ver=1");
        }
예제 #5
0
        /// <summary>
        /// Tests the example with standalone Apache.Ignite.exe nodes.
        /// </summary>
        /// <param name="example">The example to run.</param>
        /// <param name="clientMode">Client mode flag.</param>
        private static void TestRemoteNodes(Example example, bool clientMode)
        {
            // Exclude LifecycleExample
            if (string.IsNullOrEmpty(example.ConfigPath))
            {
                Assert.AreEqual("LifecycleExample", example.Name);

                return;
            }

            var configPath = Path.Combine(PathUtil.IgniteHome, PathUtil.DevPrefix, example.ConfigPath);

            // Try with multiple standalone nodes
            for (var i = 0; i < 2; i++)
            {
                // Start a grid to monitor topology
                // Stop it after topology check so we don't interfere with example
                Ignition.ClientMode = false;

                using (var ignite = Ignition.StartFromApplicationConfiguration(
                           "igniteConfiguration", configPath))
                {
                    var args = new List <string> {
                        "-configFileName=" + configPath
                    };

                    if (example.NeedsTestDll)
                    {
                        args.Add(" -assembly=" + typeof(AverageSalaryJob).Assembly.Location);
                    }

                    var proc = new IgniteProcess(args.ToArray());

                    Assert.IsTrue(ignite.WaitTopology(i + 2));
                    Assert.IsTrue(proc.Alive);
                }

                Ignition.ClientMode = clientMode;

                // Run twice to catch issues with standalone node state
                example.Run();
                example.Run();
            }
        }
예제 #6
0
        public void TestLocalNode(Example example)
        {
            StopRemoteNodes();

            if (LocalOnlyExamples.Contains(example.Name))
            {
                Assert.IsFalse(example.NeedsTestDll, "Local-only example should not mention test dll.");
                Assert.IsNull(example.ConfigPath, "Local-only example should not mention app.config path.");
            }

            example.Run();
        }
예제 #7
0
 public void TestLocalNode(Example example)
 {
     example.Run();
 }
        public void TestThickExampleWithExternalNode(Example example)
        {
            example.Run();

            CheckOutput("_ExternalNode", example, "Ignite node started OK");
        }
예제 #9
0
        /// <summary>
        /// Tests the example with standalone Apache.Ignite.exe nodes.
        /// </summary>
        /// <param name="example">The example to run.</param>
        /// <param name="clientMode">Client mode flag.</param>
        private static void TestRemoteNodes(Example example, bool clientMode)
        {
            // Exclude LifecycleExample
            if (string.IsNullOrEmpty(example.ConfigPath))
            {
                Assert.AreEqual("LifecycleExample", example.Name);

                return;
            }

            var configPath = Path.Combine(PathUtil.IgniteHome, PathUtil.DevPrefix, example.ConfigPath);

            // Try with multiple standalone nodes
            for (var i = 0; i < 2; i++)
            {
                // Start a grid to monitor topology
                // Stop it after topology check so we don't interfere with example
                Ignition.ClientMode = false;

                using (var ignite = Ignition.StartFromApplicationConfiguration(
                    "igniteConfiguration", configPath))
                {
                    var args = new List<string> { "-configFileName=" + configPath};

                    if (example.NeedsTestDll)
                        args.Add(" -assembly=" + typeof(AverageSalaryJob).Assembly.Location);

                    var proc = new IgniteProcess(args.ToArray());

                    Assert.IsTrue(ignite.WaitTopology(i + 2));
                    Assert.IsTrue(proc.Alive);
                }

                Ignition.ClientMode = clientMode;

                // Run twice to catch issues with standalone node state
                example.Run();
                example.Run();
            }
        }
예제 #10
0
 public void TestLocalNode(Example example)
 {
     example.Run();
 }
예제 #11
0
        /// <summary>
        /// Tests the example with standalone Apache.Ignite.exe nodes.
        /// </summary>
        /// <param name="example">The example to run.</param>
        /// <param name="clientMode">Client mode flag.</param>
        private static void TestRemoteNodes(Example example, bool clientMode)
        {
            // Exclude LifecycleExample
            if (string.IsNullOrEmpty(example.SpringConfigUrl))
            {
                Assert.AreEqual("LifecycleExample", example.Name);

                return;
            }

            // First node to start in current process defines JVM options.
            var gridConfig = new IgniteConfiguration
            {
                SpringConfigUrl = example.SpringConfigUrl,
                JvmOptions =
                    new[]
                    {
                        "-Xms512m", "-Xmx1024m", "-Xdebug", "-Xnoagent", "-Djava.compiler=NONE",
                        "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
                    }
            };

            // Try with multiple standalone nodes
            for (var i = 0; i < 2; i++)
            {
                // Start a grid to monitor topology
                // Stop it after topology check so we don't interfere with example
                Ignition.ClientMode = false;

                using (var ignite = Ignition.Start(gridConfig))
                {
                    var args = new List<string> {"-springConfigUrl=" + example.SpringConfigUrl};

                    if (example.NeedsTestDll)
                        args.Add(" -assembly=" + typeof(AverageSalaryJob).Assembly.Location);

                    var proc = new IgniteProcess(args.ToArray());

                    Assert.IsTrue(ignite.WaitTopology(i + 2, 30000));
                    Assert.IsTrue(proc.Alive);
                }

                Ignition.ClientMode = clientMode;

                // Run twice to catch issues with standalone node state
                example.Run();
                example.Run();
            }
        }
 public void TestThickExampleWithExternalNode(Example example)
 {
     example.Run();
 }
예제 #13
0
        public void TestThickExample(Example example)
        {
            Assert.IsFalse(example.IsThin);

            example.Run();
        }