Exemple #1
0
        public async Task TlsBasicEndToEnd()
        {
            TestCluster testCluster = default;

            try
            {
                var builder = new TestClusterBuilder()
                              .AddSiloBuilderConfigurator <TlsConfigurator>()
                              .AddClientBuilderConfigurator <TlsConfigurator>();

                var certificate = TestCertificateHelper.CreateSelfSignedCertificate(
                    CertificateSubjectName,
                    new[] { TestCertificateHelper.ClientAuthenticationOid, TestCertificateHelper.ServerAuthenticationOid });
                var encodedCertificate = TestCertificateHelper.ConvertToBase64(certificate);
                builder.Properties[CertificateConfigKey] = encodedCertificate;

                testCluster = builder.Build();
                await testCluster.DeployAsync();

                var client = testCluster.Client;

                var grain    = client.GetGrain <IPingGrain>("pingu");
                var expected = "secret chit chat";
                var actual   = await grain.Echo(expected);

                Assert.Equal(expected, actual);
            }
            finally
            {
                await testCluster?.StopAllSilosAsync();

                testCluster?.Dispose();
            }
        }
 public void Dispose()
 {
     try
     {
         hostedCluster?.StopAllSilos();
     }
     finally
     {
         hostedCluster?.Dispose();
         hostedCluster = null;
     }
 }
 public void Dispose()
 {
     try
     {
         testCluster?.StopAllSilos();
     }
     finally
     {
         testCluster?.Dispose();
         testCluster = null;
     }
 }
Exemple #4
0
        public async Task UserVerification_ClusterDown_UserRegisteredWhenRestarted()
        {
            /*
             * Send Registration
             * Assert that the state is pending
             * Switch on verification service
             * Assert that the state is verified
             */

            // Arrange
            await _registrationCluster.WaitForLivenessToStabilizeAsync();

            await _registrationStatusCluster.WaitForLivenessToStabilizeAsync();

            _verificationCluster = _testHelper.GenerateTestCluster <UserVerificationGrain>();
            await _verificationCluster.WaitForLivenessToStabilizeAsync();

            var userRegistrationGrain =
                _registrationCluster.Client.GetGrain <IUserRegistrationGrain>(_faker.Internet.Email());
            var userRegistrationKey =
                await userRegistrationGrain.RegisterAsync(_faker.Random.String2(5), _faker.Random.String2(5));

            await AssertRegistrationState(userRegistrationKey, UserRegistrationStatusEnum.Verified);

            _verificationCluster.Dispose();

            var userRegistrationGrain1 =
                _registrationCluster.Client.GetGrain <IUserRegistrationGrain>(_faker.Internet.Email());
            var userRegistrationKey1 =
                await userRegistrationGrain1.RegisterAsync(_faker.Random.String2(5), _faker.Random.String2(5));

            await AssertRegistrationState(userRegistrationKey1, UserRegistrationStatusEnum.Pending);

            // Act
            // Build Verification Service
            _verificationCluster = _testHelper.GenerateTestCluster <UserVerificationGrain>();
            await _verificationCluster.WaitForLivenessToStabilizeAsync();

            // Assert
            await AssertRegistrationState(userRegistrationKey1, UserRegistrationStatusEnum.Verified);

            await _registrationCluster.StopAllSilosAsync();

            await _registrationStatusCluster.StopAllSilosAsync();

            await _verificationCluster.StopAllSilosAsync();
        }
Exemple #5
0
        public async Task TlsEndToEnd(string[] oids, RemoteCertificateMode certificateMode)
        {
            TestCluster testCluster = default;

            try
            {
                var builder = new TestClusterBuilder()
                              .AddSiloBuilderConfigurator <TlsConfigurator>()
                              .AddClientBuilderConfigurator <TlsConfigurator>();

                var certificate = TestCertificateHelper.CreateSelfSignedCertificate(
                    CertificateSubjectName, oids);

                var encodedCertificate = TestCertificateHelper.ConvertToBase64(certificate);
                builder.Properties[CertificateConfigKey]     = encodedCertificate;
                builder.Properties[ClientCertificateModeKey] = certificateMode.ToString();

                testCluster = builder.Build();
                await testCluster.DeployAsync();

                var client = testCluster.Client;

                var grain    = client.GetGrain <IPingGrain>("pingu");
                var expected = "secret chit chat";
                var actual   = await grain.Echo(expected);

                Assert.Equal(expected, actual);
            }
            finally
            {
                if (testCluster != null)
                {
                    await testCluster.StopAllSilosAsync();

                    testCluster.Dispose();
                }
            }
        }
Exemple #6
0
 public void Dispose()
 {
     cluster?.Dispose();
     cluster = null;
 }
 public void Dispose()
 {
     GlobalConfiguration.ENFORCE_MINIMUM_REQUIREMENT_FOR_AGE_LIMIT = true;
     testCluster?.Dispose();
     testCluster = null;
 }
 public void Dispose()
 {
     host?.Dispose();
 }
Exemple #9
0
 public void Dispose()
 {
     _registrationCluster.Dispose();
     _registrationStatusCluster.Dispose();
     _verificationCluster.Dispose();
 }