PBI : 1172 Status : New Purpose : To provide an activity that can zip the contents of a file/folder from FTP, FTPS and file system
Inheritance: Dev2.Activities.PathOperations.DsfAbstractMultipleFilesActivity, IZip, IPathInput, IPathOutput, IPathOverwrite, IDestinationUsernamePassword
示例#1
0
        protected override void BuildDataList()
        {
            try
            {
                BuildShapeAndTestData();

                var zip = new DsfZip
                {
                    InputPath = ScenarioContext.Current.Get<string>(CommonSteps.SourceHolder),
                    Username = ScenarioContext.Current.Get<string>(CommonSteps.SourceUsernameHolder),
                    Password = ScenarioContext.Current.Get<string>(CommonSteps.SourcePasswordHolder),
                    OutputPath = ScenarioContext.Current.Get<string>(CommonSteps.DestinationHolder),
                    DestinationUsername = ScenarioContext.Current.Get<string>(CommonSteps.DestinationUsernameHolder),
                    DestinationPassword = ScenarioContext.Current.Get<string>(CommonSteps.DestinationPasswordHolder),
                    Overwrite = ScenarioContext.Current.Get<bool>(CommonSteps.OverwriteHolder),
                    Result = ScenarioContext.Current.Get<string>(CommonSteps.ResultVariableHolder),
                    ArchivePassword = ScenarioContext.Current.Get<string>("archivePassword"),
                    CompressionRatio = ScenarioContext.Current.Get<string>("compressio"),
                    PrivateKeyFile = ScenarioContext.Current.Get<string>(CommonSteps.SourcePrivatePublicKeyFile),
                    DestinationPrivateKeyFile = ScenarioContext.Current.Get<string>(CommonSteps.DestinationPrivateKeyFile)
                };

                TestStartNode = new FlowStep
                {
                    Action = zip
                };
                // CI
                ScenarioContext.Current.Add("activity", zip);
            }
            catch(Exception e)
            {
                Dev2Logger.Log.Debug("Error Setting Up Zip",e);
            }
        }
示例#2
0
 public void Zip_Construct_Object_Must_Be_OfType_IDestinationUsernamePassword()
 {
     var zip = new DsfZip();
     IDestinationUsernamePassword password = zip;
     Assert.IsNotNull(password);
 }
示例#3
0
        public void Zip_Execute_Workflow_SourceFile_And_DestinationFile_Has_Separate_Passwords_Both_Passwords_Are_Sent_To_OperationBroker()
        {
            var fileNames = new List<string>();
            Guid randomFileName = Guid.NewGuid();
            fileNames.Add(Path.Combine(myTestContext.TestRunDirectory, randomFileName + "Dev2.txt"));


            foreach(string fileName in fileNames)
            {
                // ReSharper disable LocalizableElement
                File.WriteAllText(fileName, "TestData");
                // ReSharper restore LocalizableElement
            }

            var activityOperationBrokerMock = new ActivityOperationBrokerMock();

            DsfZip preact = new DsfZip
            {
                InputPath = @"c:\OldFile.txt",
                OutputPath = Path.Combine(TestContext.TestRunDirectory, "NewName.txt"),
                Result = "[[res]]",
                DestinationUsername = "******",
                DestinationPassword = "******",
                Username = "******",
                Password = "******",
                GetOperationBroker = () => activityOperationBrokerMock
            };

            List<DebugItem> inRes;
            List<DebugItem> outRes;

            CheckPathOperationActivityDebugInputOutput(preact, ActivityStrings.DebugDataListShape,
                                                                ActivityStrings.DebugDataListWithData, out inRes, out outRes);

            Assert.AreEqual(activityOperationBrokerMock.Destination.IOPath.Password, "destPWord");
            Assert.AreEqual(activityOperationBrokerMock.Destination.IOPath.Username, "destUName");
            Assert.AreEqual(activityOperationBrokerMock.Source.IOPath.Password, "pWord");
            Assert.AreEqual(activityOperationBrokerMock.Source.IOPath.Username, "uName");
        }
 public void GetActivityFieldsOffDsfZipActivityExpectedAllFindMissingFieldsToBeReturned()
 {
     DsfZip activity = new DsfZip();
     activity.ArchiveName = "[[ArchiveName]]";
     activity.ArchivePassword = "******";
     activity.CompressionRatio = "[[CompressionRatio]]";
     activity.InputPath = "[[InputPath]]";
     activity.OutputPath = "[[OutputPath]]";
     activity.Password = "******";
     activity.Username = "******";
     activity.PrivateKeyFile = "[[KeyFile]]";
     activity.DestinationPassword = "******";
     activity.DestinationUsername = "******";
     activity.DestinationPrivateKeyFile = "[[DestKeyFile]]";
     activity.Result = "[[Result]]";
     Dev2FindMissingStrategyFactory fac = new Dev2FindMissingStrategyFactory();
     IFindMissingStrategy strategy = fac.CreateFindMissingStrategy(enFindMissingType.StaticActivity);
     List<string> actual = strategy.GetActivityFields(activity);
     List<string> expected = new List<string> {"[[ArchivePassword]]", "[[ArchiveName]]", "[[CompressionRatio]]", "[[InputPath]]", "[[OutputPath]]", "[[DestUsername]]","[[DestKeyFile]]", "[[DestPassword]]", "[[Password]]", "[[Username]]","[[KeyFile]]", "[[Result]]" };
     CollectionAssert.AreEqual(expected, actual);
 }
示例#5
0
        public void ZipActivity_GetInputs_Expected_Eight_Input()
        {
            DsfZip testAct = new DsfZip();

            IBinaryDataList inputs = testAct.GetInputs();

            Assert.IsTrue(inputs.FetchAllEntries().Count == 11);
        }
示例#6
0
        public void ZipActivity_GetOutputs_Expected_One_Output()
        {
            DsfZip testAct = new DsfZip();

            IBinaryDataList outputs = testAct.GetOutputs();

            Assert.IsTrue(outputs.FetchAllEntries().Count == 1);
        }