YARN-8548. AllocationRespose proto setNMToken initBuilder not done. Contributed by Bilwa S T.
This commit is contained in:
parent
8461278833
commit
ff7c2eda34
@ -347,6 +347,7 @@ public synchronized void setCompletedContainersStatuses(
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void setNMTokens(List<NMToken> nmTokens) {
|
public synchronized void setNMTokens(List<NMToken> nmTokens) {
|
||||||
|
maybeInitBuilder();
|
||||||
if (nmTokens == null || nmTokens.isEmpty()) {
|
if (nmTokens == null || nmTokens.isEmpty()) {
|
||||||
if (this.nmTokens != null) {
|
if (this.nmTokens != null) {
|
||||||
this.nmTokens.clear();
|
this.nmTokens.clear();
|
||||||
|
@ -18,7 +18,15 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager.recovery;
|
package org.apache.hadoop.yarn.server.resourcemanager.recovery;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.AllocateResponsePBImpl;
|
||||||
|
import org.apache.hadoop.yarn.api.records.NMToken;
|
||||||
import org.apache.hadoop.yarn.proto.YarnServerResourceManagerRecoveryProtos.EpochProto;
|
import org.apache.hadoop.yarn.proto.YarnServerResourceManagerRecoveryProtos.EpochProto;
|
||||||
|
import org.apache.hadoop.yarn.proto.YarnServiceProtos.AllocateResponseProto;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -33,4 +41,16 @@ public void testProtoCanBePrinted() throws Exception {
|
|||||||
String protoString = proto.toString();
|
String protoString = proto.toString();
|
||||||
Assert.assertNotNull(protoString);
|
Assert.assertNotNull(protoString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testProtoAllocateResponse() {
|
||||||
|
AllocateResponseProto proto = AllocateResponseProto.getDefaultInstance();
|
||||||
|
AllocateResponsePBImpl alloc = new AllocateResponsePBImpl(proto);
|
||||||
|
List<NMToken> nmTokens = new ArrayList<NMToken>();
|
||||||
|
try {
|
||||||
|
alloc.setNMTokens(nmTokens);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user