public static void ClassInitialize(TestContext TestContext) { // We start a Ginger grid int HubPort = SocketHelper.GetOpenPort(); GG = new GingerGrid(HubPort); GG.Start(); // Add 2 Ginger Nodes with Dummy Driver DummyDriver DummyDriver1 = new DummyDriver(); Task.Factory.StartNew(() => { GingerNodeStarter gingerNodeStarter = new GingerNodeStarter(); gingerNodeStarter.StartNode("N1", new DummyDriver(), SocketHelper.GetLocalHostIP(), HubPort); gingerNodeStarter.StartNode("N2", new DummyDriver(), SocketHelper.GetLocalHostIP(), HubPort); gingerNodeStarter.Listen(); }); Stopwatch stopwatch = Stopwatch.StartNew(); while (GG.NodeList.Count < 2 && stopwatch.ElapsedMilliseconds < 5000) // max 5 seconds { Thread.Sleep(50); } }
public static void ClassInitialize(TestContext TestContext) { // We start a Ginger grid int HubPort = SocketHelper.GetOpenPort(); GG = new GingerGrid(HubPort); GG.Start(); // Add 2 Ginger Nodes with Dummy Driver // TODO: check how to externalize // make it NodeInfo and drivers capabilities DummyDriver DummyDriver1 = new DummyDriver(); //DriverCapabilities DC = new DriverCapabilities(); //DC.OS = "Windows"; //TODO: use const //DC.Platform = "Web"; //TODO: use const //GingerNode GN = new GingerNode(DC, DummyDriver1); //GN.StartGingerNode("N1", HubIP: SocketHelper.GetLocalHostIP(), HubPort: HubPort); GingerNodeStarter gingerNodeStarter = new GingerNodeStarter(); gingerNodeStarter.StartNode("N1", new DummyDriver()); gingerNodeStarter.StartNode("N2", new DummyDriver()); // DummyDriver DummyDriver2 = new DummyDriver(); //DriverCapabilities DC2 = new DriverCapabilities(); //DC2.OS = "Mac"; //DC2.Platform = "Java"; //GingerNode GingerNode2 = new GingerNode(DC2, DummyDriver2); //GingerNode2.StartGingerNode("N2", HubIP: SocketHelper.GetLocalHostIP(), HubPort: HubPort); }
Agent prep() { mGingerGrid = WorkSpace.Instance.LocalGingerGrid; // Start one DummyDriver - in process, so we can test whats going on everywhere mDummyDriver = new DummyDriver(); GingerNode gingerNode = new GingerNode(mDummyDriver); gingerNode.StartGingerNode("N1", HubIP: SocketHelper.GetLocalHostIP(), HubPort: mGingerGrid.Port); // Wait for the Grid to be up and the node connected // max 30 seconds Stopwatch st = Stopwatch.StartNew(); while (!gingerNode.Connected && st.ElapsedMilliseconds < 30000) { Thread.Sleep(100); } if (!gingerNode.Connected) { throw new Exception(">>>>>>>>>>>>>>>> GingerNode didn't connect to grid <<<<<<<<<<<<<<<<<<<<< " + mPluginId + "." + mServiceId); } st.Restart(); while (mGingerGrid.NodeList.Count == 0 && st.ElapsedMilliseconds < 30000) { Thread.Sleep(100); } if (mGingerGrid.NodeList.Count == 0) { throw new Exception(">>>>>>>>>>>>>>>> NodeList count =0, no node connected <<<<<<<<<<<<<<<<<<<<< " + mPluginId + "." + mServiceId); } WorkSpace.Instance.PlugInsManager.PluginServiceIsSeesionDictionary.Add(mPluginId + "." + mServiceId, true); //TODO: handle no GG node found Agent agent = new Agent(); agent.Name = "agent 1"; agent.AgentType = Agent.eAgentType.Service; agent.PluginId = mPluginId; agent.ServiceId = mServiceId; mGingerRunner = new GingerRunner(); mGingerRunner.ApplicationAgents.Add(new ApplicationAgent() { AppName = cWebApp, Agent = agent }); return(agent); }
public static void ClassInitialize(TestContext TestContext) { // We start a Ginger grid on open port int GingerHubPort = SocketHelper.GetOpenPort(); GG = new GingerGrid(GingerHubPort); GG.Start(); // Add 2 Ginger Nodes with Dummy Driver DummyDriver DummyDriver1 = new DummyDriver(); GingerNode GN = new GingerNode(DummyDriver1); GN.StartGingerNode("N1", HubIP: SocketHelper.GetLocalHostIP(), HubPort: GingerHubPort); DummyDriver DummyDriver2 = new DummyDriver(); GingerNode GingerNode2 = new GingerNode(DummyDriver2); GingerNode2.StartGingerNode("N2", HubIP: SocketHelper.GetLocalHostIP(), HubPort: GingerHubPort); }
public DummyDriverTest() { Directory.CreateDirectory(Context.ProjectDirectory); _dbFile = Path.Combine(Context.ProjectDirectory, "dummy.db"); _driver = new DummyDriver(_dbFile); }