예제 #1
0
        public void GridionStopTest()
        {
            GridionInternal gridionInternal = null;

            try
            {
                var configuration = new GridionConfiguration("127.0.0.1", 24000);

                var clusterCurator = NSubstitute.Substitute.For <IClusterCurator>();

                gridionInternal = new GridionInternal(configuration, clusterCurator);

                gridionInternal.Start();

                Assert.IsTrue(gridionInternal.IsRunning, "Invalid gridion node state.");

                gridionInternal.Stop();

                Assert.IsFalse(gridionInternal.IsRunning, "Invalid gridion node state.");
            }
            finally
            {
                if (gridionInternal != null)
                {
                    gridionInternal.Dispose();
                }
            }
        }
예제 #2
0
        /// <summary>
        ///     Starts a new <see cref="IGridion" /> instance.
        /// </summary>
        /// <param name="configuration">
        ///     The <see cref="IGridion" /> configuration.
        /// </param>
        /// <returns>
        ///     a started <see cref="IGridion" /> instance.
        /// </returns>
        public static IGridion Start(GridionConfiguration configuration)
        {
            Should.NotBeNull(configuration, nameof(configuration));

            lock (GridionList)
            {
#pragma warning disable CA2000 // Dispose objects before losing scope
                var instance = new GridionInternal(configuration, ClusterCurator.Instance);
#pragma warning restore CA2000 // Dispose objects before losing scope
                instance.Start();
                GridionList.Add(instance);
                return(instance);
            }
        }