Ejemplo n.º 1
0
        public virtual void TestContainerId()
        {
            ContainerId c1 = NewContainerId(1, 1, 10l, 1);
            ContainerId c2 = NewContainerId(1, 1, 10l, 2);
            ContainerId c3 = NewContainerId(1, 1, 10l, 1);
            ContainerId c4 = NewContainerId(1, 3, 10l, 1);
            ContainerId c5 = NewContainerId(1, 3, 8l, 1);

            NUnit.Framework.Assert.IsTrue(c1.Equals(c3));
            NUnit.Framework.Assert.IsFalse(c1.Equals(c2));
            NUnit.Framework.Assert.IsFalse(c1.Equals(c4));
            NUnit.Framework.Assert.IsFalse(c1.Equals(c5));
            NUnit.Framework.Assert.IsTrue(c1.CompareTo(c3) == 0);
            NUnit.Framework.Assert.IsTrue(c1.CompareTo(c2) < 0);
            NUnit.Framework.Assert.IsTrue(c1.CompareTo(c4) < 0);
            NUnit.Framework.Assert.IsTrue(c1.CompareTo(c5) > 0);
            NUnit.Framework.Assert.IsTrue(c1.GetHashCode() == c3.GetHashCode());
            NUnit.Framework.Assert.IsFalse(c1.GetHashCode() == c2.GetHashCode());
            NUnit.Framework.Assert.IsFalse(c1.GetHashCode() == c4.GetHashCode());
            NUnit.Framework.Assert.IsFalse(c1.GetHashCode() == c5.GetHashCode());
            long        ts = Runtime.CurrentTimeMillis();
            ContainerId c6 = NewContainerId(36473, 4365472, ts, 25645811);

            NUnit.Framework.Assert.AreEqual("container_10_0001_01_000001", c1.ToString());
            NUnit.Framework.Assert.AreEqual(25645811, unchecked ((long)(0xffffffffffL)) & c6.GetContainerId
                                                ());
            NUnit.Framework.Assert.AreEqual(0, c6.GetContainerId() >> 40);
            NUnit.Framework.Assert.AreEqual("container_" + ts + "_36473_4365472_25645811", c6
                                            .ToString());
            ContainerId c7 = NewContainerId(36473, 4365472, ts, 4298334883325L);

            NUnit.Framework.Assert.AreEqual(999799999997L, unchecked ((long)(0xffffffffffL)) &
                                            c7.GetContainerId());
            NUnit.Framework.Assert.AreEqual(3, c7.GetContainerId() >> 40);
            NUnit.Framework.Assert.AreEqual("container_e03_" + ts + "_36473_4365472_999799999997"
                                            , c7.ToString());
            ContainerId c8 = NewContainerId(36473, 4365472, ts, 844424930131965L);

            NUnit.Framework.Assert.AreEqual(1099511627773L, unchecked ((long)(0xffffffffffL))
                                            & c8.GetContainerId());
            NUnit.Framework.Assert.AreEqual(767, c8.GetContainerId() >> 40);
            NUnit.Framework.Assert.AreEqual("container_e767_" + ts + "_36473_4365472_1099511627773"
                                            , c8.ToString());
        }
Ejemplo n.º 2
0
 protected internal virtual bool HasAMContainer(ContainerId containerId, ICollection
                                                <ContainerReport> containers)
 {
     foreach (ContainerReport container in containers)
     {
         if (containerId.Equals(container.GetContainerId()))
         {
             return(true);
         }
     }
     return(false);
 }
 public bool Equals(ContainerElementAddress <T> other)
 {
     return(ContainerId.Equals(other.ContainerId) && Offset == other.Offset);
 }
Ejemplo n.º 4
0
 public override bool Equals(object obj)
 {
     if (this == obj)
     {
         return(true);
     }
     if (obj == null)
     {
         return(false);
     }
     if (GetType() != obj.GetType())
     {
         return(false);
     }
     Org.Apache.Hadoop.Mapreduce.V2.App.Launcher.ContainerLauncherEvent other = (Org.Apache.Hadoop.Mapreduce.V2.App.Launcher.ContainerLauncherEvent
                                                                                 )obj;
     if (containerID == null)
     {
         if (other.containerID != null)
         {
             return(false);
         }
     }
     else
     {
         if (!containerID.Equals(other.containerID))
         {
             return(false);
         }
     }
     if (containerMgrAddress == null)
     {
         if (other.containerMgrAddress != null)
         {
             return(false);
         }
     }
     else
     {
         if (!containerMgrAddress.Equals(other.containerMgrAddress))
         {
             return(false);
         }
     }
     if (containerToken == null)
     {
         if (other.containerToken != null)
         {
             return(false);
         }
     }
     else
     {
         if (!containerToken.Equals(other.containerToken))
         {
             return(false);
         }
     }
     if (taskAttemptID == null)
     {
         if (other.taskAttemptID != null)
         {
             return(false);
         }
     }
     else
     {
         if (!taskAttemptID.Equals(other.taskAttemptID))
         {
             return(false);
         }
     }
     return(true);
 }