当前位置: 首页>>代码示例>>C#>>正文


C# TestContext.GetJobResourceUploader方法代码示例

本文整理汇总了C#中TestContext.GetJobResourceUploader方法的典型用法代码示例。如果您正苦于以下问题:C# TestContext.GetJobResourceUploader方法的具体用法?C# TestContext.GetJobResourceUploader怎么用?C# TestContext.GetJobResourceUploader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestContext的用法示例。


在下文中一共展示了TestContext.GetJobResourceUploader方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UploadJobResourceCreatesResourceArchive

        public async Task UploadJobResourceCreatesResourceArchive()
        {
            var testContext = new TestContext();
            var jobResourceUploader = testContext.GetJobResourceUploader();
            
            await jobResourceUploader.UploadArchiveResourceAsync(AnyDriverLocalFolderPath, AnyDriverResourceUploadPath);

            // Archive file generator recieved exactly one call with correct driver local folder path with trailing \
            testContext.ResourceArchiveFileGenerator.Received(1).CreateArchiveToUpload(AnyDriverLocalFolderPath + @"\");
        }
开发者ID:beomyeol,项目名称:reef,代码行数:10,代码来源:LegacyJobResourceUploaderTests.cs

示例2: UploadJobResourceCreatesResourceArchive

        public void UploadJobResourceCreatesResourceArchive()
        {
            var testContext = new TestContext();
            var jobResourceUploader = testContext.GetJobResourceUploader();

            jobResourceUploader.UploadArchiveResource(AnyDriverLocalFolderPath, AnyDriverResourceUploadPath);

            // Archive file generator recieved exactly one call with correct driver local folder path
            testContext.ResourceArchiveFileGenerator.Received(1).CreateArchiveToUpload(AnyDriverLocalFolderPath);
        }
开发者ID:kumbhare,项目名称:reef,代码行数:10,代码来源:JobResourceUploaderTests.cs

示例3: UploadJobResourceReturnsJobResourceDetails

        public void UploadJobResourceReturnsJobResourceDetails()
        {
            var testContext = new TestContext();
            var jobResourceUploader = testContext.GetJobResourceUploader();

            var jobResource = jobResourceUploader.UploadJobResource(AnyDriverLocalFolderPath, AnyDriverResourceUploadPath);

            Assert.Equal(AnyModificationTime, jobResource.LastModificationUnixTimestamp);
            Assert.Equal(AnyResourceSize, jobResource.ResourceSize);
            Assert.Equal(AnyUploadedResourceAbsoluteUri, jobResource.RemoteUploadPath);
        }
开发者ID:LastOne817,项目名称:reef,代码行数:11,代码来源:JobResourceUploaderTests.cs

示例4: UploadJobResourceMakesCorrectFileSystemCalls

        public void UploadJobResourceMakesCorrectFileSystemCalls()
        {
            var testContext = new TestContext();
            var jobResourceUploader = testContext.GetJobResourceUploader();

            jobResourceUploader.UploadJobResource(AnyDriverLocalFolderPath, AnyDriverResourceUploadPath);

            testContext.FileSystem.Received(1).CreateUriForPath(AnyDriverResourceUploadPath);
            testContext.FileSystem.Received(1).CreateUriForPath(AnyUploadedResourcePath);
            testContext.FileSystem.Received(1)
                .CopyFromLocal(AnyLocalArchivePath, new Uri(AnyUploadedResourceAbsoluteUri));
            testContext.FileSystem.Received(1)
                .CreateDirectory(new Uri(AnyScheme + AnyHost + AnyDriverResourceUploadPath));
        }
开发者ID:LastOne817,项目名称:reef,代码行数:14,代码来源:JobResourceUploaderTests.cs

示例5: UploadJobResourceReturnsJobResourceDetails

        public void UploadJobResourceReturnsJobResourceDetails()
        {
            var testContext = new TestContext();
            var jobResourceUploader = testContext.GetJobResourceUploader();

            var archiveJobResource = jobResourceUploader.UploadArchiveResource(AnyDriverLocalFolderPath, AnyDriverResourceUploadPath);
            var fileJobResource = jobResourceUploader.UploadFileResource(AnyLocalJobFilePath, AnyDriverResourceUploadPath);
            var jobResources = new List<JobResource> { archiveJobResource, fileJobResource };

            foreach (var resource in jobResources)
            {
                Assert.Equal(AnyModificationTime, resource.LastModificationUnixTimestamp);
                Assert.Equal(AnyResourceSize, resource.ResourceSize);
            }

            var resourcePaths = new HashSet<string>(jobResources.Select(resource => resource.RemoteUploadPath));
            Assert.True(resourcePaths.Contains(AnyUploadedResourceAbsoluteUri));
            Assert.True(resourcePaths.Contains(AnyJobFileResourceAbsoluteUri));
        }
开发者ID:kumbhare,项目名称:reef,代码行数:19,代码来源:JobResourceUploaderTests.cs

示例6: UploadJobResourceJavaLauncherCalledWithCorrectArguments

        public async Task UploadJobResourceJavaLauncherCalledWithCorrectArguments()
        {
            var testContext = new TestContext();
            var jobResourceUploader = testContext.GetJobResourceUploader();
            const string anyLocalArchivePath = @"Any\Local\Archive\Path.zip";
            var anyLocalJobFilePath = AnyDriverLocalFolderPath.TrimEnd('\\') + @"\job-submission-params.json";
            testContext.ResourceArchiveFileGenerator.CreateArchiveToUpload(AnyDriverLocalFolderPath + @"\")
                .Returns(anyLocalArchivePath);
            await jobResourceUploader.UploadArchiveResourceAsync(AnyDriverLocalFolderPath, AnyDriverResourceUploadPath);
            await jobResourceUploader.UploadFileResourceAsync(AnyLocalJobFilePath, AnyDriverResourceUploadPath);

            const string javaClassNameForResourceUploader = @"org.apache.reef.bridge.client.JobResourceUploader";
            Guid notUsedGuid;

            // Clientlauncher is called with correct class name, local archive path, upload path and temp file.
            var notUsedTask = testContext.JavaClientLauncher.Received(1)
                .LaunchAsync(
                    JavaLoggingSetting.Info,
                    javaClassNameForResourceUploader,
                    anyLocalArchivePath,
                    "ARCHIVE",
                    AnyDriverResourceUploadPath + "/",
                    Arg.Is<string>(
                        outputFilePath =>
                            Path.GetDirectoryName(outputFilePath) + @"\" == Path.GetTempPath() 
                            && Guid.TryParse(Path.GetFileName(outputFilePath), out notUsedGuid)));

            // Clientlauncher is called with correct class name, local job file path, upload path and temp file.
            notUsedTask = testContext.JavaClientLauncher.Received(1)
                .LaunchAsync(
                    JavaLoggingSetting.Info,    
                    javaClassNameForResourceUploader,
                    anyLocalJobFilePath,
                    "FILE",
                    AnyDriverResourceUploadPath + "/",
                    Arg.Is<string>(
                        outputFilePath =>
                            Path.GetDirectoryName(outputFilePath) + @"\" == Path.GetTempPath()
                            && Guid.TryParse(Path.GetFileName(outputFilePath), out notUsedGuid)));
        }
开发者ID:beomyeol,项目名称:reef,代码行数:40,代码来源:LegacyJobResourceUploaderTests.cs

示例7: UploadJobResourceReturnsJobResourceDetails

        public void UploadJobResourceReturnsJobResourceDetails()
        {
            var testContext = new TestContext();
            var jobResourceUploader = testContext.GetJobResourceUploader();

            var jobResources = new List<JobResource>()
            {
                jobResourceUploader.UploadArchiveResource(AnyDriverLocalFolderPath, AnyDriverResourceUploadPath),
                jobResourceUploader.UploadFileResource(AnyLocalJobFilePath, AnyDriverResourceUploadPath)
            };

            Assert.Equal(jobResources.Count, 2);
            foreach (var resource in jobResources)
            {
                Assert.Equal(AnyModificationTime, resource.LastModificationUnixTimestamp);
                Assert.Equal(AnyResourceSize, resource.ResourceSize);
                Assert.Equal(AnyUploadedResourcePath, resource.RemoteUploadPath);
            }
        }
开发者ID:kumbhare,项目名称:reef,代码行数:19,代码来源:LegacyJobResourceUploaderTests.cs

示例8: UploadJobResourceNoFileCreatedByJavaCallThrowsException

        public void UploadJobResourceNoFileCreatedByJavaCallThrowsException()
        {
            var testContext = new TestContext();
            var jobResourceUploader = testContext.GetJobResourceUploader(fileExistsReturnValue: false);

            // throws filenotfound exception
            Assert.Throws<FileNotFoundException>(() => jobResourceUploader.UploadArchiveResource(AnyDriverLocalFolderPath, AnyDriverResourceUploadPath));
        }
开发者ID:kumbhare,项目名称:reef,代码行数:8,代码来源:LegacyJobResourceUploaderTests.cs


注:本文中的TestContext.GetJobResourceUploader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。