public void Test_GearRegistry()
 {
     bool testresult = true;
     try
     {
         GearRegistry reg = new GearRegistry(TestHelper.CreateAppContainer());
         Dictionary<string, object> entryops = new Dictionary<string, object>();
         entryops["type"] = "testType";
         entryops["uuid"] = "test";
         entryops["namespace"] = "testnamespace";
         entryops["dns"] = "127.0.0.1";
         entryops["proxy_hostname"] = "broker.test.com";
         entryops["proxy_port"] = "65555";
         reg.Add(entryops); //Test fails in GearRegistry.cs line 116 ->it tries to access the gearRegistry key although the count is 0
         if (reg.Entries.Count > 0)
         {   
             reg.Clear();
         }                
     }
     catch
     {
         testresult = false;
     }
     Assert.AreEqual(true, testresult);
 }
        private RubyHash ActivateRemoteGear(GearRegistry.Entry gear, Dictionary<string, string> gearEnv, RubyHash options)
        {
            string gearUuid = gear.Uuid;

            RubyHash result = new RubyHash();
            result["status"] = RESULT_FAILURE;
            result["gear_uuid"] = this.Uuid;
            result["deployment_id"] = options["deployment_id"];
            result["messages"] = new List<string>();
            result["errors"] = new List<string>();

            string postInstallOptions = options["post_install"] == true ? "--post-install" : "";

            result["messages"].Add(string.Format("Activating gear {0}, deployment id: {1}, {2}", gearUuid, options["deployment_id"], postInstallOptions));
            try
            {
                string ooSSH = @"/cygpath/c/openshift/oo-bin/oo-ssh";
                string bashBinary = Path.Combine(NodeConfig.Values["SSHD_BASE_DIR"], "bin\bash.exe");

                string sshCommand = string.Format("{0} {1} gear activate {2} --as-json {3} --no-rotation",
                    ooSSH, gear.ToSshUrl(), options["deployment_id"], postInstallOptions);

                string bashArgs = string.Format("--norc --login -c '{0}'", sshCommand);

                string command = string.Format("{0} {1}", bashBinary, bashArgs);

                string output = RunProcessInContainerContext(this.ContainerDir, command).StdOut;

                if (string.IsNullOrEmpty(output))
                {
                    throw new Exception("No result JSON was received from the remote activate call");
                }
                Dictionary<string, object> activateResult = JsonConvert.DeserializeObject<Dictionary<string, object>>(output);
                if (!activateResult.ContainsKey("status"))
                {
                    throw new Exception("Invalid result JSON received from remote activate call");
                }

                result["messages"].Add(activateResult["messages"]);
                result["errors"].Add(activateResult["errors"]);
                result["status"] = activateResult["status"];
            }
            catch (Exception e)
            {
                result["errors"].Add("Gear activation failed: " + e.ToString());                
            }

            return result;
        }