/// <summary> /// Adds a profile for an account /// </summary> /// <param name="profileName"></param> /// <param name="accountName"></param> /// <param name="profileSettings"></param> /// <returns></returns> public IProfile AddProfile(ProfileName profileName, AccountName accountName, object profileSettings) { var command = new ExecutePluginCommandCommand { CommandName = EmbeddedPluginCommands.AddProfile, Arguments = new PluginProfileDto { Name = profileName.Value, Settings = profileSettings }.Serialize() }; HandleMessageFromTp( new List <HeaderInfo> { new HeaderInfo { Key = BusExtensions.ACCOUNTNAME_KEY, Value = accountName.Value } }, command); var account = ObjectFactory.GetInstance <IAccountCollection>().GetOrCreate(accountName); var profile = account.Profiles[profileName]; if (profile == null) { throw new ApplicationException( string.Format( "Profile '{0}' was not found in account '{1}'. Probably it's because profile did not pass validation -- check TpQueue for errors", profileName.Value, accountName.Value)); } return(profile); }
public void SeleniumResultsCommandIsSent() { var command = new ExecutePluginCommandCommand { CommandName = "SeleniumResults", Arguments = ReadSeleniumResourceFileForCurrentProfile() }; Context.Transport.HandleMessageFromTp(Context.CurrentProfile, command); }
private void HandlePluginCommand(string commandName, string args) { var command = new ExecutePluginCommandCommand { CommandName = commandName, Arguments = args }; TransportMock.TpQueue.Clear(); TransportMock.HandleMessageFromTp(command); }
private static void UpdateProfile(PluginProfileDto pluginProfileDto) { var command = new ExecutePluginCommandCommand { CommandName = EmbeddedPluginCommands.AddOrUpdateProfile, Arguments = pluginProfileDto.Serialize() }; ObjectFactory.GetInstance <TransportMock>().HandleMessageFromTp(command); }
public void WhenProfileIsValidatedForMapping() { var args = new PluginProfileDto { Settings = _settings }.Serialize(); var command = new ExecutePluginCommandCommand { CommandName = "ValidateProfileForMapping", Arguments = args }; Context.Transport.TpQueue.Clear(); Context.Transport.HandleMessageFromTp(command); }
public void ReceivePluginSpecificChangePluginProfileCommand(string commandName, string accountName, string profileName) { ObjectFactory.GetInstance <PluginContextMock>().AccountName = accountName; ObjectFactory.GetInstance <PluginContextMock>().ProfileName = profileName; var command = new ExecutePluginCommandCommand { CommandName = commandName, Arguments = new PluginProfileDto { Name = profileName }.Serialize() }; ObjectFactory.GetInstance <PluginCommandHandler>().Handle(command); }
public void Handle(AccountRemovedMessage message) { _log.InfoFormat("Removing account {0} profiles", message.AccountName); var account = _collection.GetOrCreate(message.AccountName); foreach (var profile in account.Profiles) { _log.InfoFormat("Removing account {0} profile {1}", message.AccountName, profile.Name); var deleteProfileCommand = new ExecutePluginCommandCommand { CommandName = EmbeddedPluginCommands.DeleteProfile, Arguments = string.Empty }; _bus.SendLocalWithContext(profile.Name, account.Name, deleteProfileCommand); } _bus.SendLocalWithContext(string.Empty, string.Empty, new AccountRemovedLastStepMessage(message.AccountName)); }
private static void UpdateProfile(TransportMock transportMock, IProfileReadonly profile) { var addOrUpdateProfileCmd = new ExecutePluginCommandCommand { CommandName = EmbeddedPluginCommands.AddOrUpdateProfile, Arguments = profile.ConvertToDto().Serialize() }; transportMock.HandleMessageFromTp( new List <HeaderInfo> { new HeaderInfo { Key = BusExtensions.ACCOUNTNAME_KEY, Value = AccountName.Empty.Value } }, addOrUpdateProfileCmd); }
public void SetStringValue(string profileName, string stringValue, string accountName) { var profileUpdated = new PluginProfileDto { Name = profileName, Settings = new SampleProfileSerialized { StringValue = stringValue } }; var addOrUpdateProfileCmd = new ExecutePluginCommandCommand { CommandName = EmbeddedPluginCommands.AddOrUpdateProfile, Arguments = profileUpdated.Serialize() }; _transportMock.HandleMessageFromTp( new List <HeaderInfo> { new HeaderInfo { Key = BusExtensions.ACCOUNTNAME_KEY, Value = accountName } }, addOrUpdateProfileCmd); }
private void CreateProfileInitialization(ProjectEmailProfile settings, string profileName) { var profile = new PluginProfileDto { Name = profileName, Settings = settings }; var createProfileCmd = new ExecutePluginCommandCommand { CommandName = EmbeddedPluginCommands.AddProfile, Arguments = profile.Serialize() }; _transportMock.HandleMessageFromTp( new List <HeaderInfo> { new HeaderInfo { Key = BusExtensions.ACCOUNTNAME_KEY, Value = "Account" } }, createProfileCmd); }
private void HandlePluginCommand(string commandName, string args) { TransportMock.TpQueue.Clear(); var command = new ExecutePluginCommandCommand { CommandName = commandName, Arguments = args }; TransportMock.HandleMessageFromTp( new List <HeaderInfo> { new HeaderInfo { Key = BusExtensions.ACCOUNTNAME_KEY, Value = AccountName.Empty.Value }, new HeaderInfo { Key = BusExtensions.PROFILENAME_KEY, Value = Profile.Name.Value } }, command); }
public void CreateProfile(string profileName, string accountName) { var profileDto = new PluginProfileDto { Name = profileName, Settings = new SampleProfileSerialized() }; var createProfileCmd = new ExecutePluginCommandCommand { CommandName = EmbeddedPluginCommands.AddProfile, Arguments = profileDto.Serialize() }; _transportMock.HandleMessageFromTp( new List <HeaderInfo> { new HeaderInfo { Key = BusExtensions.ACCOUNTNAME_KEY, Value = accountName } }, createProfileCmd); var profile = ObjectFactory.GetInstance <IAccountCollection>().GetOrCreate(accountName).Profiles[profileName]; profile.MarkAsInitialized(); profile.Save(); }
public void ExecuteCommand(string commandName, string account, string profileName) { var profile = new PluginProfileDto { Name = profileName, Settings = new SampleProfileSerialized() }; var cmd = new ExecutePluginCommandCommand { CommandName = commandName, Arguments = profile.Serialize() }; Context.TransportMock.HandleMessageFromTp( new List <HeaderInfo> { new HeaderInfo { Key = BusExtensions.ACCOUNTNAME_KEY, Value = account }, new HeaderInfo { Key = BusExtensions.PROFILENAME_KEY, Value = profileName } }, cmd); }
public void SetSyncInterval(string profileName, string accountName, int syncInterval) { var currentProfileDto = new PluginProfileDto { Name = profileName, Settings = new SampleProfileSerialized { SynchronizationInterval = syncInterval } }; var createProfileCmd = new ExecutePluginCommandCommand { CommandName = EmbeddedPluginCommands.AddOrUpdateProfile, Arguments = currentProfileDto.Serialize() }; ObjectFactory.GetInstance <TransportMock>().HandleMessageFromTp( new List <HeaderInfo> { new HeaderInfo { Key = BusExtensions.ACCOUNTNAME_KEY, Value = accountName } }, createProfileCmd); }