예제 #1
0
        public void Read1()
        {
            LauncherFactory launcherFactory = new LauncherFactory();
            AppInitializedDetectorFactory appInitializedDetectorFactory = new AppInitializedDetectorFactory();
            var localOps = new LocalOperations("m1", launcherFactory, appInitializedDetectorFactory, null);

            localOps.SetPlanRepo(TestPlanRepo.plans.Values);

            var server = new CLIServer("127.0.0.1", 6001, localOps);

            server.Start();


            var client = new TcpClient("localhost", 6001);

            SendReq(client, "001", "StartPlan p1");
            server.Tick();
            var resp001 = ReadResp(client, 1000);


            SendReq(client, "002", "GetAppState m1.a");
            server.Tick();
            var resp002 = ReadResp(client, 1000);

            SendReq(client, "003", "GetPlanState p1");
            server.Tick();
            var resp003 = ReadResp(client, 1000);

            SendReq(client, "004", "GetAllPlansState");
            server.Tick();
            var resp004 = ReadResp(client, 1000);

            SendReq(client, "005", "GetAllAppsState");
            server.Tick();
            var resp005 = ReadResp(client, 1000);


            client.Close();


            //Assert.IsNotNull(cfg.Plans[0].getAppDefs());
            //Assert.AreEqual( "m1.a", cfg.Plans[0].getAppDefs().First().AppIdTuple.ToString() );

            server.Stop();
        }
예제 #2
0
 static void Run()
 {
     Console.WriteLine("Press Ctr+C to stop the server.");
     // run forever
     while (true)
     {
         agent.tick();
         cliServer.Tick();
         Thread.Sleep(500);
     }
 }