示例#1
0
        private Builder ConfigureCloudCluster(string bundlePath)
        {
            if (_addedSsl)
            {
                throw new ArgumentException("SSL options can not be set when a secure connection bundle is provided.");
            }

            if (_addedContactPoints)
            {
                throw new ArgumentException("Contact points can not be set when a secure connection bundle is provided.");
            }

            SecureConnectionBundle bundle;

            try
            {
                bundle = new SecureConnectionBundleParser().ParseBundle(bundlePath);
            }
            catch (Exception ex2)
            {
                throw new InvalidOperationException(
                          "Failed to load or parse the secure connection bundle. See inner exception for more details.", ex2);
            }

            return(ConfigureCloudCluster(bundle));
        }
示例#2
0
        public void Should_ParseBundleCorrectly_When_BundlePathIsProvided()
        {
            var scb = new SecureConnectionBundleParser()
                      .ParseBundle(
                Path.Combine(
                    ((CloudCluster)TestCluster).SniHomeDirectory,
                    "certs",
                    "bundles",
                    "creds-v1.zip"));

            Assert.IsNotNull(scb.CaCert);
            Assert.IsNotNull(scb.ClientCert);
            Assert.IsFalse(string.IsNullOrWhiteSpace(scb.Config.CertificatePassword));
            Assert.IsTrue(scb.ClientCert.HasPrivateKey);
            Assert.AreEqual(30443, scb.Config.Port);
            Assert.AreEqual("localhost", scb.Config.Host);
        }