Ejemplo n.º 1
0
        public virtual void TestRunCleanerTaskCLI()
        {
            string[] args = new string[] { "-runCleanerTask" };
            RunSharedCacheCleanerTaskResponse rp = new RunSharedCacheCleanerTaskResponsePBImpl
                                                       ();

            rp.SetAccepted(true);
            Org.Mockito.Mockito.When(mockAdmin.RunCleanerTask(Matchers.IsA <RunSharedCacheCleanerTaskRequest
                                                                            >())).ThenReturn(rp);
            NUnit.Framework.Assert.AreEqual(0, adminCLI.Run(args));
            rp.SetAccepted(false);
            Org.Mockito.Mockito.When(mockAdmin.RunCleanerTask(Matchers.IsA <RunSharedCacheCleanerTaskRequest
                                                                            >())).ThenReturn(rp);
            NUnit.Framework.Assert.AreEqual(1, adminCLI.Run(args));
            Org.Mockito.Mockito.Verify(mockAdmin, Org.Mockito.Mockito.Times(2)).RunCleanerTask
                (Matchers.Any <RunSharedCacheCleanerTaskRequest>());
        }
Ejemplo n.º 2
0
        public virtual void TestRunCleanerTask()
        {
            Org.Mockito.Mockito.DoNothing().When(cleaner).RunCleanerTask();
            RunSharedCacheCleanerTaskRequest request = recordFactory.NewRecordInstance <RunSharedCacheCleanerTaskRequest
                                                                                        >();
            RunSharedCacheCleanerTaskResponse response = SCMAdminProxy.RunCleanerTask(request
                                                                                      );

            NUnit.Framework.Assert.IsTrue("cleaner task request isn't accepted", response.GetAccepted
                                              ());
            Org.Mockito.Mockito.Verify(service, Org.Mockito.Mockito.Times(1)).RunCleanerTask(
                Matchers.Any <RunSharedCacheCleanerTaskRequest>());
        }
Ejemplo n.º 3
0
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        /// <exception cref="System.IO.IOException"/>
        private int RunCleanerTask()
        {
            // run cleaner task right away
            SCMAdminProtocol scmAdminProtocol        = CreateSCMAdminProtocol();
            RunSharedCacheCleanerTaskRequest request = recordFactory.NewRecordInstance <RunSharedCacheCleanerTaskRequest
                                                                                        >();
            RunSharedCacheCleanerTaskResponse response = scmAdminProtocol.RunCleanerTask(request
                                                                                         );

            if (response.GetAccepted())
            {
                System.Console.Out.WriteLine("request accepted by shared cache manager");
                return(0);
            }
            else
            {
                System.Console.Out.WriteLine("request rejected by shared cache manager");
                return(1);
            }
        }
Ejemplo n.º 4
0
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServiceProtos.RunSharedCacheCleanerTaskResponseProto RunCleanerTask
            (RpcController controller, YarnServiceProtos.RunSharedCacheCleanerTaskRequestProto
            proto)
        {
            RunSharedCacheCleanerTaskRequestPBImpl request = new RunSharedCacheCleanerTaskRequestPBImpl
                                                                 (proto);

            try
            {
                RunSharedCacheCleanerTaskResponse response = real.RunCleanerTask(request);
                return(((RunSharedCacheCleanerTaskResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }