Skip to content
Permalink
Browse files
docs(regen): update sample code to set total timeout, add API client …
…header test
  • Loading branch information
yoshi-automation committed Feb 10, 2020
1 parent 2d98e84 commit a078590a3e9f31157b31318188da60f772e30f52
@@ -61,8 +61,12 @@
* <code>
* DataCatalogSettings.Builder dataCatalogSettingsBuilder =
* DataCatalogSettings.newBuilder();
* dataCatalogSettingsBuilder.createEntryGroupSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30));
* dataCatalogSettingsBuilder
* .createEntryGroupSettings()
* .setRetrySettings(
* dataCatalogSettingsBuilder.createEntryGroupSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* DataCatalogSettings dataCatalogSettings = dataCatalogSettingsBuilder.build();
* </code>
* </pre>
@@ -51,8 +51,12 @@
* <code>
* PolicyTagManagerSerializationSettings.Builder policyTagManagerSerializationSettingsBuilder =
* PolicyTagManagerSerializationSettings.newBuilder();
* policyTagManagerSerializationSettingsBuilder.importTaxonomiesSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30));
* policyTagManagerSerializationSettingsBuilder
* .importTaxonomiesSettings()
* .setRetrySettings(
* policyTagManagerSerializationSettingsBuilder.importTaxonomiesSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* PolicyTagManagerSerializationSettings policyTagManagerSerializationSettings = policyTagManagerSerializationSettingsBuilder.build();
* </code>
* </pre>
@@ -57,8 +57,12 @@
* <code>
* PolicyTagManagerSettings.Builder policyTagManagerSettingsBuilder =
* PolicyTagManagerSettings.newBuilder();
* policyTagManagerSettingsBuilder.createTaxonomySettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30));
* policyTagManagerSettingsBuilder
* .createTaxonomySettings()
* .setRetrySettings(
* policyTagManagerSettingsBuilder.createTaxonomySettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* PolicyTagManagerSettings policyTagManagerSettings = policyTagManagerSettingsBuilder.build();
* </code>
* </pre>
@@ -110,8 +110,12 @@
* <code>
* DataCatalogStubSettings.Builder dataCatalogSettingsBuilder =
* DataCatalogStubSettings.newBuilder();
* dataCatalogSettingsBuilder.createEntryGroupSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30));
* dataCatalogSettingsBuilder
* .createEntryGroupSettings()
* .setRetrySettings(
* dataCatalogSettingsBuilder.createEntryGroupSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* DataCatalogStubSettings dataCatalogSettings = dataCatalogSettingsBuilder.build();
* </code>
* </pre>
@@ -64,8 +64,12 @@
* <code>
* PolicyTagManagerSerializationStubSettings.Builder policyTagManagerSerializationSettingsBuilder =
* PolicyTagManagerSerializationStubSettings.newBuilder();
* policyTagManagerSerializationSettingsBuilder.importTaxonomiesSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30));
* policyTagManagerSerializationSettingsBuilder
* .importTaxonomiesSettings()
* .setRetrySettings(
* policyTagManagerSerializationSettingsBuilder.importTaxonomiesSettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* PolicyTagManagerSerializationStubSettings policyTagManagerSerializationSettings = policyTagManagerSerializationSettingsBuilder.build();
* </code>
* </pre>
@@ -80,8 +80,12 @@
* <code>
* PolicyTagManagerStubSettings.Builder policyTagManagerSettingsBuilder =
* PolicyTagManagerStubSettings.newBuilder();
* policyTagManagerSettingsBuilder.createTaxonomySettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30));
* policyTagManagerSettingsBuilder
* .createTaxonomySettings()
* .setRetrySettings(
* policyTagManagerSettingsBuilder.createTaxonomySettings().getRetrySettings().toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* PolicyTagManagerStubSettings policyTagManagerSettings = policyTagManagerSettingsBuilder.build();
* </code>
* </pre>
@@ -497,6 +497,57 @@ public void getEntryExceptionTest() throws Exception {
}
}

@Test
@SuppressWarnings("all")
public void lookupEntryTest() {
String name = "name3373707";
String linkedResource = "linkedResource1544625012";
String userSpecifiedType = "userSpecifiedType-940364963";
String userSpecifiedSystem = "userSpecifiedSystem-1776119406";
String displayName = "displayName1615086568";
String description = "description-1724546052";
Entry expectedResponse =
Entry.newBuilder()
.setName(name)
.setLinkedResource(linkedResource)
.setUserSpecifiedType(userSpecifiedType)
.setUserSpecifiedSystem(userSpecifiedSystem)
.setDisplayName(displayName)
.setDescription(description)
.build();
mockDataCatalog.addResponse(expectedResponse);

LookupEntryRequest request = LookupEntryRequest.newBuilder().build();

Entry actualResponse = client.lookupEntry(request);
Assert.assertEquals(expectedResponse, actualResponse);

List<AbstractMessage> actualRequests = mockDataCatalog.getRequests();
Assert.assertEquals(1, actualRequests.size());
LookupEntryRequest actualRequest = (LookupEntryRequest) actualRequests.get(0);

Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}

@Test
@SuppressWarnings("all")
public void lookupEntryExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT);
mockDataCatalog.addException(exception);

try {
LookupEntryRequest request = LookupEntryRequest.newBuilder().build();

client.lookupEntry(request);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception
}
}

@Test
@SuppressWarnings("all")
public void listEntryGroupsTest() {
@@ -640,17 +691,15 @@ public void updateEntryGroupTest2() {
mockDataCatalog.addResponse(expectedResponse);

EntryGroup entryGroup = EntryGroup.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();

EntryGroup actualResponse = client.updateEntryGroup(entryGroup, updateMask);
EntryGroup actualResponse = client.updateEntryGroup(entryGroup);
Assert.assertEquals(expectedResponse, actualResponse);

List<AbstractMessage> actualRequests = mockDataCatalog.getRequests();
Assert.assertEquals(1, actualRequests.size());
UpdateEntryGroupRequest actualRequest = (UpdateEntryGroupRequest) actualRequests.get(0);

Assert.assertEquals(entryGroup, actualRequest.getEntryGroup());
Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
Assert.assertTrue(
channelProvider.isHeaderSent(
ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
@@ -665,9 +714,8 @@ public void updateEntryGroupExceptionTest2() throws Exception {

try {
EntryGroup entryGroup = EntryGroup.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();

client.updateEntryGroup(entryGroup, updateMask);
client.updateEntryGroup(entryGroup);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception

0 comments on commit a078590

Please sign in to comment.