Exemple #1
0
        public LoginStatus AllowedToLogin(LoginViewModel vm)
        {
            using (var con = conFac.GetConnection())
            {
                using (var cmd = QueryConst.GetLoginCommand(con, vm.EmpId))
                {
                    con.Open();
                    SqlDataReader dr = cmd.ExecuteReader();
                    if (!dr.HasRows)
                    {
                        return(LoginStatus.NotFound);
                    }

                    dr.Read();
                    vm.FirstName = dr.GetFieldValue <string>(0).Trim();
                    bool   isActive = dr.GetFieldValue <bool>(1);
                    string jobCode  = dr.GetFieldValue <string>(2).Trim();

                    if (isActive && ApplicationVariable.JobCodeAllowedToLogin().Any(c => string.Equals(c, jobCode, StringComparison.InvariantCultureIgnoreCase)))
                    {
                        return(LoginStatus.Successful);
                    }
                    else
                    {
                        return(LoginStatus.NotAllowed);
                    }
                }
            }
        }
Exemple #2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            ApplicationVariable.LoadAll();
        }
        public ActionResult Login(LoginViewModel loginModel)
        {
            if (ModelState.IsValid)
            {
                LoginStatus rslt = qMgr.AllowedToLogin(loginModel);
                var         msg  = string.Empty;
                switch (rslt)
                {
                case LoginStatus.NotFound:
                    msg = ApplicationVariable.GetBrandConfig().LoginPage.ErrorMessageIfUserNotFound.Value;
                    break;

                case LoginStatus.NotAllowed:
                    msg = ApplicationVariable.GetBrandConfig().LoginPage.ErrorMessageIfUserNotAllowedToLogin.Value;
                    break;

                case LoginStatus.Successful:
                    FormsAuthentication.SetAuthCookie(loginModel.FirstName, false);
                    return(RedirectToAction("Search"));

                    break;
                }

                ModelState.AddModelError("EmpId", msg);
            }
            return(View(loginModel));
        }
        public void TC001_ConfigureApplicationTest()
        {
            //Arrange
            IISPlugin target = new IISPlugin();

            ApplicationVariable[] appVariables = new ApplicationVariable[] {
                new ApplicationVariable()
                {
                    Name = "VCAP_PLUGIN_STAGING_INFO", Value = @"{""assembly"":""Uhuru.CloudFoundry.DEA.Plugins.dll"",""class_name"":""Uhuru.CloudFoundry.DEA.Plugins.IISPlugin"",""logs"":{""app_error"":""logs/stderr.log"",""dea_error"":""logs/err.log"",""startup"":""logs/startup.log"",""app"":""logs/stdout.log""},""auto_wire_templates"":{""mssql-2008"":""Data Source={host},{port};Initial Catalog={name};User Id={user};Password={password};MultipleActiveResultSets=true"",""mysql-5.1"":""server={host};port={port};Database={name};Uid={user};Pwd={password};""}}"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_APPLICATION", Value = @"{""instance_id"":""646c477f54386d8afb279ec2f990a823"",""instance_index"":0,""name"":""sinatra_env_test_app"",""uris"":[""sinatra_env_test_app.uhurucloud.net""],""users"":[""*****@*****.**""],""version"":""c394f661a907710b8a8bb70b84ff0c83354dbbed-1"",""start"":""2011-12-07 14:40:12 +0200"",""runtime"":""iis"",""state_timestamp"":1323261612,""port"":51202,""limits"":{""fds"":256,""mem"":67108864,""disk"":2147483648},""host"":""192.168.1.117""}"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_SERVICES", Value = @"{""mssql-2008"":[{""name"":""mssql-b24a2"",""label"":""mssql-2008"",""plan"":""free"",""tags"":[""mssql"",""2008"",""relational""],""credentials"":{""name"":""D4Tac4c307851cfe495bb829235cd384f094"",""username"":""US3RTfqu78UpPM5X"",""user"":""US3RTfqu78UpPM5X"",""password"":""P4SSdCGxh2gYjw54"",""hostname"":""192.168.1.3"",""port"":1433,""bind_opts"":{}}}]}"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_APP_HOST", Value = @"192.168.1.118"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_APP_PORT", Value = @"65498"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_WINDOWS_USER_PASSWORD", Value = password
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_WINDOWS_USER", Value = user
                },
                new ApplicationVariable()
                {
                    Name = "HOME", Value = TestUtil.CopyFolderToTemp(testAppLoc)
                }
            };

            Exception exception = null;

            //Act
            try
            {
                target.ConfigureApplication(appVariables);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            //Assert
            Assert.IsNull(exception, "Exception thrown");
        }
 public ActionResult Search(SearchViewModel view)
 {
     if (ModelState.IsValid)
     {
         SearchStatus rslt = qMgr.DiscountLookup(view);
         if (rslt == SearchStatus.NotFound)
         {
             ModelState.AddModelError("EmpId", ApplicationVariable.GetBrandConfig().SearchPage.NoResultFound.Value);
         }
     }
     return(View(view));
 }
Exemple #6
0
        private string LogException(Exception ex)
        {
            string result = string.Empty;

            var logLocation = ApplicationVariable.GetBrandConfig().CustomError.ErrorLogLocation.Value.Trim();

            #region Remove "/" OR "\" if we have
            if (logLocation.StartsWith("/") || logLocation.StartsWith("\\"))
            {
                logLocation = logLocation.Substring(1).Trim();
            }
            #endregion

            if (!string.IsNullOrEmpty(logLocation))
            {
                if (!Path.IsPathRooted(logLocation))
                {
                    logLocation = Server.MapPath(string.Format(@"\{0}", logLocation));
                }

                var fileName = string.Format("Error_{0}.txt", DateTime.Now.ToString("yyyy-MM-dd"));
                var filePath = Path.Combine(logLocation, fileName);

                try
                {
                    if (!Directory.Exists(logLocation))
                    {
                        Directory.CreateDirectory(logLocation);
                    }
                    using (FileStream fs = new FileStream(filePath, FileMode.Append, FileAccess.Write))
                        using (StreamWriter sw = new StreamWriter(fs))
                        {
                            sw.WriteLine("=======================================================");
                            sw.WriteLine(string.Format("Error Occured at - {0}", DateTime.Now));
                            sw.WriteLine("=======================================================");
                            sw.WriteLine(ex.Message);
                            sw.WriteLine(Environment.NewLine + "Details - ");
                            sw.WriteLine(ex.StackTrace);
                            sw.WriteLine("=======================================================");
                            sw.WriteLine(Environment.NewLine + Environment.NewLine + Environment.NewLine);
                        }
                }
                catch (Exception exc)
                {
                    result = exc.Message;
                }
            }

            return(result);
        }
        public void TC005_TestGetProcessId()
        {
            //Arrange
            IISPlugin target = new IISPlugin();

            Assert.AreEqual(0, target.GetApplicationProcessId());

            int port = Uhuru.Utilities.NetworkInterface.GrabEphemeralPort();

            ApplicationVariable[] appVariables = new ApplicationVariable[] {
                new ApplicationVariable()
                {
                    Name = "VCAP_PLUGIN_STAGING_INFO", Value = @"{""assembly"":""Uhuru.CloudFoundry.DEA.Plugins.dll"",""class_name"":""Uhuru.CloudFoundry.DEA.Plugins.IISPlugin"",""logs"":{""app_error"":""logs/stderr.log"",""dea_error"":""logs/err.log"",""startup"":""logs/startup.log"",""app"":""logs/stdout.log""},""auto_wire_templates"":{""mssql-2008"":""Data Source={host},{port};Initial Catalog={name};User Id={user};Password={password};MultipleActiveResultSets=true"",""mysql-5.1"":""server={host};port={port};Database={name};Uid={user};Pwd={password};""}}"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_APPLICATION", Value = @"{""instance_id"":""" + Guid.NewGuid().ToString() + @""",""instance_index"":0,""name"":""MyTestApp"",""uris"":[""sinatra_env_test_app.uhurucloud.net""],""users"":[""*****@*****.**""],""version"":""c394f661a907710b8a8bb70b84ff0c83354dbbed-1"",""start"":""2011-12-07 14:40:12 +0200"",""runtime"":""iis"",""state_timestamp"":1323261612,""port"":51202,""limits"":{""fds"":256,""mem"":67108864,""disk"":2147483648},""host"":""192.168.1.117""}"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_SERVICES", Value = @"{""mssql-2008"":[{""name"":""mssql-b24a2"",""label"":""mssql-2008"",""plan"":""free"",""tags"":[""mssql"",""2008"",""relational""],""credentials"":{""name"":""D4Tac4c307851cfe495bb829235cd384f094"",""username"":""US3RTfqu78UpPM5X"",""user"":""US3RTfqu78UpPM5X"",""password"":""P4SSdCGxh2gYjw54"",""hostname"":""192.168.1.3"",""port"":1433,""bind_opts"":{}}}]}"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_APP_HOST", Value = TestUtil.GetLocalIp()
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_APP_PORT", Value = port.ToString()
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_WINDOWS_USER_PASSWORD", Value = password
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_WINDOWS_USER", Value = user
                },
                new ApplicationVariable()
                {
                    Name = "HOME", Value = TestUtil.CopyFolderToTemp(testAppLoc)
                }
            };


            //Act
            target.ConfigureApplication(appVariables);

            Assert.AreEqual(0, target.GetApplicationProcessId());

            target.StartApplication();

            Assert.AreEqual(0, target.GetApplicationProcessId());

            //Assert
            WebClient client = new WebClient();
            string    html   = client.DownloadString("http://localhost:" + port.ToString());

            Assert.IsTrue(html.Contains("My ASP.NET Application"));

            Assert.AreNotEqual(0, target.GetApplicationProcessId());

            target.StopApplication();

            Assert.AreEqual(0, target.GetApplicationProcessId());

            try
            {
                html = client.DownloadString("http://localhost:" + port.ToString());
            }
            catch
            {
                return;
            }
            Assert.AreEqual(0, target.GetApplicationProcessId());
        }
        public void TC003_MultipleWebApps()
        {
            List <ApplicationVariable[]> appInfos = new List <ApplicationVariable[]>();
            List <IISPlugin>             plugins  = new List <IISPlugin>();
            List <Thread> threadsStart            = new List <Thread>();
            List <Thread> threadsStop             = new List <Thread>();

            for (int i = 0; i < 20; i++)
            {
                int port = Uhuru.Utilities.NetworkInterface.GrabEphemeralPort();
                ApplicationVariable[] appInfo = new ApplicationVariable[] {
                    new ApplicationVariable()
                    {
                        Name = "VCAP_PLUGIN_STAGING_INFO", Value = @"{""assembly"":""Uhuru.CloudFoundry.DEA.Plugins.dll"",""class_name"":""Uhuru.CloudFoundry.DEA.Plugins.IISPlugin"",""logs"":{""app_error"":""logs/stderr.log"",""dea_error"":""logs/err.log"",""startup"":""logs/startup.log"",""app"":""logs/stdout.log""},""auto_wire_templates"":{""mssql-2008"":""Data Source={host},{port};Initial Catalog={name};User Id={user};Password={password};MultipleActiveResultSets=true"",""mysql-5.1"":""server={host};port={port};Database={name};Uid={user};Pwd={password};""}}"
                    },
                    new ApplicationVariable()
                    {
                        Name = "VCAP_APPLICATION", Value = @"{""instance_id"":""" + Guid.NewGuid().ToString() + @""",""instance_index"":0,""name"":""MyTestApp"",""uris"":[""sinatra_env_test_app.uhurucloud.net""],""users"":[""*****@*****.**""],""version"":""c394f661a907710b8a8bb70b84ff0c83354dbbed-1"",""start"":""2011-12-07 14:40:12 +0200"",""runtime"":""iis"",""state_timestamp"":1323261612,""port"":51202,""limits"":{""fds"":256,""mem"":67108864,""disk"":2147483648},""host"":""192.168.1.117""}"
                    },
                    new ApplicationVariable()
                    {
                        Name = "VCAP_SERVICES", Value = @"{""mssql-2008"":[{""name"":""mssql-b24a2"",""label"":""mssql-2008"",""plan"":""free"",""tags"":[""mssql"",""2008"",""relational""],""credentials"":{""name"":""D4Tac4c307851cfe495bb829235cd384f094"",""username"":""US3RTfqu78UpPM5X"",""user"":""US3RTfqu78UpPM5X"",""password"":""P4SSdCGxh2gYjw54"",""hostname"":""192.168.1.3"",""port"":1433,""bind_opts"":{}}}]}"
                    },
                    new ApplicationVariable()
                    {
                        Name = "VCAP_APP_HOST", Value = TestUtil.GetLocalIp()
                    },
                    new ApplicationVariable()
                    {
                        Name = "VCAP_APP_PORT", Value = port.ToString()
                    },
                    new ApplicationVariable()
                    {
                        Name = "VCAP_WINDOWS_USER_PASSWORD", Value = password
                    },
                    new ApplicationVariable()
                    {
                        Name = "VCAP_WINDOWS_USER", Value = user
                    },
                    new ApplicationVariable()
                    {
                        Name = "HOME", Value = TestUtil.CopyFolderToTemp(testAppLoc)
                    }
                };

                appInfos.Add(appInfo);
                plugins.Add(new IISPlugin());
            }


            for (int i = 0; i < 20; i++)
            {
                threadsStart.Add(new Thread(new ParameterizedThreadStart(delegate(object data)
                {
                    try
                    {
                        IISPlugin target = plugins[(int)data];

                        target.ConfigureApplication(appInfos[(int)data]);
                        target.StartApplication();
                    }
                    catch (Exception ex)
                    {
                        Logger.Fatal(ex.ToString());
                    }
                })));
            }

            for (int i = 0; i < threadsStart.Count; i++)
            {
                Thread thread = threadsStart[i];
                thread.Start(i);
            }

            foreach (Thread thread in threadsStart)
            {
                thread.Join();
            }


            foreach (ApplicationVariable[] appInfo in appInfos)
            {
                WebClient client = new WebClient();
                string    html   = client.DownloadString("http://localhost:" + appInfo.First(v => v.Name == "VCAP_APP_PORT").Value);
                Assert.IsTrue(html.Contains("My ASP.NET Application"));
            }


            for (int i = 0; i < 20; i++)
            {
                threadsStop.Add(new Thread(new ParameterizedThreadStart(delegate(object data)
                {
                    try
                    {
                        IISPlugin target = plugins[(int)data];
                        target.StopApplication();
                    }
                    catch (Exception ex)
                    {
                        Logger.Fatal(ex.ToString());
                    }
                })));
            }


            for (int i = 0; i < threadsStop.Count; i++)
            {
                Thread thread = threadsStop[i];
                thread.Start(i);
            }

            foreach (Thread thread in threadsStop)
            {
                thread.Join();
            }

            foreach (ApplicationVariable[] appInfo in appInfos)
            {
                try
                {
                    WebClient client = new WebClient();
                    string    html   = client.DownloadString("http://localhost:" + appInfo.First(v => v.Name == "VCAP_APP_PORT").Value);
                    Assert.Fail();
                }
                catch
                {
                }
            }
        }
        /// <summary>
        /// Autowires the service connections and ASP.NET health monitoring in the application's web.config
        /// </summary>
        /// <param name="appInfo">The application info structure.</param>
        /// <param name="variables">All application variables.</param>
        /// <param name="services">The services.</param>
        /// <param name="logFilePath">The ASP.NET "Heartbeat" and "Lifetime Events" log file path.</param>
        /// <param name="errorLogFilePath">The ASP.NET "All Errors" events log file path.</param>
        private void AutowireApp(ApplicationInfo appInfo, ApplicationVariable[] variables, ApplicationService[] services, string logFilePath, string errorLogFilePath)
        {
            this.startupLogger.Info(Strings.StartingApplicationAutoWiring);

            List <ApplicationVariable> varList             = variables.ToList <ApplicationVariable>();
            ApplicationVariable        applicationVariable = new ApplicationVariable();

            applicationVariable.Name  = "TUNNEL_NET_TCP_PORT";
            applicationVariable.Value = NetworkInterface.GrabEphemeralPort().ToString(CultureInfo.InvariantCulture);
            varList.Add(applicationVariable);
            variables = varList.ToArray();

            // get all config files
            string[] allConfigFiles = Directory.GetFiles(appInfo.Path, "*.config", SearchOption.AllDirectories);

            foreach (string configFile in allConfigFiles)
            {
                if (File.Exists(configFile))
                {
                    string configFileContents = File.ReadAllText(configFile);

                    if (services != null)
                    {
                        Dictionary <string, string> connections = new Dictionary <string, string>();
                        Dictionary <string, string> connValues  = new Dictionary <string, string>();

                        foreach (ApplicationService service in services)
                        {
                            string key      = service.ServiceLabel;
                            string template = string.Empty;

                            if (this.autoWireTemplates.TryGetValue(key, out template))
                            {
                                template = template.Replace(Strings.Host, service.Host);
                                template = template.Replace(Strings.Port, service.Port.ToString(CultureInfo.InvariantCulture));
                                template = template.Replace(Strings.Name, service.InstanceName);
                                template = template.Replace(Strings.User, service.User);
                                template = template.Replace(Strings.Password, service.Password);

                                connections[string.Format(CultureInfo.InvariantCulture, "{{{0}#{1}}}", key, service.Name)] = template;
                            }

                            char[] charsToTrim = { '{', '}' };
                            connValues.Add(string.Format(CultureInfo.InvariantCulture, "{{{0}#{1}}}", service.Name, Strings.User.Trim(charsToTrim)), service.User);
                            connValues.Add(string.Format(CultureInfo.InvariantCulture, "{{{0}#{1}}}", service.Name, Strings.Host.Trim(charsToTrim)), service.Host);
                            connValues.Add(string.Format(CultureInfo.InvariantCulture, "{{{0}#{1}}}", service.Name, Strings.Port.Trim(charsToTrim)), service.Port.ToString(CultureInfo.InvariantCulture));
                            connValues.Add(string.Format(CultureInfo.InvariantCulture, "{{{0}#{1}}}", service.Name, Strings.Password.Trim(charsToTrim)), service.Password);
                            connValues.Add(string.Format(CultureInfo.InvariantCulture, "{{{0}#{1}}}", service.Name, Strings.Name.Trim(charsToTrim)), service.InstanceName);
                        }

                        foreach (string con in connections.Keys)
                        {
                            this.startupLogger.Info(Strings.ConfiguringService + con);
                            configFileContents = configFileContents.Replace(con, connections[con]);
                        }

                        foreach (string key in connValues.Keys)
                        {
                            this.startupLogger.Info(string.Format(CultureInfo.InvariantCulture, Strings.ConfiguringServiceValue, key));
                            configFileContents = configFileContents.Replace(key, connValues[key]);
                        }
                    }

                    File.WriteAllText(configFile, configFileContents);
                }
            }

            string webConfigFile = Path.Combine(appInfo.Path, "web.config");

            if (File.Exists(webConfigFile))
            {
                this.SetApplicationVariables(webConfigFile, variables, logFilePath, errorLogFilePath);

                this.startupLogger.Info(Strings.SavedConfigurationFile);

                this.startupLogger.Info(Strings.SettingUpLogging);

                string appDir                  = Path.GetDirectoryName(webConfigFile);
                string binDir                  = Path.Combine(appDir, "bin");
                string assemblyFile            = typeof(LogFileWebEventProvider).Assembly.Location;
                string destinationAssemblyFile = Path.Combine(binDir, Path.GetFileName(assemblyFile));

                Directory.CreateDirectory(binDir);

                File.Copy(assemblyFile, destinationAssemblyFile, true);

                this.startupLogger.Info(Strings.CopiedLoggingBinariesToBin);

                SiteConfig      siteConfiguration = new SiteConfig(appDir, true);
                HealthMonRewire healthMon         = new HealthMonRewire();
                healthMon.Register(siteConfiguration);

                siteConfiguration.Rewire(false);
                siteConfiguration.CommitChanges();

                this.startupLogger.Info(Strings.UpdatedLoggingConfiguration);

                DirectoryInfo errorLogDir = new DirectoryInfo(Path.GetDirectoryName(errorLogFilePath));
                DirectoryInfo logDir      = new DirectoryInfo(Path.GetDirectoryName(logFilePath));

                DirectorySecurity errorLogDirSecurity = errorLogDir.GetAccessControl();
                DirectorySecurity logDirSecurity      = logDir.GetAccessControl();

                errorLogDirSecurity.SetAccessRule(
                    new FileSystemAccessRule(
                        appInfo.WindowsUserName,
                        FileSystemRights.Write | FileSystemRights.Read | FileSystemRights.Delete | FileSystemRights.Modify | FileSystemRights.CreateFiles,
                        InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
                        PropagationFlags.None,
                        AccessControlType.Allow));

                logDirSecurity.SetAccessRule(
                    new FileSystemAccessRule(
                        appInfo.WindowsUserName,
                        FileSystemRights.Write | FileSystemRights.Read | FileSystemRights.Delete | FileSystemRights.Modify | FileSystemRights.CreateFiles,
                        InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
                        PropagationFlags.None,
                        AccessControlType.Allow));

                errorLogDir.SetAccessControl(errorLogDirSecurity);
                logDir.SetAccessControl(logDirSecurity);
            }
        }
        public void GetParsedDataTest()
        {
            ApplicationVariable[] appVariables = new ApplicationVariable[] {
                new ApplicationVariable()
                {
                    Name = "VCAP_PLUGIN_STAGING_INFO", Value = @"{""assembly"":""Uhuru.CloudFoundry.DEA.Plugins.dll"",""class_name"":""Uhuru.CloudFoundry.DEA.Plugins.IISPlugin"",""logs"":{""app_error"":""logs/stderr.log"",""dea_error"":""logs/err.log"",""startup"":""logs/startup.log"",""app"":""logs/stdout.log""},""auto_wire_templates"":{""mssql-2008"":""Data Source={host},{port};Initial Catalog={name};User Id={user};Password={password};MultipleActiveResultSets=true"",""mysql-5.1"":""server={host};port={port};Database={name};Uid={user};Pwd={password};""}}"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_APPLICATION", Value = @"{""instance_id"":""646c477f54386d8afb279ec2f990a823"",""instance_index"":0,""name"":""sinatra_env_test_app"",""uris"":[""sinatra_env_test_app.uhurucloud.net""],""users"":[""*****@*****.**""],""version"":""c394f661a907710b8a8bb70b84ff0c83354dbbed-1"",""start"":""2011-12-07 14:40:12 +0200"",""runtime"":""iis"",""state_timestamp"":1323261612,""port"":51202,""limits"":{""fds"":256,""mem"":67108864,""disk"":2147483648},""host"":""192.168.1.117""}"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_SERVICES", Value = @"{""mssql-2008"":[{""name"":""mssql-b24a2"",""label"":""mssql-2008"",""plan"":""free"",""tags"":[""mssql"",""2008"",""relational""],""credentials"":{""name"":""D4Tac4c307851cfe495bb829235cd384f094"",""username"":""US3RTfqu78UpPM5X"",""user"":""US3RTfqu78UpPM5X"",""password"":""P4SSdCGxh2gYjw54"",""hostname"":""192.168.1.3"",""port"":1433,""bind_opts"":{}}}]}"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_APP_HOST", Value = @"192.168.1.118"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_APP_PORT", Value = @"65498"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_WINDOWS_USER_PASSWORD", Value = @"password"
                },
                new ApplicationVariable()
                {
                    Name = "VCAP_WINDOWS_USER", Value = @"cfuser"
                },
                new ApplicationVariable()
                {
                    Name = "HOME", Value = @"c:\droplets\mydroplet"
                }
            };
            ApplicationParsedData actual;

            actual = PluginHelper.GetParsedData(appVariables);
            Assert.AreEqual("646c477f54386d8afb279ec2f990a823", actual.AppInfo.InstanceId);
            Assert.AreEqual("192.168.1.118", actual.AppInfo.LocalIP);
            Assert.AreEqual("sinatra_env_test_app", actual.AppInfo.Name);
            Assert.AreEqual(@"c:\droplets\mydroplet\app", actual.AppInfo.Path);
            Assert.AreEqual(65498, actual.AppInfo.Port);
            Assert.AreEqual("cfuser", actual.AppInfo.WindowsUserName);
            Assert.AreEqual("password", actual.AppInfo.WindowsPassword);
            Assert.AreEqual(2, actual.AutoWireTemplates.Count);
            Assert.AreEqual(@"c:\droplets\mydroplet\logs/stderr.log", actual.ErrorLogFilePath);
            Assert.AreEqual(@"c:\droplets\mydroplet\logs/stdout.log", actual.LogFilePath);
            Assert.AreEqual("iis", actual.Runtime);
            Assert.AreEqual("192.168.1.3", actual.GetServices()[0].Host);
            Assert.AreEqual("D4Tac4c307851cfe495bb829235cd384f094", actual.GetServices()[0].InstanceName);
            Assert.AreEqual("mssql-b24a2", actual.GetServices()[0].Name);
            Assert.AreEqual("P4SSdCGxh2gYjw54", actual.GetServices()[0].Password);
            Assert.AreEqual("free", actual.GetServices()[0].Plan);
            Assert.AreEqual(1433, actual.GetServices()[0].Port);
            Assert.AreEqual("mssql-2008", actual.GetServices()[0].ServiceLabel);
            Assert.AreEqual(3, actual.GetServices()[0].GetServiceTags().Length);
            Assert.AreEqual("US3RTfqu78UpPM5X", actual.GetServices()[0].User);
            Assert.AreEqual(@"c:\droplets\mydroplet\logs/startup.log", actual.StartupLogFilePath);
        }