public string GenerateDeleteMessage(string localPath, IpAddressSettings ipAddressSettings) { MessageArgsDelete messageArgs = new MessageArgsDelete(localPath, ipAddressSettings); string result = GenerateCurrentCommandParametersXml(messageArgs); return(result); }
public void ProcessMsBuildLoggerMessage(ConcurrentQueue<MessageArgsLogger> messagesToBeSend, IpAddressSettings settings) { TcpListener agentMsBuildListener = null; TcpClient agentTcpMsbuildReader = null; try { agentMsBuildListener = new TcpListener(settings.GetIPAddress(), settings.Port); agentMsBuildListener.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1); agentTcpMsbuildReader = default(TcpClient); agentMsBuildListener.Start(); agentTcpMsbuildReader = agentMsBuildListener.AcceptTcpClient(); do { string dataFromClient = ATACore.TcpWrapperProcessor.TcpClientWrapper.ReadSimpleClientMessage(agentTcpMsbuildReader); if (!String.IsNullOrEmpty(dataFromClient)) ATACore.CommandExecutor.EnqueueNewMessage(dataFromClient, MessageSource.MsBuildLogger, messagesToBeSend); else if (dataFromClient == null) agentTcpMsbuildReader = agentMsBuildListener.AcceptTcpClient(); } while (true); } catch (Exception ex) { Log.Error("Exception in ProcessClientMessge", ex); } finally { ATACore.TcpWrapperProcessor.TcpListenerWrapper.CloseTcpMsLogger(agentMsBuildListener, agentTcpMsbuildReader); } }
public string GenerateBuildMessage(string localPath, string name, IpAddressSettings ipAddressSettings) { MessageArgsBuild messageArgs = new MessageArgsBuild(localPath, name, ipAddressSettings); string result = GenerateCurrentCommandParametersXml(messageArgs); return(result); }
private string BuildMsBuildAdditionalArguments(string msbuildProjPath, IpAddressSettings ipAddressSettings, string additionalArgs, string currentAssemblyFullpath) { string additionalArguments = String.Concat(msbuildProjPath, " ", additionalArgs, " ", "/fileLoggerParameters:LogFile=MsBuildLog.txt;append=true;Verbosity=normal;Encoding=UTF-8 /l:AutomationTestAssistantCore.MsBuildLogger.TcpIpLogger,", currentAssemblyFullpath, ";Ip=", ipAddressSettings.GetIPAddress(), ";Port=", ipAddressSettings.Port, ";"); return(additionalArguments); }
public MainWindow() { InitializeComponent(); SettingsAppearanceViewModel = new SettingsAppearanceViewModel(); messagesToBeSend = new ConcurrentQueue<MessageArgsLogger>(); CurrentExecutionViews = new List<CurrentExecutionViewModel>(); LocalMsBuildLogIpSettings = new IpAddressSettings("127.0.0.1:8889"); LocalExecutionIpSettings = new IpAddressSettings("127.0.0.1:8888"); }
public CurrentExecutionViewModel(TestsExecutionViewModel testsExecutionViewModel) { TestsExecutionViewModel = testsExecutionViewModel; AlreadyCreatedWorkspaces = new List<string>(); MessagesToBeDisplayed = new ConcurrentQueue<string>(); CommandsToBeExecuted = new List<string>(); CurrentSelectedMachine = TestsExecutionViewModel.GetCurrentlySelectedExecutionMachine(); CurrentAgentMachineExecutionIpSettings = new IpAddressSettings(CurrentSelectedMachine.Ip, "8888"); CurrentAgentMachineMsBuildLogIpSettings = new IpAddressSettings(CurrentSelectedMachine.Ip, "8889"); GenerateMessagesToBeSentToAgent(); }
public Process ExecuteMsbuildProject(string msbuildProjPath, IpAddressSettings ipAddressSettings, string additionalArgs = "") { string currentAssemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location; string currentAssemblyFullpath = String.Format(currentAssemblyLocation, "\\AutomationTestAssistantCore.dll"); string additionalArguments = BuildMsBuildAdditionalArguments(msbuildProjPath, ipAddressSettings, additionalArgs, currentAssemblyFullpath); ProcessStartInfo procStartInfo = new ProcessStartInfo(MSBUILD_PATH, additionalArguments); procStartInfo.RedirectStandardOutput = false; //procStartInfo.UseShellExecute = true; //procStartInfo.CreateNoWindow = false; procStartInfo.UseShellExecute = false; procStartInfo.CreateNoWindow = true; Process proc = new Process(); proc.StartInfo = procStartInfo; proc.Start(); return proc; }
private static void InitializeSettings() { clientSettings = new IpAddressSettings(ConfigurationManager.AppSettings["clientIp"], ConfigurationManager.AppSettings["clientPort"]); agentSettings = new IpAddressSettings(ConfigurationManager.AppSettings["agentIp"], ConfigurationManager.AppSettings["agentPort"]); msBuildLogSettings = new IpAddressSettings(ConfigurationManager.AppSettings["agentIp"], ConfigurationManager.AppSettings["msBuildAgentPort"]); Console.BackgroundColor = ConsoleColor.DarkGreen; commandsToBeExecuted = new ConcurrentQueue<string>(); messagesToBeSend = new ConcurrentQueue<MessageArgsLogger>(); cts = new CancellationTokenSource(); token = cts.Token; currentlyExecutedProc = null; lockObject = new Object(); agentListener = new TcpListener(agentSettings.GetIPAddress(), clientSettings.Port); agentListener.Start(); BaseLogger.Log.Info(AgentSettingsInitializedMsg); Console.WriteLine(AgentSettingsInitializedMsg); }
public Process ExecuteMsbuildProject(string msbuildProjPath, IpAddressSettings ipAddressSettings, string additionalArgs = "") { string currentAssemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location; string currentAssemblyFullpath = String.Format(currentAssemblyLocation, "\\AutomationTestAssistantCore.dll"); string additionalArguments = BuildMsBuildAdditionalArguments(msbuildProjPath, ipAddressSettings, additionalArgs, currentAssemblyFullpath); ProcessStartInfo procStartInfo = new ProcessStartInfo(MSBUILD_PATH, additionalArguments); procStartInfo.RedirectStandardOutput = false; //procStartInfo.UseShellExecute = true; //procStartInfo.CreateNoWindow = false; procStartInfo.UseShellExecute = false; procStartInfo.CreateNoWindow = true; Process proc = new Process(); proc.StartInfo = procStartInfo; proc.Start(); return(proc); }
public string GenerateCreateWorkspacetMessage(string projectPath, string tfsServerUrl, string workspaceName, string tfsPath, string localPath, IpAddressSettings ipAddressSettings) { MessageArgsWorkspaceCreation messageArgs = new MessageArgsWorkspaceCreation(Command.TFSWN, projectPath, tfsServerUrl, ipAddressSettings, workspaceName, tfsPath, localPath); string result = GenerateCurrentCommandParametersXml(messageArgs); return(result); }
public string GenerateResultParseMessage(string resultsFilePath, string currentUserName, IpAddressSettings ipAddressSettings) { MessageArgsParseResult messageArgs = new MessageArgsParseResult(resultsFilePath, currentUserName, ipAddressSettings); string result = GenerateCurrentCommandParametersXml(messageArgs); return(result); }
public string GenerateMsTestMessage(string projectPath, string testListContent, string resultsFilePath, string testListName, IpAddressSettings ipAddressSettings, string workingDir) { MessageArgsMsTest messageArgs = new MessageArgsMsTest(Command.MSTL, projectPath, ipAddressSettings, workingDir, testListContent, testListName, resultsFilePath); string result = GenerateCurrentCommandParametersXml(messageArgs); return(result); }
private void GetIpsInformation() { agentSettings = new IpAddressSettings(tbAgentIp.Text); clientSettings = new IpAddressSettings(tbClientIp.Text); msBuildLogSettings = new IpAddressSettings(tbMsBuildLogIp.Text); }
public string GenerateDeleteMessage(string localPath, IpAddressSettings ipAddressSettings) { MessageArgsDelete messageArgs = new MessageArgsDelete(localPath, ipAddressSettings); string result = GenerateCurrentCommandParametersXml(messageArgs); return result; }
public string GenerateResultParseMessage(string resultsFilePath, string currentUserName, IpAddressSettings ipAddressSettings) { MessageArgsParseResult messageArgs = new MessageArgsParseResult(resultsFilePath, currentUserName, ipAddressSettings); string result = GenerateCurrentCommandParametersXml(messageArgs); return result; }
public string GenerateTfsGetLatestMessage(string projectPath, string pathToGet, string userName, IpAddressSettings ipAddressSettings) { MessageArgsTfsGettingLatest messageArgs = new MessageArgsTfsGettingLatest(Command.TFGL, projectPath, ipAddressSettings, pathToGet, userName); string result = GenerateCurrentCommandParametersXml(messageArgs); return result; }
public string GenerateDeleteWorkspacetMessage(string projectPath, string tfsServerUrl, string workspaceName, string userName, IpAddressSettings ipAddressSettings) { MessageArgsWorkspaceDeletion messageArgs = new MessageArgsWorkspaceDeletion(Command.TFSWD, projectPath, ipAddressSettings, tfsServerUrl, workspaceName, userName); string result = GenerateCurrentCommandParametersXml(messageArgs); return result; }
private void GetLatest(string tfsProjectPath, string currentTfsUserName, string localPath, IpAddressSettings msBuildLoggerIpSettings) { Process currentlyExecutedProcess; MessageArgsTfsGettingLatest tfsGetLatestArgs = new MessageArgsTfsGettingLatest(Command.TFGL, tfsProjectPath, msBuildLoggerIpSettings, localPath, currentTfsUserName); currentlyExecutedProcess = ATACore.CommandLine.CommandLineExecutor.ExecuteTfsGetLatest(tfsGetLatestArgs); currentlyExecutedProcess.WaitForExit(Int32.MaxValue); }
private void CreateNewWorkspace(string tfsProjectPath, string currentUserName, string tfsUrl, string tfsPath, string localPath, IpAddressSettings msBuildLoggerIpSettings, string newWorkspaceName) { MessageArgsWorkspaceCreation tfsWorkspaceCreationArgs = new MessageArgsWorkspaceCreation(Command.TFSWN, tfsProjectPath, tfsUrl, msBuildLoggerIpSettings, newWorkspaceName, tfsPath, localPath); Process currentlyExecutedProcess = ATACore.CommandLine.CommandLineExecutor.ExecuteTfsCreateNewWorkspace(tfsWorkspaceCreationArgs); currentlyExecutedProcess.WaitForExit(Int32.MaxValue); ATACore.RegistryManager.WriterWorkspaceNameToRegistry(currentUserName, localPath, newWorkspaceName); }
private void BuildCurrentProject(string localPath, string name, IpAddressSettings msBuildLoggerIpSettings) { Process currentlyExecutedProcess; MessageArgsBuild buildArgs = new MessageArgsBuild(localPath, name, msBuildLoggerIpSettings); currentlyExecutedProcess = ATACore.CommandLine.CommandLineExecutor.ExecuteBuild(buildArgs); currentlyExecutedProcess.WaitForExit(Int32.MaxValue); }
private void PrepareAllCurrentProjectAddiotionalPaths(List<Task> taskToBeExecuted, string tfsProjectPath, string currentUserName, string currentTfsUserName, ProjectViewModel cProject, IpAddressSettings msBuildLoggerIpSettings) { foreach (var cAdditionalPath in cProject.ObservableAdditionalPaths) { string localPath = GetProjectLocalPath(currentUserName, cAdditionalPath.TfsPath); string workspaceName = ATACore.RegistryManager.GetWorkspaceName(currentUserName, localPath); string tfsUrl = cAdditionalPath.TfsUrl; string tfsPath = cAdditionalPath.TfsPath; Task t1 = taskToBeExecuted[taskToBeExecuted.Count - 1].ContinueWith((antecedent) => { if (!String.IsNullOrEmpty(workspaceName)) { DeleteWorkSpaceIfExists(tfsProjectPath, currentTfsUserName, tfsUrl, msBuildLoggerIpSettings, workspaceName); cAdditionalPath.WorkspacesForDelete.Add(workspaceName); } }); taskToBeExecuted.Add(t1); if (!AlreadyCreatedWorkspaces.Contains(tfsPath)) { ATACore.Utilities.FilesDeleter.DeleteAllFilesAndFolders(localPath); string newWorkspaceName = Guid.NewGuid().ToString(); Task t2 = taskToBeExecuted[taskToBeExecuted.Count - 1].ContinueWith((antecedent) => CreateNewWorkspace(tfsProjectPath, currentUserName, tfsUrl, tfsPath, localPath, msBuildLoggerIpSettings, newWorkspaceName)); taskToBeExecuted.Add(t2); AlreadyCreatedWorkspaces.Add(tfsPath); } Task t3 = taskToBeExecuted[taskToBeExecuted.Count - 1].ContinueWith((antecedent) => GetLatest(tfsProjectPath, currentTfsUserName, localPath, msBuildLoggerIpSettings)); taskToBeExecuted.Add(t3); } }
public void ProcessMsBuildLoggerMessage(ConcurrentQueue <MessageArgsLogger> messagesToBeSend, IpAddressSettings settings) { TcpListener agentMsBuildListener = null; TcpClient agentTcpMsbuildReader = null; try { agentMsBuildListener = new TcpListener(settings.GetIPAddress(), settings.Port); agentMsBuildListener.Server.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1); agentTcpMsbuildReader = default(TcpClient); agentMsBuildListener.Start(); agentTcpMsbuildReader = agentMsBuildListener.AcceptTcpClient(); do { string dataFromClient = ATACore.TcpWrapperProcessor.TcpClientWrapper.ReadSimpleClientMessage(agentTcpMsbuildReader); if (!String.IsNullOrEmpty(dataFromClient)) { ATACore.CommandExecutor.EnqueueNewMessage(dataFromClient, MessageSource.MsBuildLogger, messagesToBeSend); } else if (dataFromClient == null) { agentTcpMsbuildReader = agentMsBuildListener.AcceptTcpClient(); } } while (true); } catch (Exception ex) { Log.Error("Exception in ProcessClientMessge", ex); } finally { ATACore.TcpWrapperProcessor.TcpListenerWrapper.CloseTcpMsLogger(agentMsBuildListener, agentTcpMsbuildReader); } }
public string GenerateDeleteWorkspacetMessage(string projectPath, string tfsServerUrl, string workspaceName, string userName, IpAddressSettings ipAddressSettings) { MessageArgsWorkspaceDeletion messageArgs = new MessageArgsWorkspaceDeletion(Command.TFSWD, projectPath, ipAddressSettings, tfsServerUrl, workspaceName, userName); string result = GenerateCurrentCommandParametersXml(messageArgs); return(result); }
private string BuildMsBuildAdditionalArguments(string msbuildProjPath, IpAddressSettings ipAddressSettings, string additionalArgs, string currentAssemblyFullpath) { string additionalArguments = String.Concat(msbuildProjPath, " ", additionalArgs, " ", "/fileLoggerParameters:LogFile=MsBuildLog.txt;append=true;Verbosity=normal;Encoding=UTF-8 /l:AutomationTestAssistantCore.MsBuildLogger.TcpIpLogger,", currentAssemblyFullpath, ";Ip=", ipAddressSettings.GetIPAddress(), ";Port=", ipAddressSettings.Port, ";"); return additionalArguments; }
public string GenerateTfsGetLatestMessage(string projectPath, string pathToGet, string userName, IpAddressSettings ipAddressSettings) { MessageArgsTfsGettingLatest messageArgs = new MessageArgsTfsGettingLatest(Command.TFGL, projectPath, ipAddressSettings, pathToGet, userName); string result = GenerateCurrentCommandParametersXml(messageArgs); return(result); }
public string GenerateCreateWorkspacetMessage(string projectPath, string tfsServerUrl, string workspaceName, string tfsPath, string localPath, IpAddressSettings ipAddressSettings) { MessageArgsWorkspaceCreation messageArgs = new MessageArgsWorkspaceCreation(Command.TFSWN, projectPath, tfsServerUrl, ipAddressSettings, workspaceName, tfsPath, localPath); string result = GenerateCurrentCommandParametersXml(messageArgs); return result; }
public string GenerateMsTestMessage(string projectPath, string testListContent, string resultsFilePath, string testListName, IpAddressSettings ipAddressSettings, string workingDir) { MessageArgsMsTest messageArgs = new MessageArgsMsTest(Command.MSTL, projectPath, ipAddressSettings, workingDir, testListContent, testListName, resultsFilePath); string result = GenerateCurrentCommandParametersXml(messageArgs); return result; }
private void TestGetIpsInformation() { agentSettings = new IpAddressSettings("127.0.0.1:8887"); clientSettings = new IpAddressSettings("127.0.0.1:8888"); msBuildLogSettings = new IpAddressSettings("127.0.0.1:8889"); }
private void DeleteWorkSpaceIfExists(string tfsProjectPath, string currentTfsUserName, string tfsUrl, IpAddressSettings msBuildLoggerIpSettings, string workspaceName) { if (!String.IsNullOrEmpty(workspaceName)) { MessageArgsWorkspaceDeletion tfsWorkspaceDeletionArgs = new MessageArgsWorkspaceDeletion(Command.TFSWD, tfsProjectPath, msBuildLoggerIpSettings, tfsUrl, workspaceName, currentTfsUserName); Process currentlyExecutedProcess = ATACore.CommandLine.CommandLineExecutor.ExecuteTfsDeleteWorkspace(tfsWorkspaceDeletionArgs); currentlyExecutedProcess.WaitForExit(Int32.MaxValue); } }
public string GenerateBuildMessage(string localPath, string name, IpAddressSettings ipAddressSettings) { MessageArgsBuild messageArgs = new MessageArgsBuild(localPath, name, ipAddressSettings); string result = GenerateCurrentCommandParametersXml(messageArgs); return result; }