コード例 #1
0
		protected void NormalizeProfile(PluginProfileDto dto)
		{
			if (dto.Name == null)
				dto.Name = string.Empty;

			dto.Name = dto.Name.Trim();
		}
コード例 #2
0
 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);
     }
 }
コード例 #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));
 }
コード例 #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);
        }
コード例 #5
0
        protected void NormalizeProfile(PluginProfileDto dto)
        {
            if (dto.Name == null)
            {
                dto.Name = string.Empty;
            }

            dto.Name = dto.Name.Trim();
        }
コード例 #6
0
		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"});
			}
		}
コード例 #7
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};
		}
コード例 #8
0
		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)));
		}
コード例 #9
0
        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;
		}
コード例 #11
0
        private void UpdateProfile(MashupManagerProfile managerProfile)
        {
            var addOrUpdateProfileCommand = ObjectFactory.GetInstance <AddOrUpdateProfileCommand>();
            var profileDto = new PluginProfileDto
            {
                Name     = ProfileName,
                Settings = managerProfile
            };

            addOrUpdateProfileCommand.Execute(profileDto.Serialize());
        }
コード例 #12
0
 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"
         });
     }
 }
コード例 #13
0
 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, '_');
     }
 }
コード例 #14
0
        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)));
        }
コード例 #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
            });
        }
コード例 #16
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();
        }
コード例 #17
0
        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);
        }
コード例 #18
0
		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);
		}
コード例 #19
0
        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);
        }
コード例 #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;
		}
コード例 #22
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;
		}
		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);
        }
コード例 #25
0
		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();
			               	});
		}
コード例 #26
0
        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();
            });
        }
コード例 #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);
        }
コード例 #28
0
        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"));
        }
コード例 #30
0
        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);
        }
コード例 #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);
        }
コード例 #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();
        }
コード例 #33
0
        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);
        }
コード例 #34
0
		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};
		}
コード例 #35
0
        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);
        }
コード例 #36
0
        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());
        }
コード例 #37
0
        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);
        }
コード例 #38
0
        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()));
 }
コード例 #40
0
        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);
        }
コード例 #41
0
        private static void UpdateProfile(PluginProfileDto pluginProfileDto)
        {
            var command = new ExecutePluginCommandCommand
            {
                CommandName = EmbeddedPluginCommands.AddOrUpdateProfile,
                Arguments = pluginProfileDto.Serialize()
            };

            ObjectFactory.GetInstance<TransportMock>().HandleMessageFromTp(command);
        }
コード例 #42
0
		protected abstract PluginCommandResponseMessage OnExecute(PluginProfileDto profileProfileDto);
コード例 #43
0
 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);
 }
コード例 #44
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);
		}
        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);
        }
コード例 #47
0
		protected static void ValidateProfile(PluginProfileDto pluginProfile, PluginProfileErrorCollection errors)
		{
			new ProfileDtoValidator(pluginProfile).Validate(errors);
		}
コード例 #48
0
 public ProfileDtoValidator(PluginProfileDto dto)
 {
     _dto = dto;
 }
コード例 #49
0
		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);
		}
コード例 #50
0
 private void CheckReturnedProfile(PluginProfileDto profileDto)
 {
     _response.ResponseData.Should(Be.EqualTo(profileDto.Serialize()));
 }
コード例 #51
0
 public ProfileDtoValidator(PluginProfileDto dto)
 {
     _dto = dto;
 }
コード例 #52
0
 protected static void ValidateProfile(PluginProfileDto pluginProfile, PluginProfileErrorCollection errors)
 {
     new ProfileDtoValidator(pluginProfile).Validate(errors);
 }
コード例 #53
0
		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());
        }
コード例 #55
0
 protected abstract PluginCommandResponseMessage OnExecute(PluginProfileDto profileProfileDto);
コード例 #56
0
        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());
        }