Exemple #1
0
        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 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());
            }
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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());
            }
        }