コード例 #1
0
        public void UploadMetadataDocument(Record record)
        {
            string resourceUrl = config.HttpRootUrl + "/" + WebificationUtility.GetUnrootedDataPath(record.Id, record.Path);
            var    metaXmlDoc  = xmlHelper.GetMetadataDocument(record, resourceUrl);
            string metaPath    = String.Format("waf/{0}.xml", record.Id);
            string metaFtpPath = config.FtpRootUrl + "/" + metaPath;

            Logger.Info("Metadata file path: " + metaPath);
            Logger.Info("Metadata FTP path: " + metaFtpPath);

            ftpClient.UploadBytes(metaFtpPath, metaXmlDoc);
            Logger.Info("Uploaded metadata document successfully");
        }
コード例 #2
0
        public void UploadDataFile(Guid recordId, string filePath)
        {
            filePath = JnccDriveMappings.GetUncPath(filePath);

            string unrootedDataPath = WebificationUtility.GetUnrootedDataPath(recordId, filePath);

            string dataFtpPath = config.FtpRootUrl + "/" + unrootedDataPath;

            Logger.Info("Data file path: " + filePath);
            Logger.Info("Data FTP path: " + dataFtpPath);

            ftpClient.UploadFile(dataFtpPath, filePath);
            Logger.Info("Uploaded data file successfully");
        }
コード例 #3
0
 private void ResourcesUpdatedCorrectly(string recordId, List <Resource> originalResources, List <Resource> updatedResources)
 {
     originalResources.Count.Should().Be(updatedResources.Count);
     foreach (var originalResource in originalResources)
     {
         updatedResources.Count(r => r.Path.Equals(originalResource.Path)).Should().Be(1);
         var updatedResource = updatedResources.Find(x => x.Path.Equals(originalResource.Path));
         if (IsFileResource(updatedResource))
         {
             string dataPath = WebificationUtility.GetUnrootedDataPath(recordId, originalResource.Path);
             updatedResource.PublishedUrl.Should().Be("http://data.jncc.gov.uk" + dataPath);
         }
         else
         {
             updatedResource.PublishedUrl.Should().BeNullOrEmpty();
         }
     }
 }
コード例 #4
0
        public void UploadDataFile(string recordId, string filePath)
        {
            filePath = JnccDriveMappings.GetUncPath(filePath);

            var fileSize = fileHelper.GetFileSizeInBytes(filePath);

            if (fileSize <= env.MAX_FILE_SIZE_IN_BYTES)
            {
                string dataFtpPath = WebificationUtility.GetUnrootedDataPath(recordId, filePath);

                Logger.Info("Data file path: " + filePath);
                Logger.Info("Data FTP path: " + dataFtpPath);

                ftpClient.UploadFile(dataFtpPath, filePath);
                Logger.Info("Uploaded data file successfully");
            }
            else
            {
                // force fail large files
                throw new InvalidOperationException($"File at path {filePath} is too large to be uploaded by Topcat - manual upload required");
            }
        }