コード例 #1
0
        private int HanldeGridOption(GridOptions gridOptions)
        {
            SetVerboseLevel(gridOptions.VerboseLevel);

            Reporter.ToLog(eLogLevel.INFO, "Starting Ginger Grid at port: " + gridOptions.Port);
            GingerGrid gingerGrid = new GingerGrid(gridOptions.Port);

            gingerGrid.Start();

            if (gridOptions.Tracker)
            {
                ServiceGridTracker serviceGridTracker = new ServiceGridTracker(gingerGrid);
            }

            Console.WriteLine();
            Console.WriteLine("---------------------------------------------------");
            Console.WriteLine("-               Press 'q' exit                    -");
            Console.WriteLine("---------------------------------------------------");

            if (!Console.IsInputRedirected && !WorkSpace.Instance.RunningFromUnitTest)  // for example unit test redirect input, or we can run without input like from Jenkins
            {
                ConsoleKey consoleKey = ConsoleKey.A;
                while (consoleKey != ConsoleKey.Q)
                {
                    ConsoleKeyInfo consoleKeyInfo = Console.ReadKey();
                    consoleKey = consoleKeyInfo.Key;
                }
            }

            return(0);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: GingerGridTest.cs プロジェクト: lanicon/Ginger
        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);
            }
        }
コード例 #4
0
        public static void ClassInitialize(TestContext TestContext)
        {
            // We start a Ginger grid
            int HubPort = SocketHelper.GetOpenPort();

            mGingerGrid = new GingerGrid(HubPort);
            mGingerGrid.Start();
        }
コード例 #5
0
 void StartGrid()
 {
     Console.WriteLine("Starting Ginger Grid Hub");
     mGingerGrid = new GingerGrid(SocketHelper.GetOpenPort());
     mGingerGrid.Start();
     Console.WriteLine("Ginger Grid started - " + mGingerGrid.Status);
     Console.WriteLine("Port: " + mGingerGrid.Port);
 }
コード例 #6
0
 private void InitLocalGrid()
 {
     try
     {
         mLocalGingerGrid = new GingerGrid();
         mLocalGingerGrid.Start();
     }
     catch (Exception e)
     {
         Reporter.ToLog(eLogLevel.ERROR, "Failed to start Ginger Grid", e);
     }
 }
コード例 #7
0
ファイル: MultiRunTest.cs プロジェクト: csuffyy/Ginger
        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);
        }
コード例 #8
0
ファイル: WorkSpace.cs プロジェクト: anthrax3/Ginger
 private void InitLocalGrid()
 {
     mLocalGingerGrid = new GingerGrid();
     mLocalGingerGrid.Start();
 }
コード例 #9
0
        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();
        }
コード例 #10
0
        private void HandleArg(string param, string value)
        {
            // TODO: get all classes impl ICLI and check Identifier then set

            switch (param)
            {
            case "--version":
                Console.WriteLine(string.Format("{0} Version: {1}", ApplicationInfo.ApplicationName, ApplicationInfo.ApplicationVersionWithInfo));
                break;

            case "--help":
            case "-h":
                ShowCLIHelp();
                break;

            case "ConfigFile":
            case "--configfile":
                mCLIHelper.CLIType = eCLIType.Config;
                Reporter.ToLog(eLogLevel.DEBUG, string.Format("Running with ConfigFile= '{0}'", value));
                mCLIHandler = new CLIConfigFile();
                PerformLoadAndExecution(ReadFile(value));
                break;

            case "Script":
            case "--scriptfile":
                mCLIHelper.CLIType = eCLIType.Script;
                Reporter.ToLog(eLogLevel.DEBUG, string.Format("Running with ScriptFile= '{0}'", value));
                mCLIHandler = new CLIScriptFile();
                PerformLoadAndExecution(ReadFile(value));
                break;

            case "--dynamicfile":
            case "Dynamic":
                mCLIHelper.CLIType = eCLIType.Dynamic;
                Reporter.ToLog(eLogLevel.DEBUG, string.Format("Running with DynamicXML= '{0}'", value));
                mCLIHandler = new CLIDynamicXML();
                PerformLoadAndExecution(ReadFile(value));
                break;

            case "--args":
                mCLIHelper.CLIType = eCLIType.Arguments;
                Reporter.ToLog(eLogLevel.DEBUG, string.Format("Running with Command Args= '{0}'", value));
                mCLIHandler = new CLIArgs();
                PerformLoadAndExecution(value);
                break;

            case "--excel":
                Reporter.ToLog(eLogLevel.DEBUG, string.Format("Running with CLI Excel= '{0}'", value));
                mCLIHandler = new CLIExcel();
                PerformLoadAndExecution(value);
                break;

            case "--servicegrid":
                int port = 15555;
                Console.WriteLine("Starting Ginger Grid at port: " + port);
                GingerGrid gingerGrid = new GingerGrid(15555);       // TODO: get port from CLI arg
                gingerGrid.Start();

                ServiceGridTracker serviceGridTracker = new ServiceGridTracker(gingerGrid);

                Console.ReadKey();
                break;
            }
        }