public void PutOnOneCacheGetOnAnotherCache() { var geodeServer = new GeodeServer(); var cacheXml = new CacheXml(new FileInfo("cache.xml"), geodeServer); var cacheFactory = new CacheFactory(); cacheOne = cacheFactory.Create(); cacheOne.InitializeDeclarativeCache(cacheXml.File.FullName); cacheTwo = cacheFactory.Create(); cacheTwo.InitializeDeclarativeCache(cacheXml.File.FullName); var regionForCache1 = cacheOne.GetRegion <string, string>("testRegion1"); var regionForCache2 = cacheTwo.GetRegion <string, string>("testRegion1"); const string key = "hello"; const string expectedResult = "dave"; regionForCache1.Put(key, expectedResult, null); var actualResult = regionForCache2.Get(key, null); Assert.Equal(expectedResult, actualResult); cacheXml.Dispose(); geodeServer.Dispose(); }
public void ConstructAndGenerate() { using (var gfsh = new GfshExecute()) { try { string testDir = CreateTestCaseDirectoryName(); CleanTestCaseDirectory(testDir); Assert.Equal(gfsh.start() .locator() .withDir(testDir) .withHttpServicePort(0) .execute(), 0); var template = new FileInfo("cache.xml"); var cacheXml = new CacheXml(template, gfsh.LocatorPort); Assert.NotNull(cacheXml.File); Assert.True(cacheXml.File.Exists); using (var input = cacheXml.File.OpenText()) { var content = input.ReadToEnd(); Assert.True(content.Contains(gfsh.LocatorPort.ToString())); } } finally { Assert.Equal(gfsh.shutdown() .withIncludeLocators(true) .execute(), 0); } } }
public void ConstructAndGenerate() { using (var gfs = new GeodeServer()) { var template = new FileInfo("cache.xml"); var cacheXml = new CacheXml(template, gfs); Assert.NotNull(cacheXml.File); Assert.True(cacheXml.File.Exists); using (var input = cacheXml.File.OpenText()) { var content = input.ReadToEnd(); Assert.True(content.Contains(gfs.LocatorPort.ToString())); } } }
public void ConstructAndGenerate() { string testDir = CreateTestCaseDirectoryName(); CleanTestCaseDirectory(testDir); var template = new FileInfo("cache.xml"); var cacheXml = new CacheXml(template, 1234); Assert.NotNull(cacheXml.File); Assert.True(cacheXml.File.Exists); using (var input = cacheXml.File.OpenText()) { var content = input.ReadToEnd(); Assert.True(content.Contains(1234.ToString())); } }
public void DisposeAndCleanup() { using (var gfs = new GeodeServer()) { FileInfo file; var template = new FileInfo("cache.xml"); using (var cacheXml = new CacheXml(template, gfs)) { Assert.NotNull(cacheXml.File); file = cacheXml.File; Assert.True(file.Exists); } file.Refresh(); // File deletion via File.Delete (inside the file.Refresh() call) // is not synchronous so we need to potentially wait until the file // has been deleted here Assert.True(SpinWait.SpinUntil(() => !file.Exists, 10000)); } }
public void DisposeAndCleanup() { using (var gfsh = new GfshExecute()) { try { var testDir = CreateTestCaseDirectoryName(); CleanTestCaseDirectory(testDir); Assert.Equal(gfsh.start() .locator() .withDir(testDir) .withHttpServicePort(0) .execute(), 0); FileInfo file; var template = new FileInfo("cache.xml"); using (var cacheXml = new CacheXml(template, gfsh.LocatorPort)) { Assert.NotNull(cacheXml.File); file = cacheXml.File; Assert.True(file.Exists); } file.Refresh(); // File deletion via File.Delete (inside the file.Refresh() call) // is not synchronous so we need to potentially wait until the file // has been deleted here Assert.True(SpinWait.SpinUntil(() => !file.Exists, 10000)); } finally { Assert.Equal(gfsh.shutdown() .withIncludeLocators(true) .execute(), 0); } } }
public void DisposeAndCleanup() { var testDir = CreateTestCaseDirectoryName(); CleanTestCaseDirectory(testDir); FileInfo file; var template = new FileInfo("cache.xml"); using (var cacheXml = new CacheXml(template, 1234)) { Assert.NotNull(cacheXml.File); file = cacheXml.File; Assert.True(file.Exists); } file.Refresh(); // File deletion via File.Delete (inside the file.Refresh() call) // is not synchronous so we need to potentially wait until the file // has been deleted here Assert.True(SpinWait.SpinUntil(() => !file.Exists, 10000)); }