public void Copy_Execute_Workflow_SourceFile_And_DestinationFile_Has_Separate_Passwords_Both_Passwords_Are_Sent_To_OperationBroker() { var fileNames = new List <string>(); fileNames.Add(Path.Combine(TestContext.TestRunDirectory, Guid.NewGuid() + ".txt")); foreach (string fileName in fileNames) { File.WriteAllText(fileName, "TestData"); } CreateDataListWithRecsetAndCreateShape(fileNames, "FileNames", "Name", out string dataListShape, out string dataListWithData); var activityOperationBrokerMock = new ActivityOperationBrokerMock(); var act = new DsfPathCopy { InputPath = @"c:\OldFile.txt", OutputPath = Path.Combine(TestContext.TestRunDirectory, "NewName.txt"), Result = "[[res]]", DestinationUsername = "******", DestinationPassword = "******", Username = "******", Password = "******", GetOperationBroker = () => activityOperationBrokerMock }; CheckPathOperationActivityDebugInputOutput(act, dataListShape, dataListWithData, out List <DebugItem> inRes, out List <DebugItem> 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 Unzip_Execute_Workflow_SourceFile_And_DestinationFile_Has_Separate_Passwords_Both_Passwords_Are_Sent_To_OperationBroker() { var fileNames = new List <string>(); var guid = Guid.NewGuid(); fileNames.Add(Path.Combine(TestContext.TestRunDirectory, guid + "Dev2.txt")); foreach (string fileName in fileNames) { File.Delete(fileName); } var activityOperationBrokerMock = new ActivityOperationBrokerMock(); var act = new DsfUnZip { InputPath = @"c:\OldFile.txt", OutputPath = Path.Combine(TestContext.TestRunDirectory, "NewName.txt"), Result = "[[res]]", DestinationUsername = "******", DestinationPassword = "******", Username = "******", Password = "******", GetOperationBroker = () => activityOperationBrokerMock }; CheckPathOperationActivityDebugInputOutput(act, ActivityStrings.DebugDataListShape, ActivityStrings.DebugDataListWithData, out List <DebugItem> inRes, out List <DebugItem> 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 Zip_Execute_WhenOutputPathNotIsRooted_MovesArchivePasswordItr() { //---------------Setup---------------------------------------------- var fileNames = new List <string>(); var guid = Guid.NewGuid(); fileNames.Add(Path.Combine(TestContext.TestRunDirectory, guid + "Dev2.txt")); List <DebugItem> inRes; List <DebugItem> outRes; foreach (string fileName in fileNames) { File.Delete(fileName); } var activityOperationBrokerMock = new ActivityOperationBrokerMock(); var act = new DsfZip { InputPath = @"c:\OldFile.txt", OutputPath = "NewName.txt", Result = "[[res(*).a]]", DestinationUsername = "******", DestinationPassword = "******", Username = "******", Password = "******", ArchivePassword = "******", CompressionRatio = "[[comp(*).val]]", ArchiveName = "[[arch(*).name]]", GetOperationBroker = () => activityOperationBrokerMock }; const string shape = "<ADL><res><a></a></res><pass><word></word></pass><comp><val></val></comp><arch><name></name></arch></ADL>"; const string data = "<ADL><pass><word>test</word></pass><pass><word>test2</word></pass><pass><word>test3</word></pass><comp><val>test</val></comp><comp><val>test2</val></comp><comp><val>test3</val></comp><arch><name>test</name></arch><arch><name>test2</name></arch><arch><name>test3</name></arch></ADL>"; //-------------------------Execute----------------------------------------------- CheckPathOperationActivityDebugInputOutput(act, shape, data, out inRes, out outRes); //-------------------------Assertions--------------------------------------------- Assert.AreEqual(1, outRes.Count); var outputResultList = outRes[0].FetchResultsList(); Assert.AreEqual(3, outputResultList.Count); Assert.AreEqual("", outputResultList[0].Value); Assert.AreEqual("[[res(1).a]]", outputResultList[0].Variable); Assert.AreEqual("", outputResultList[1].Value); Assert.AreEqual("[[res(1).a]]", outputResultList[1].Variable); Assert.AreEqual("", outputResultList[2].Value); Assert.AreEqual("[[res(1).a]]", outputResultList[2].Variable); }
public void Move_Execute_Workflow_SourceFile_And_DestinationFile_Has_Separate_Passwords_Both_Passwords_Are_Sent_To_OperationBroker() { List <string> fileNames = new List <string> { Path.Combine(TestContext.TestRunDirectory, "NewFileFolder\\Dev2.txt") }; List <string> directoryNames = new List <string>(); directoryNames.Add(Path.Combine(TestContext.TestRunDirectory, "NewFileFolder")); directoryNames.Add(Path.Combine(TestContext.TestRunDirectory, "NewFileFolder2")); foreach (string directoryName in directoryNames) { Directory.CreateDirectory(directoryName); } foreach (string fileName in fileNames) { File.WriteAllText(fileName, @"TestData"); } var activityOperationBrokerMock = new ActivityOperationBrokerMock(); DsfPathMove act = new DsfPathMove { 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(act, 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 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 AbstractMultipleFiles_Execute_WhenOutputPathNotIsRooted_ExceptionCaughtErrorAdded() { //---------------Setup---------------------------------------------- var fileNames = new List <string>(); var guid = Guid.NewGuid(); fileNames.Add(Path.Combine(TestContext.TestRunDirectory, guid + "Dev2.txt")); List <DebugItem> inRes; List <DebugItem> outRes; foreach (string fileName in fileNames) { File.Delete(fileName); } var activityOperationBrokerMock = new ActivityOperationBrokerMock(); var act = new MockAbstractMultipleFilesActivity("Mock") { InputPath = @"c:\OldFile.txt", OutputPath = "NewTest.zip", Result = "[[res]]", DestinationUsername = "******", DestinationPassword = "******", Username = "******", Password = "******", GetOperationBroker = () => activityOperationBrokerMock }; //-------------------------Execute----------------------------------------------- CheckPathOperationActivityDebugInputOutput(act, ActivityStrings.DebugDataListShape, ActivityStrings.DebugDataListWithData, out inRes, out outRes); //-------------------------Assertions--------------------------------------------- Assert.AreEqual(1, outRes.Count); var outputResultList = outRes[0].FetchResultsList(); Assert.AreEqual(1, outputResultList.Count); Assert.AreEqual("", outputResultList[0].Value); }
public void DsfPathRename_GetState() { var fileNames = new List <string> { Path.Combine(TestContext.TestRunDirectory, Guid.NewGuid() + ".txt"), Path.Combine(TestContext.TestRunDirectory, Guid.NewGuid() + ".txt") }; foreach (string fileName in fileNames) { File.WriteAllText(fileName, @"TestData"); } CreateDataListWithRecsetAndCreateShape(fileNames, "FileNames", "Name", out string dataListShape, out string dataListWithData); var activityOperationBrokerMock = new ActivityOperationBrokerMock(); var inputPath = @"c:\OldFile.txt"; var outputPath = Path.Combine(TestContext.TestRunDirectory, "NewName.txt"); var result = "[[res]]"; var destinationUsername = "******"; var destinationPassword = "******"; var username = "******"; var password = "******"; var overwrite = false; var privateKeyFile = "[[KeyFile]]"; var destinationPrivateKeyFile = "[[DestKeyFile]]"; var act = new DsfPathRename { InputPath = inputPath, OutputPath = outputPath, Result = result, Overwrite = overwrite, DestinationUsername = destinationUsername, DestinationPassword = destinationPassword, Username = username, Password = password, PrivateKeyFile = privateKeyFile, DestinationPrivateKeyFile = destinationPrivateKeyFile, GetOperationBroker = () => activityOperationBrokerMock }; CheckPathOperationActivityDebugInputOutput(act, dataListShape, dataListWithData, out List <DebugItem> inRes, out List <DebugItem> outRes); //------------Execute Test--------------------------- var stateItems = act.GetState(); Assert.AreEqual(8, stateItems.Count()); var expectedResults = new[] { new StateVariable { Name = "InputPath", Type = StateVariable.StateType.Input, Value = inputPath }, new StateVariable { Name = "OutputPath", Type = StateVariable.StateType.Output, Value = outputPath }, new StateVariable { Name = "DestinationUsername", Type = StateVariable.StateType.Input, Value = destinationUsername }, new StateVariable { Name = "Username", Type = StateVariable.StateType.Input, Value = username }, new StateVariable { Name = "Overwrite", Type = StateVariable.StateType.Input, Value = overwrite.ToString() }, new StateVariable { Name = "PrivateKeyFile", Type = StateVariable.StateType.Input, Value = privateKeyFile }, new StateVariable { Name = "DestinationPrivateKeyFile", Type = StateVariable.StateType.Input, Value = destinationPrivateKeyFile }, new StateVariable { Name = "Result", Type = StateVariable.StateType.Output, Value = result } }; var iter = act.GetState().Select( (item, index) => new { value = item, expectValue = expectedResults[index] } ); //------------Assert Results------------------------- foreach (var entry in iter) { Assert.AreEqual(entry.expectValue.Name, entry.value.Name); Assert.AreEqual(entry.expectValue.Type, entry.value.Type); Assert.AreEqual(entry.expectValue.Value, entry.value.Value); } }