namespace GemfireDotNetTest
{
- public class CacheFactoryUnitTests
+ [Collection("Geode .net Core Collection")]
+ public class CacheFactoryUnitTests
{
[Fact]
public void TestCreateFactory()
{
- using (var client = new Client())
+ using (var cacheFactory = CacheFactory.Create())
{
- using (var cacheFactory = CacheFactory.Create())
- {
- Assert.NotNull(cacheFactory);
- }
+ Assert.NotNull(cacheFactory);
}
}
[Fact]
public void TestCacheFactoryGetVersion()
{
- using (var client = new Client())
+ using (var cacheFactory = CacheFactory.Create())
{
- using (var cacheFactory = CacheFactory.Create())
- {
- var version = cacheFactory.Version;
- Assert.NotEqual(version, String.Empty);
- }
+ var version = cacheFactory.Version;
+ Assert.NotEqual(version, String.Empty);
}
}
[Fact]
public void TestCacheFactoryGetProductDescription()
{
- using (var client = new Client())
+ using (var cacheFactory = CacheFactory.Create())
{
- using (var cacheFactory = CacheFactory.Create())
- {
- var description = cacheFactory.ProductDescription;
- Assert.NotEqual(description, String.Empty);
- }
+ var description = cacheFactory.ProductDescription;
+ Assert.NotEqual(description, String.Empty);
}
}
[Fact]
public void TestCacheFactorySetPdxIgnoreUnreadFields()
{
- using (var client = new Client())
+ using (var cacheFactory = CacheFactory.Create())
{
- using (var cacheFactory = CacheFactory.Create())
- {
- cacheFactory.PdxIgnoreUnreadFields = true;
- cacheFactory.PdxIgnoreUnreadFields = false;
- }
+ cacheFactory.PdxIgnoreUnreadFields = true;
+ cacheFactory.PdxIgnoreUnreadFields = false;
}
}
[Fact]
public void TestCacheFactorySetPdxReadSerialized()
{
- using (var client = new Client())
+ using (var cacheFactory = CacheFactory.Create())
{
- using (var cacheFactory = CacheFactory.Create())
- {
- cacheFactory.PdxReadSerialized = true;
- cacheFactory.PdxReadSerialized = false;
- }
+ cacheFactory.PdxReadSerialized = true;
+ cacheFactory.PdxReadSerialized = false;
}
}
[Fact]
public void TestCacheFactoryCreateCache()
{
- using (var client = new Client())
+ using (var cacheFactory = CacheFactory.Create())
{
- using (var cacheFactory = CacheFactory.Create())
+ using (var cache = cacheFactory.CreateCache())
{
- using (var cache = cacheFactory.CreateCache())
- {
- ;
- }
+ ;
}
}
}
[Fact]
public void TestCacheFactorySetProperty()
{
- using (var client = new Client())
+ using (var cacheFactory = CacheFactory.Create())
{
- using (var cacheFactory = CacheFactory.Create())
- {
- cacheFactory.SetProperty("log-level", "none")
- .SetProperty("log-file", "geode_native.log");
- }
+ cacheFactory.SetProperty("log-level", "none")
+ .SetProperty("log-file", "geode_native.log");
}
}
}
namespace GemfireDotNetTest
{
+ [Collection("Geode .net Core Collection")]
public class CacheUnitTests
{
[Fact]
public void TestClientCacheGetPdxReadSerialized()
{
- using (var client = new Client())
+ using var cacheFactory = CacheFactory.Create()
+ .SetProperty("log-level", "debug")
+ .SetProperty("log-file", "TestClientCacheGetPdxReadSerialized.log");
+ try
{
- using (var cacheFactory = CacheFactory.Create()
- .SetProperty("log-level", "debug")
- .SetProperty("log-file", "TestClientCacheGetPdxReadSerialized.log"))
- {
- try
- {
- cacheFactory.PdxReadSerialized = true;
- using (var cache = cacheFactory.CreateCache())
- {
- Assert.True(cache.GetPdxReadSerialized());
- }
+ cacheFactory.PdxReadSerialized = true;
+ using var cache = cacheFactory.CreateCache();
- cacheFactory.PdxReadSerialized = false;
- using (var otherCache = cacheFactory.CreateCache())
- {
- Assert.False(otherCache.GetPdxReadSerialized());
- }
- }
- catch (Exception e)
- {
- Console.WriteLine(e);
- throw;
- }
- }
+ Assert.True(cache.GetPdxReadSerialized());
+
+ cacheFactory.PdxReadSerialized = false;
+ using var otherCache = cacheFactory.CreateCache();
+
+ Assert.False(otherCache.GetPdxReadSerialized());
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine(e);
+ throw;
}
}
[Fact]
public void TestClientCacheGetPdxIgnoreUnreadFields()
{
- using (var client = new Client())
- {
- using (var cacheFactory = CacheFactory.Create()
- .SetProperty("log-level", "none")
- .SetProperty("log-file", "geode_native.log"))
- {
- cacheFactory.PdxIgnoreUnreadFields = true;
- using (var cache = cacheFactory.CreateCache())
- {
- Assert.True(cache.GetPdxIgnoreUnreadFields());
- }
+ using var cacheFactory = CacheFactory.Create()
+ .SetProperty("log-level", "none")
+ .SetProperty("log-file", "geode_native.log");
+ cacheFactory.PdxIgnoreUnreadFields = true;
+ using var cache = cacheFactory.CreateCache();
- cacheFactory.PdxIgnoreUnreadFields = false;
- using (var otherCache = cacheFactory.CreateCache())
- {
- Assert.False(otherCache.GetPdxIgnoreUnreadFields());
- }
- }
- }
+ Assert.True(cache.GetPdxIgnoreUnreadFields());
+
+ cacheFactory.PdxIgnoreUnreadFields = false;
+ using var otherCache = cacheFactory.CreateCache();
+ Assert.False(otherCache.GetPdxIgnoreUnreadFields());
}
[Fact]
public void TestClientCacheGetPoolManager()
{
- using (var client = new Client())
- {
- using (var cacheFactory = CacheFactory.Create()
- .SetProperty("log-level", "none")
- .SetProperty("log-file", "geode_native.log"))
- {
- cacheFactory.PdxIgnoreUnreadFields = true;
- using (var cache = cacheFactory.CreateCache())
- {
- var poolManager = cache.PoolManager;
- poolManager.Dispose();
- }
- }
- }
+ using var cacheFactory = CacheFactory.Create()
+ .SetProperty("log-level", "none")
+ .SetProperty("log-file", "geode_native.log");
+
+ cacheFactory.PdxIgnoreUnreadFields = true;
+ using var cache = cacheFactory.CreateCache();
+ using var poolManager = cache.PoolManager;
}
[Fact]
public void TestClientCacheCreateRegionFactory()
{
- using (var client = new Client())
- {
- using (var cacheFactory = CacheFactory.Create()
- .SetProperty("log-level", "none")
- .SetProperty("log-file", "geode_native.log"))
- {
- cacheFactory.PdxIgnoreUnreadFields = true;
- using (var cache = cacheFactory.CreateCache())
- {
- using (var regionFactory = cache.CreateRegionFactory(RegionShortcut.Proxy))
- {
- ;
- }
- }
- }
- }
+ using var cacheFactory = CacheFactory.Create()
+ .SetProperty("log-level", "none")
+ .SetProperty("log-file", "geode_native.log");
+ cacheFactory.PdxIgnoreUnreadFields = true;
+ using var cache = cacheFactory.CreateCache();
+ using var regionFactory = cache.CreateRegionFactory(RegionShortcut.Proxy);
}
[Fact]
public void TestClientCacheGetName()
{
- using (var client = new Client())
- {
- using (var cacheFactory = CacheFactory.Create()
- .SetProperty("log-level", "none"))
- {
- cacheFactory.PdxIgnoreUnreadFields = true;
- using (var cache = cacheFactory.CreateCache())
- {
- var cacheName = cache.Name;
- Assert.NotEqual(cacheName, String.Empty);
- }
- }
- }
+ using var cacheFactory = CacheFactory.Create()
+ .SetProperty("log-level", "none");
+ cacheFactory.PdxIgnoreUnreadFields = true;
+ using var cache = cacheFactory.CreateCache();
+
+ var cacheName = cache.Name;
+ Assert.NotEqual(cacheName, String.Empty);
}
[Fact]
public void TestClientCacheClose()
{
- using (var client = new Client())
- {
- using (var cacheFactory = CacheFactory.Create()
- .SetProperty("log-level", "none"))
- {
- cacheFactory.PdxIgnoreUnreadFields = true;
- using (var cache = cacheFactory.CreateCache())
- {
- Assert.False(cache.Closed);
- cache.Close();
- Assert.True(cache.Closed);
- }
- }
- }
+ using var cacheFactory = CacheFactory.Create()
+ .SetProperty("log-level", "none");
+ cacheFactory.PdxIgnoreUnreadFields = true;
+ using var cache = cacheFactory.CreateCache();
+
+ Assert.False(cache.Closed);
+ cache.Close();
+ Assert.True(cache.Closed);
}
[Fact]
public void TestClientCacheCloseWithKeepalive()
{
- using (var client = new Client())
- {
- using (var cacheFactory = CacheFactory.Create()
- .SetProperty("log-level", "none"))
- {
- cacheFactory.PdxIgnoreUnreadFields = true;
- using (var cache = cacheFactory.CreateCache())
- {
- Assert.False(cache.Closed);
- cache.Close(true);
- Assert.True(cache.Closed);
+ using var cacheFactory = CacheFactory.Create()
+ .SetProperty("log-level", "none");
+ cacheFactory.PdxIgnoreUnreadFields = true;
+ using var cache = cacheFactory.CreateCache();
+
+ Assert.False(cache.Closed);
+ cache.Close(true);
+ Assert.True(cache.Closed);
- }
+ using var otherCache = cacheFactory.CreateCache();
- using (var otherCache = cacheFactory.CreateCache())
- {
- Assert.False(otherCache.Closed);
- otherCache.Close(false);
- Assert.True(otherCache.Closed);
- }
- }
- }
+ Assert.False(otherCache.Closed);
+ otherCache.Close(false);
+ Assert.True(otherCache.Closed);
}
}
}
--- /dev/null
+using System;
+using Apache.Geode.NetCore;
+using Xunit;
+
+public class NetCoreCollectionFixture : IDisposable
+{
+ public NetCoreCollectionFixture()
+ {
+ client_ = new Client();
+ }
+ public void Dispose()
+ {
+ client_.Dispose();
+ }
+
+ Client client_;
+}
+
+[CollectionDefinition("Geode .net Core Collection")]
+public class NetCoreCollection : ICollectionFixture<NetCoreCollectionFixture>
+{
+}
namespace GemfireDotNetTest
{
- public class ObjectLeakUnitTests
+ [Collection("Geode .net Core Collection")]
+ public class ObjectLeakUnitTests
{
[Fact]
public void TestLeakCacheFactory()
namespace GemfireDotNetTest
{
+ [Collection("Geode .net Core Collection")]
public class PoolFactoryUnitTests
{
[Fact]
public void TestPoolFactoryAddLocator()
{
- using (var client = new Client())
- {
- using (var cacheFactory = CacheFactory.Create()
- .SetProperty("log-level", "none")
- .SetProperty("log-file", "geode_native.log"))
- {
- using (var cache = cacheFactory.CreateCache())
- {
- using (var poolManager = cache.PoolManager)
- {
- using (var poolFactory = poolManager.CreatePoolFactory())
- {
- poolFactory.AddLocator("localhost", 10334);
- }
- }
- }
- }
- }
+ using var cacheFactory = CacheFactory.Create()
+ .SetProperty("log-level", "none")
+ .SetProperty("log-file", "geode_native.log");
+ using var cache = cacheFactory.CreateCache();
+ using var poolManager = cache.PoolManager;
+ using var poolFactory = poolManager.CreatePoolFactory();
+
+ poolFactory.AddLocator("localhost", 10334);
}
[Fact]
public void TestPoolFactoryCreatePool()
{
- using (var client = new Client())
- {
- using (var cacheFactory = CacheFactory.Create()
- .SetProperty("log-level", "none")
- .SetProperty("log-file", "geode_native.log"))
- {
- using (var cache = cacheFactory.CreateCache())
- {
- using (var poolManager = cache.PoolManager)
- {
- using (var poolFactory = poolManager.CreatePoolFactory())
- {
- poolFactory.AddLocator("localhost", 10334);
- using (var pool = poolFactory.CreatePool("myPool"))
- {
- ;
- }
- }
- }
- }
- }
- }
+ using var cacheFactory = CacheFactory.Create()
+ .SetProperty("log-level", "none")
+ .SetProperty("log-file", "geode_native.log");
+ using var cache = cacheFactory.CreateCache();
+ using var poolManager = cache.PoolManager;
+ using var poolFactory = poolManager.CreatePoolFactory();
+
+ poolFactory.AddLocator("localhost", 10334);
+ using var pool = poolFactory.CreatePool("myPool");
}
[Fact]
public void TestCreatePoolWithoutPoolManager()
{
- using (var client = new Client())
- {
- using (var cacheFactory = CacheFactory.Create())
- {
- using (var cache = cacheFactory.CreateCache())
- {
- using (var poolFactory = cache.PoolFactory)
- {
- poolFactory.AddLocator("localhost", 10334);
- using (var pool = poolFactory.CreatePool("myPool"))
- {
- }
- }
- }
- }
- }
+ using var cacheFactory = CacheFactory.Create();
+ using var cache = cacheFactory.CreateCache();
+ using var poolFactory = cache.PoolFactory;
+
+ poolFactory.AddLocator("localhost", 10334);
+ using var pool = poolFactory.CreatePool("myPool");
}
- }
+ }
}
namespace GemfireDotNetTest
{
+ [Collection("Geode .net Core Collection")]
public class PoolManagerUnitTests
{
[Fact]
public void TestPoolManagerCreatePoolFactory()
{
- using (var client = new Client())
- {
- using (var cacheFactory = CacheFactory.Create())
- {
- using (var cache = cacheFactory.CreateCache())
- {
- using (var poolManager = cache.PoolManager)
- {
- using (var poolFactory = poolManager.CreatePoolFactory())
- {
- }
- }
- }
- }
- }
+ using var cacheFactory = CacheFactory.Create();
+ using var cache = cacheFactory.CreateCache();
+ using var poolManager = cache.PoolManager;
+ using var poolFactory = poolManager.CreatePoolFactory();
}
}
}
}
}
+
+ [Collection("Geode .net Core Collection")]
public class RegionFactoryUnitTests
{
private const string Username1 = "rtimmons";
private void createPool(IGeodeCache cache, int port)
{
- using (var poolManager = cache.PoolManager)
- {
- using (var poolFactory = poolManager.CreatePoolFactory()
- .AddLocator("localhost", port))
- {
- using (var pool = poolFactory.CreatePool("myPool"))
- {
- ;
- }
- }
- }
+ using var poolManager = cache.PoolManager;
+ using var poolFactory = poolManager.CreatePoolFactory()
+ .AddLocator("localhost", port);
+ using var pool = poolFactory.CreatePool("myPool");
}
private void doPutsAndGets(Region region)
private void CreateRegionAndDoWork(IGeodeCache cache, string regionName, RegionShortcut regionType)
{
- using (var regionFactory = cache.CreateRegionFactory(regionType))
- {
- using (var region = regionFactory.CreateRegion(regionName))
- {
- doPutsAndGets(region);
- DoRemoves(region);
- }
- }
+ using var regionFactory = cache.CreateRegionFactory(regionType);
+ using var region = regionFactory.CreateRegion(regionName);
+
+ doPutsAndGets(region);
+ DoRemoves(region);
}
[Fact]
public void TestRegionFactoryCreateProxyRegion()
{
- using (var client = new Client())
- {
- using (var cacheFactory = CacheFactory.Create()
- .SetProperty("log-level", "none")
- .SetProperty("log-file", "geode_native.log"))
- {
- using (var cache = cacheFactory.CreateCache())
- {
- createPool(cache, 10334);
- CreateRegionAndDoWork(cache, "exampleRegion", RegionShortcut.Proxy);
- }
- }
- }
+ using var cacheFactory = CacheFactory.Create()
+ .SetProperty("log-level", "none")
+ .SetProperty("log-file", "geode_native.log");
+ using var cache = cacheFactory.CreateCache();
+
+ createPool(cache, 10334);
+ CreateRegionAndDoWork(cache, "exampleRegion", RegionShortcut.Proxy);
}
[Fact]
public void TestRegionFactoryCreateRegionWithAuthentication()
{
- using (var client = new Client())
- {
- using (var cacheFactory = CacheFactory.Create()
- .SetProperty("log-level", "debug")
- .SetProperty("log-file", "geode_native_with_auth.log"))
- {
- cacheFactory.AuthInitialize = new SimpleAuthInitialize();
- using (var cache = cacheFactory.CreateCache())
- {
- createPool(cache, 10335);
- CreateRegionAndDoWork(cache, "authExampleRegion", RegionShortcut.CachingProxy);
- }
- }
- }
+ using var cacheFactory = CacheFactory.Create()
+ .SetProperty("log-level", "debug")
+ .SetProperty("log-file", "geode_native_with_auth.log");
+ cacheFactory.AuthInitialize = new SimpleAuthInitialize();
+ using var cache = cacheFactory.CreateCache();
+
+ createPool(cache, 10335);
+ CreateRegionAndDoWork(cache, "authExampleRegion", RegionShortcut.CachingProxy);
}
}
}
{
"methodDisplay": "classAndMethod",
"parallelizeAssembly": true,
- "parallelizeTestCollections": false
-}
+ "parallelizeTestCollections": true
+}
\ No newline at end of file