public void Upload_pdf_copyHandle()
        {
            _docs.UploadAsync(TestConfig.PathToDocumentPdf, DocumentHandle.FromString("docs_to_copy")).Wait();
            Thread.Sleep(2000);
            _docs.CopyHandleAsync(DocumentHandle.FromString("docs_to_copy"), DocumentHandle.FromString("docs_to_copy_copied")).Wait();

            _demo.UploadAsync(TestConfig.PathToDocumentPdf, DocumentHandle.FromString("demo_to_copy")).Wait();
            Thread.Sleep(2000);
            _demo.CopyHandleAsync(DocumentHandle.FromString("demo_to_copy"), DocumentHandle.FromString("demo_to_copy_copied")).Wait();
        }
Пример #2
0
        public void Upload_TempDirectory()
        {
            var files = Directory.GetFiles(@"X:\temp\testupload", "*.*", SearchOption.AllDirectories);

            Parallel.ForEach(files, file =>
            {
                {
                    if (!Path.GetFileName(file).StartsWith("."))
                    {
                        _docs.UploadAsync(file, DocumentHandle.FromString(SanitizeFileName(file))).Wait();
                    }
                }
            });
        }
Пример #3
0
        static int Run()
        {
            Console.WriteLine("------------------------------------------");
            Console.WriteLine("Running");
            Console.WriteLine("\tServer: {0}", _endPoint.AbsoluteUri);
            Console.WriteLine("\tFolder: {0}", _folder);
            Console.WriteLine("------------------------------------------");

            var client = new DocumentStoreServiceClient(_endPoint);
            int counter = 1;

            Parallel.ForEach(Directory.GetFiles(_folder), file =>
            {
                Console.WriteLine("Processing file {0}", file);
                var id = Interlocked.Increment(ref counter);
                try
                {
                    client.UploadAsync(file, "File_" + id).Wait();
                }
                catch (AggregateException aex)
                {
                    foreach(var ex in aex.InnerExceptions)
                        Console.WriteLine("Error: {0}", ex.Message);
                }
            });

            Console.WriteLine("------------------------------------------");

            return 0;
        }
        static int Run()
        {
            Console.WriteLine("------------------------------------------");
            Console.WriteLine("Running");
            Console.WriteLine("\tServer: {0}", _endPoint.AbsoluteUri);
            Console.WriteLine("\tFolder: {0}", _folder);
            Console.WriteLine("------------------------------------------");

            var client  = new DocumentStoreServiceClient(_endPoint);
            int counter = 1;

            Parallel.ForEach(Directory.GetFiles(_folder), file =>
            {
                Console.WriteLine("Processing file {0}", file);
                var id = Interlocked.Increment(ref counter);
                try
                {
                    client.UploadAsync(file, "File_" + id).Wait();
                }
                catch (AggregateException aex)
                {
                    foreach (var ex in aex.InnerExceptions)
                    {
                        Console.WriteLine("Error: {0}", ex.Message);
                    }
                }
            });

            Console.WriteLine("------------------------------------------");

            return(0);
        }
 public void Upload_pdf_to_demo_and_docs_tenants()
 {
     Task.WaitAll(
         _docs.UploadAsync(TestConfig.PathToDocumentPdf, DocumentHandle.FromString("Rev_1")),
         _demo.UploadAsync(TestConfig.PathToDocumentPdf, DocumentHandle.FromString("Rev_1"))
         );
 }
 public void Upload_pdf()
 {
     _docs.UploadAsync(TestConfig.PathToDocumentPdf, DocumentHandle.FromString("pdf")).Wait();
 }
Пример #7
0
        public async Task Should_get_info_without_content()
        {
            var documentHandle = DocumentHandle.FromString("Pdf_2");

            await _documentStoreClient.UploadAsync(
                TestConfig.PathToDocumentPdf,
                documentHandle
                );

            // waits for storage
            await UpdateAndWaitAsync().ConfigureAwait(false);

            var format = new DocumentFormat("original");

            var options = new OpenOptions()
            {
                FileName    = "pluto.pdf",
                SkipContent = true
            };

            var reader = _documentStoreClient.OpenRead(documentHandle, format, options);

            using (var downloaded = new MemoryStream())
            {
                await(await reader.OpenStream()).CopyToAsync(downloaded);
                Assert.AreEqual(0, downloaded.Length);
                Assert.AreEqual(72768, reader.ContentLength);
            }
        }