// ReSharper disable InconsistentNaming
        public void CreatePathFromString_Expected_IActivityIOPath_FTP_Type()
// ReSharper restore InconsistentNaming
        {
            IActivityIOPath result = ActivityIOFactory.CreatePathFromString(ParserStrings.PathOperations_FTP_Path, "", "");

            Assert.AreEqual(enActivityIOPathType.FTP, result.PathType);
        }
// ReSharper disable InconsistentNaming
        public void CreateOperationsBroker_Expected_IActivityOperationsBroker_FileSysytemProvider_Type()
// ReSharper restore InconsistentNaming
        {
            IActivityOperationsBroker result = ActivityIOFactory.CreateOperationsBroker();

            Assert.IsTrue(result != null);
        }
Example #3
0
        public void ActivityIOBroker_Zip_WhenOverwriteSetTrue_ShouldOverwriteFile()
        {
            //------------Setup for test--------------------------
            tempFile = Path.GetTempFileName();
            var zipPathName = Path.GetTempPath() + NewFileName + ".zip";
            IActivityIOOperationsEndPoint scrEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(ActivityIOFactory.CreatePathFromString(tempFile, string.Empty, null, true, ""));
            IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(ActivityIOFactory.CreatePathFromString(zipPathName, string.Empty, null, true, ""));
            Dev2ZipOperationTO            zipTO       = ActivityIOFactory.CreateZipTO(null, null, null, true);

            File.WriteAllText(zipPathName, "");
            //------------Assert Preconditions-------------------
            Assert.IsTrue(zipTO.Overwrite);
            Assert.IsTrue(File.Exists(zipPathName));
            var readAllBytes = File.ReadAllBytes(zipPathName);

            Assert.AreEqual(0, readAllBytes.Length);
            //------------Execute Test---------------------------
            ActivityIOFactory.CreateOperationsBroker().Zip(scrEndPoint, dstEndPoint, zipTO);
            //------------Assert Results-------------------------
            Assert.IsTrue(File.Exists(zipPathName));
            readAllBytes = File.ReadAllBytes(zipPathName);
            Assert.AreNotEqual(0, readAllBytes.Length);
            File.Delete(tempFile);
            File.Delete(zipPathName);
        }
 void CreateSourceFileWithSomeDummyData()
 {
     try
     {
         Dev2Logger.Log.Debug(string.Format("Source File: {0}", ScenarioContext.Current.Get <string>(ActualSourceHolder)));
         var             broker = ActivityIOFactory.CreateOperationsBroker();
         IActivityIOPath source = ActivityIOFactory.CreatePathFromString(ScenarioContext.Current.Get <string>(ActualSourceHolder),
                                                                         ScenarioContext.Current.Get <string>(SourceUsernameHolder),
                                                                         ScenarioContext.Current.Get <string>(SourcePasswordHolder),
                                                                         true);
         var ops = ActivityIOFactory.CreatePutRawOperationTO(WriteType.Overwrite, Guid.NewGuid().ToString());
         IActivityIOOperationsEndPoint sourceEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(source);
         if (sourceEndPoint.PathIs(sourceEndPoint.IOPath) == enPathType.File)
         {
             var result = broker.PutRaw(sourceEndPoint, ops);
             if (result != "Success")
             {
                 result = broker.PutRaw(sourceEndPoint, ops);
                 if (result != "Success")
                 {
                     Dev2Logger.Log.Debug("Create Source File for file op test error");
                 }
             }
         }
     }
     catch (Exception e)
     {
         Dev2Logger.Log.Debug("Create Source File for file op test error", e);
     }
 }
        public void CopyFileWithPathsExpectedRecursiveCopy()
        {
            var          innerDir     = Guid.NewGuid().ToString();
            var          tempPath     = Path.GetTempPath();
            var          tempFileName = Path.GetFileName(Path.GetTempFileName());
            const string TempData     = "some string data";

            if (tempFileName != null)
            {
                var    tempFile      = Path.Combine(tempPath, innerDir, innerDir, tempFileName);
                string directoryName = Path.GetDirectoryName(tempFile);
                if (directoryName != null)
                {
                    Directory.CreateDirectory(directoryName);
                }
                var upperLevelDir = Path.Combine(tempPath, innerDir);
                File.WriteAllText(tempFile, TempData);
                var dst         = Path.Combine(tempPath, Guid.NewGuid().ToString());
                var scrEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(ActivityIOFactory.CreatePathFromString(upperLevelDir, string.Empty, null, true));
                var dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(ActivityIOFactory.CreatePathFromString(dst, string.Empty, null, true));

                var moveTO = new Dev2CRUDOperationTO(true);
                ActivityIOFactory.CreateOperationsBroker().Copy(scrEndPoint, dstEndPoint, moveTO);
                var newFilePath = Path.Combine(dst, innerDir, tempFileName);
                Assert.IsTrue(File.Exists(newFilePath));
                Assert.IsTrue(File.Exists(tempFile));
            }
        }
        private void BootstrapPersistence(string baseDir)
        {
            lock (InitLock)
            {
                if (_debugPath == null)
                {
                    if (baseDir != null)
                    {
                        _rootPath = baseDir;
                    }

                    if (_rootPath.EndsWith("\\"))
                    {
                        _debugPersistPath = _rootPath + SavePath;
                    }
                    else
                    {
                        _debugPersistPath = _rootPath + "\\" + SavePath;
                    }

                    _debugPath         = ActivityIOFactory.CreatePathFromString(_debugPersistPath, "", "");
                    _debugOptsEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(_debugPath);
                }
            }
        }
Example #7
0
        static void RunCopy()
        {
            IActivityIOPath source = ActivityIOFactory.CreatePathFromString(ScenarioContext.Current.Get <string>(CommonSteps.ActualSourceHolder),
                                                                            ScenarioContext.Current.Get <string>(CommonSteps.SourceUsernameHolder),
                                                                            ScenarioContext.Current.Get <string>(CommonSteps.SourcePasswordHolder),
                                                                            true);
            IActivityIOOperationsEndPoint sourceEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(source);


            string resourceName = "Dev2.Activities.Specs.Toolbox.FileAndFolder.Unzip.Test.zip";

            if (ScenarioContext.Current.ContainsKey("WhenTheUnzipFileToolIsExecutedWithASingleFile"))
            {
                resourceName = "TestFile.zip";
            }
            Assembly      assembly       = Assembly.GetExecutingAssembly();
            List <string> filesToCleanup = new List <string>();

            using (Stream stream = assembly.GetManifestResourceStream(resourceName))
            {
                if (stream != null)
                {
                    sourceEndPoint.Put(stream, sourceEndPoint.IOPath, new Dev2CRUDOperationTO(true), null, filesToCleanup);
                }
            }
            filesToCleanup.ForEach(File.Delete);
        }
Example #8
0
        public void PutWithOverwriteTrue_FileNot_Present_Expect_FileReadAndDataInputToStream()
        {
            Dev2CRUDOperationTO opTO = new Dev2CRUDOperationTO(true);
            string tmp = Path.GetTempFileName();

            File.Delete(tmp);
            IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(tmp, "", "");
            IActivityIOPath src = ActivityIOFactory.CreatePathFromString(_tmpfile2, "", "");
            IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);
            Stream stream        = FileSystemPro.Get(src, new List <string>());
            var    directoryInfo = new FileInfo(src.Path).Directory;

            if (directoryInfo != null)
            {
                int len = FileSystemPro.Put(stream, dst, opTO, directoryInfo.ToString(), new List <string>());
                stream.Close();

                File.Delete(tmp);

                Assert.IsTrue(len > 0);
            }
            else
            {
                Assert.Fail();
            }
        }
Example #9
0
        IList <IActivityIOPath> ListDirectorySftp(IActivityIOPath src)
        {
            List <IActivityIOPath> result = new List <IActivityIOPath>();
            var sftp = BuildSftpClient(src);

            try
            {
                var fromPath = ExtractFileNameFromPath(src.Path);
                var fileList = sftp.ListDirectory(fromPath).Select(a => a.FullName);
                result.AddRange(from string file in fileList
                                where file != ".." && file != "."
                                select BuildValidPathForFtp(src, file)
                                into uri
                                select ActivityIOFactory.CreatePathFromString(uri, src.Username, src.Password));
            }
            catch (Exception)
            {
                throw new DirectoryNotFoundException(string.Format("Directory '{0}' was not found", src.Path));
            }
            //catch(Exception ex)
            //{
            //    Dev2Logger.Log.Error(this, ex);
            //    throw;
            //}
            finally
            {
                sftp.Dispose();
            }

            return(result);
        }
Example #10
0
            public IList <IActivityIOPath> ListDirectorySftp(IActivityIOPath src)
            {
                var result = new List <IActivityIOPath>();
                var sftp   = BuildSftpClient(src);

                try
                {
                    var fromPath = ExtractFileNameFromPath(src.Path);
                    var fileList = sftp.ListDirectory(fromPath).Select(a => a.Name);
                    result.AddRange(from string file in fileList
                                    where !file.EndsWith(@"..") && !file.EndsWith(@".")
                                    select BuildValidPathForFtp(src, file)
                                    into uri
                                    select ActivityIOFactory.CreatePathFromString(uri, src.Username, src.Password, src.PrivateKeyFile));
                }
                catch (Exception)
                {
                    throw new DirectoryNotFoundException(string.Format(ErrorResource.DirectoryNotFound, src.Path));
                }
                finally
                {
                    sftp.Dispose();
                }
                return(result);
            }
Example #11
0
        string ExtendedDirListSftp(string path, string user, string pass)
        {
            var result         = new StringBuilder();
            var pathFromString = ActivityIOFactory.CreatePathFromString(path, user, pass);
            var sftp           = BuildSftpClient(pathFromString);

            try
            {
                var fromPath = ExtractFileNameFromPath(pathFromString.Path);
                var fileList = sftp.ListDirectory(fromPath);
                sftp.Disconnect();
                sftp.Dispose();
                foreach (var filePath in fileList)
                {
                    string filename = filePath.FullName;
                    if (filename == ".." || filename == "." || filename.EndsWith("."))
                    {
                        continue;
                    }
                    result.AppendLine(filePath.FullName);
                }
            }
            catch (Exception ex)
            {
                sftp.Dispose();
                Dev2Logger.Log.Error(this, ex);
                throw new Exception(string.Format("Path not found {0}. Please ensure that it exists", path));
            }
            return(result.ToString());
        }
        public void CreateOperationEndPointFromIOPath_Expected_IActivityIOOperationsEndPoint_FTPProvider_Type()
        {
            var path   = ActivityIOFactory.CreatePathFromString(ParserStrings.PathOperations_FTP_Path, "", "");
            var result = ActivityIOFactory.CreateOperationEndPointFromIOPath(path);

            Assert.IsTrue(result.GetType() == typeof(Dev2FTPProvider));
        }
Example #13
0
        public override int ExecuteOperation()
        {
            var destination = _destination;

            if (!_pathWrapper.IsPathRooted(_destination.Path) && _whereToPut != null)
            {
                destination = ActivityIOFactory.CreatePathFromString(_whereToPut + "\\" + _destination.Path, _destination.Username, _destination.Password, _destination.PrivateKeyFile);
            }
            _fileLock.EnterWriteLock();
            try
            {
                using (_currentStream)
                {
                    if (_impersonatedUser != null)
                    {
                        return(ExecuteOperationWithAuth(_currentStream, destination));
                    }
                    return(WriteData(_currentStream, destination));
                }
            }
            finally
            {
                _fileLock.ExitWriteLock();
                _impersonatedUser?.Undo();
            }
        }
Example #14
0
        public void CreatePathFromString_Expected_IActivityIOPath_FTP_Type()

        {
            var result = ActivityIOFactory.CreatePathFromString(ParserStrings.PathOperations_FTP_Path, "", "");

            Assert.AreEqual(enActivityIOPathType.FTP, result.PathType);
        }
Example #15
0
        public void CreateOperationsBroker_Expected_IActivityOperationsBroker_FileSysytemProvider_Type()

        {
            var result = ActivityIOFactory.CreateOperationsBroker();

            Assert.IsTrue(result != null);
        }
Example #16
0
 public void DeleteHandler(IList <string> pathStack, string user, string pass, string privateKeyFile)
 {
     if (pathStack.Count > 0)
     {
         var path = pathStack[0];
         pathStack.RemoveAt(0);
         var addBack        = true;
         var pathFromString = ActivityIOFactory.CreatePathFromString(path, user, pass, privateKeyFile);
         IList <IActivityIOPath> allFiles = ListFilesInDirectory(pathFromString).GroupBy(a => a.Path).Select(g => g.First()).ToList();
         var allDirs = ListFoldersInDirectory(pathFromString);
         if (allDirs.Count == 0)
         {
             var tmpPath = pathFromString;
             allFiles.Insert(allFiles.Count, tmpPath);
             DeleteOp(allFiles);
             addBack = false;
         }
         else
         {
             pathStack = pathStack.Union(allDirs.Select(ioPath => ioPath.Path)).ToList();
         }
         DeleteHandler(pathStack, user, pass, privateKeyFile);
         if (addBack)
         {
             DeleteHandler(new List <string> {
                 path
             }, user, pass, privateKeyFile);
         }
     }
 }
Example #17
0
        public void Dev2FileSystemProvider_ListFilesInDirectory_Normal_AllFilesInDirectoryReturned()
        {
            //------------Setup for test--------------------------
            var dev2FileSystemProvider = new Dev2FileSystemProvider();
            //string baseFolderDirectory = Path.GetTempPath() + @"\ListDirectoryTestFolder";
            string tmpFolderLocal  = Path.GetTempPath() + @"\ListDirectoryTestFolderNormal_AllFilesInDirectoryReturned\Folder1";
            string tmpFolderLocal2 = Path.GetTempPath() + @"\ListDirectoryTestFolderNormal_AllFilesInDirectoryReturned\Folder2";
            string tmpFileLocal1   = Path.GetTempPath() + @"\ListDirectoryTestFolderNormal_AllFilesInDirectoryReturned\File1.txt";
            string tmpFileLocal2   = Path.GetTempPath() + @"\ListDirectoryTestFolderNormal_AllFilesInDirectoryReturned\File2.txt";

            CreateDirectory(tmpFolderLocal);
            CreateDirectory(tmpFolderLocal2);
            CreateLocalPath(tmpFileLocal1);
            CreateLocalPath(tmpFileLocal2);
            IActivityIOPath path = ActivityIOFactory.CreatePathFromString(Path.GetTempPath() + @"\ListDirectoryTestFolderNormal_AllFilesInDirectoryReturned", "", "");

            //------------Execute Test---------------------------

            IList <IActivityIOPath> fileList = dev2FileSystemProvider.ListFilesInDirectory(path);


            //------------Assert Results-------------------------

            Assert.AreEqual(2, fileList.Count);
            Assert.IsTrue(fileList[0].Path.EndsWith("File1.txt"));
            Assert.IsTrue(fileList[1].Path.EndsWith("File2.txt"));

            DeleteDirectory(Path.GetTempPath() + @"\ListDirectoryTestFolderNormal_AllFilesInDirectoryReturned");
        }
Example #18
0
        public void PutWithOverwriteTrue_UNCPathValidUser_File_Present_FileInStream()
        {
            Dev2CRUDOperationTO opTO = new Dev2CRUDOperationTO(true);
            string tmp  = TestResource.PathOperations_UNC_Path_Secure + Guid.NewGuid() + ".test";
            string tmp2 = TestResource.PathOperations_UNC_Path_Secure + Guid.NewGuid() + ".test";

            PathIOTestingUtils.CreateAuthedUNCPath(tmp, false, _inDomain);
            IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(tmp, (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username, TestResource.PathOperations_Correct_Password);
            IActivityIOPath src = ActivityIOFactory.CreatePathFromString(tmp2, (_inDomain ? "DEV2\\" : ".\\") + TestResource.PathOperations_Correct_Username, TestResource.PathOperations_Correct_Password);
            IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);
            Stream stream        = new MemoryStream(File.ReadAllBytes(_tmpfile1));
            var    directoryInfo = new FileInfo(src.Path).Directory;

            if (directoryInfo != null)
            {
                int len = FileSystemPro.Put(stream, dst, opTO, directoryInfo.ToString(), new List <string>());
                stream.Close();

                PathIOTestingUtils.DeleteAuthedUNCPath(tmp);
                PathIOTestingUtils.DeleteAuthedUNCPath(tmp2);

                Assert.IsTrue(len > 0);
            }
            else
            {
                Assert.Fail();
            }
        }
        protected static void RemovedFilesCreatedForTesting()
        {
            // ReSharper disable EmptyGeneralCatchClause


            Dev2Logger.Log.Debug("Cleanup");

            var    broker = ActivityIOFactory.CreateOperationsBroker();
            string destLocation;

            if (ScenarioContext.Current != null && ScenarioContext.Current.TryGetValue(CommonSteps.ActualDestinationHolder, out destLocation))
            {
                IActivityIOPath dst = ActivityIOFactory.CreatePathFromString(destLocation,
                                                                             ScenarioContext.Current.Get <string>(CommonSteps.DestinationUsernameHolder),
                                                                             ScenarioContext.Current.Get <string>(CommonSteps.DestinationPasswordHolder),
                                                                             true);
                IActivityIOOperationsEndPoint dstEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(dst);
                try
                {
                    if (dstEndPoint.PathIs(dstEndPoint.IOPath) == enPathType.File)
                    {
                        broker.Delete(dstEndPoint);
                    }
                }
                catch (Exception)
                {
                    Dev2Logger.Log.Debug("Cleanup Error");
                    //    throw;
                }
            }

            string sourceLocation;

            if (ScenarioContext.Current != null && ScenarioContext.Current.TryGetValue(CommonSteps.ActualSourceHolder, out sourceLocation))
            {
                IActivityIOPath source = ActivityIOFactory.CreatePathFromString(sourceLocation,
                                                                                ScenarioContext.Current.Get <string>(CommonSteps.SourceUsernameHolder),
                                                                                ScenarioContext.Current.Get <string>(CommonSteps.SourcePasswordHolder),
                                                                                true);
                IActivityIOOperationsEndPoint sourceEndPoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(source);
                try
                {
                    if (sourceEndPoint.PathIs(sourceEndPoint.IOPath) == enPathType.File)
                    {
                        broker.Delete(sourceEndPoint);
                    }
                }
                catch (Exception)
                {
                    Dev2Logger.Log.Debug("Cleanup Error");
                    //The file may already be deleted
                    // throw;
                }
            }

            // SOME SILLY CHICKEN BUNDLED TWO DIS-JOIN OPERATIONS IN THIS METHOD.
            // THIS CAUSED THE SFTP SERVER TO NEVER SHUTDOWN WHEN THE COMMONSTEPS.ACTUALSOURCEHOLDER KEY WAS NOT PRESENT!
            // ;)
        }
Example #20
0
        protected override IList <OutputTO> ExecuteConcreteAction(IDSFDataObject dataObject, out ErrorResultTO allErrors, int update)
        {
            IList <OutputTO> outputs = new List <OutputTO>();

            allErrors = new ErrorResultTO();
            var colItr = new WarewolfListIterator();

            //get all the possible paths for all the string variables
            var inputItr = new WarewolfIterator(dataObject.Environment.Eval(InputPath, update));

            colItr.AddVariableToIterateOn(inputItr);

            var unameItr = new WarewolfIterator(dataObject.Environment.Eval(Username, update));

            colItr.AddVariableToIterateOn(unameItr);

            var passItr = new WarewolfIterator(dataObject.Environment.Eval(DecryptedPassword, update));

            colItr.AddVariableToIterateOn(passItr);

            var privateKeyItr = new WarewolfIterator(dataObject.Environment.Eval(PrivateKeyFile, update));

            colItr.AddVariableToIterateOn(privateKeyItr);

            outputs.Add(DataListFactory.CreateOutputTO(Result));

            if (dataObject.IsDebugMode())
            {
                AddDebugInputItem(InputPath, "Input Path", dataObject.Environment, update);
                AddDebugInputItemUserNamePassword(dataObject.Environment, update);
                if (!string.IsNullOrEmpty(PrivateKeyFile))
                {
                    AddDebugInputItem(PrivateKeyFile, "Private Key File", dataObject.Environment, update);
                }
            }

            while (colItr.HasMoreData())
            {
                IActivityOperationsBroker broker = ActivityIOFactory.CreateOperationsBroker();
                IActivityIOPath           ioPath = ActivityIOFactory.CreatePathFromString(colItr.FetchNextValue(inputItr),
                                                                                          colItr.FetchNextValue(unameItr),
                                                                                          colItr.FetchNextValue(passItr),
                                                                                          true, colItr.FetchNextValue(privateKeyItr));
                IActivityIOOperationsEndPoint endpoint = ActivityIOFactory.CreateOperationEndPointFromIOPath(ioPath);
                try
                {
                    string result = broker.Get(endpoint);
                    outputs[0].OutputStrings.Add(result);
                }
                catch (Exception e)
                {
                    outputs[0].OutputStrings.Add(null);
                    allErrors.AddError(e.Message);
                    break;
                }
            }

            return(outputs);
        }
Example #21
0
            public IList <IActivityIOPath> ListDirectoryStandardFtp(IActivityIOPath src)
            {
                var result = new List <IActivityIOPath>();

                try
                {
                    var request = (FtpWebRequest)WebRequest.Create(ConvertSslToPlain(src.Path));
                    request.Method    = WebRequestMethods.Ftp.ListDirectory;
                    request.UseBinary = true;
                    request.KeepAlive = false;
                    request.EnableSsl = EnableSsl(src);

                    if (src.Username != string.Empty)
                    {
                        request.Credentials = new NetworkCredential(src.Username, src.Password);
                    }

                    if (src.IsNotCertVerifiable)
                    {
                        ServicePointManager.ServerCertificateValidationCallback = AcceptAllCertifications;
                    }

                    using (FtpWebResponse response = request.GetResponse() as FtpWebResponse)
                    {
                        using (Stream responseStream = response?.GetResponseStream())
                        {
                            if (responseStream != null)
                            {
                                using (StreamReader reader = new StreamReader(responseStream))
                                {
                                    while (!reader.EndOfStream)
                                    {
                                        var uri = BuildValidPathForFtp(src, reader.ReadLine());
                                        result.Add(ActivityIOFactory.CreatePathFromString(uri, src.Username, src.Password, true, src.PrivateKeyFile));
                                    }
                                }
                            }
                        }
                    }
                }
                catch (WebException webEx)
                {
                    var webResponse = webEx.Response as FtpWebResponse;
                    {
                        if (webResponse?.StatusCode == FtpStatusCode.ActionNotTakenFileUnavailable)
                        {
                            throw new DirectoryNotFoundException(string.Format(ErrorResource.DirectoryNotFound, src.Path));
                        }
                        throw;
                    }
                }
                catch (Exception ex)
                {
                    Dev2Logger.Error(this, ex, GlobalConstants.WarewolfError);
                    throw;
                }

                return(result);
            }
Example #22
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);
        }
Example #23
0
        public void CreatePathFromString_CreatePathFromString_AssertCorrectType()

        {
            var operationTO = ActivityIOFactory.CreatePathFromString(@"c:\moon", true);

            Assert.AreEqual(@"c:\moon", operationTO.Path);
            //Assert.AreEqual(, operationTO.);
        }
Example #24
0
        public void CreatePathFromString_CreateUnzipTO_PWD_OverWrite_AssertCorrectType()

        {
            var operationTO = ActivityIOFactory.CreateUnzipTO("20", true);

            Assert.AreEqual("20", operationTO.ArchivePassword);
            Assert.IsTrue(operationTO.Overwrite);
        }
Example #25
0
        protected override string ExecuteBroker(IActivityOperationsBroker broker, IActivityIOOperationsEndPoint scrEndPoint, IActivityIOOperationsEndPoint dstEndPoint)
        {
            Dev2UnZipOperationTO zipTo =
                ActivityIOFactory.CreateUnzipTO(ColItr.FetchNextValue(_archPassItr),
                                                Overwrite);

            return(broker.UnZip(scrEndPoint, dstEndPoint, zipTo));
        }
Example #26
0
        public void ListDirectory_StarDotStar_With_NoContents_Expected_NoFilesInList()
        {
            IActivityIOPath path = ActivityIOFactory.CreatePathFromString(_tmpdir3 + "\\*.*", "", "");
            IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path);
            IList <IActivityIOPath>       result        = FileSystemPro.ListDirectory(path);

            Assert.IsTrue(result.Count == 0);
        }
Example #27
0
        public void ListDirectory_With_Contents_Expected_ListAllFiles()
        {
            IActivityIOPath path = ActivityIOFactory.CreatePathFromString(_tmpdir1, "", "");
            IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path);
            IList <IActivityIOPath>       result        = FileSystemPro.ListDirectory(path);

            Assert.IsTrue(result.Count == 2);
        }
Example #28
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);
        }
Example #29
0
        public void IsFileSystemPathType()
        {
            IActivityIOPath path = ActivityIOFactory.CreatePathFromString(_tmpfile1, "", "");
            IActivityIOOperationsEndPoint fileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path);

            fileSystemPro.Get(path, new List <string>());
            Assert.IsTrue(fileSystemPro is Dev2FileSystemProvider);
        }
        public void ListDirectory_StarDotStar_With_Contents_Expected_ListOfDirectoriesAndFiles()
        {
            IActivityIOPath path = ActivityIOFactory.CreatePathFromString(Path.GetTempPath() + "\\*.*", "", "");
            IActivityIOOperationsEndPoint FileSystemPro = ActivityIOFactory.CreateOperationEndPointFromIOPath(path);
            IList <IActivityIOPath>       result        = FileSystemPro.ListDirectory(path);

            Assert.IsTrue(result.Count > 0);
        }