예제 #1
0
        /// <summary>
        /// Uploads the specified file to the specified Blob container.
        /// </summary>
        /// <param name="storageSvcClient">A <see cref="CloudBlobClient"/>.</param>
        /// <param name="containerName">The name of the blob storage container to which the file should be uploaded.</param>
        /// <param name="filePath">The full path to the file to upload to Storage.</param>
        /// <returns>A ResourceFile instance representing the file within blob storage.</returns>



        /// <summary>
        /// Gets a string array for all of the target DB override settings
        /// </summary>
        /// <param name="multiDBFileName"></param>
        /// <returns></returns>
        private static string[] GetTargetConfigValues(string multiDBFileName)
        {
            MultiDbData multiDb;

            string[] errorMessages;
            int      valRet = Validation.ValidateAndLoadMultiDbData(multiDBFileName, null, out multiDb, out errorMessages);
            string   cfg    = MultiDbHelper.ConvertMultiDbDataToTextConfig(multiDb);

            return(cfg.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries));
        }
예제 #2
0
        public void ConvertMultiDbDataToTextConfigTest()
        {
            DbOverrideSequence sequenceA = new DbOverrideSequence();

            sequenceA.Add("1", new DatabaseOverride("default1", "override1"));
            sequenceA.Add("2", new DatabaseOverride("default2", "override2"));
            sequenceA.Add("0", new DatabaseOverride("default0", "override0"));

            DatabaseOverride        ovrX   = new DatabaseOverride("defaultX", "overrideX");
            DatabaseOverride        ovrY   = new DatabaseOverride("defaultY", "overrideY");
            List <DatabaseOverride> lstOvr = new List <DatabaseOverride>();

            lstOvr.Add(ovrX);
            lstOvr.Add(ovrY);
            sequenceA.Add("M", lstOvr);

            ServerData serverA = new ServerData();

            serverA.OverrideSequence = sequenceA;
            serverA.ServerName       = "ServerA";

            DbOverrideSequence sequenceB = new DbOverrideSequence();

            sequenceB.Add("6", new DatabaseOverride("default6", "override6"));
            sequenceB.Add("7", new DatabaseOverride("default7", "override7"));
            sequenceB.Add("5", new DatabaseOverride("default5", "override5"));

            ServerData serverB = new ServerData();

            serverB.OverrideSequence = sequenceB;
            serverB.ServerName       = "ServerB";

            MultiDbData cfg = new MultiDbData();

            cfg.Add(serverA);
            cfg.Add(serverB);

            string expected =
                @"ServerA:default1,override1
ServerA:default2,override2
ServerA:default0,override0
ServerA:defaultX,overrideX;defaultY,overrideY
ServerB:default6,override6
ServerB:default7,override7
ServerB:default5,override5
";
            string actual;

            actual = MultiDbHelper.ConvertMultiDbDataToTextConfig(cfg);
            Assert.AreEqual(expected, actual);
        }