private void EditRabbitMQSource()
        {
            _model.EditSource(SelectedRabbitMQSource);
            RabbitMQSources = LoadRabbitMQSources();
            IRabbitMQServiceSourceDefinition editedRabbitMQSources = RabbitMQSources.FirstOrDefault(source => source.ResourceID == RabbitMQSourceResourceId);

            SetSelectedRabbitMQSource(editedRabbitMQSources);
        }
예제 #2
0
        public StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace)
        {
            ExecuteMessage     msg        = new ExecuteMessage();
            Dev2JsonSerializer serializer = new Dev2JsonSerializer();

            try
            {
                Dev2Logger.Info("Test RabbitMQ Service Source");
                StringBuilder resourceDefinition;
                msg.HasError = false;

                values.TryGetValue("RabbitMQServiceSource", out resourceDefinition);

                RabbitMQServiceSourceDefinition rabbitMQServiceSourceDefinition = serializer.Deserialize <RabbitMQServiceSourceDefinition>(resourceDefinition);
                RabbitMQSources  rabbitMQSources = new RabbitMQSources();
                ValidationResult result          = rabbitMQSources.Test(new RabbitMQSource
                {
                    ResourceID   = rabbitMQServiceSourceDefinition.ResourceID,
                    ResourceName = rabbitMQServiceSourceDefinition.ResourceName,
                    HostName     = rabbitMQServiceSourceDefinition.HostName,
                    Port         = rabbitMQServiceSourceDefinition.Port,
                    UserName     = rabbitMQServiceSourceDefinition.UserName,
                    Password     = rabbitMQServiceSourceDefinition.Password,
                    VirtualHost  = rabbitMQServiceSourceDefinition.VirtualHost
                });

                if (!result.IsValid)
                {
                    msg.HasError = true;
                    msg.Message  = new StringBuilder(result.ErrorMessage);
                }
            }
            catch (Exception err)
            {
                msg.HasError = true;
                msg.Message  = new StringBuilder(err.Message);
                Dev2Logger.Error(err);
            }
            return(serializer.SerializeToBuilder(msg));
        }
        private void SetSelectedRabbitMQSource(IRabbitMQServiceSourceDefinition rabbitMQSource)
        {
            IRabbitMQServiceSourceDefinition selectRabbitMQSource = rabbitMQSource ?? RabbitMQSources.FirstOrDefault(d => d.ResourceID == RabbitMQSourceResourceId);

            SelectedRabbitMQSource = selectRabbitMQSource;
        }