Ejemplo n.º 1
0
 public void TestDebugConfiguration()
 {
     string oldSparkClrHome = SetEnviromentVariable(ConfigurationService.SPARKCLR_HOME, Path.GetTempPath());
     try
     {
         ConfigurationService debugConfiguration = new ConfigurationService();
         Assert.Throws<ConfigurationErrorsException>(() => Console.WriteLine(debugConfiguration.BackendPortNumber));
         Assert.Throws<Exception>(() => Console.WriteLine(debugConfiguration.GetCSharpWorkerExePath()));
     }
     finally
     {
         SetEnviromentVariable(ConfigurationService.SPARKCLR_HOME, oldSparkClrHome);
     }
 }
Ejemplo n.º 2
0
 public void TestLocalConfiguration()
 {
     string oldSparkClrHome = SetEnviromentVariable(ConfigurationService.SPARKCLR_HOME, Path.GetTempPath());
     string oldSparkMaster = SetEnviromentVariable(ConfigurationService.SPARK_MASTER, "local[3]");
     try
     {
         ConfigurationService localConfiguration = new ConfigurationService();
         Assert.IsNotNull(localConfiguration.GetCSharpWorkerExePath());
     }
     finally
     {
         SetEnviromentVariable(ConfigurationService.SPARKCLR_HOME, oldSparkClrHome);
         SetEnviromentVariable(ConfigurationService.SPARK_MASTER, oldSparkMaster);
     }
 }
Ejemplo n.º 3
0
        internal void TestConfiguration(string sparkMaster)
        {
            string oldSparkClrHome = SetEnviromentVariable(ConfigurationService.SPARKCLR_HOME, Path.GetTempPath());
            string oldSparkMaster = SetEnviromentVariable(ConfigurationService.SPARK_MASTER, sparkMaster);
            string oldPort = "NOT_SET";
            try
            {
                ConfigurationService localConfiguration = new ConfigurationService();
                Assert.IsNotNull(localConfiguration.GetCSharpWorkerExePath());
                Assert.Throws<Exception>(() => Console.WriteLine(localConfiguration.BackendPortNumber));
                const int backendPort = 1108;

                oldPort = SetEnviromentVariable(ConfigurationService.CSHARPBACKEND_PORT, Convert.ToString(backendPort));

                Assert.AreEqual(backendPort, localConfiguration.BackendPortNumber);
                Assert.AreEqual(ConfigurationService.ProcFileName, localConfiguration.GetCSharpWorkerExePath());
            }
            finally
            {
                SetEnviromentVariable(ConfigurationService.SPARKCLR_HOME, oldSparkClrHome);
                SetEnviromentVariable(ConfigurationService.SPARK_MASTER, oldSparkMaster);
                if (oldPort != "NOT_SET")
                {
                    SetEnviromentVariable(ConfigurationService.CSHARPBACKEND_PORT, oldPort);
                }
            }
        }