public void TestIgniteStart()
        {
            using (EnvVar.Set(Classpath.EnvIgniteNativeTestClasspath, bool.TrueString))
            {
                using (var ignite = Ignition.StartFromApplicationConfiguration(Ignition.ConfigurationSectionName))
                {
                    Assert.AreEqual("myGrid1", ignite.Name);
                    Assert.IsNotNull(ignite.GetCache <int, int>("cacheName"));
                }

                using (var ignite = Ignition.StartFromApplicationConfiguration("igniteConfiguration2"))
                {
                    Assert.AreEqual("myGrid2", ignite.Name);
                    Assert.IsNotNull(ignite.GetCache <int, int>("cacheName2"));
                }

                using (var ignite = Ignition.StartFromApplicationConfiguration())
                {
                    Assert.AreEqual("myGrid1", ignite.Name);
                }

                using (var ignite = Ignition.StartFromApplicationConfiguration(
                           "igniteConfiguration3", "custom_app.config"))
                {
                    Assert.AreEqual("myGrid3", ignite.Name);
                }
            }
        }
Ejemplo n.º 2
0
        public void TestDisabledRedirect()
        {
            // Run test in new process because JVM is initialized only once.
            const string envVar = "ConsoleRedirectTest.TestDisabledRedirect";

            if (Environment.GetEnvironmentVariable(envVar) == bool.TrueString)
            {
                var cfg = new IgniteConfiguration(TestUtils.GetTestConfiguration(false));
                Assert.IsTrue(cfg.RedirectJavaConsoleOutput);

                cfg.RedirectJavaConsoleOutput = false;

                using (Ignition.Start(cfg))
                {
                    Assert.AreEqual(string.Empty, _errSb.ToString());
                    Assert.AreEqual(string.Empty, _outSb.ToString());
                }
            }
            else
            {
                using (EnvVar.Set(envVar, bool.TrueString))
                {
                    TestUtils.RunTestInNewProcess(GetType().FullName, "TestDisabledRedirect");
                }
            }
        }
Ejemplo n.º 3
0
 public void TestDetection([Values(null, "c:\\invalid111")] string javaHome)
 {
     using (EnvVar.Set(EnvJavaHome, javaHome))
     using (var ignite = Ignition.Start(TestUtils.GetTestConfiguration()))
     {
         Assert.IsNotNull(ignite);
     }
 }
Ejemplo n.º 4
0
        public void TestIgniteHome()
        {
            using (EnvVar.Set(IgniteHome.EnvIgniteHome, null))
            {
                var home = IgniteHome.Resolve(null);
                Assert.IsTrue(Directory.Exists(home));

                // Invalid home.
                const string invalidHome = @"c:\foo\bar";
                var          ex          = Assert.Throws <IgniteException>(() => IgniteHome.Resolve(invalidHome));
                Assert.AreEqual(string.Format(
                                    "IgniteConfiguration.IgniteHome is not valid: '{0}'", invalidHome), ex.Message);
            }
        }