Example #1
0
        public ConnectionTestStatus WriteTest(string path, string itemName)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("path");
            }

            if (string.IsNullOrEmpty(itemName))
            {
                throw new ArgumentException("itemName");
            }

            this.mLogger.Info("Testing write using connection to '{0}' using path '{1}'...",
                              this.mReportRepository.ServerAddress,
                              path);

            ConnectionTestStatus status = new ConnectionTestStatus();

            status.ServerAddress = this.mReportRepository.ServerAddress;
            status.Path          = path;

            try
            {
                string error = this.mReportRepository.CreateFolder(itemName, path);

                if (string.IsNullOrEmpty(error))
                {
                    status.Success = true;

                    this.mReportRepository.DeleteItem(path + itemName);
                }
                else
                {
                    status.Success = false;
                    status.Error   = error;
                }

                this.mLogger.Info("Test status = {0}", status.Success);

                if (!status.Success)
                {
                    this.mLogger.Info("Error = {0}", status.Error);
                }

                return(status);
            }
            catch (Exception er)
            {
                this.mLogger.Error(er, "Write test failed.");

                status.Success = false;
                status.Error   = er.Message;

                return(status);
            }
        }
Example #2
0
        public ConnectionTestStatus ReadTest(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                throw new ArgumentException("path");
            }

            this.mLogger.Info("Testing read using connection to '{0}' using path '{1}'...",
                              this.mReportRepository.ServerAddress,
                              path);

            ConnectionTestStatus status = new ConnectionTestStatus();

            status.ServerAddress = this.mReportRepository.ServerAddress;
            status.Path          = path;

            try
            {
                bool exists = this.mReportRepository.ItemExists(path, "Folder");

                if (exists)
                {
                    status.Success = true;
                }
                else
                {
                    status.Success = false;

                    status.Error = string.Format("Item '{0}' does not exist or you do not have permission.", path);
                }

                this.mLogger.Info("Test status = {0}", status.Success);

                if (!status.Success)
                {
                    this.mLogger.Info("Error = {0}", status.Error);
                }

                return(status);
            }
            catch (Exception er)
            {
                this.mLogger.Error(er, "Read test failed.");

                status.Success = false;
                status.Error   = er.Message;

                return(status);
            }
        }
Example #3
0
        public ConnectionTestStatus ReadTest(string path)
        {
            if (string.IsNullOrEmpty(path))
                throw new ArgumentException("path");

            this.mLogger.Info("Testing read using connection to '{0}' using path '{1}'...",
                this.mReportRepository.ServerAddress,
                path);

            ConnectionTestStatus status = new ConnectionTestStatus();
            status.ServerAddress = this.mReportRepository.ServerAddress;
            status.Path = path;

            try
            {
                bool exists = this.mReportRepository.ItemExists(path, "Folder");

                if (exists)
                    status.Success = true;
                else
                {
                    status.Success = false;

                    status.Error = string.Format("Item '{0}' does not exist or you do not have permission.", path);
                }

                this.mLogger.Info("Test status = {0}", status.Success);

                if (!status.Success)
                    this.mLogger.Info("Error = {0}", status.Error);

                return status;
            }
            catch (Exception er)
            {
                this.mLogger.Error(er, "Read test failed.");

                status.Success = false;
                status.Error = er.Message;

                return status;
            }
        }
Example #4
0
        public ConnectionTestStatus WriteTest(string path, string itemName)
        {
            if (string.IsNullOrEmpty(path))
                throw new ArgumentException("path");

            if (string.IsNullOrEmpty(itemName))
                throw new ArgumentException("itemName");

            this.mLogger.Info("Testing write using connection to '{0}' using path '{1}'...",
                this.mReportRepository.ServerAddress,
                path);

            ConnectionTestStatus status = new ConnectionTestStatus();
            status.ServerAddress = this.mReportRepository.ServerAddress;
            status.Path = path;

            try
            {
                string error = this.mReportRepository.CreateFolder(itemName, path);

                if (string.IsNullOrEmpty(error))
                {
                    status.Success = true;

                    this.mReportRepository.DeleteItem(path + itemName);
                }
                else
                {
                    status.Success = false;
                    status.Error = error;
                }

                this.mLogger.Info("Test status = {0}", status.Success);

                if (!status.Success)
                    this.mLogger.Info("Error = {0}", status.Error);

                return status;
            }
            catch (Exception er)
            {
                this.mLogger.Error(er, "Write test failed.");

                status.Success = false;
                status.Error = er.Message;

                return status;
            }
        }