Exemplo n.º 1
0
 /// <summary>
 /// Add the serviceToAdd to the parent if this service
 /// is in the state requested
 /// </summary>
 private void MaybeAddSibling()
 {
     if (GetServiceState() == triggerState)
     {
         parent.AddService(serviceToAdd);
     }
 }
Exemplo n.º 2
0
        /// <exception cref="System.Exception"/>
        public virtual void TestAddUninitedSiblingInStart()
        {
            CompositeService parent  = new CompositeService("parent");
            BreakableService sibling = new BreakableService();

            parent.AddService(new TestCompositeService.AddSiblingService(parent, sibling, Service.STATE
                                                                         .Started));
            parent.Init(new Configuration());
            AssertInState(Service.STATE.Notinited, sibling);
            parent.Start();
            parent.Stop();
            Assert.Equal("Incorrect number of services", 2, parent.GetServices
                             ().Count);
        }
Exemplo n.º 3
0
        /// <exception cref="System.Exception"/>
        public virtual void TestAddUninitedSiblingInInit()
        {
            CompositeService parent  = new CompositeService("parent");
            BreakableService sibling = new BreakableService();

            parent.AddService(new TestCompositeService.AddSiblingService(parent, sibling, Service.STATE
                                                                         .Inited));
            parent.Init(new Configuration());
            try
            {
                parent.Start();
                NUnit.Framework.Assert.Fail("Expected an exception, got " + parent);
            }
            catch (ServiceStateException)
            {
            }
            //expected
            parent.Stop();
            Assert.Equal("Incorrect number of services", 2, parent.GetServices
                             ().Count);
        }
Exemplo n.º 4
0
 /// <summary>Expose addService method</summary>
 /// <param name="parent">parent service</param>
 /// <param name="child">child to add</param>
 public static void AddChildToService(CompositeService parent, Org.Apache.Hadoop.Service.Service
                                      child)
 {
     parent.AddService(child);
 }