|
@@ -18,60 +18,33 @@
|
|
|
|
|
|
package org.apache.hadoop.yarn.server.resourcemanager;
|
|
|
|
|
|
-import com.google.common.collect.Maps;
|
|
|
import org.junit.Assert;
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
-import org.apache.hadoop.conf.Configuration;
|
|
|
-import org.apache.hadoop.security.UserGroupInformation;
|
|
|
import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
|
|
|
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest;
|
|
|
-import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
|
|
|
-import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse;
|
|
|
+
|
|
|
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.AllocateRequestPBImpl;
|
|
|
import org.apache.hadoop.yarn.api.records.*;
|
|
|
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
|
|
-import org.apache.hadoop.yarn.event.Dispatcher;
|
|
|
-import org.apache.hadoop.yarn.event.EventHandler;
|
|
|
-import org.apache.hadoop.yarn.event.InlineDispatcher;
|
|
|
-import org.apache.hadoop.yarn.exceptions.InvalidApplicationMasterRequestException;
|
|
|
+import org.apache.hadoop.yarn.exceptions.ApplicationMasterNotRegisteredException;
|
|
|
import org.apache.hadoop.yarn.exceptions.InvalidContainerReleaseException;
|
|
|
-import org.apache.hadoop.yarn.exceptions.YarnException;
|
|
|
-import org.apache.hadoop.yarn.security.AMRMTokenIdentifier;
|
|
|
import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.*;
|
|
|
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AbstractYarnScheduler;
|
|
|
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler;
|
|
|
-import org.apache.hadoop.yarn.server.resourcemanager.ahs.RMApplicationHistoryWriter;
|
|
|
-import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore;
|
|
|
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
|
|
|
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event.RMAppAttemptStatusupdateEvent;
|
|
|
-import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.ContainerAllocationExpirer;
|
|
|
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
|
|
|
-import org.apache.hadoop.yarn.server.resourcemanager.rmapp.MockRMApp;
|
|
|
-
|
|
|
-import org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM;
|
|
|
+
|
|
|
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
|
|
|
import org.junit.BeforeClass;
|
|
|
import org.junit.Test;
|
|
|
-import org.mockito.ArgumentCaptor;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
-import java.nio.ByteBuffer;
|
|
|
-import java.security.PrivilegedExceptionAction;
|
|
|
import java.util.ArrayList;
|
|
|
-import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
-import java.util.concurrent.ConcurrentMap;
|
|
|
|
|
|
import static java.lang.Thread.sleep;
|
|
|
import static org.mockito.Matchers.any;
|
|
|
-import static org.mockito.Matchers.anyList;
|
|
|
-import static org.mockito.Mockito.*;
|
|
|
|
|
|
public class TestApplicationMasterService {
|
|
|
private static final Log LOG = LogFactory.getLog(TestFifoScheduler.class);
|
|
@@ -270,13 +243,17 @@ public class TestApplicationMasterService {
|
|
|
}
|
|
|
Assert.assertNotNull(cause);
|
|
|
Assert
|
|
|
- .assertTrue(cause instanceof InvalidApplicationMasterRequestException);
|
|
|
+ .assertTrue(cause instanceof ApplicationMasterNotRegisteredException);
|
|
|
Assert.assertNotNull(cause.getMessage());
|
|
|
Assert
|
|
|
.assertTrue(cause
|
|
|
.getMessage()
|
|
|
.contains(
|
|
|
"Application Master is trying to unregister before registering for:"));
|
|
|
+
|
|
|
+ am1.registerAppAttempt();
|
|
|
+
|
|
|
+ am1.unregisterAppAttempt(req, false);
|
|
|
} finally {
|
|
|
if (rm != null) {
|
|
|
rm.stop();
|