diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/BaseAMRMProxyE2ETest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/BaseAMRMProxyE2ETest.java index 0b6205415c5..4adf3f46099 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/BaseAMRMProxyE2ETest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/BaseAMRMProxyE2ETest.java @@ -29,6 +29,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; +import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.LocalResource; import org.apache.hadoop.yarn.api.records.NodeReport; @@ -126,12 +127,12 @@ public abstract class BaseAMRMProxyE2ETest { } ResourceBlacklistRequest resourceBlacklistRequest = ResourceBlacklistRequest - .newInstance(new ArrayList<>(), new ArrayList<>()); + .newInstance(new ArrayList(), new ArrayList()); int responseId = 1; return AllocateRequest.newInstance(responseId, 0, resourceAsk, - new ArrayList<>(), resourceBlacklistRequest); + new ArrayList(), resourceBlacklistRequest); } protected ApplicationAttemptId createApp(YarnClient yarnClient, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestDistributedScheduling.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestDistributedScheduling.java index a556aa2cd6d..132a89fb249 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestDistributedScheduling.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestDistributedScheduling.java @@ -448,19 +448,25 @@ public class TestDistributedScheduling extends BaseAMRMProxyE2ETest { try { ApplicationMasterProtocol mockRM = mock(ApplicationMasterProtocol .class); + final Resource _capability = capability; + final String[] _nodes = nodes; + final String[] _racks = racks; + final Priority _priority = priority; + final Priority _priority2 = priority2; + when(mockRM.allocate(any(AllocateRequest.class))).thenAnswer( new Answer() { public AllocateResponse answer(InvocationOnMock invocation) throws Exception { amc.removeContainerRequest( - new AMRMClient.ContainerRequest(capability, nodes, - racks, priority)); + new AMRMClient.ContainerRequest(_capability, _nodes, + _racks, _priority)); amc.removeContainerRequest( - new AMRMClient.ContainerRequest(capability, nodes, racks, - priority)); + new AMRMClient.ContainerRequest(_capability, _nodes, _racks, + _priority)); amc.removeContainerRequest( - new AMRMClient.ContainerRequest(capability, null, null, - priority2, true, null, + new AMRMClient.ContainerRequest(_capability, null, null, + _priority2, true, null, ExecutionTypeRequest.newInstance( ExecutionType.OPPORTUNISTIC, true))); throw new Exception();