// [Timeout(60000)] public void SendActionToRemoteGrid() { // Arrange ActPlugIn actPlugin = new ActPlugIn() { ServiceId = "DummyService", ActionId = "A1" }; //Act GingerNodeProxy.RemoteGridIP = RemoteGridIP; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GingerNodeProxy.RemoteGridPort = RemoteGridPort; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GingerNodeInfo gingerNodeInfo = new GingerNodeInfo() { }; GingerNodeProxy gingerNodeProxy = new GingerNodeProxy(gingerNodeInfo, true); NewPayLoad actionPayLoad = ExecuteOnPlugin.CreateActionPayload(actPlugin); NewPayLoad actionResult = gingerNodeProxy.RunAction(actionPayLoad); ExecuteOnPlugin.ParseActionResult(actionResult, actPlugin); //Assert Assert.AreEqual(RemoteGingerGrid.NodeList.Count, 2); Assert.AreEqual("A1 Result", actPlugin.ExInfo); }
private void RunAction(ActPlugIn a1, GingerNodeProxy gNP1) { NewPayLoad a1Payload = ExecuteOnPlugin.CreateActionPayload(a1); NewPayLoad rc = gNP1.RunAction(a1Payload); ExecuteOnPlugin.ParseActionResult(rc, a1); }
private void ShowUIGrid() { BuildUIGrid(); int row = 0; int col = 0; foreach (GingerNodeInfo GNI in mGingerGrid.NodeList) { GingerNodeProxy GNA = mGingerGrid.CreateGingerNodeAgent(GNI); GingerGridNodePage p = new GingerGridNodePage(GNA); // Connect to LiveView Channel - this is not via Run act Frame f = new Frame(); f.Content = p; GingersGrid.Children.Add(f); Grid.SetRow(f, row); Grid.SetColumn(f, col); col++; if (col > GingersGrid.ColumnDefinitions.Count) { col = 0; row++; } } }
public void Close() { try { if (AgentType == eAgentType.Service) { if (mGingerNodeInfo != null) { // this is plugin driver GingerNodeProxy GNP = new GingerNodeProxy(mGingerNodeInfo); GNP.GingerGrid = WorkSpace.Instance.LocalGingerGrid; GNP.CloseDriver(); if (mProcess != null) { // mProcess.Kill(); //mProcess.Close(); //GingerCore.General.DoEvents(); mProcess.CloseMainWindow(); } mGingerNodeInfo = null; // GNP.Shutdown(); return; } } if (Driver == null) { return; } Driver.IsDriverRunning = false; if (Driver.Dispatcher != null) { Driver.Dispatcher.Invoke(() => { Driver.CloseDriver(); Thread.Sleep(1000); }); } else { Driver.CloseDriver(); } if (MSTATask != null) { // Using Cancelleation token soucrce to cancel CancelTask = new BackgroundWorker(); CancelTask.DoWork += new DoWorkEventHandler(CancelTMSTATask); CancelTask.RunWorkerAsync(); } Driver = null; } finally { OnPropertyChanged(Fields.Status); OnPropertyChanged(Fields.IsWindowExplorerSupportReady); } }
public void Execute(string PluginId, string ServiceId, NewPayLoad payLoad) { GingerGrid gingerGrid = WorkSpace.Instance.LocalGingerGrid; // string PID = GA.InputParams["PluginID"].GetValueAsString(); PluginPackage p = (from x in mPluginPackages where x.PluginID == PluginId select x).SingleOrDefault(); if (p == null) { throw new Exception("Plugin id not found: " + PluginId); // GA.AddError("Execute", "Plugin id not found: " + PID); // return; } //TODO: use nameof after ActPlugin move to common // string serviceID = GA.InputParams["PluginActionID"].GetValueAsString(); GingerNodeInfo GNI = (from x in gingerGrid.NodeList where x.Name == p.PluginID select x).FirstOrDefault(); //run script only if service is not up if (GNI == null) { string script = CommandProcessor.CreateLoadPluginScript(p.Folder); // hard coded!!!!!!!!!! - use ServiceId script += CommandProcessor.CreateStartServiceScript("PACTService", p.PluginID, SocketHelper.GetLocalHostIP(), gingerGrid.Port); // script += CommandProcessor.CreateStartServiceScript("ExcelService", p.PluginID, SocketHelper.GetLocalHostIP(), gingerGrid.Port); Task t = new Task(() => { // GingerConsoleHelper.Execute(script); // keep it for regular service dll load string StarterDLL = Path.Combine(p.Folder, "GingerPACTPluginConsole.dll"); StartService(StarterDLL); }); t.Start(); } int counter = 0; while (GNI == null && counter < 30) { Thread.Sleep(1000); GNI = (from x in gingerGrid.NodeList where x.Name == "PACT" select x).FirstOrDefault(); counter++; } if (GNI == null) { // GA.AddError("Execute", "Cannot execute action beacuse Service was not found or was not abale to start: " + p.PluginID); } GingerNodeProxy GNA = new GingerNodeProxy(GNI); GNA.Reserve(); GNA.GingerGrid = gingerGrid; //GNA.RunAction(GA); }
public static void ClassCleanup() { foreach (GingerNodeInfo GNI in WorkSpace.Instance.LocalGingerGrid.NodeList) { GingerNodeProxy proxy = new GingerNodeProxy(GNI); // proxy.Shutdown(); } }
private void PingButton_Click(object sender, RoutedEventArgs e) { //TODO: make me work to ping each node foreach (GingerNodeInfo GNI in mGingerGrid.NodeList) { GingerNodeProxy GNA = new GingerNodeProxy(GNI); GNA.Reserve(); string rc = GNA.Ping(); GNI.Ping = rc; GNA.Disconnect(); } }
// TODO: move to ExecuteOnPlugin public void StartPluginService() { try { // Enable to start one plugin each time so will let the plugin reserve and avoid race cond mutex.WaitOne(); gingerNodeInfo = FindFreeNode(ServiceId); // Service not found start new one // Add plugin config start if not exist and more depends on the config if (gingerNodeInfo == null) { // Dup with GR consolidate with timeout mProcess = WorkSpace.Instance.PlugInsManager.StartService(PluginId, ServiceId); } Stopwatch st = Stopwatch.StartNew(); while (gingerNodeInfo == null && st.ElapsedMilliseconds < 30000) // max 30 seconds to wait { gingerNodeInfo = FindFreeNode(ServiceId); if (gingerNodeInfo != null) { break; } Thread.Sleep(100); } if (gingerNodeInfo == null) { throw new Exception("Plugin not started " + PluginId); } gingerNodeInfo.Status = GingerNodeInfo.eStatus.Reserved; // TODO: add by which agent to GNI // Keep GNP on agent GingerNodeProxy = WorkSpace.Instance.LocalGingerGrid.GetNodeProxy(gingerNodeInfo); //TODO: Ginger Grid CHeck if required GingerNodeProxy.GingerGrid = WorkSpace.Instance.LocalGingerGrid; GingerNodeProxy.StartDriver(DriverConfiguration); } catch (Exception ex) { throw ex; } finally { mutex.ReleaseMutex(); } }
private void xPingButton_Click(object sender, RoutedEventArgs e) { foreach (GingerNodeInfo GNI in mGingerGrid.NodeList) { GingerNodeProxy GNA = new GingerNodeProxy(GNI); GNA.GingerGrid = WorkSpace.Instance.LocalGingerGrid; GNA.Reserve(); string rc = GNA.Ping(); GNI.Ping = rc; GNA.Disconnect(); } ShowProcesses(); }
public void Execute(GingerAction GA) { GingerGrid gingerGrid = WorkSpace.Instance.LocalGingerGrid; string PID = GA.InputParams["PluginID"].GetValueAsString(); PluginPackage p = (from x in mPluginPackages where x.PluginID == PID select x).SingleOrDefault(); if (p == null) { GA.AddError("Execute", "Plugin id not found: " + PID); return; } //TODO: use nameof after ActPlugin move to common string serviceID = GA.InputParams["PluginActionID"].GetValueAsString(); GingerNodeInfo GNI = (from x in gingerGrid.NodeList where x.Name == p.PluginID select x).FirstOrDefault(); //run script only if service is not up if (GNI == null) { string script = CommandProcessor.CreateLoadPluginScript(p.Folder); // hard coded!!!!!!!!!! script += CommandProcessor.CreateStartServiceScript("ExcelService", p.PluginID, SocketHelper.GetLocalHostIP(), gingerGrid.Port); Task t = new Task(() => { GingerConsoleHelper.Execute(script); }); t.Start(); } int counter = 0; while (GNI == null && counter < 30) { Thread.Sleep(1000); GNI = (from x in gingerGrid.NodeList where x.Name == p.PluginID select x).FirstOrDefault(); counter++; } GingerNodeProxy GNA = new GingerNodeProxy(GNI); GNA.Reserve(); GNA.GingerGrid = gingerGrid; GNA.RunAction(GA); }
public void StartDriver() { WorkSpace.Instance.Telemetry.Add("startagent", new { AgentType = AgentType.ToString(), DriverType = DriverType.ToString() }); if (AgentType == eAgentType.Service) { StartPluginService(); GingerNodeProxy.StartDriver(); OnPropertyChanged(Fields.Status); } else { RepositoryItemHelper.RepositoryItemFactory.StartAgentDriver(this); } }
public static void ExecuteActionOnRemotePlugin(ActPlugIn actPlugin) { NewPayLoad p = CreateActionPayload(actPlugin); string serviceID = actPlugin.ServiceId; RemoteServiceGrid remoteServiceGrid = FindRemoteGrid(actPlugin.ServiceId); // Temp !!!!!!!!!!!!!!!!! change to get GingerNodePorxy for Remote grid GingerNodeInfo gingerNodeInfo = new GingerNodeInfo(); GingerNodeProxy gingerNodeProxy = new GingerNodeProxy(gingerNodeInfo, true); NewPayLoad RC = gingerNodeProxy.RunAction(p); }
private void TestPlugin() { Stopwatch st = Stopwatch.StartNew(); for (int i = 0; i < 1000; i++) { GingerNodeProxy GNP = new GingerNodeProxy(WorkSpace.Instance.LocalGingerGrid.NodeList[0]); GNP.GingerGrid = WorkSpace.Instance.LocalGingerGrid; NewPayLoad pl = GetPL(); GNP.RunAction(pl); } st.Stop(); Console.WriteLine("Elapsed: " + (long)st.ElapsedMilliseconds); Console.WriteLine("AVG: " + (long)st.ElapsedMilliseconds / 1000); }
private void ShowSocketMonitor() { if (mGingerGrid == null) { return; } //Check all nodes and create new Monitor if not exist foreach (GingerNodeInfo gingerNodeInfo in mGingerGrid.NodeList) { GingerNodeProxy gingerNodeProxy = mGingerGrid.GetNodeProxy(gingerNodeInfo); if (gingerNodeProxy.Monitor == null) { gingerNodeProxy.Monitor = new GingerSocketMonitorWindow(gingerNodeProxy); gingerNodeProxy.StartRecordingSocketTraffic(); } } }
public void StartPluginService() { /// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< MyDriver // Find the first service which match mGingerNodeInfo = (from x in WorkSpace.Instance.LocalGingerGrid.NodeList where x.ServiceId == "SeleniumChromeDriver" select x).FirstOrDefault(); // Keep First!!! // Service not found start new one // Add plugin config start if not exist and more depeneds on the config if (mGingerNodeInfo == null) { // Dup with GR consolidate with timeout mProcess = WorkSpace.Instance.PlugInsManager.StartService(PluginId, "SeleniumChromeDriver"); // TEMP!!!!!!!!!!!!!!!!!!!!!! } Stopwatch st = Stopwatch.StartNew(); while (mGingerNodeInfo == null && st.ElapsedMilliseconds < 30000) // max 30 seconds to wait { //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> mGingerNodeInfo = (from x in WorkSpace.Instance.LocalGingerGrid.NodeList where x.ServiceId == "SeleniumChromeDriver" select x).FirstOrDefault(); // Keep First!!! if (mGingerNodeInfo != null) { break; } Thread.Sleep(100); } if (mGingerNodeInfo == null) { throw new Exception("Plugin not started " + PluginId); } mGingerNodeInfo.Status = GingerNodeInfo.eStatus.Reserved; // TODO: add by which agent to GNI // Keep GNP on agent GingerNodeProxy GNP = new GingerNodeProxy(mGingerNodeInfo); GNP.GingerGrid = WorkSpace.Instance.LocalGingerGrid; GNP.StartDriver(); }
// Use for Actions which run without agent and are of the generic type ActPlugin - public static void ExecuteActionOnPlugin(ActPlugIn actPlugin, GingerNodeInfo gingerNodeInfo) { try { // first verify we have service ready or start service Stopwatch st = Stopwatch.StartNew(); GingerNodeProxy gingerNodeProxy = WorkSpace.Instance.LocalGingerGrid.GetNodeProxy(gingerNodeInfo); // FIXME for remote grid //!!!!!!!!!!!!! TODO: check if null set err NewPayLoad p = CreateActionPayload(actPlugin); NewPayLoad RC = gingerNodeProxy.RunAction(p); // release the node as soon as the result came in bool IsSessionService = WorkSpace.Instance.PlugInsManager.IsSessionService(actPlugin.PluginId, gingerNodeInfo.ServiceId); if (!IsSessionService) { // standalone plugin action release the node gingerNodeInfo.Status = GingerNodeInfo.eStatus.Ready; } ParseActionResult(RC, actPlugin); gingerNodeInfo.IncreaseActionCount(); st.Stop(); long millis = st.ElapsedMilliseconds; actPlugin.ExInfo += "Elapsed: " + millis + "ms"; } catch (Exception ex) { Console.WriteLine(ex.Message); string errorMessage = ""; if (gingerNodeInfo == null) { errorMessage += "Cannot find GingerNodeInfo in service grid for: " + ((ActPlugIn)actPlugin).PluginId + ", Service " + ((ActPlugIn)actPlugin).ServiceId + Environment.NewLine; } errorMessage += "Error while executing Plugin Service action " + Environment.NewLine; errorMessage += ex.Message; actPlugin.Error = errorMessage; } }
public void SendActionToRemoteGridOnProcess() { // TODO: start the service batch + plugin to connect, for now we use manual bat file for testing // Arrange ActPlugIn actPlugin = new ActPlugIn() { ServiceId = "DummyService", ActionId = "Sum" }; actPlugin.GetOrCreateInputParam("a").Value = "4"; actPlugin.GetOrCreateInputParam("a").ParamType = typeof(int); actPlugin.GetOrCreateInputParam("b").Value = "3"; actPlugin.GetOrCreateInputParam("b").ParamType = typeof(int); //Act GingerNodeProxy.RemoteGridIP = RemoteGridIP; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GingerNodeProxy.RemoteGridPort = 15555; // RemoteGridPort; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! GingerNodeInfo gingerNodeInfo = new GingerNodeInfo() { }; GingerNodeProxy gingerNodeProxy = new GingerNodeProxy(gingerNodeInfo, true); NewPayLoad actionPayLoad = ExecuteOnPlugin.CreateActionPayload(actPlugin); for (int i = 0; i < 1000; i++) { NewPayLoad actionResult = gingerNodeProxy.RunAction(actionPayLoad); ExecuteOnPlugin.ParseActionResult(actionResult, actPlugin); } //Assert Assert.AreEqual(RemoteGingerGrid.NodeList.Count, 2); // Assert.AreEqual("A1 Result", actPlugin.ExInfo); }
public void Close() { try { if (Agent.AgentType == Agent.eAgentType.Service) { if (gingerNodeInfo != null) { // this is plugin driver on local machine GingerNodeProxy.GingerGrid = WorkSpace.Instance.LocalGingerGrid; GingerNodeProxy.CloseDriver(); gingerNodeInfo.Status = GingerNodeInfo.eStatus.Ready; if (mProcess != null) // it means a new plugin process was started for this agent - so we close it { // Remove the node from the grid WorkSpace.Instance.LocalGingerGrid.NodeList.Remove(gingerNodeInfo); // Close the plugin process mProcess.CloseMainWindow(); } GingerNodeProxy = null; gingerNodeInfo = null; return; } else { if (GingerNodeProxy != null) { // Running on Remote Grid GingerNodeProxy.CloseDriver(); GingerNodeProxy.Disconnect(); GingerNodeProxy = null; } } } if (Driver == null) { return; } Driver.IsDriverRunning = false; if (Driver is IDriverWindow && ((IDriverWindow)Driver).ShowWindow) { DriversWindowUtils.OnDriverWindowEvent(DriverWindowEventArgs.eEventType.CloseDriverWindow, Driver, this); Driver.CloseDriver(); } else if (Driver.Dispatcher != null) { Driver.Dispatcher.Invoke(() => { Driver.CloseDriver(); Thread.Sleep(1000); }); } else { Driver.CloseDriver(); } if (MSTATask != null) { // Using cancellation token source to cancel CancelTask = new BackgroundWorker(); CancelTask.DoWork += new DoWorkEventHandler(Agent.CancelTMSTATask); CancelTask.RunWorkerAsync(); } Driver = null; } finally { Agent.OnPropertyChanged(nameof(AgentOperations.Status)); Agent.OnPropertyChanged(nameof(AgentOperations.IsWindowExplorerSupportReady)); } }
// TODO: move to ExecuteOnPlugin public void StartPluginService() { try { // Enable to start one plugin each time so will let the plugin reserve and avoid race condition // TODO: consider using lock mutex.WaitOne(); // First we try on local Ginger Grid gingerNodeInfo = FindFreeNode(Agent.ServiceId); if (gingerNodeInfo == null) { // Try to find service on Remote Grid ObservableList <RemoteServiceGrid> remoteServiceGrids = WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <RemoteServiceGrid>(); GingerNodeProxy = GingerNodeProxy.FindRemoteNode(Agent.ServiceId, remoteServiceGrids); if (GingerNodeProxy != null) { // We found the service on remote grid return; } } // Service not found start new one on local // Add plugin config start if not exist and more depends on the config if (gingerNodeInfo == null) { // Dup with GR consolidate with timeout mProcess = WorkSpace.Instance.PlugInsManager.StartService(Agent.PluginId, Agent.ServiceId); } Stopwatch st = Stopwatch.StartNew(); while (gingerNodeInfo == null && st.ElapsedMilliseconds < 30000) // max 30 seconds to wait { gingerNodeInfo = FindFreeNode(Agent.ServiceId); if (gingerNodeInfo != null) { break; } Thread.Sleep(100); } if (gingerNodeInfo == null) { throw new Exception("Plugin not started " + Agent.PluginId); } gingerNodeInfo.Status = GingerNodeInfo.eStatus.Reserved; // TODO: add by which agent to GNI // Keep GNP on agent GingerNodeProxy = WorkSpace.Instance.LocalGingerGrid.GetNodeProxy(gingerNodeInfo); //TODO: Ginger Grid CHeck if required GingerNodeProxy.GingerGrid = WorkSpace.Instance.LocalGingerGrid; GingerNodeProxy.StartDriver(Agent.DriverConfiguration); } catch (Exception ex) { throw ex; } finally { mutex.ReleaseMutex(); } }
public void StartDriver() { WorkSpace.Instance.Telemetry.Add("startagent", new { AgentType = Agent.AgentType.ToString(), DriverType = Agent.DriverType.ToString() }); if (Agent.AgentType == Agent.eAgentType.Service) { StartPluginService(); GingerNodeProxy.StartDriver(); Agent.OnPropertyChanged(nameof(Agent.Status)); } else { try { Agent.mIsStarting = true; Agent.OnPropertyChanged(nameof(Agent.Status)); try { if (Agent.Remote) { throw new Exception("Remote is Obsolete, use GingerGrid"); } else { Driver = (DriverBase)TargetFrameworkHelper.Helper.GetDriverObject(Agent); } } catch (Exception e) { Reporter.ToLog(eLogLevel.ERROR, "Failed to set Agent Driver", e); return; } if (Agent.AgentType == Agent.eAgentType.Service) { throw new Exception("Error - Agent type is service and trying to launch from Ginger.exe"); // we should never get here with service } else { Driver.InitDriver(Agent); Driver.BusinessFlow = Agent.BusinessFlow; SetDriverConfiguration(); IVirtualDriver VirtualDriver = null; if (Driver is IVirtualDriver VD) { VirtualDriver = VD; string ErrorMessage; if (!VirtualDriver.CanStartAnotherInstance(out ErrorMessage)) { throw new NotSupportedException(ErrorMessage); } } //if STA we need to start it on seperate thread, so UI/Window can be refreshed: Like IB, Mobile, Unix if (Driver is IDriverWindow && ((IDriverWindow)Driver).ShowWindow) { DriversWindowUtils.OnDriverWindowEvent(DriverWindowEventArgs.eEventType.ShowDriverWindow, Driver, this); Driver.StartDriver(); } else if (Driver.IsSTAThread()) { CTS = new CancellationTokenSource(); MSTATask = new Task(() => { Driver.StartDriver(); } , CTS.Token, TaskCreationOptions.LongRunning); MSTATask.Start(); } else { Driver.StartDriver(); } if (VirtualDriver != null) { VirtualDriver.DriverStarted(Agent.Guid.ToString()); } } } finally { if (Agent.AgentType == Agent.eAgentType.Service) { Agent.mIsStarting = false; } else { if (Driver != null) { // Give the driver time to start Thread.Sleep(500); Driver.IsDriverRunning = true; Driver.DriverMessageEvent += driverMessageEventHandler; } Agent.mIsStarting = false; Agent.OnPropertyChanged(nameof(Agent.Status)); Agent.OnPropertyChanged(nameof(IsWindowExplorerSupportReady)); } } } }
public void ParallelRunTest() { //Arrange ActPlugIn a1 = new ActPlugIn() { ActionId = "A1" }; ActPlugIn a2 = new ActPlugIn() { ActionId = "A1" }; ActPlugIn a3 = new ActPlugIn() { ActionId = "A1" }; ActPlugIn a4 = new ActPlugIn() { ActionId = "A1" }; ActPlugIn a5 = new ActPlugIn() { ActionId = "A1" }; ActPlugIn b1 = new ActPlugIn() { ActionId = "A1" }; ActPlugIn b2 = new ActPlugIn() { ActionId = "A1" }; ActPlugIn b3 = new ActPlugIn() { ActionId = "A1" }; ActPlugIn b4 = new ActPlugIn() { ActionId = "A1" }; ActPlugIn b5 = new ActPlugIn() { ActionId = "A1" }; // Act // We run on 2 drivers in parralel Task t1 = Task.Factory.StartNew(() => { GingerNodeInfo GNI1 = GG.NodeList[0]; GingerNodeProxy GNP1 = new GingerNodeProxy(GNI1); GNP1.GingerGrid = GG; GNP1.Reserve(); GNP1.StartDriver(); RunAction(a1, GNP1); RunAction(a2, GNP1); RunAction(a3, GNP1); RunAction(a4, GNP1); RunAction(a5, GNP1); GNP1.CloseDriver(); }); Task t2 = Task.Factory.StartNew(() => { GingerNodeInfo GNI2 = GG.NodeList[1]; GingerNodeProxy GNP2 = new GingerNodeProxy(GNI2); GNP2.GingerGrid = GG; GNP2.Reserve(); GNP2.StartDriver(); RunAction(b1, GNP2); RunAction(b2, GNP2); RunAction(b3, GNP2); RunAction(b4, GNP2); RunAction(b5, GNP2); GNP2.CloseDriver(); }); t1.Wait(); t2.Wait(); // Assert Assert.AreEqual(a1.Error, null); Assert.AreEqual(a1.ExInfo, "A1 Result"); Assert.AreEqual(a2.Error, null); Assert.AreEqual(a2.ExInfo, "A1 Result"); Assert.AreEqual(a3.Error, null); Assert.AreEqual(a3.ExInfo, "A1 Result"); Assert.AreEqual(a4.Error, null); Assert.AreEqual(a4.ExInfo, "A1 Result"); Assert.AreEqual(a5.Error, null); Assert.AreEqual(a5.ExInfo, "A1 Result"); Assert.AreEqual(b1.Error, null); Assert.AreEqual(b1.ExInfo, "A1 Result"); Assert.AreEqual(b2.Error, null); Assert.AreEqual(b2.ExInfo, "A1 Result"); Assert.AreEqual(b3.Error, null); Assert.AreEqual(b3.ExInfo, "A1 Result"); Assert.AreEqual(b4.Error, null); Assert.AreEqual(b4.ExInfo, "A1 Result"); Assert.AreEqual(b5.Error, null); Assert.AreEqual(b5.ExInfo, "A1 Result"); }
public GingerGridNodePage(GingerNodeProxy gingerNodeProxy) { InitializeComponent(); mGingerNodeProxy = gingerNodeProxy; GingerNodeNameLabel.Content = gingerNodeProxy.Description; }
internal static GingerNodeInfo GetGingerNodeInfo(string pluginId, string serviceID, ObservableList <DriverConfigParam> DriverConfiguration = null) { Console.WriteLine("In GetGingerNodeInfoForPluginAction.."); bool DoStartSession = false; bool isSessionService = WorkSpace.Instance.PlugInsManager.IsSessionService(pluginId, serviceID); GingerNodeInfo gingerNodeInfo; string key = null; if (isSessionService) { key = pluginId + "." + serviceID; bool found = SessionsNodes.TryGetValue(key, out gingerNodeInfo); if (found) { if (gingerNodeInfo.IsAlive()) { return(gingerNodeInfo); } else { SessionsNodes.Remove(key); } } } // !!!!!!!!!!!!!!!!! // Need to lock the grid until we get GNI // temp for now we lock all // TODO: improve to do it but without StartService which might be long // for now it is working and safe lock (WorkSpace.Instance.LocalGingerGrid) { gingerNodeInfo = GetGingerNode(serviceID); if (gingerNodeInfo == null) { // call plugin to start service and wait for ready WorkSpace.Instance.PlugInsManager.StartService(pluginId, serviceID); Stopwatch stopwatch = Stopwatch.StartNew(); while (gingerNodeInfo == null && stopwatch.ElapsedMilliseconds < 30000) // max 30 seconds for service to start { //Todo: remove thread.sleep Thread.Sleep(500); gingerNodeInfo = GetGingerNode(serviceID); } if (gingerNodeInfo == null) { return(null); } } if (isSessionService) { DoStartSession = true; } else { gingerNodeInfo.Status = GingerNodeInfo.eStatus.Reserved; } } // keep the proxy on agent GingerNodeProxy GNP = WorkSpace.Instance.LocalGingerGrid.GetNodeProxy(gingerNodeInfo); // FIXME for remote grid !!!!!!!!!!! //TODO: check if service is session start session only once if (DoStartSession) { gingerNodeInfo.Status = GingerNodeInfo.eStatus.Reserved; GNP.StartDriver(DriverConfiguration); SessionsNodes.Add(key, gingerNodeInfo); } return(gingerNodeInfo); }
public GingerGridNodePage(GingerNodeProxy GingerNodeAgent) { InitializeComponent(); mGingerNodeAgent = GingerNodeAgent; GingerNodeNameLabel.Content = GingerNodeAgent.Description; }
public void ShowMonitor(GingerNodeProxy gingerNodeProxy) { GingerSocketLogs = new ObservableList <GingerSocketLog>(); MainListView.ItemsSource = GingerSocketLogs; this.Show(); }
public GingerSocketMonitorWindow(GingerNodeProxy gingerNodeProxy) { InitializeComponent(); MessageLabel.Visibility = Visibility.Collapsed; mGingerNodeProxy = gingerNodeProxy; }
public static void ClassInit(TestContext context) { Reporter.WorkSpaceReporter = new UnitTestWorkspaceReporter(); int port = SocketHelper.GetOpenPort(); // gingerGrid = WorkSpace.Instance.LocalGingerGrid; // new GingerGrid(port); gingerGrid = new GingerGrid(port); gingerGrid.Start(); // WorkSpace.Instance.LocalGingerGrid = gingerGrid; webPlatform = new WebPlatformServiceFake(); gingerNode = new GingerNode(webPlatform); gingerNode.StartGingerNode("WebPlatformServiceFake 1", SocketHelper.GetLocalHostIP(), port); // Wait for node to be connected. gingerNodeProxy = new GingerNodeProxy(gingerGrid.NodeList[0]); gingerNodeProxy.GingerGrid = gingerGrid; // GingerRunner gingerRunner = new GingerRunner(); agent = new Agent(); agent.GingerNodeProxy = gingerNodeProxy; agent.Platform = GingerCoreNET.SolutionRepositoryLib.RepositoryObjectsLib.PlatformsLib.ePlatformType.Service; // agent.PluginId = "aa"; agent.ServiceId = "WebPlatformServiceFake"; agent.AgentType = Agent.eAgentType.Service; agent.DriverConfiguration = new Amdocs.Ginger.Common.ObservableList <DriverConfigParam>(); //agent.st // agent.StartDriver(); gingerNodeProxy.StartDriver(agent.DriverConfiguration); mGR = new GingerRunner(); mGR.CurrentSolution = new Ginger.SolutionGeneral.Solution(); mBF = new BusinessFlow(); mBF.Activities = new ObservableList <Activity>(); mBF.Name = "BF Test Java Driver"; Platform p = new Platform(); p.PlatformType = ePlatformType.Web; mBF.TargetApplications.Add(new TargetApplication() { AppName = "TestApp" }); Activity activity = new Activity(); activity.TargetApplication = "JavaTestApp"; mBF.Activities.Add(activity); mBF.CurrentActivity = activity; mGR.CurrentBusinessFlow = mBF; ApplicationAgent AA = new ApplicationAgent(); AA.AppName = "JavaTestApp"; AA.Agent = agent; mGR.ApplicationAgents.Add(AA); mGR.SetCurrentActivityAgent(); }
public void Close() { try { if (AgentType == eAgentType.Service) { if (gingerNodeInfo != null) { // this is plugin driver GingerNodeProxy.GingerGrid = WorkSpace.Instance.LocalGingerGrid; GingerNodeProxy.CloseDriver(); gingerNodeInfo.Status = GingerNodeInfo.eStatus.Ready; if (mProcess != null) // it means a new plugin process was started for this agent - so we close it { // Remove the node from the grid WorkSpace.Instance.LocalGingerGrid.NodeList.Remove(gingerNodeInfo); // Close the plugin process mProcess.CloseMainWindow(); } GingerNodeProxy = null; gingerNodeInfo = null; return; } } if (Driver == null) { return; } Driver.IsDriverRunning = false; if (Driver.Dispatcher != null) { Driver.Dispatcher.Invoke(() => { Driver.CloseDriver(); Thread.Sleep(1000); }); } else { Driver.CloseDriver(); } if (MSTATask != null) { // Using cancellation token source to cancel CancelTask = new BackgroundWorker(); CancelTask.DoWork += new DoWorkEventHandler(CancelTMSTATask); CancelTask.RunWorkerAsync(); } Driver = null; } finally { OnPropertyChanged(Fields.Status); OnPropertyChanged(Fields.IsWindowExplorerSupportReady); } }