public virtual void StartGrids()
        {
            TestUtils.JvmDebug = true;
            TestUtils.KillProcesses();

            IgniteConfigurationEx cfg = new IgniteConfigurationEx
            {
                BinaryConfiguration = new BinaryConfiguration
                {
                    TypeConfigurations = new[]
                    {
                        new BinaryTypeConfiguration(typeof(QueryPerson)),
                        new BinaryTypeConfiguration(typeof(BinarizableScanQueryFilter <QueryPerson>)),
                        new BinaryTypeConfiguration(typeof(BinarizableScanQueryFilter <BinaryObject>))
                    }
                },
                JvmClasspath    = TestUtils.CreateTestClasspath(),
                JvmOptions      = TestUtils.TestJavaOptions(),
                SpringConfigUrl = CfgPath
            };

            for (int i = 0; i < GridCnt; i++)
            {
                cfg.GridName = "grid-" + i;

                Ignition.Start(cfg);
            }
        }
Example #2
0
        public void SetUp()
        {
            GC.Collect();
            TestUtils.JvmDebug = true;

            IgniteConfigurationEx cfg = new IgniteConfigurationEx();

            PortableConfiguration portCfg = new PortableConfiguration();

            ICollection <PortableTypeConfiguration> portTypeCfgs = new List <PortableTypeConfiguration>();

            portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableEntry)));
            portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableFilter)));
            portTypeCfgs.Add(new PortableTypeConfiguration(typeof(KeepPortableFilter)));

            portCfg.TypeConfigurations = portTypeCfgs;

            cfg.PortableConfiguration = portCfg;
            cfg.JvmClasspath          = TestUtils.CreateTestClasspath();
            cfg.JvmOptions            = TestUtils.TestJavaOptions();
            cfg.SpringConfigUrl       = "config\\cache-query-continuous.xml";

            cfg.GridName = "grid-1";
            grid1        = Ignition.Start(cfg);
            cache1       = grid1.Cache <int, PortableEntry>(cacheName);

            cfg.GridName = "grid-2";
            grid2        = Ignition.Start(cfg);
            cache2       = grid2.Cache <int, PortableEntry>(cacheName);
        }
Example #3
0
        public void BeforeTests()
        {
            //TestUtils.JVM_DEBUG = true;

            TestUtils.KillProcesses();

            TestUtils.JvmDebug = true;

            IgniteConfigurationEx cfg = new IgniteConfigurationEx();

            cfg.GridName        = GridName();
            cfg.JvmClasspath    = TestUtils.CreateTestClasspath();
            cfg.JvmOptions      = TestUtils.TestJavaOptions();
            cfg.SpringConfigUrl = "config\\native-client-test-cache-store.xml";

            PortableConfiguration portCfg = new PortableConfiguration();

            portCfg.Types = new List <string> {
                typeof(Key).FullName, typeof(Value).FullName
            };

            cfg.PortableConfiguration = portCfg;

            Ignition.Start(cfg);
        }
Example #4
0
        public void SetUp()
        {
            var cfg = new IgniteConfigurationEx
            {
                GridName        = GridName,
                JvmClasspath    = TestUtils.CreateTestClasspath(),
                JvmOptions      = TestUtils.TestJavaOptions(),
                SpringConfigUrl = "config\\native-client-test-cache.xml"
            };

            Ignition.Start(cfg);
        }
        public virtual void StartGrids()
        {
            TestUtils.KillProcesses();

            IgniteConfigurationEx cfg = new IgniteConfigurationEx();

            cfg.JvmClasspath    = TestUtils.CreateTestClasspath();
            cfg.JvmOptions      = TestUtils.TestJavaOptions();
            cfg.SpringConfigUrl = "config\\native-client-test-cache-affinity.xml";

            for (int i = 0; i < 3; i++)
            {
                cfg.GridName = "grid-" + i;

                Ignition.Start(cfg);
            }
        }
        public virtual void BeforeTests()
        {
            //TestUtils.JVM_DEBUG = true;

            TestUtils.KillProcesses();

            TestUtils.JvmDebug = true;

            IgniteConfigurationEx cfg = new IgniteConfigurationEx
            {
                GridName        = IgniteName,
                JvmClasspath    = TestUtils.CreateTestClasspath(),
                JvmOptions      = TestUtils.TestJavaOptions(),
                SpringConfigUrl = @"config\cache\store\cache-store-session.xml"
            };


            Ignition.Start(cfg);
        }
        /// <summary>
        /// Create configuration.
        /// </summary>
        /// <param name="name">Grid name.</param>
        /// <param name="springCfg">Spring configuration.</param>
        /// <returns>Configuration.</returns>
        private static IgniteConfigurationEx CreateConfiguration(string name, string springCfg)
        {
            IgniteConfigurationEx cfg = new IgniteConfigurationEx();

            BinaryConfiguration portCfg = new BinaryConfiguration();

            ICollection <BinaryTypeConfiguration> portTypeCfgs = new List <BinaryTypeConfiguration>();

            portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(DynamicTestKey)));
            portTypeCfgs.Add(new BinaryTypeConfiguration(typeof(DynamicTestValue)));

            portCfg.TypeConfigurations = portTypeCfgs;

            cfg.GridName            = name;
            cfg.BinaryConfiguration = portCfg;
            cfg.JvmClasspath        = TestUtils.CreateTestClasspath();
            cfg.JvmOptions          = TestUtils.TestJavaOptions();
            cfg.SpringConfigUrl     = springCfg;

            return(cfg);
        }
Example #8
0
        /// <summary>
        /// Starts Ignite with given configuration.
        /// </summary>
        /// <returns>Started Ignite.</returns>
        public unsafe static IIgnite Start(IgniteConfiguration cfg)
        {
            IgniteArgumentCheck.NotNull(cfg, "cfg");

            // Copy configuration to avoid changes to user-provided instance.
            IgniteConfigurationEx cfgEx = cfg as IgniteConfigurationEx;

            cfg = cfgEx == null ? new IgniteConfiguration(cfg) : new IgniteConfigurationEx(cfgEx);

            // Set default Spring config if needed.
            if (cfg.SpringConfigUrl == null)
            {
                cfg.SpringConfigUrl = DefaultCfg;
            }

            lock (SyncRoot)
            {
                // 1. Check GC settings.
                CheckServerGc(cfg);

                // 2. Create context.
                IgniteUtils.LoadDlls(cfg.JvmDllPath);

                var cbs = new UnmanagedCallbacks();

                IgniteManager.CreateJvmContext(cfg, cbs);

                var gridName = cfgEx != null ? cfgEx.GridName : null;

                var cfgPath = Environment.GetEnvironmentVariable(EnvIgniteSpringConfigUrlPrefix) + cfg.SpringConfigUrl;

                // 3. Create startup object which will guide us through the rest of the process.
                _startup = new Startup(cfg, cbs);

                IUnmanagedTarget interopProc = null;

                try
                {
                    // 4. Initiate Ignite start.
                    UU.IgnitionStart(cbs.Context, cfgPath, gridName, ClientMode);

                    // 5. At this point start routine is finished. We expect STARTUP object to have all necessary data.
                    var node = _startup.Ignite;
                    interopProc = node.InteropProcessor;

                    // 6. On-start callback (notify lifecycle components).
                    node.OnStart();

                    Nodes[new NodeKey(_startup.Name)] = node;

                    return(node);
                }
                catch (Exception)
                {
                    // 1. Perform keys cleanup.
                    string name = _startup.Name;

                    if (name != null)
                    {
                        NodeKey key = new NodeKey(name);

                        if (Nodes.ContainsKey(key))
                        {
                            Nodes.Remove(key);
                        }
                    }

                    // 2. Stop Ignite node if it was started.
                    if (interopProc != null)
                    {
                        UU.IgnitionStop(interopProc.Context, gridName, true);
                    }

                    // 3. Throw error further (use startup error if exists because it is more precise).
                    if (_startup.Error != null)
                    {
                        throw _startup.Error;
                    }

                    throw;
                }
                finally
                {
                    _startup = null;

                    if (interopProc != null)
                    {
                        UU.ProcessorReleaseStart(interopProc);
                    }
                }
            }
        }
 /// <summary>
 /// Copying constructor.
 /// </summary>
 /// <param name="cfg">Configuration.</param>
 public IgniteConfigurationEx(IgniteConfigurationEx cfg)
     : this((IgniteConfiguration) cfg)
 {
     GridName = cfg.GridName;
 }
 /// <summary>
 /// Copying constructor.
 /// </summary>
 /// <param name="cfg">Configuration.</param>
 public IgniteConfigurationEx(IgniteConfigurationEx cfg)
     : this((IgniteConfiguration)cfg)
 {
     GridName = cfg.GridName;
 }