protected void NormalizeProfile(PluginProfileDto dto)
		{
			if (dto.Name == null)
				dto.Name = string.Empty;

			dto.Name = dto.Name.Trim();
		}
 protected virtual void CreateNewProfileName(PluginProfileDto pluginProfile, IAccount account)
 {
     while (account.Profiles.Any(x => x.Name == pluginProfile.Name))
     {
         pluginProfile.Name = String.Format("{0} _re-converted_", pluginProfile.Name);
     }
 }
Ejemplo n.º 3
0
 protected override void CreateNewProfileName(PluginProfileDto pluginProfile, IAccount account)
 {
     do
     {
         pluginProfile.Name = String.Concat(pluginProfile.Name, "_converted");
     } while (account.Profiles.Any(x => x.Name == pluginProfile.Name));
 }
Ejemplo n.º 4
0
        private static PluginProfileDto CreateTypedProfile(PluginProfileDto pluginProfileDto)
        {
            var profileGenericType = typeof(PluginProfileTypedDto <>).MakeGenericType(SettingsType);
            var typedProfile       = (PluginProfileDto)Activator.CreateInstance(profileGenericType);

            typedProfile.Settings = pluginProfileDto.Settings;
            typedProfile.Name     = pluginProfileDto.Name;
            return(typedProfile);
        }
        protected void NormalizeProfile(PluginProfileDto dto)
        {
            if (dto.Name == null)
            {
                dto.Name = string.Empty;
            }

            dto.Name = dto.Name.Trim();
        }
		private void ValidateUniqueness(PluginProfileDto pluginProfile, PluginProfileErrorCollection errors)
		{
			if (
				ProfileCollection.Any(
					x => string.Equals(x.Name.Value, pluginProfile.Name, StringComparison.InvariantCultureIgnoreCase)))
			{
				errors.Add(new PluginProfileError {FieldName = "Name", Message = "Profile name should be unique for plugin"});
			}
		}
		protected override PluginCommandResponseMessage OnExecute(PluginProfileDto profileDto)
		{
			NormalizeProfile(profileDto);

			AddPluginProfile(profileDto);
			SendProfileChangedLocalMessage(profileDto.Name, new ProfileAddedMessage());

			return new PluginCommandResponseMessage
			       	{ResponseData = string.Empty, PluginCommandStatus = PluginCommandStatus.Succeed};
		}
		public void AddPluginProfile(PluginProfileDto pluginProfile)
		{
			var errors = new PluginProfileErrorCollection();
			ValidateUniqueness(pluginProfile, errors);
			ValidateProfile(pluginProfile, errors);
			HandleErrors(errors);

			ChangeProfiles(
				profileCollection => profileCollection.Add(new ProfileCreationArgs(pluginProfile.Name, pluginProfile.Settings)));
		}
        private static void UpdateProfile(PluginProfileDto pluginProfileDto)
        {
            var command = new ExecutePluginCommandCommand
            {
                CommandName = EmbeddedPluginCommands.AddOrUpdateProfile,
                Arguments   = pluginProfileDto.Serialize()
            };

            ObjectFactory.GetInstance <TransportMock>().HandleMessageFromTp(command);
        }
		private static PluginProfileErrorCollection ValidateProfileForSeleniumUrl(PluginProfileDto profileDto)
		{
			var errors = new PluginProfileErrorCollection();
			if (string.IsNullOrEmpty(profileDto.Name) || string.IsNullOrEmpty(profileDto.Name.Trim()))
			{
				errors.Add(new PluginProfileError { FieldName = "Name", Message = "Profile name should not be empty" });
			}
			((TestRunImportPluginProfile)profileDto.Settings).ValidateSeleniumUrlData(errors);
			return errors;
		}
        private void UpdateProfile(MashupManagerProfile managerProfile)
        {
            var addOrUpdateProfileCommand = ObjectFactory.GetInstance <AddOrUpdateProfileCommand>();
            var profileDto = new PluginProfileDto
            {
                Name     = ProfileName,
                Settings = managerProfile
            };

            addOrUpdateProfileCommand.Execute(profileDto.Serialize());
        }
 private void ValidateUniqueness(PluginProfileDto pluginProfile, PluginProfileErrorCollection errors)
 {
     if (
         ProfileCollection.Any(
             x => string.Equals(x.Name.Value, pluginProfile.Name, StringComparison.InvariantCultureIgnoreCase)))
     {
         errors.Add(new PluginProfileError {
             FieldName = "Name", Message = "Profile name should be unique for plugin"
         });
     }
 }
 private static void FixName(PluginProfileDto pluginProfile)
 {
     foreach (var profileNameChar in pluginProfile.Name.Distinct())
     {
         if (ProfileDtoValidator.IsValid(profileNameChar.ToString()))
         {
             continue;
         }
         pluginProfile.Name = pluginProfile.Name.Replace(profileNameChar, '_');
     }
 }
        public void AddPluginProfile(PluginProfileDto pluginProfile)
        {
            var errors = new PluginProfileErrorCollection();

            ValidateUniqueness(pluginProfile, errors);
            ValidateProfile(pluginProfile, errors);
            HandleErrors(errors);

            ChangeProfiles(
                profileCollection => profileCollection.Add(new ProfileCreationArgs(pluginProfile.Name, pluginProfile.Settings)));
        }
Ejemplo n.º 15
0
        protected override PluginCommandResponseMessage OnExecute(PluginProfileDto profileDto)
        {
            NormalizeProfile(profileDto);

            AddPluginProfile(profileDto);
            SendProfileChangedLocalMessage(profileDto.Name, new ProfileAddedMessage());

            return(new PluginCommandResponseMessage
            {
                ResponseData = string.Empty, PluginCommandStatus = PluginCommandStatus.Succeed
            });
        }
        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 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 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);
		}
        protected override PluginProfileDto ConvertToPluginProfile(PluginProfile legacyProfile)
        {
            var pluginProfileDto = new PluginProfileDto {
                Name = legacyProfile.ProfileName
            };

            var document  = ConvertToXmlDocument(legacyProfile);
            var converted = Parse(document);

            pluginProfileDto.Settings = converted;

            return(pluginProfileDto);
        }
Ejemplo n.º 20
0
        private static PluginProfileErrorCollection ValidateProfileForSeleniumUrl(PluginProfileDto profileDto)
        {
            var errors = new PluginProfileErrorCollection();

            if (string.IsNullOrEmpty(profileDto.Name) || string.IsNullOrEmpty(profileDto.Name.Trim()))
            {
                errors.Add(new PluginProfileError {
                    FieldName = "Name", Message = "Profile name should not be empty"
                });
            }
            ((TestRunImportPluginProfile)profileDto.Settings).ValidateSeleniumUrlData(errors);
            return(errors);
        }
		private static PluginProfileErrorCollection ValidateProfileForMapping(PluginProfileDto profileDto)
		{
			var errors = new PluginProfileErrorCollection();
			if (((TestRunImportPluginProfile)profileDto.Settings).PostResultsToRemoteUrl)
			{
				errors.Add(new PluginProfileError { FieldName = "Mapping", Message = "Check mapping is not available when results are posted to the remote Url" });
			}
			else
			{
				ObjectFactory.GetInstance<IMappingProfileValidator>().ValidateProfileForMapping(
					((TestRunImportPluginProfile) profileDto.Settings), errors);
			}
			return errors;
		}
		public PluginCommandResponseMessage Execute(string _)
		{
			bool wasNoProfile = _pluginContext.ProfileName.IsEmpty;
			var c = new AddOrUpdateProfileCommand(_bus, _profileCollection, _pluginContext, _pluginMetadata);
			var profile = new PluginProfileDto { Name = SearcherProfile.Name }.Serialize();
			var result = c.Execute(profile);
			if (result.PluginCommandStatus == PluginCommandStatus.Succeed && wasNoProfile)
			{
				_bus.SendLocalWithContext(new ProfileName(SearcherProfile.Name), _pluginContext.AccountName, new ExecutePluginCommandCommand
					{
						CommandName = SetEnableForTp2.CommandName,
						Arguments = bool.TrueString
					});
			}
			return result;
		}
		public void ShouldBeAbleToSerializeProfile()
		{
			TransportMock.CreateWithoutStructureMapClear(typeof (SampleProfileSerialized).Assembly);
			var pluginProfile = new PluginProfileDto
			                    	{
			                    		Name = "TestProfile",
			                    		Settings = new SampleProfileSerialized {StringValue = "components"}
			                    	};

			var serializedProfile = pluginProfile.Serialize();
			var deserializedProfile = serializedProfile.DeserializeProfile();

			deserializedProfile.Name.Should(Be.EqualTo("TestProfile"), "deserializedProfile.Name.Should(Be.EqualTo(\"TestProfile\"))");
			deserializedProfile.Settings.Should(Be.Not.Null, "Settings weren't deserialized");
			var settings = (SampleProfileSerialized) deserializedProfile.Settings;
			settings.StringValue.Should(Be.EqualTo("components"), "settings.StringValue.Should(Be.EqualTo(\"components\"))");
		}
        private static PluginProfileErrorCollection ValidateProfileForMapping(PluginProfileDto profileDto)
        {
            var errors = new PluginProfileErrorCollection();

            if (((TestRunImportPluginProfile)profileDto.Settings).PostResultsToRemoteUrl)
            {
                errors.Add(new PluginProfileError {
                    FieldName = "Mapping", Message = "Check mapping is not available when results are posted to the remote Url"
                });
            }
            else
            {
                ObjectFactory.GetInstance <IMappingProfileValidator>().ValidateProfileForMapping(
                    ((TestRunImportPluginProfile)profileDto.Settings), errors);
            }
            return(errors);
        }
		private void UpdatePluginProfile(PluginProfileDto pluginProfile)
		{
			var errors = new PluginProfileErrorCollection();
			ValidateProfile(pluginProfile, errors);
			HandleErrors(errors);

			ChangeProfiles(profileCollection =>
			               	{
			               		var profile = profileCollection[pluginProfile.Name];
			               		profile.Settings = pluginProfile.Settings;
			               		if (PluginMetadata.IsUpdatedProfileInitializable)
			               		{
			               			profile.MarkAsNotInitialized();
			               		}
			               		profile.Save();
			               	});
		}
        private void UpdatePluginProfile(PluginProfileDto pluginProfile)
        {
            var errors = new PluginProfileErrorCollection();

            ValidateProfile(pluginProfile, errors);
            HandleErrors(errors);

            ChangeProfiles(profileCollection =>
            {
                var profile      = profileCollection[pluginProfile.Name];
                profile.Settings = pluginProfile.Settings;
                if (PluginMetadata.IsUpdatedProfileInitializable)
                {
                    profile.MarkAsNotInitialized();
                }
                profile.Save();
            });
        }
Ejemplo n.º 27
0
        public PluginCommandResponseMessage Execute(string _)
        {
            bool wasNoProfile = _pluginContext.ProfileName.IsEmpty;
            var  c = new AddOrUpdateProfileCommand(_bus, _profileCollection, _pluginContext, _pluginMetadata);
            var  profile = new PluginProfileDto {
                Name = SearcherProfile.Name
            }.Serialize();
            var result = c.Execute(profile);

            if (result.PluginCommandStatus == PluginCommandStatus.Succeed && wasNoProfile)
            {
                _bus.SendLocalWithContext(new ProfileName(SearcherProfile.Name), _pluginContext.AccountName, new ExecutePluginCommandCommand
                {
                    CommandName = SetEnableForTp2.CommandName,
                    Arguments   = bool.TrueString
                });
            }
            return(result);
        }
        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);
        }
        public void ShouldBeAbleToSerializeProfile()
        {
            TransportMock.CreateWithoutStructureMapClear(typeof(SampleProfileSerialized).Assembly);
            var pluginProfile = new PluginProfileDto
            {
                Name     = "TestProfile",
                Settings = new SampleProfileSerialized {
                    StringValue = "components"
                }
            };

            var serializedProfile   = pluginProfile.Serialize();
            var deserializedProfile = serializedProfile.DeserializeProfile();

            deserializedProfile.Name.Should(Be.EqualTo("TestProfile"));
            deserializedProfile.Settings.Should(Be.Not.Null, "Settings weren't deserialized");
            var settings = (SampleProfileSerialized)deserializedProfile.Settings;

            settings.StringValue.Should(Be.EqualTo("components"));
        }
        public void UpdateProfile(string profileName)
        {
            var oldProfile       = ObjectFactory.GetInstance <IStorageRepository>().GetProfile <ProjectEmailProfile>();
            var pluginProfileDto = new PluginProfileDto
            {
                Name     = profileName,
                Settings = new ProjectEmailProfile
                {
                    Login      = oldProfile.Login,
                    MailServer = oldProfile.MailServer,
                    Password   = oldProfile.Password,
                    Port       = 2,
                    Protocol   = "pop3",
                    Rules      = "then attach to project 111",
                    UseSSL     = true
                }
            };

            UpdateProfile(pluginProfileDto);
        }
Ejemplo n.º 31
0
        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);
        }
Ejemplo n.º 32
0
        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);
        }
		protected override PluginCommandResponseMessage OnExecute(PluginProfileDto profileDto)
		{
			NormalizeProfile(profileDto);

			ITargetProcessMessage message;

			if (_profileCollection.Any(x => x.Name == profileDto.Name))
			{
				UpdatePluginProfile(profileDto);
				message = new ProfileUpdatedMessage();
			}
			else
			{
				AddPluginProfile(profileDto);
				message = new ProfileAddedMessage();
			}

			SendProfileChangedLocalMessage(profileDto.Name, message);

			return new PluginCommandResponseMessage
			       	{ResponseData = string.Empty, PluginCommandStatus = PluginCommandStatus.Succeed};
		}
        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);
        }
        public void ModifyJiraUrlByPlugin(string profileName, string accountName, string jiraUrl)
        {
            var account = ObjectFactory.GetInstance <IAccountRepository>().GetAll().First(x => x.Name == accountName);
            var context = ObjectFactory.GetInstance <PluginContextMock>();

            context.ProfileName = profileName;
            context.AccountName = account.Name;
            ObjectFactory.GetInstance <IBus>().SetIn((ProfileName)profileName);
            ObjectFactory.GetInstance <IBus>().SetIn(account.Name);

            var profile =
                ObjectFactory.GetInstance <IAccountCollection>().GetOrCreate(context.AccountName).Profiles[context.ProfileName].
                GetProfile <SampleJiraProfile>();

            profile.JiraUrl = jiraUrl;

            var updatedProfileDto = new PluginProfileDto {
                Name = context.ProfileName.Value, Settings = profile
            };

            ObjectFactory.GetInstance <AddOrUpdateProfileCommand>().Execute(updatedProfileDto.Serialize());
        }
        public void UpdatedProfile(string profileName, string mailServer, string login)
        {
            ObjectFactory.GetInstance <TransportMock>().ResetAllOnMessageHandlers();
            ObjectFactory.GetInstance <TransportMock>()
            .On <RetrieveAllMessageUidsQuery>()
            .Reply(x =>
            {
                _queryCount++;
                return(_uids.Where(uid => uid.MailLogin == login && uid.MailServer == mailServer)
                       .Select(uid => new MessageUidQueryResult {
                    Dtos = new[] { uid }, QueryResultCount = _uids.Count
                })
                       .ToArray());
            });
            var pluginProfileDto = new PluginProfileDto
            {
                Name     = profileName,
                Settings = ProfileSettings(mailServer, login)
            };

            UpdateProfile(pluginProfileDto);
        }
        protected override PluginCommandResponseMessage OnExecute(PluginProfileDto profileDto)
        {
            NormalizeProfile(profileDto);

            ITargetProcessMessage message;

            if (_profileCollection.Any(x => x.Name == profileDto.Name))
            {
                UpdatePluginProfile(profileDto);
                message = new ProfileUpdatedMessage();
            }
            else
            {
                AddPluginProfile(profileDto);
                message = new ProfileAddedMessage();
            }

            SendProfileChangedLocalMessage(profileDto.Name, message);

            return(new PluginCommandResponseMessage
            {
                ResponseData = string.Empty, PluginCommandStatus = PluginCommandStatus.Succeed
            });
        }
 private void CheckReturnedProfile(PluginProfileDto profileDto)
 {
     _response.ResponseData.Should(Be.EqualTo(profileDto.Serialize()));
 }
        public void UpdateProfile(string profileName)
        {
            var oldProfile = ObjectFactory.GetInstance<IStorageRepository>().GetProfile<ProjectEmailProfile>();
            var pluginProfileDto = new PluginProfileDto
            {
                Name = profileName,
                Settings = new ProjectEmailProfile
                {
                    Login = oldProfile.Login,
                    MailServer = oldProfile.MailServer,
                    Password = oldProfile.Password,
                    Port = 2,
                    Protocol = "pop3",
                    Rules = "then attach to project 111",
                    UseSSL = true
                }
            };

            UpdateProfile(pluginProfileDto);
        }
        private static void UpdateProfile(PluginProfileDto pluginProfileDto)
        {
            var command = new ExecutePluginCommandCommand
            {
                CommandName = EmbeddedPluginCommands.AddOrUpdateProfile,
                Arguments = pluginProfileDto.Serialize()
            };

            ObjectFactory.GetInstance<TransportMock>().HandleMessageFromTp(command);
        }
		protected abstract PluginCommandResponseMessage OnExecute(PluginProfileDto profileProfileDto);
 public void UpdatedProfile(string profileName, string mailServer, string login)
 {
     ObjectFactory.GetInstance<TransportMock>().ResetAllOnMessageHandlers();
     ObjectFactory.GetInstance<TransportMock>()
         .On<RetrieveAllMessageUidsQuery>()
         .Reply(x =>
                {
                	_queryCount++;
                	return _uids.Where(uid => uid.MailLogin == login && uid.MailServer == mailServer)
                		.Select(uid => new MessageUidQueryResult {Dtos = new[] {uid}, QueryResultCount = _uids.Count})
                		.ToArray();
                });
     var pluginProfileDto = new PluginProfileDto
     {
         Name = profileName,
         Settings = ProfileSettings(mailServer, login)
     };
     UpdateProfile(pluginProfileDto);
 }
		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);
		}
        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);
        }
        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);
        }
		protected static void ValidateProfile(PluginProfileDto pluginProfile, PluginProfileErrorCollection errors)
		{
			new ProfileDtoValidator(pluginProfile).Validate(errors);
		}
Ejemplo n.º 48
0
 public ProfileDtoValidator(PluginProfileDto dto)
 {
     _dto = dto;
 }
		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);
		}
 private void CheckReturnedProfile(PluginProfileDto profileDto)
 {
     _response.ResponseData.Should(Be.EqualTo(profileDto.Serialize()));
 }
 public ProfileDtoValidator(PluginProfileDto dto)
 {
     _dto = dto;
 }
 protected static void ValidateProfile(PluginProfileDto pluginProfile, PluginProfileErrorCollection errors)
 {
     new ProfileDtoValidator(pluginProfile).Validate(errors);
 }
		private void UpdateProfile(MashupManagerProfile managerProfile)
		{
			var addOrUpdateProfileCommand = ObjectFactory.GetInstance<AddOrUpdateProfileCommand>();
			var profileDto = new PluginProfileDto
			{
				Name = ProfileName,
				Settings = managerProfile
			};
			addOrUpdateProfileCommand.Execute(profileDto.Serialize(), null);
		}
        public void ModifyJiraUrlByPlugin(string profileName, string accountName, string jiraUrl)
        {
            var account = ObjectFactory.GetInstance<IAccountRepository>().GetAll().First(x => x.Name == accountName);
            var context = ObjectFactory.GetInstance<PluginContextMock>();

            context.ProfileName = profileName;
            context.AccountName = account.Name;
            ObjectFactory.GetInstance<IBus>().SetIn((ProfileName) profileName);
            ObjectFactory.GetInstance<IBus>().SetIn(account.Name);

            var profile = ObjectFactory.GetInstance<IAccountCollection>().GetOrCreate(context.AccountName).Profiles[context.ProfileName].GetProfile<SampleJiraProfile>();
            profile.JiraUrl = jiraUrl;

            var updatedProfileDto = new PluginProfileDto {Name = context.ProfileName.Value, Settings = profile};
            ObjectFactory.GetInstance<AddOrUpdateProfileCommand>().Execute(updatedProfileDto.Serialize());
        }
 protected abstract PluginCommandResponseMessage OnExecute(PluginProfileDto profileProfileDto);
        private void CreateOrUpdateProfile(MashupNames names)
        {
            var command = ObjectFactory.GetInstance<AddOrUpdateProfileCommand>();

            var pluginProfileDto = new PluginProfileDto
            {
                Name = ProfileName,
                Settings = new MashupManagerProfile
                {
                    MashupNames = names
                }
            };

            command.Execute(pluginProfileDto.Serialize());
        }