public virtual void TestRelease()
 {
     // Release does not care about the return value because it is empty
     Org.Mockito.Mockito.When(cProtocol.Release(Matchers.IsA <ReleaseSharedCacheResourceRequest
                                                              >())).ThenReturn(null);
     client.Release(Org.Mockito.Mockito.Mock <ApplicationId>(), "key");
 }
Example #2
0
        public virtual void TestRelease_ExistingEntry_NonExistantAppId()
        {
            // Pre-populate the SCM with one cache entry
            store.AddResource("key1", "foo.jar");
            store.AddResourceReference("key1", new SharedCacheResourceReference(CreateAppId(1
                                                                                            , 1L), "user"));
            NUnit.Framework.Assert.AreEqual(1, store.GetResourceReferences("key1").Count);
            long releases = ClientSCMMetrics.GetInstance().GetCacheReleases();
            ReleaseSharedCacheResourceRequest request = recordFactory.NewRecordInstance <ReleaseSharedCacheResourceRequest
                                                                                         >();

            request.SetResourceKey("key1");
            request.SetAppId(CreateAppId(2, 2L));
            clientSCMProxy.Release(request);
            NUnit.Framework.Assert.AreEqual(1, store.GetResourceReferences("key1").Count);
            NUnit.Framework.Assert.AreEqual("Client SCM metrics were updated when a release did not happen"
                                            , 0, ClientSCMMetrics.GetInstance().GetCacheReleases() - releases);
        }
        /// <exception cref="Com.Google.Protobuf.ServiceException"/>
        public virtual YarnServiceProtos.ReleaseSharedCacheResourceResponseProto Release(
            RpcController controller, YarnServiceProtos.ReleaseSharedCacheResourceRequestProto
            proto)
        {
            ReleaseSharedCacheResourceRequestPBImpl request = new ReleaseSharedCacheResourceRequestPBImpl
                                                                  (proto);

            try
            {
                ReleaseSharedCacheResourceResponse response = real.Release(request);
                return(((ReleaseSharedCacheResourceResponsePBImpl)response).GetProto());
            }
            catch (YarnException e)
            {
                throw new ServiceException(e);
            }
            catch (IOException e)
            {
                throw new ServiceException(e);
            }
        }