Exemplo n.º 1
0
        public string Rename(IActivityIOOperationsEndPoint src, IActivityIOOperationsEndPoint dst, IDev2CRUDOperationTO args)
        {
            string performRename()
            {
                if (src.PathIs(src.IOPath) != dst.PathIs(dst.IOPath))
                {
                    throw new Exception(ErrorResource.SourceAndDestinationNOTFilesOrDirectory);
                }
                if (dst.PathExist(dst.IOPath))
                {
                    if (!args.Overwrite)
                    {
                        throw new Exception(ErrorResource.DestinationDirectoryExist);
                    }
                    dst.Delete(dst.IOPath);
                }

                return(Move(src, dst, args));
            }

            try
            {
                return(performRename());
            }
            finally
            {
                RemoveAllTmpFiles();
            }
        }
Exemplo n.º 2
0
        public void DeleteUNCWith_FilePresent_Expectd_DeleteSucessful()
        {
            IActivityIOPath path = ActivityIOFactory.CreatePathFromString(_uncfile1, "", "");
            IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path);
            bool ok = FileSystemPro.Delete(path);

            Assert.IsTrue(ok);
        }
Exemplo n.º 3
0
        public void DeleteUNCWith_DirPresent_Expected_DeleteSuccesful()
        {
            IActivityIOPath path = ActivityIOFactory.CreatePathFromString(_uncdir1, "", "");
            IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path) as Dev2FileSystemProvider;
            bool ok = FileSystemPro != null && FileSystemPro.Delete(path);

            Assert.IsTrue(ok);
        }
Exemplo n.º 4
0
        public void DeleteUNCValidUserWith_NoDirPresent_DeleteUnsuccesful()
        {
            string          tmp  = TestResource.PathOperations_UNC_Path_Secure + Guid.NewGuid() + "_dir";
            IActivityIOPath path = ActivityIOFactory.CreatePathFromString(tmp, (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username, TestResource.PathOperations_Correct_Password);
            IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path);
            bool ok = FileSystemPro.Delete(path);

            Assert.IsFalse(ok);
        }
Exemplo n.º 5
0
        public void DeleteUNCWith_NoDirPresent_Expected_DeleteUnsuccessful()
        {
            IActivityIOPath path = ActivityIOFactory.CreatePathFromString(_uncdir1, "", "");

            Directory.Delete(_uncdir1, true);
            IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path);
            bool ok = FileSystemPro.Delete(path);

            Assert.IsFalse(ok);
        }
Exemplo n.º 6
0
        public void DeleteUNCWith_NoFilePresent_DeleteUnsucessful()
        {
            IActivityIOPath path = ActivityIOFactory.CreatePathFromString(_uncfile1 + "abc", "", "");

            File.Delete(_tmpfile1);
            IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path);
            bool ok = FileSystemPro.Delete(path);

            Assert.IsFalse(ok);
        }
Exemplo n.º 7
0
        public void DeleteUNCValidUserWith_DirPresent_Expected_DeleteSuccessful()
        {
            string tmp = TestResource.PathOperations_UNC_Path_Secure + Guid.NewGuid() + "_dir";

            PathIOTestingUtils.CreateAuthedUNCPath(tmp, true, _inDomain);
            IActivityIOPath path = ActivityIOFactory.CreatePathFromString(tmp, (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username, TestResource.PathOperations_Correct_Password);
            IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path);
            bool ok = FileSystemPro.Delete(path);

            Assert.IsTrue(ok);
        }
Exemplo n.º 8
0
        public string Delete(IActivityIOOperationsEndPoint src)
        {
            var result = ResultOk;

            try
            {
                if (!src.Delete(src.IOPath))
                {
                    result = ResultBad;
                }
            }
            finally
            {
                _filesToDelete.ForEach(RemoveTmpFile);
            }
            return(result);
        }
Exemplo n.º 9
0
        public string Move(IActivityIOOperationsEndPoint src, IActivityIOOperationsEndPoint dst, IDev2CRUDOperationTO args)
        {
            string result;

            try
            {
                result = Copy(src, dst, args);
                if (result.Equals(ActivityIOBrokerBaseDriver.ResultOk))
                {
                    src.Delete(src.IOPath);
                }
            }
            finally
            {
                RemoveAllTmpFiles();
            }

            return(result);
        }
Exemplo n.º 10
0
 public string Delete(IActivityIOOperationsEndPoint src)
 {
     try
     {
         if (!src.Delete(src.IOPath))
         {
             return(ActivityIOBrokerBaseDriver.ResultBad);
         }
     }
     catch
     {
         return(ActivityIOBrokerBaseDriver.ResultBad);
     }
     finally
     {
         RemoveAllTmpFiles();
     }
     return(ActivityIOBrokerBaseDriver.ResultOk);
 }
Exemplo n.º 11
0
        string ValidateRenameSourceAndDesinationTypes(IActivityIOOperationsEndPoint src,
                                                      IActivityIOOperationsEndPoint dst,
                                                      IDev2CRUDOperationTO args)
        {
            if (src.PathIs(src.IOPath) != dst.PathIs(dst.IOPath))
            {
                throw new Exception(ErrorResource.SourceAndDestinationNOTFilesOrDirectory);
            }
            if (dst.PathExist(dst.IOPath))
            {
                if (!args.Overwrite)
                {
                    throw new Exception(ErrorResource.DestinationDirectoryExist);
                }
                dst.Delete(dst.IOPath);
            }

            return(Move(src, dst, args));
        }
Exemplo n.º 12
0
        public string Move(IActivityIOOperationsEndPoint src, IActivityIOOperationsEndPoint dst, IDev2CRUDOperationTO args)
        {
            string result;

            try
            {
                result = Copy(src, dst, args);
                if (result.Equals(ResultOk))
                {
                    src.Delete(src.IOPath);
                }
            }
            finally
            {
                _filesToDelete.ForEach(RemoveTmpFile);
            }

            return(result);
        }
Exemplo n.º 13
0
 public string Delete(IActivityIOOperationsEndPoint src)
 {
     try
     {
         if (!src.Delete(src.IOPath))
         {
             return(ResultBad);
         }
     }
     catch
     {
         return(ResultBad);
     }
     finally
     {
         _filesToDelete.ForEach(RemoveTmpFile);
     }
     return(ResultOk);
 }
Exemplo n.º 14
0
        public string Move(IActivityIOOperationsEndPoint src, IActivityIOOperationsEndPoint dst,
                           Dev2CRUDOperationTO args)
        {
            string result;

            try
            {
                result = Copy(src, dst, args);

                if(result.Equals("Success"))
                {
                    src.Delete(src.IOPath);
                }
            }
            finally
            {
                _filesToDelete.ForEach(RemoveTmpFile);
            }

            return result;
        }
Exemplo n.º 15
0
 public string Delete(IActivityIOOperationsEndPoint src)
 {
     var result = ResultOk;
     try
     {
         if(!src.Delete(src.IOPath))
         {
             result = ResultBad;
         }
     }
     finally
     {
         _filesToDelete.ForEach(RemoveTmpFile);
     }
     return result;
 }
Exemplo n.º 16
0
        string ValidateRenameSourceAndDesinationTypes(IActivityIOOperationsEndPoint src,
                                                              IActivityIOOperationsEndPoint dst,
                                                              Dev2CRUDOperationTO args)
        {
            //ensures that the source and destination locations are of the same type
            if(src.PathIs(src.IOPath) != dst.PathIs(dst.IOPath))
            {
                throw new Exception("Source and destination need to be both files or directories");
            }

            //Rename Tool if the file/folder exists then delete it and put the source there
            if(dst.PathExist(dst.IOPath))
            {
                if(!args.Overwrite)
                {
                    throw new Exception("Destination directory already exists and overwrite is set to false");
                }

                //Clear the existing folder
                dst.Delete(dst.IOPath);
            }

            return Move(src, dst, args);
        }