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());
            }
        }
Ejemplo n.º 2
0
        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());
            }
        }
Ejemplo n.º 3
0
        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);
                }
            }
        }
Ejemplo n.º 4
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);
                }
            }
        }
Ejemplo n.º 5
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());
            }
        }
Ejemplo n.º 6
0
        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);
                }
            }
        }
Ejemplo n.º 7
0
        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);
            }
        }
Ejemplo n.º 8
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);
                }
            }
        }
Ejemplo n.º 9
0
        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);
        }