use of com.microsoft.applicationinsights.serviceprofilerapi.client.uploader.UploadFinishArgs in project ApplicationInsights-Java by microsoft.
the class ServiceProfilerUploaderTest method uploadFileGoodPathReturnsExpectedResponse.
@Test
void uploadFileGoodPathReturnsExpectedResponse() throws IOException {
ServiceProfilerClientV2 serviceProfilerClient = stubServiceProfilerClient();
File tmpFile = createFakeJfrFile();
UUID appId = UUID.randomUUID();
ServiceProfilerUploader serviceProfilerUploader = new ServiceProfilerUploader(serviceProfilerClient, "a-machine-name", "a-process-id", appId::toString, "a-role-name") {
@Override
protected Mono<UploadFinishArgs> performUpload(UploadContext uploadContext, BlobAccessPass uploadPass, File file) {
return Mono.just(new UploadFinishArgs("a-stamp-id", "a-timestamp"));
}
};
serviceProfilerUploader.uploadJfrFile("a-trigger", 321, tmpFile, 0.0, 0.0).subscribe(result -> {
assertThat(result.getServiceProfilerIndex().getProperties().get(ServiceProfilerIndex.SERVICE_PROFILER_STAMPID_PROPERTY_NAME)).isEqualTo("a-stamp-id");
assertThat(result.getServiceProfilerIndex().getProperties().get(ServiceProfilerIndex.SERVICE_PROFILER_MACHINENAME_PROPERTY_NAME)).isEqualTo("a-machine-name");
assertThat(result.getServiceProfilerIndex().getProperties().get(ServiceProfilerIndex.SERVICE_PROFILER_ETLFILESESSIONID_PROPERTY_NAME)).isEqualTo("a-timestamp");
assertThat(result.getServiceProfilerIndex().getProperties().get(ServiceProfilerIndex.SERVICE_PROFILER_DATACUBE_PROPERTY_NAME)).isEqualTo(appId.toString());
});
}
Aggregations