Exemplo n.º 1
0
        static void Main(string[] args)
        {
            SharedXmlConfigReader cr = new SharedXmlConfigReader();
            var cfg = cr.Load( File.OpenText("../../../../data/SharedConfig.xml") );

            var cl = new Client("cl1", "localhost", 12345);
            cl.Connect();

            LaunchPlan plan1 = new LaunchPlan(
                "plan1",
                new List<AppDef>()
                {
                    new AppDef() { AppIdTuple = new AppIdTuple("m1", "a"), StartupOrder = -1, Dependencies=new List<string>() {"b"} },
                    new AppDef() { AppIdTuple = new AppIdTuple("m1", "b"), StartupOrder = -1, },
                    new AppDef() { AppIdTuple = new AppIdTuple("m1", "c"), StartupOrder = -1, Dependencies=new List<string>() {"b"} },
                    new AppDef() { AppIdTuple = new AppIdTuple("m1", "d"), StartupOrder = -1, Dependencies=new List<string>() {"a"} },
                }
            );

            cl.BroadcastMessage( new LoadPlanMessage(plan1) );

            var messages = cl.ReadMessages();
            foreach( var msg in messages )
            {
                Console.WriteLine("Received: {0}", msg.ToString());

                if( msg.GetType() == typeof(LoadPlanMessage) )
                {
                    LoadPlanMessage m = msg as LoadPlanMessage;
                    Console.WriteLine("  LoadPlan '{0}' ({1} applications)", m.plan.Name, m.plan.getAppDefs().Count<AppDef>());
                }
            }
        }
Exemplo n.º 2
0
        public override bool Equals(Object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            LaunchPlan personObj = obj as LaunchPlan;

            if (personObj == null)
            {
                return(false);
            }
            else
            {
                return(Equals(personObj));
            }
        }
Exemplo n.º 3
0
        public void testSelectPlan()
        {
            var ctrlMock = new Mock<IDirigentControl>();
            var appIdTuple = new AppIdTuple("m1.a");
            var appDef = new AppDef() { AppIdTuple = appIdTuple };
            var plan = new LaunchPlan("plan1", new List<AppDef>() { appDef } );
            var planRepo = new List<ILaunchPlan>() { plan };
            ctrlMock.Setup(f => f.GetPlanRepo()).Returns(planRepo);
            ctrlMock.Setup(f => f.SelectPlan(plan)).Verifiable();

            var cmdRepo = new CommandRepository();
            cmdRepo.Register( new Commands.SelectPlan(ctrlMock.Object) );
            cmdRepo.ParseAndExecute(new List<string>() { "SelectPlan", "plan1" });

            ctrlMock.Verify();

            //Assert.AreEqual(");
        }