예제 #1
0
 public virtual void TestNMTokenSecretManagerCleanup()
 {
     TestApplication.WrappedApplication wa = null;
     try
     {
         wa = new TestApplication.WrappedApplication(this, 1, 314159265358979L, "yak", 1);
         wa.InitApplication();
         wa.InitContainer(0);
         NUnit.Framework.Assert.AreEqual(ApplicationState.Initing, wa.app.GetApplicationState
                                             ());
         NUnit.Framework.Assert.AreEqual(1, wa.app.GetContainers().Count);
         wa.AppFinished();
         wa.ContainerFinished(0);
         wa.AppResourcesCleanedup();
         NUnit.Framework.Assert.AreEqual(ApplicationState.Finished, wa.app.GetApplicationState
                                             ());
         Org.Mockito.Mockito.Verify(wa.nmTokenSecretMgr).AppFinished(Matchers.Eq(wa.appId)
                                                                     );
     }
     finally
     {
         if (wa != null)
         {
             wa.Finished();
         }
     }
 }
예제 #2
0
 public virtual void TestAppFinishedOnCompletedContainers()
 {
     TestApplication.WrappedApplication wa = null;
     try
     {
         wa = new TestApplication.WrappedApplication(this, 5, 314159265358979L, "yak", 3);
         wa.InitApplication();
         wa.InitContainer(-1);
         NUnit.Framework.Assert.AreEqual(ApplicationState.Initing, wa.app.GetApplicationState
                                             ());
         wa.ApplicationInited();
         NUnit.Framework.Assert.AreEqual(ApplicationState.Running, wa.app.GetApplicationState
                                             ());
         Org.Mockito.Mockito.Reset(wa.localizerBus);
         wa.ContainerFinished(0);
         wa.ContainerFinished(1);
         wa.ContainerFinished(2);
         NUnit.Framework.Assert.AreEqual(ApplicationState.Running, wa.app.GetApplicationState
                                             ());
         NUnit.Framework.Assert.AreEqual(0, wa.app.GetContainers().Count);
         wa.AppFinished();
         NUnit.Framework.Assert.AreEqual(ApplicationState.ApplicationResourcesCleaningup,
                                         wa.app.GetApplicationState());
         Org.Mockito.Mockito.Verify(wa.localizerBus).Handle(Matchers.RefEq(new ApplicationLocalizationEvent
                                                                               (LocalizationEventType.DestroyApplicationResources, wa.app)));
         wa.AppResourcesCleanedup();
         foreach (Org.Apache.Hadoop.Yarn.Server.Nodemanager.Containermanager.Container.Container
                  container in wa.containers)
         {
             ContainerTokenIdentifier identifier = wa.GetContainerTokenIdentifier(container.GetContainerId
                                                                                      ());
             WaitForContainerTokenToExpire(identifier);
             NUnit.Framework.Assert.IsTrue(wa.context.GetContainerTokenSecretManager().IsValidStartContainerRequest
                                               (identifier));
         }
         NUnit.Framework.Assert.AreEqual(ApplicationState.Finished, wa.app.GetApplicationState
                                             ());
     }
     finally
     {
         if (wa != null)
         {
             wa.Finished();
         }
     }
 }
예제 #3
0
 //TODO Re-work after Application transitions are changed.
 //  @Test
 public virtual void TestAppFinishedOnIniting()
 {
     // AM may send a startContainer() - AM APP_FINIHSED processed after
     // APP_FINISHED on another NM
     TestApplication.WrappedApplication wa = null;
     try
     {
         wa = new TestApplication.WrappedApplication(this, 1, 314159265358979L, "yak", 3);
         wa.InitApplication();
         wa.InitContainer(0);
         NUnit.Framework.Assert.AreEqual(ApplicationState.Initing, wa.app.GetApplicationState
                                             ());
         NUnit.Framework.Assert.AreEqual(1, wa.app.GetContainers().Count);
         Org.Mockito.Mockito.Reset(wa.localizerBus);
         wa.AppFinished();
         Org.Mockito.Mockito.Verify(wa.containerBus).Handle(Matchers.ArgThat(new TestApplication.ContainerKillMatcher
                                                                                 (this, wa.containers[0].GetContainerId())));
         NUnit.Framework.Assert.AreEqual(ApplicationState.FinishingContainersWait, wa.app.
                                         GetApplicationState());
         wa.ContainerFinished(0);
         NUnit.Framework.Assert.AreEqual(ApplicationState.ApplicationResourcesCleaningup,
                                         wa.app.GetApplicationState());
         Org.Mockito.Mockito.Verify(wa.localizerBus).Handle(Matchers.RefEq(new ApplicationLocalizationEvent
                                                                               (LocalizationEventType.DestroyApplicationResources, wa.app)));
         wa.InitContainer(1);
         NUnit.Framework.Assert.AreEqual(ApplicationState.ApplicationResourcesCleaningup,
                                         wa.app.GetApplicationState());
         NUnit.Framework.Assert.AreEqual(0, wa.app.GetContainers().Count);
         wa.AppResourcesCleanedup();
         NUnit.Framework.Assert.AreEqual(ApplicationState.Finished, wa.app.GetApplicationState
                                             ());
     }
     finally
     {
         if (wa != null)
         {
             wa.Finished();
         }
     }
 }
예제 #4
0
 //TODO Re-work after Application transitions are changed.
 //  @Test
 public virtual void TestStartContainerAfterAppFinished()
 {
     TestApplication.WrappedApplication wa = null;
     try
     {
         wa = new TestApplication.WrappedApplication(this, 5, 314159265358979L, "yak", 3);
         wa.InitApplication();
         wa.InitContainer(-1);
         NUnit.Framework.Assert.AreEqual(ApplicationState.Initing, wa.app.GetApplicationState
                                             ());
         wa.ApplicationInited();
         NUnit.Framework.Assert.AreEqual(ApplicationState.Running, wa.app.GetApplicationState
                                             ());
         Org.Mockito.Mockito.Reset(wa.localizerBus);
         wa.ContainerFinished(0);
         wa.ContainerFinished(1);
         wa.ContainerFinished(2);
         NUnit.Framework.Assert.AreEqual(ApplicationState.Running, wa.app.GetApplicationState
                                             ());
         NUnit.Framework.Assert.AreEqual(0, wa.app.GetContainers().Count);
         wa.AppFinished();
         NUnit.Framework.Assert.AreEqual(ApplicationState.ApplicationResourcesCleaningup,
                                         wa.app.GetApplicationState());
         Org.Mockito.Mockito.Verify(wa.localizerBus).Handle(Matchers.RefEq(new ApplicationLocalizationEvent
                                                                               (LocalizationEventType.DestroyApplicationResources, wa.app)));
         wa.AppResourcesCleanedup();
         NUnit.Framework.Assert.AreEqual(ApplicationState.Finished, wa.app.GetApplicationState
                                             ());
     }
     finally
     {
         if (wa != null)
         {
             wa.Finished();
         }
     }
 }