public void StartServerStringsTest() { var Gfsh = new GfshExecute(output); var currentDir = Environment.CurrentDirectory; var server = Gfsh .start() .server(); var s = server.ToString(); Assert.Equal("start server", s); server = Gfsh .start() .server() .withName("server") .withDir("someDir") .withBindAddress("someAddress") .withPort(1234) .withLocators("someLocator") .withLogLevel("debug") .withMaxHeap("1.21gigabytes") .withSslEnableComponents("server,locator,jmx") .withSslKeyStore("some/path/keystore.jks") .withSslKeyStorePassword("password1") .withSslTrustStore("some/path/truststore.jks") .withSslTrustStorePassword("password2"); s = server.ToString(); Assert.Equal("start server --name=server " + "--dir=someDir --bind-address=someAddress --server-port=1234 --locators=someLocator --log-level=debug " + "--max-heap=1.21gigabytes --J=-Dgemfire.ssl-enabled-components=server,locator,jmx " + "--J=-Dgemfire.ssl-keystore=some/path/keystore.jks --J=-Dgemfire.ssl-keystore-password=password1 " + "--J=-Dgemfire.ssl-truststore=some/path/truststore.jks --J=-Dgemfire.ssl-truststore-password=password2", s); }
public void Start1Locator1ServerWithSSL() { var gfsh = new GfshExecute(output); var testDir = CreateTestCaseDirectoryName(); CleanTestCaseDirectory(testDir); var sslPassword = "******"; var keystore = Config.SslServerKeyPath + @"/server_keystore_chained.jks"; var truststore = Config.SslServerKeyPath + @"/server_truststore_chained_root.jks"; var jmxManagerPort = Framework.FreeTcpPort(); try { Assert.Equal(0, gfsh .start() .locator() .withDir(testDir) .withHttpServicePort(0) .withPort(Framework.FreeTcpPort()) .withJmxManagerPort(jmxManagerPort) .withJmxManagerStart(true) .withSslEnableComponents("locator,jmx") .withSslKeyStore(keystore) .withSslKeyStorePassword(sslPassword) .withSslTrustStore(truststore) .withSslTrustStorePassword(sslPassword) .withConnect(false) .execute()); Assert.Equal(0, gfsh .connect() .withJmxManager("localhost", jmxManagerPort) .withUseSsl(true) .withKeyStore(keystore) .withKeyStorePassword(sslPassword) .withTrustStore(truststore) .withTrustStorePassword(sslPassword) .execute()); Assert.Equal(0, gfsh .start() .server() .withDir(testDir + "/server/0") .withPort(0) .withSslEnableComponents("server,locator,jmx") .withSslKeyStore(keystore) .withSslKeyStorePassword(sslPassword) .withSslTrustStore(truststore) .withSslTrustStorePassword(sslPassword) .execute()); } finally { Assert.Equal(0, gfsh .shutdown() .withIncludeLocators(true) .execute()); } }
public void Start1Locator1Server() { var gfsh = new GfshExecute(output); var testDir = CreateTestCaseDirectoryName(); CleanTestCaseDirectory(testDir); try { Assert.Equal(0, gfsh.start() .locator() .withDir(testDir) .withHttpServicePort(0) .withPort(Framework.FreeTcpPort()) .withJmxManagerPort(Framework.FreeTcpPort()) .execute()); Assert.Equal(0, gfsh.start() .server() .withDir(testDir + "/server/0") .withPort(0) .execute()); } finally { Assert.Equal(0, gfsh .shutdown() .withIncludeLocators(true) .execute()); } }
public void StartLocatorStringsTest() { var Gfsh = new GfshExecute(output); var locator = Gfsh .start() .locator(); var s = locator.ToString(); Assert.Equal("start locator", s); locator = Gfsh .start() .locator() .withName("name") .withDir("dir") .withBindAddress("address") .withPort(420) .withJmxManagerPort(1111) .withHttpServicePort(2222) .withLogLevel("fine") .withMaxHeap("someHugeAmount") .withConnect(false) .withSslEnableComponents("locator,jmx") .withSslKeyStore("some/path/keystore.jks") .withSslKeyStorePassword("password1") .withSslTrustStore("some/path/truststore.jks") .withSslTrustStorePassword("password2"); s = locator.ToString(); Assert.Equal("start locator --name=name --dir=dir --bind-address=address --port=420 " + "--J=-Dgemfire.jmx-manager-port=1111 --http-service-port=2222 --log-level=fine --max-heap=someHugeAmount " + "--connect=false --J=-Dgemfire.ssl-enabled-components=locator,jmx " + "--J=-Dgemfire.ssl-keystore=some/path/keystore.jks --J=-Dgemfire.ssl-keystore-password=password1 " + "--J=-Dgemfire.ssl-truststore=some/path/truststore.jks --J=-Dgemfire.ssl-truststore-password=password2", s); }
public void ConnectStringsTest() { var Gfsh = new GfshExecute(); var currentDir = Environment.CurrentDirectory; Gfsh.Keystore = "some/path/keystore.jks"; Gfsh.KeystorePassword = "******"; Gfsh.Truststore = "some/path/truststore.jks"; Gfsh.TruststorePassword = "******"; var connect = Gfsh .connect(); var s = connect.ToString(); Assert.Equal(s, "connect"); connect = Gfsh .connect() .withJmxManager("localhost", 1234) .withUseSsl(); s = connect.ToString(); Assert.Equal(s, "connect --jmx-manager=localhost[1234] --use-ssl " + "--key-store=some/path/keystore.jks --key-store-password=password " + "--trust-store=some/path/truststore.jks --trust-store-password=password"); }
public void GfshExecuteStartTwoServersTest() { using (var gfsh1 = new GfshExecute()) { var testDir = CreateTestCaseDirectoryName(); CleanTestCaseDirectory(testDir); try { Assert.Equal(gfsh1.start() .locator() .withDir(testDir) .withHttpServicePort(0) .execute(), 0); Assert.Equal(gfsh1.start() .server() .withDir(testDir + "/server/0") .withPort(0) .execute(), 0); Assert.Equal(gfsh1.start() .server() .withDir(testDir + "/server/1") .withPort(0) .execute(), 0); } finally { Assert.Equal(gfsh1.shutdown() .withIncludeLocators(true) .execute(), 0); } } }
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 Cluster(ITestOutputHelper output, string name, int locatorCount, int serverCount) { started_ = false; Gfsh = new GfshExecute(output); UseSSL = false; name_ = name; locatorCount_ = locatorCount; serverCount_ = serverCount; locators_ = new List <Locator>(); }
public Cluster(string name, int locatorCount, int serverCount) { started_ = false; Gfsh = new GfshExecute(); UseSSL = false; name_ = name; locatorCount_ = locatorCount; serverCount_ = serverCount; locators_ = new List <Locator>(); servers_ = new List <Server>(); }
public void Start1LocatorWithSSL() { var gfsh = new GfshExecute(output); var testDir = CreateTestCaseDirectoryName(); CleanTestCaseDirectory(testDir); var sslPassword = "******"; var currentDir = Environment.CurrentDirectory; var keystore = currentDir + @"\ServerSslKeys\server_keystore.jks"; var truststore = currentDir + @"\ServerSslKeys\server_truststore.jks"; var jmxManagerPort = Framework.FreeTcpPort(); try { Assert.Equal(0, gfsh .start() .locator() .withDir(testDir) .withHttpServicePort(0) .withPort(Framework.FreeTcpPort()) .withJmxManagerPort(jmxManagerPort) .withJmxManagerStart(true) .withSslEnableComponents("locator,jmx") .withSslKeyStore(keystore) .withSslKeyStorePassword(sslPassword) .withSslTrustStore(truststore) .withSslTrustStorePassword(sslPassword) .withConnect(false) .execute()); Assert.Equal(0, gfsh .connect() .withJmxManager("localhost", jmxManagerPort) .withUseSsl(true) .withKeyStore(keystore) .withKeyStorePassword(sslPassword) .withTrustStore(truststore) .withTrustStorePassword(sslPassword) .execute()); } finally { Assert.Equal(0, gfsh .shutdown() .withIncludeLocators(true) .execute()); } }
public void StopLocatorStringsTest() { var locator = new GfshExecute() .stop() .locator(); var s = locator.ToString(); Assert.True(s.Equals("stop locator")); locator = new GfshExecute().stop().locator() .withName("name") .withDir("dir"); s = locator.ToString(); Assert.True(s.Equals("stop locator --name=name --dir=dir")); }
public void StopServerStringsTest() { var server = new GfshExecute() .stop() .server(); var s = server.ToString(); Assert.True(s.Equals("stop server")); server = new GfshExecute() .stop() .server() .withName("server") .withDir("someDir"); s = server.ToString(); Assert.True(s.Equals("stop server --name=server --dir=someDir")); }
public void CreateRegionStringsTest() { var region = new GfshExecute() .create() .region(); var s = region.ToString(); Assert.True(s.Equals("create region")); region = new GfshExecute() .create() .region() .withName("region") .withType("PARTITION"); s = region.ToString(); Assert.True(s.Equals("create region --name=region --type=PARTITION")); }
public void GfshExecuteStartLocatorAndServerWithUseSslTest() { using (var gfsh = new GfshExecute()) { var testDir = CreateTestCaseDirectoryName(); CleanTestCaseDirectory(testDir); var sslPassword = "******"; var currentDir = Environment.CurrentDirectory; gfsh.Keystore = currentDir + "/ServerSslKeys/server_keystore.jks"; gfsh.KeystorePassword = sslPassword; gfsh.Truststore = currentDir + "/ServerSslKeys/server_truststore.jks"; gfsh.TruststorePassword = sslPassword; gfsh.UseSSL = true; try { Assert.Equal(gfsh .start() .locator() .withDir(testDir) .withHttpServicePort(0) .withUseSsl() .withConnect(false) .execute(), 0); Assert.Equal(gfsh .start() .server() .withDir(testDir + "/server/0") .withPort(0) .withUseSsl() .execute(), 0); } finally { Assert.Equal(gfsh .shutdown() .withIncludeLocators(true) .execute(), 0); } } }
public void ConfigurePdxStringsTest() { var configurePdx = new GfshExecute() .configurePdx(); var s = configurePdx.ToString(); Assert.Equal(s, "configure pdx"); configurePdx = new GfshExecute() .configurePdx() .withReadSerialized(true); s = configurePdx.ToString(); Assert.Equal(s, "configure pdx --read-serialized=true"); configurePdx = new GfshExecute() .configurePdx() .withReadSerialized(false); s = configurePdx.ToString(); Assert.Equal(s, "configure pdx --read-serialized=false"); }
public void ShutdownStringsTest() { var shutdown = new GfshExecute() .shutdown(); var s = shutdown.ToString(); Assert.True(s.Equals("shutdown")); shutdown = new GfshExecute() .shutdown() .withIncludeLocators(true); s = shutdown.ToString(); Assert.True(s.Equals("shutdown --include-locators=true")); shutdown = new GfshExecute() .shutdown() .withIncludeLocators(false); s = shutdown.ToString(); Assert.True(s.Equals("shutdown --include-locators=false")); }
public void GfshExecuteStartLocatorAndVerifyPortTest() { using (var gfsh = new GfshExecute()) { var testDir = CreateTestCaseDirectoryName(); CleanTestCaseDirectory(testDir); Assert.Equal(gfsh.start() .locator() .withDir(testDir) .withHttpServicePort(0) .execute(), 0); Assert.NotEqual(0, gfsh.LocatorPort); Assert.Equal(gfsh.shutdown() .withIncludeLocators(true) .execute(), 0); } }
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 StartLocatorStringsTest() { var Gfsh = new GfshExecute(); var currentDir = Environment.CurrentDirectory; Gfsh.Keystore = "some/path/keystore.jks"; Gfsh.KeystorePassword = "******"; Gfsh.Truststore = "some/path/truststore.jks"; Gfsh.TruststorePassword = "******"; var locator = Gfsh .start() .locator(); var s = locator.ToString(); Assert.True(s.Equals("start locator")); locator = Gfsh .start() .locator() .withName("name") .withDir("dir") .withBindAddress("address") .withPort(420) .withJmxManagerPort(1111) .withHttpServicePort(2222) .withLogLevel("fine") .withMaxHeap("someHugeAmount") .withConnect(false) .withUseSsl(); s = locator.ToString(); Assert.Equal(s, "start locator --name=name --dir=dir " + "--http-service-port=2222 --log-level=fine --max-heap=someHugeAmount " + "--connect=false --J=-Dgemfire.ssl-enabled-components=locator,jmx " + "--J=-Dgemfire.ssl-keystore=some/path/keystore.jks --J=-Dgemfire.ssl-keystore-password=password " + "--J=-Dgemfire.ssl-truststore=some/path/truststore.jks --J=-Dgemfire.ssl-truststore-password=password"); }
public void ConnectStringsTest() { var Gfsh = new GfshExecute(output); var connect = Gfsh .connect(); var s = connect.ToString(); Assert.Equal(s, "connect"); connect = Gfsh .connect() .withJmxManager("localhost", 1234) .withUseSsl(true) .withKeyStore("some/path/keystore.jks") .withKeyStorePassword("password1") .withTrustStore("some/path/truststore.jks") .withTrustStorePassword("password2"); s = connect.ToString(); Assert.Equal("connect --jmx-manager=localhost[1234] --use-ssl=true " + "--key-store=some/path/keystore.jks --key-store-password=password1 " + "--trust-store=some/path/truststore.jks --trust-store-password=password2", s); }
public void InstantiateGfshClassesTest() { var gfsh = new GfshExecute(); var start = gfsh.start(); Assert.NotNull(start); var stop = gfsh.stop(); Assert.NotNull(stop); var create = gfsh.create(); Assert.NotNull(create); var shutdown = gfsh.shutdown(); Assert.NotNull(shutdown); var configurePdx = gfsh.configurePdx(); Assert.NotNull(configurePdx); }