本文整理汇总了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 + @"\");
}
示例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);
}
示例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);
}
示例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));
}
示例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));
}
示例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)));
}
示例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);
}
}
示例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));
}