Exemple #1
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);
        }
Exemple #2
0
        private static IPortableObject ToPortable(IIgnite grid, object obj)
        {
            var cache = grid.Cache <object, object>(Cache1Name).WithKeepPortable <object, object>();

            cache.Put(1, obj);

            return((IPortableObject)cache.Get(1));
        }
Exemple #3
0
        public virtual void InitClient()
        {
            _grid = Ignition.Start(GetIgniteConfiguration(GridName));

            Ignition.Start(GetIgniteConfiguration(GridName + "_1"));

            _cache = _grid.Cache <int, int?>(CacheName);
        }
Exemple #4
0
        /// <summary>
        /// Generates the cache query event.
        /// </summary>
        private static void GenerateCacheQueryEvent(IIgnite g)
        {
            var cache = g.Cache <int, int>(null);

            cache.Clear();

            cache.Put(1, 1);

            cache.Query(new ScanQuery <int, int>()).GetAll();
        }
Exemple #5
0
        /// <summary>
        /// Uses the ignite.
        /// </summary>
        /// <param name="ignite">The ignite.</param>
        private static void UseIgnite(IIgnite ignite)
        {
            // Create objects holding references to java objects.
            var comp = ignite.Compute();

            // ReSharper disable once RedundantAssignment
            comp = comp.WithKeepPortable();

            var prj = ignite.Cluster.ForOldest();

            Assert.IsTrue(prj.Nodes().Count > 0);

            Assert.IsNotNull(prj.Compute());

            var cache = ignite.Cache <int, int>("cache1");

            Assert.IsNotNull(cache);

            cache.GetAndPut(1, 1);

            Assert.AreEqual(1, cache.Get(1));
        }
        /// <summary>
        /// Uses the ignite.
        /// </summary>
        /// <param name="ignite">The ignite.</param>
        private static void UseIgnite(IIgnite ignite)
        {
            // Create objects holding references to java objects.
            var comp = ignite.Compute();

            // ReSharper disable once RedundantAssignment
            comp = comp.WithKeepPortable();

            var prj = ignite.Cluster.ForOldest();

            Assert.IsTrue(prj.Nodes().Count > 0);

            Assert.IsNotNull(prj.Compute());

            var cache = ignite.Cache<int, int>("cache1");

            Assert.IsNotNull(cache);

            cache.GetAndPut(1, 1);

            Assert.AreEqual(1, cache.Get(1));
        }
Exemple #7
0
 /** <inheritdoc /> */
 public ICache <TK, TV> Cache <TK, TV>(string name)
 {
     return(_ignite.Cache <TK, TV>(name));
 }
Exemple #8
0
 public void TestClearCache()
 {
     _grid.Cache <object, object>(null).Clear();
 }