public static new void BaseClassInitialize(TestContext testContext)
        {
            MultiDirectionTestBase <DMLibDataInfo, DMLibDataType> .BaseClassInitialize(testContext);

            FileSizeInKB = int.Parse(Test.Data.Get("FileSize"));
            DMLibTestBase.InitializeDataAdaptor();
        }
Example #2
0
        public static void MyClassInitialize(TestContext testContext)
        {
            Test.Info("Class Initialize: FollowSymlinkTest");
            DMLibTestBase.BaseClassInitialize(testContext);

            Test.Info("Use file name {0} in BVT.", UnicodeFileName);
        }
        public static object GetDefaultTransferDirectoryOptions(DMLibDataType sourceType, DMLibDataType destType)
        {
            if (DMLibTestBase.IsLocal(sourceType))
            {
                var result = new UploadDirectoryOptions();

                if (IsCloudBlob(destType))
                {
                    result.BlobType = MapBlobDataTypeToXSCLBlobType(destType);
                }

                return(result);
            }
            else if (DMLibTestBase.IsLocal(destType))
            {
                return(new DownloadDirectoryOptions());
            }
            else
            {
                var result = new CopyDirectoryOptions();

                if (IsCloudBlob(destType))
                {
                    result.BlobType = MapBlobDataTypeToXSCLBlobType(destType);
                }

                return(result);
            }
        }
 public static void MyClassInitialize(TestContext testContext)
 {
     Test.Info("Class Initialize: BVT");
     DMLibTestBase.BaseClassInitialize(testContext);
     BVT.UnicodeFileName = FileOp.NextString(random, random.Next(6, 10));
     Test.Info("Use file name {0} in BVT.", UnicodeFileName);
 }
Example #5
0
        private static List <TransferItem> GetTransformItemsForAllDirTransferDirections(bool resume)
        {
            List <TransferItem> allItems = new List <TransferItem>();

            foreach (DMLibTransferDirection direction in GetAllDirectoryValidDirections())
            {
                string dirName = GetTransferDirName(direction);
                DataAdaptor <DMLibDataInfo> sourceAdaptor = GetSourceAdaptor(direction.SourceType);
                DataAdaptor <DMLibDataInfo> destAdaptor   = GetDestAdaptor(direction.DestType);

                DirNode dirNode = directoryNodes[dirName];

                dynamic options = DMLibTestBase.GetDefaultTransferDirectoryOptions(direction.SourceType, direction.DestType);
                options.Recursive = true;

                TransferItem item = new TransferItem()
                {
                    SourceObject        = sourceAdaptor.GetTransferObject(string.Empty, dirNode),
                    DestObject          = destAdaptor.GetTransferObject(string.Empty, dirNode),
                    SourceType          = direction.SourceType,
                    DestType            = direction.DestType,
                    CopyMethod          = direction.CopyMethod,
                    IsDirectoryTransfer = true,
                    Options             = options,
                    TransferContext     = new DirectoryTransferContext()
                    {
                        SetAttributesCallbackAsync = AllTransferDirectionTest.SetAttributesCallbackMethodAsync
                    }
                };

                allItems.Add(item);
            }

            return(allItems);
        }
        public static void MyClassInitialize(TestContext testContext)
        {
            DMLibTestBase.BaseClassInitialize(testContext);

            DMLibTestBase.CleanupSource = false;

            AllTransferDirectionTest.PrepareSourceData();
        }
        public static void MyClassCleanup()
        {
            foreach (DMLibDataType dataType in sourceDataTypes)
            {
                CleanupSourceData(dataType);
            }

            DMLibTestBase.BaseClassCleanup();
        }
        private static List <TransferItem> GetTransformItemsForAllDirections(bool resume)
        {
            List <TransferItem> allItems = new List <TransferItem>();

            foreach (DMLibTransferDirection direction in GetAllValidDirections())
            {
                if (resume && (direction.SourceType == DMLibDataType.Stream || direction.DestType == DMLibDataType.Stream))
                {
                    continue;
                }

                string fileName = GetTransferFileName(direction);
                DataAdaptor <DMLibDataInfo> sourceAdaptor = GetSourceAdaptor(direction.SourceType);
                DataAdaptor <DMLibDataInfo> destAdaptor   = GetDestAdaptor(direction.DestType);

                FileNode     fileNode = singleObjectNodes[fileName];
                TransferItem item     = new TransferItem()
                {
                    SourceObject  = sourceAdaptor.GetTransferObject(string.Empty, fileNode),
                    DestObject    = destAdaptor.GetTransferObject(string.Empty, fileNode),
                    SourceType    = direction.SourceType,
                    DestType      = direction.DestType,
                    IsServiceCopy = direction.IsAsync,
                };
                allItems.Add(item);
            }

            foreach (DMLibTransferDirection direction in GetAllDirectoryValidDirections())
            {
                string dirName = GetTransferDirName(direction);
                DataAdaptor <DMLibDataInfo> sourceAdaptor = GetSourceAdaptor(direction.SourceType);
                DataAdaptor <DMLibDataInfo> destAdaptor   = GetDestAdaptor(direction.DestType);

                DirNode dirNode = directoryNodes[dirName];

                dynamic options = DMLibTestBase.GetDefaultTransferDirectoryOptions(direction.SourceType, direction.DestType);
                options.Recursive = true;

                TransferItem item = new TransferItem()
                {
                    SourceObject        = sourceAdaptor.GetTransferObject(string.Empty, dirNode),
                    DestObject          = destAdaptor.GetTransferObject(string.Empty, dirNode),
                    SourceType          = direction.SourceType,
                    DestType            = direction.DestType,
                    IsServiceCopy       = direction.IsAsync,
                    IsDirectoryTransfer = true,
                    Options             = options,
                };

                allItems.Add(item);
            }

            return(allItems);
        }
        public static void MyClassInitialize(TestContext testContext)
        {
            DMLibTestBase.BaseClassInitialize(testContext);
            DMLibTestBase.CleanupSource = false;

            sourceDataTypes = new DMLibDataType[] {
                DMLibDataType.Local,
                DMLibDataType.BlockBlob,
                DMLibDataType.PageBlob,
                DMLibDataType.AppendBlob,
                DMLibDataType.CloudFile,
            };

            SearchPatternTest.PrepareSourceData();
        }
 public DMLibWrapper GetDMLibWrapper(DMLibDataType sourceType, DMLibDataType destType, bool isServiceCopy)
 {
     if (DMLibTestBase.IsLocal(sourceType))
     {
         return(new UploadWrapper());
     }
     else if (DMLibTestBase.IsLocal(destType))
     {
         return(new DownloadWrapper());
     }
     else
     {
         return(new CopyWrapper());
     }
 }
 public static object GetDefaultTransferOptions(DMLibDataType sourceType, DMLibDataType destType)
 {
     if (DMLibTestBase.IsLocal(sourceType))
     {
         return(new UploadOptions());
     }
     else if (DMLibTestBase.IsLocal(destType))
     {
         return(new DownloadOptions());
     }
     else
     {
         return(new CopyOptions());
     }
 }
        private static string GetConnectionString(SourceOrDest sourceOrDest, DMLibDataType dataType)
        {
            IDictionary <string, string> connectionStrings = SourceOrDest.Source == sourceOrDest ? sourceConnectionStrings : destConnectionStrings;
            string key = DMLibTestBase.GetLocationKey(dataType);

            string connectionString;

            if (connectionStrings.TryGetValue(key, out connectionString))
            {
                return(connectionString);
            }

            if (SourceOrDest.Dest == sourceOrDest)
            {
                return(TestAccounts.Secondary.ConnectionString);
            }
            else
            {
                return(TestAccounts.Primary.ConnectionString);
            }
        }
Example #13
0
        public static void SetCalculatedFileMD5(DMLibDataInfo dataInfo, DataAdaptor <DMLibDataInfo> destAdaptor, bool disableMD5Check = false)
        {
            foreach (FileNode fileNode in dataInfo.EnumerateFileNodes())
            {
                if (DMLibTestBase.IsCloudBlob(DMLibTestContext.DestType))
                {
                    CloudBlobDataAdaptor cloudBlobDataAdaptor = destAdaptor as CloudBlobDataAdaptor;
                    CloudBlob            cloudBlob            = cloudBlobDataAdaptor.GetCloudBlobReference(fileNode);

                    fileNode.MD5 = CloudBlobHelper.CalculateMD5ByDownloading(cloudBlob, disableMD5Check);
                }
                else if (DMLibTestContext.DestType == DMLibDataType.CloudFile)
                {
                    CloudFileDataAdaptor cloudFileDataAdaptor = destAdaptor as CloudFileDataAdaptor;
                    CloudFile            cloudFile            = cloudFileDataAdaptor.GetCloudFileReference(fileNode);

                    fileNode.MD5 = CloudFileHelper.CalculateMD5ByDownloading(cloudFile, disableMD5Check);
                }

                // No need to set md5 for local destination
            }
        }
 public static new void BaseClassCleanup()
 {
     DMLibTestBase.BaseClassCleanup();
 }
        public static new void BaseClassInitialize(TestContext testContext)
        {
            DMLibTestBase.BaseClassInitialize(testContext);

            DMLibTestBase.CleanupSource = false;
        }
 public static void MyClassCleanup()
 {
     DMLibTestBase.BaseClassCleanup();
 }
Example #17
0
 public static void MyClassInitialize(TestContext testContext)
 {
     Test.Info("Class Initialize: ResumeTest");
     DMLibTestBase.BaseClassInitialize(testContext);
 }
Example #18
0
 public static void MyClassInitialize(TestContext testContext)
 {
     Test.Info("Class Initialize: DummyVirtualFolderTest");
     DMLibTestBase.BaseClassInitialize(testContext);
 }
Example #19
0
 public static void MyClassInitialize(TestContext testContext)
 {
     DMLibTestBase.BaseClassInitialize(testContext);
 }
        public static void SetDestConnectionString(string value, DMLibDataType dataType)
        {
            string key = DMLibTestBase.GetLocationKey(dataType);

            destConnectionStrings[key] = value;
        }