use of org.apache.beam.sdk.extensions.gcp.options.GoogleApiDebugOptions.GoogleApiTracer in project beam by apache.
the class GoogleApiDebugOptionsTest method testMatchingAgainstClient.
@Test
public void testMatchingAgainstClient() throws Exception {
GcsOptions options = PipelineOptionsFactory.as(GcsOptions.class);
options.setGcpCredential(new TestCredential());
options.setGoogleApiTrace(new GoogleApiTracer().addTraceFor(Transport.newStorageClient(options).build(), "TraceDestination"));
Storage.Objects.Get getRequest = Transport.newStorageClient(options).build().objects().get("testBucketId", "testObjectId");
assertEquals("TraceDestination", getRequest.get("$trace"));
Delete deleteRequest = GcpOptions.GcpTempLocationFactory.newCloudResourceManagerClient(options.as(CloudResourceManagerOptions.class)).build().projects().delete("testProjectId");
assertNull(deleteRequest.get("$trace"));
}
use of org.apache.beam.sdk.extensions.gcp.options.GoogleApiDebugOptions.GoogleApiTracer in project beam by apache.
the class GoogleApiDebugOptionsTest method testMatchingAgainstRequestType.
@Test
public void testMatchingAgainstRequestType() throws Exception {
GcsOptions options = PipelineOptionsFactory.as(GcsOptions.class);
options.setGcpCredential(new TestCredential());
options.setGoogleApiTrace(new GoogleApiTracer().addTraceFor(Transport.newStorageClient(options).build().objects().get("aProjectId", "aObjectId"), "TraceDestination"));
Storage.Objects.Get getRequest = Transport.newStorageClient(options).build().objects().get("testBucketId", "testObjectId");
assertEquals("TraceDestination", getRequest.get("$trace"));
Storage.Objects.List listRequest = Transport.newStorageClient(options).build().objects().list("testProjectId");
assertNull(listRequest.get("$trace"));
}
Aggregations