Ejemplo n.º 1
0
        public void RedisSourceDefinition_Equals_RedisServiceSource_Null_Expected_False()
        {
            var redisSourceDefinition = new RedisSourceDefinition();

            const IRedisServiceSource redisServiceSource = null;

            var isEqual = redisSourceDefinition.Equals(redisServiceSource);

            Assert.IsFalse(isEqual);
        }
Ejemplo n.º 2
0
        public void SaveRedisServiceSource(IRedisServiceSource redisServiceSource, Guid serverWorkspaceId)
        {
            var con            = Connection;
            var comsController = CommunicationControllerFactory.CreateController(nameof(SaveRedisSource));
            var serialiser     = new Dev2JsonSerializer();

            comsController.AddPayloadArgument(SaveRedisSource.RedisSource, serialiser.SerializeToBuilder(redisServiceSource));
            var output = comsController.ExecuteCommand <IExecuteMessage>(con, GlobalConstants.ServerWorkspaceID);

            if (output.HasError)
            {
                throw new WarewolfSaveException(output.Message.ToString(), null);
            }
        }
Ejemplo n.º 3
0
        public StringBuilder Execute(Dictionary <string, StringBuilder> values, IWorkspace theWorkspace)
        {
            var msg        = new ExecuteMessage();
            var serializer = new Dev2JsonSerializer();

            try
            {
                Dev2Logger.Info("Save Redis Resource Service", GlobalConstants.WarewolfInfo);

                values.TryGetValue(Warewolf.Service.SaveRedisSource.RedisSource, out StringBuilder resourceDefinition);

                IRedisServiceSource redisSourceDef = serializer.Deserialize <RedisSourceDefinition>(resourceDefinition);

                if (redisSourceDef.Path == null)
                {
                    redisSourceDef.Path = string.Empty;
                }

                if (redisSourceDef.Path.EndsWith("\\"))
                {
                    redisSourceDef.Path = redisSourceDef.Path.Substring(0, redisSourceDef.Path.LastIndexOf("\\", StringComparison.Ordinal));
                }

                var redisSource = new RedisSource
                {
                    ResourceID         = redisSourceDef.Id,
                    HostName           = redisSourceDef.HostName,
                    Port               = redisSourceDef.Port,
                    AuthenticationType = redisSourceDef.AuthenticationType,
                    Password           = redisSourceDef.Password,
                    ResourceName       = redisSourceDef.Name
                };

                ResourceCat.SaveResource(GlobalConstants.ServerWorkspaceID, redisSource, redisSourceDef.Path);
                msg.HasError = false;
            }
            catch (Exception err)
            {
                msg.HasError = true;
                msg.Message  = new StringBuilder(err.Message);
                Dev2Logger.Error(err, GlobalConstants.WarewolfError);
            }

            return(serializer.SerializeToBuilder(msg));
        }
Ejemplo n.º 4
0
        public bool Equals(IRedisServiceSource other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            var equals = true;

            equals &= string.Equals(HostName, other.HostName);
            equals &= Id == other.Id;
            equals &= string.Equals(Name, other.Name);
            equals &= string.Equals(Password, other.Password);
            equals &= AuthenticationType == other.AuthenticationType;

            return(equals);
        }
Ejemplo n.º 5
0
 public void TestConnection(IRedisServiceSource resource)
 {
     _updateRepository.TestConnection(resource);
 }
Ejemplo n.º 6
0
 public void Save(IRedisServiceSource toRedisSource)
 {
     _updateRepository.Save(toRedisSource);
 }
Ejemplo n.º 7
0
 public void TestConnection(IRedisServiceSource redisServiceSource) => UpdateManagerProxy.TestConnection(redisServiceSource);
Ejemplo n.º 8
0
 public void Save(IRedisServiceSource redisServiceSource) => UpdateManagerProxy.SaveRedisServiceSource(redisServiceSource, GlobalConstants.ServerWorkspaceID);