public virtual void TestNotify_noEntry() { long accepted = SharedCacheUploaderMetrics.GetInstance().GetAcceptedUploads(); SCMUploaderNotifyRequest request = recordFactory.NewRecordInstance <SCMUploaderNotifyRequest >(); request.SetResourceKey("key1"); request.SetFilename("foo.jar"); NUnit.Framework.Assert.IsTrue(proxy.Notify(request).GetAccepted()); ICollection <SharedCacheResourceReference> set = store.GetResourceReferences("key1" ); NUnit.Framework.Assert.IsNotNull(set); NUnit.Framework.Assert.AreEqual(0, set.Count); NUnit.Framework.Assert.AreEqual("NM upload metrics aren't updated.", 1, SharedCacheUploaderMetrics .GetInstance().GetAcceptedUploads() - accepted); }
public virtual void TestUse_ExistingEntry_NoAppIds() { // Pre-populate the SCM with one cache entry store.AddResource("key1", "foo.jar"); long hits = ClientSCMMetrics.GetInstance().GetCacheHits(); UseSharedCacheResourceRequest request = recordFactory.NewRecordInstance <UseSharedCacheResourceRequest >(); request.SetResourceKey("key1"); request.SetAppId(CreateAppId(2, 2L)); // Expecting default depth of 3 and under the shared cache root dir string expectedPath = testDir.GetAbsolutePath() + "/k/e/y/key1/foo.jar"; NUnit.Framework.Assert.AreEqual(expectedPath, clientSCMProxy.Use(request).GetPath ()); NUnit.Framework.Assert.AreEqual(1, store.GetResourceReferences("key1").Count); NUnit.Framework.Assert.AreEqual("Client SCM metrics aren't updated.", 1, ClientSCMMetrics .GetInstance().GetCacheHits() - hits); }