Esempio n. 1
0
        public void LoadValidInternalTypes(string method1, string method2)
        {
            RetryLogicConfigs cnnCfg = RetryLogicConfigHelper.CreateRandomConfig(method1);
            RetryLogicConfigs cmdCfg = RetryLogicConfigHelper.CreateRandomConfig(method2,
                                                                                 // Doesn't accept DML statements
                                                                                 @"^\b(?!UPDATE|DELETE|TRUNCATE|INSERT( +INTO){0,1})\b");

            // for sake of reducing the retry time in total
            cnnCfg.NumberOfTries = 1;
            cmdCfg.NumberOfTries = 1;

            object loaderObj = RetryLogicConfigHelper.ReturnLoaderAndProviders(cnnCfg, cmdCfg, out SqlRetryLogicBaseProvider cnnProvider, out SqlRetryLogicBaseProvider cmdProvider);

            Assert.NotNull(loaderObj);
            RetryLogicConfigHelper.AssessProvider(cnnProvider, cnnCfg);
            RetryLogicConfigHelper.AssessProvider(cmdProvider, cmdCfg);

            // check the retry in action
            s_connectionCRLTest.ConnectionRetryOpenInvalidCatalogFailed(TcpCnnString, cnnProvider);
            s_commandCRLTest.RetryExecuteFail(TcpCnnString, cmdProvider);
            if (DataTestUtility.IsNotAzureSynapse())
            {
                s_commandCRLTest.RetryExecuteUnauthorizedSqlStatementDML(TcpCnnString, cmdProvider);
            }
        }
Esempio n. 2
0
        public void LoadValidInternalTypesWithoutEnablingSwitch(string method1, string method2)
        {
            bool switchValue         = false;
            RetryLogicConfigs cnnCfg = RetryLogicConfigHelper.CreateRandomConfig(method1);
            RetryLogicConfigs cmdCfg = RetryLogicConfigHelper.CreateRandomConfig(method2, @"Don't care!");

            object loaderObj = RetryLogicConfigHelper.ReturnLoaderAndProviders(cnnCfg, cmdCfg, switchValue, out SqlRetryLogicBaseProvider cnnProvider, out SqlRetryLogicBaseProvider cmdProvider);

            Assert.NotNull(loaderObj);
            RetryLogicConfigHelper.AssessProvider(cnnProvider, cnnCfg, switchValue);
            RetryLogicConfigHelper.AssessProvider(cmdProvider, cmdCfg, switchValue);

            s_connectionCRLTest.DefaultOpenWithoutRetry(TcpCnnString, cnnProvider);
            s_commandCRLTest.NoneRetriableExecuteFail(TcpCnnString, cmdProvider);
        }
Esempio n. 3
0
        public void InvalidRetryLogicTypeWithValidInternalMethodName(string typeName)
        {
            RetryLogicConfigs cnnCfg = RetryLogicConfigHelper.CreateRandomConfig(RetryLogicConfigHelper.RetryMethodName_Fix);

            cnnCfg.RetryLogicType = typeName;
            RetryLogicConfigs cmdCfg = RetryLogicConfigHelper.CreateRandomConfig(RetryLogicConfigHelper.RetryMethodName_Fix);

            // for sake of reducing the retry time in total
            cnnCfg.NumberOfTries = 1;
            cmdCfg.NumberOfTries = 1;

            object loaderObj = RetryLogicConfigHelper.ReturnLoaderAndProviders(cnnCfg, cmdCfg, out SqlRetryLogicBaseProvider cnnProvider, out SqlRetryLogicBaseProvider cmdProvider);

            Assert.NotNull(loaderObj);
            RetryLogicConfigHelper.AssessProvider(cnnProvider, cnnCfg);
            RetryLogicConfigHelper.AssessProvider(cmdProvider, cmdCfg);

            // internal type used to resolve the specified method
            s_connectionCRLTest.ConnectionRetryOpenInvalidCatalogFailed(TcpCnnString, cnnProvider);
            s_commandCRLTest.RetryExecuteFail(TcpCnnString, cmdProvider);
        }