예제 #1
0
        public void TestDeSerirializeInjectionPlanForSimpleConstructor()
        {
            //Type simpleConstructorType = typeof(Com.Microsoft.Tang.Examples.SimpleConstructors);

            ITang tang = TangFactory.GetTang();
            ICsConfigurationBuilder cb   = tang.NewConfigurationBuilder(new string[] { file });
            IConfiguration          conf = cb.Build();

            var ch = conf.GetClassHierarchy();
            var ip = ProtocolBufferInjectionPlan.DeSerialize("plan.bin", ch);
        }
예제 #2
0
        public void TestSerirializeInjectionPlanForSimpleConstructor()
        {
            Type simpleConstructorType = typeof(Com.Microsoft.Tang.Examples.SimpleConstructors);

            ITang tang = TangFactory.GetTang();
            ICsConfigurationBuilder cb   = tang.NewConfigurationBuilder(new string[] { file });
            IConfiguration          conf = cb.Build();
            IInjector     injector       = tang.NewInjector(conf);
            InjectionPlan ip             = injector.GetInjectionPlan(simpleConstructorType);

            ProtocolBufferInjectionPlan.Serialize("plan.bin", ip);
        }
예제 #3
0
        public void TestDeSerirializeInjectionPlanForTimer()
        {
            Type  namedParameter       = asm.GetType(@"Com.Microsoft.Tang.Examples.Timer+Seconds");
            ITang tang                 = TangFactory.GetTang();
            ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(new string[] { file });

            cb.BindNamedParameter(namedParameter, "2");
            IConfiguration conf = cb.Build();

            var ch = conf.GetClassHierarchy();
            var ip = ProtocolBufferInjectionPlan.DeSerialize("timerplan.bin", ch);
        }
예제 #4
0
 public void TestSerirializeInjectionPlanForTimer()
 {
     Type timerType = typeof(Timer);
     ITang tang = TangFactory.GetTang();
     ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(new string[] { FileNames.Examples });
     cb.BindNamedParameter<Timer.Seconds, Int32>(GenericType < Timer.Seconds>.Class, "2");
     IConfiguration conf = cb.Build();
     IInjector injector = tang.NewInjector(conf);
     Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan ip = injector.GetInjectionPlan(timerType);
     ProtocolBufferInjectionPlan.Serialize("timerplan.bin", ip);
     var ch = conf.GetClassHierarchy();
     var ip1 = ProtocolBufferInjectionPlan.DeSerialize("timerplan.bin", ch);
     Assert.IsNotNull(ip1);
 }
예제 #5
0
        public void TestSerirializeInjectionPlanForTimer()
        {
            Type timerType      = typeof(Com.Microsoft.Tang.Examples.Timer);
            Type namedParameter = asm.GetType(@"Com.Microsoft.Tang.Examples.Timer+Seconds");

            ITang tang = TangFactory.GetTang();
            ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(new string[] { file });

            cb.BindNamedParameter(namedParameter, "2");
            IConfiguration conf     = cb.Build();
            IInjector      injector = tang.NewInjector(conf);
            InjectionPlan  ip       = injector.GetInjectionPlan(timerType);

            ProtocolBufferInjectionPlan.Serialize("timerplan.bin", ip);
        }
예제 #6
0
        public void TestSerirializeInjectionPlanForSimpleConstructor()
        {
            Type simpleConstructorType = typeof(SimpleConstructors);

            ITang tang = TangFactory.GetTang();
            ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(new string[] { FileNames.Examples });
            IConfiguration conf = cb.Build();
            IInjector injector = tang.NewInjector(conf);
            Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan ip = injector.GetInjectionPlan(simpleConstructorType);

            ProtocolBufferInjectionPlan.Serialize("plan.bin", ip);
            var ch = conf.GetClassHierarchy();
            var ipRecovered = ProtocolBufferInjectionPlan.DeSerialize("plan.bin", ch);
            Assert.IsNotNull(ipRecovered);
        }