@Test public void ContainerResourceIncreaseRequest() { ContainerId containerId = ContainerId .newContainerId(ApplicationAttemptId.newInstance( ApplicationId.newInstance(1234, 3), 3), 7); Resource resource = Resource.newInstance(1023, 3, 4); ContainerResourceIncreaseRequest context = ContainerResourceIncreaseRequest .newInstance(containerId, resource); // to proto and get it back ContainerResourceIncreaseRequestProto proto = ((ContainerResourceIncreaseRequestPBImpl) context).getProto(); ContainerResourceIncreaseRequest contextRecover = new ContainerResourceIncreaseRequestPBImpl(proto); // check value Assert.assertEquals(contextRecover.getContainerId(), containerId); Assert.assertEquals(contextRecover.getCapability(), resource); }
@Test public void ContainerResourceIncreaseRequest() { ContainerId containerId = ContainerId .newContainerId(ApplicationAttemptId.newInstance( ApplicationId.newInstance(1234, 3), 3), 7); Resource resource = Resource.newInstance(1023, 3); ContainerResourceIncreaseRequest context = ContainerResourceIncreaseRequest .newInstance(containerId, resource); // to proto and get it back ContainerResourceIncreaseRequestProto proto = ((ContainerResourceIncreaseRequestPBImpl) context).getProto(); ContainerResourceIncreaseRequest contextRecover = new ContainerResourceIncreaseRequestPBImpl(proto); // check value Assert.assertEquals(contextRecover.getContainerId(), containerId); Assert.assertEquals(contextRecover.getCapability(), resource); }
@Test public void ContainerResourceIncreaseRequest() { ContainerId containerId = ContainerId .newInstance(ApplicationAttemptId.newInstance( ApplicationId.newInstance(1234, 3), 3), 7); Resource resource = Resource.newInstance(1023, 3); ContainerResourceIncreaseRequest context = ContainerResourceIncreaseRequest .newInstance(containerId, resource); // to proto and get it back ContainerResourceIncreaseRequestProto proto = ((ContainerResourceIncreaseRequestPBImpl) context).getProto(); ContainerResourceIncreaseRequest contextRecover = new ContainerResourceIncreaseRequestPBImpl(proto); // check value Assert.assertEquals(contextRecover.getContainerId(), containerId); Assert.assertEquals(contextRecover.getCapability(), resource); }
@Test public void testResourceChangeContextWithNullField() { ContainerResourceIncreaseRequest context = ContainerResourceIncreaseRequest .newInstance(null, null); // to proto and get it back ContainerResourceIncreaseRequestProto proto = ((ContainerResourceIncreaseRequestPBImpl) context).getProto(); ContainerResourceIncreaseRequest contextRecover = new ContainerResourceIncreaseRequestPBImpl(proto); // check value Assert.assertNull(contextRecover.getContainerId()); Assert.assertNull(contextRecover.getCapability()); }
private ContainerResourceIncreaseRequestPBImpl convertFromProtoFormat( ContainerResourceIncreaseRequestProto p) { return new ContainerResourceIncreaseRequestPBImpl(p); }
private ContainerResourceIncreaseRequestProto convertToProtoFormat( ContainerResourceIncreaseRequest t) { return ((ContainerResourceIncreaseRequestPBImpl) t).getProto(); }
private ContainerResourceIncreaseRequestPBImpl convertFromProtoFormat( YarnProtos.ContainerResourceIncreaseRequestProto p) { return new ContainerResourceIncreaseRequestPBImpl(p); }
private YarnProtos.ContainerResourceIncreaseRequestProto convertToProtoFormat( ContainerResourceIncreaseRequest t) { return ((ContainerResourceIncreaseRequestPBImpl) t).getProto(); }