Пример #1
0
        public virtual void TestResourceDecreaseContextWithNull()
        {
            ContainerResourceDecrease ctx = ContainerResourceDecrease.NewInstance(null, null);

            // get proto and recover to ctx;
            YarnProtos.ContainerResourceDecreaseProto proto = ((ContainerResourceDecreasePBImpl
                                                                )ctx).GetProto();
            ctx = new ContainerResourceDecreasePBImpl(proto);
            // check values
            NUnit.Framework.Assert.IsNull(ctx.GetCapability());
            NUnit.Framework.Assert.IsNull(ctx.GetContainerId());
        }
Пример #2
0
        public virtual void TestResourceDecreaseContext()
        {
            ContainerId containerId = ContainerId.NewContainerId(ApplicationAttemptId.NewInstance
                                                                     (ApplicationId.NewInstance(1234, 3), 3), 7);
            Resource resource             = Resource.NewInstance(1023, 3);
            ContainerResourceDecrease ctx = ContainerResourceDecrease.NewInstance(containerId
                                                                                  , resource);

            // get proto and recover to ctx
            YarnProtos.ContainerResourceDecreaseProto proto = ((ContainerResourceDecreasePBImpl
                                                                )ctx).GetProto();
            ctx = new ContainerResourceDecreasePBImpl(proto);
            // check values
            NUnit.Framework.Assert.AreEqual(ctx.GetCapability(), resource);
            NUnit.Framework.Assert.AreEqual(ctx.GetContainerId(), containerId);
        }