public PluginCommandResponseMessage Execute(string args) { var guid = new Guid(args); var subscriber = SubscriberRepository.GetSubscriber(guid); var response = new PluginCommandResponseMessage() { PluginCommandStatus = PluginCommandStatus.Succeed, ResponseData = subscriber.Serialize() }; subscriber.Messages.Clear(); return response; }
public void WhenSaved() { HandlePluginCommand("AddProfile", new PluginProfileDto {Name = "Test Profile", Settings = _settings}.Serialize()); _response = TransportMock.TpQueue.GetMessages<PluginCommandResponseMessage>().Single(); _errors = new PluginProfileErrorCollection(); if (_response.PluginCommandStatus == PluginCommandStatus.Fail) { _errors = _response.ResponseData.Deserialize<PluginProfileErrorCollection>(); } }
public void GetProfileCommandReceived(string accountName, string profileName) { ObjectFactory.GetInstance<PluginContextMock>().AccountName = accountName; _response = ObjectFactory.GetInstance<GetProfileCommand>().Execute(profileName); }
public void WhenCheckedConnection() { HandlePluginCommand("CheckConnection", new PluginProfileDto {Name = "Test Profile", Settings = _settings}.Serialize()); _response = Context.Transport.TpQueue.GetMessages<PluginCommandResponseMessage>().Single(); _errors = _response.ResponseData.Deserialize<PluginProfileErrorCollection>(); }
public void RequestAutomapping() { var settings = new ConnectionSettings {UserMapping = _settings.UserMapping}; var args = new AutomapVcsToTpUsersCommandArgs { Connection = settings, TpUsers = Context.TpUsers.ToList() }; HandlePluginCommand(ObjectFactory.GetInstance<AutomapVcsToTpUsersCommand>().Name, args.Serialize()); _response = Context.Transport.TpQueue.GetMessages<PluginCommandResponseMessage>().Single(); }
public PluginCommandResponseMessage Execute(string arguments) { Arguments = arguments; var pluginCustomCommandResponse = new PluginCommandResponseMessage {ResponseData = "Some Response"}; ResponseMessage = pluginCustomCommandResponse; return pluginCustomCommandResponse; }
private PluginCommandResponseMessage OnExecute() { var resultMessage = new PluginCommandResponseMessage {ResponseData = string.Empty, PluginCommandStatus = PluginCommandStatus.Succeed}; var profile = _storageRepository.GetProfile<TestRunImportPluginProfile>(); if (profile.FrameworkType == FrameworkTypes.FrameworkTypes.Selenium && profile.PostResultsToRemoteUrl) { return resultMessage; } try { var uri = new Uri(profile.ResultsFilePath); var factoryResult = _streamFactory.OpenStreamIfModified(uri, new LastModifyResult(), profile.PassiveMode); if (factoryResult != null) { _storageRepository.Get<LastModifyResult>().Clear(); _storageRepository.Get<LastModifyResult>().Add(factoryResult.LastModifyResult); using (factoryResult.Stream) { using (var reader = new StreamReader(factoryResult.Stream)) { try { var result = _resultsReaderFactory.GetResolver(profile, reader).GetTestRunImportResults(); if (result.Count > 0) { _localBus.SendLocal(new TestRunImportResultDetectedLocalMessage { TestRunImportInfo = new TestRunImportInfo { TestRunImportResults = result.ToArray() } }); } } catch (ApplicationException ex) { resultMessage.ResponseData = ex.Message; resultMessage.PluginCommandStatus = PluginCommandStatus.Error; } catch (XmlException ex) { resultMessage.ResponseData = string.Format("Error parsing results XML file; {0}", ex.Message); resultMessage.PluginCommandStatus = PluginCommandStatus.Error; } catch (Exception ex) { resultMessage.ResponseData = string.Format("Error parsing results XML file; {0}", ex.Message); resultMessage.PluginCommandStatus = PluginCommandStatus.Error; } } } } } catch (UriFormatException ex) { resultMessage.ResponseData = string.Format("Specified path has invalid format. {0}", ex.Message); resultMessage.PluginCommandStatus = PluginCommandStatus.Error; } catch (ApplicationException ex) { resultMessage.ResponseData = string.Format("Specified path has invalid format. {0}", ex.Message); resultMessage.PluginCommandStatus = PluginCommandStatus.Error; } catch (Exception ex) { resultMessage.ResponseData = string.Format("Could not read file \"{0}\": {1}", profile.ResultsFilePath, ex.Message); resultMessage.PluginCommandStatus = PluginCommandStatus.Error; } return resultMessage; }