Package org.apache.hadoop.yarn.api.records

Examples of org.apache.hadoop.yarn.api.records.ContainerResourceIncrease


    Token token = Token.newInstance(identifier, "", "".getBytes(), "");
    ContainerId containerId = ContainerId
        .newInstance(ApplicationAttemptId.newInstance(
            ApplicationId.newInstance(1234, 3), 3), 7);
    Resource resource = Resource.newInstance(1023, 3);
    ContainerResourceIncrease ctx = ContainerResourceIncrease.newInstance(
        containerId, resource, token);

    // get proto and recover to ctx
    ContainerResourceIncreaseProto proto =
        ((ContainerResourceIncreasePBImpl) ctx).getProto();
    ctx = new ContainerResourceIncreasePBImpl(proto);

    // check values
    Assert.assertEquals(ctx.getCapability(), resource);
    Assert.assertEquals(ctx.getContainerId(), containerId);
    Assert.assertTrue(Arrays.equals(ctx.getContainerToken().getIdentifier()
        .array(), identifier));
  }
View Full Code Here


        .array(), identifier));
  }
 
  @Test
  public void testResourceIncreaseContextWithNull() {
    ContainerResourceIncrease ctx = ContainerResourceIncrease.newInstance(null,
        null, null);
   
    // get proto and recover to ctx;
    ContainerResourceIncreaseProto proto =
        ((ContainerResourceIncreasePBImpl) ctx).getProto();
    ctx = new ContainerResourceIncreasePBImpl(proto);

    // check values
    Assert.assertNull(ctx.getContainerToken());
    Assert.assertNull(ctx.getCapability());
    Assert.assertNull(ctx.getContainerId());
  }
View Full Code Here

    Token token = Token.newInstance(identifier, "", "".getBytes(), "");
    ContainerId containerId = ContainerId
        .newInstance(ApplicationAttemptId.newInstance(
            ApplicationId.newInstance(1234, 3), 3), 7);
    Resource resource = Resource.newInstance(1023, 3);
    ContainerResourceIncrease ctx = ContainerResourceIncrease.newInstance(
        containerId, resource, token);

    // get proto and recover to ctx
    ContainerResourceIncreaseProto proto =
        ((ContainerResourceIncreasePBImpl) ctx).getProto();
    ctx = new ContainerResourceIncreasePBImpl(proto);

    // check values
    Assert.assertEquals(ctx.getCapability(), resource);
    Assert.assertEquals(ctx.getContainerId(), containerId);
    Assert.assertTrue(Arrays.equals(ctx.getContainerToken().getIdentifier()
        .array(), identifier));
  }
View Full Code Here

        .array(), identifier));
  }
 
  @Test
  public void testResourceIncreaseContextWithNull() {
    ContainerResourceIncrease ctx = ContainerResourceIncrease.newInstance(null,
        null, null);
   
    // get proto and recover to ctx;
    ContainerResourceIncreaseProto proto =
        ((ContainerResourceIncreasePBImpl) ctx).getProto();
    ctx = new ContainerResourceIncreasePBImpl(proto);

    // check values
    Assert.assertNull(ctx.getContainerToken());
    Assert.assertNull(ctx.getCapability());
    Assert.assertNull(ctx.getContainerId());
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.yarn.api.records.ContainerResourceIncrease

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.