Skip to content

Commit

Permalink
[ggj][codegen] fix: use both map generics in ServiceClientTest codegen (
Browse files Browse the repository at this point in the history
#428)

* fix: support non-name fields with res-refs in resname def parsing

* fix: add workaround for missing default_host and oauth_scopes annotation

* fix: clarify LRO parsing error messages

* feat: support deeply-nested types in AST and proto message parsing

* fix: prevent resname tokens from matching subcomponents

* fix: use TypeParser for proto message parsing

* fix: use generic types in field instantiation in ServiceClientTest

* fix: prevent descension into map types in nested message parsing

* fix: merge master

* fix: use both map generics in ServiceClientTest codegen

* fix: add workaround for missing default_host and oauth_scopes annotation

* [ggj][infra][3/5]feat: add goldens update bazel rules for Redis API (#396)

* goldens update bazel rules

* clean up

* [ggj][infra][4/5]feat: add goldens update bazel rules for Asset API (#397)

* goldens update bazel rules

* clean up

* goldens update rule for asset API

* update goldens

* [ggj][infra][3/5]feat: add goldens update bazel rules for Redis API (#396)

* goldens update bazel rules

* clean up

* [ggj][infra][4/5]feat: add goldens update bazel rules for Asset API (#397)

* goldens update bazel rules

* clean up

* goldens update rule for asset API

* update goldens

* [ggj][infra][3/5]feat: add goldens update bazel rules for Redis API (#396)

* goldens update bazel rules

* clean up

* [ggj][infra][4/5]feat: add goldens update bazel rules for Asset API (#397)

* goldens update bazel rules

* clean up

* goldens update rule for asset API

* update goldens

* fix: clarify LRO parsing error messages

* feat: support deeply-nested types in AST and proto message parsing

* fix: prevent resname tokens from matching subcomponents

* fix: use TypeParser for proto message parsing

* fix: merge master

* fix: use generic types in field instantiation in ServiceClientTest

* fix: prevent descension into map types in nested message parsing

* fix: merge master

* fix: merge master

* fix: merge master

* fix: merge master

* fix: prevent descension into map types in nested message parsing

* build: add logging, redis gradle assembly rules

* fix: merge master

Co-authored-by: Xiaozhen Liu <[email protected]>
  • Loading branch information
miraleung and xiaozhenliu-gg5 authored Oct 31, 2020
1 parent 7a184e1 commit 797695b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ static Expr createDefaultValue(Field f, boolean useExplicitInitTypeInGenerics) {
ConcreteReference.Builder refBuilder =
ConcreteReference.builder().setClazz(f.isMap() ? HashMap.class : ArrayList.class);
if (useExplicitInitTypeInGenerics) {
refBuilder = refBuilder.setGenerics(f.type().reference().generics().get(0));
if (f.isMap()) {
refBuilder = refBuilder.setGenerics(f.type().reference().generics().subList(0, 2));
} else {
refBuilder = refBuilder.setGenerics(f.type().reference().generics().get(0));
}
}

TypeNode newType = TypeNode.withReference(refBuilder.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -140,7 +140,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -199,7 +199,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -258,7 +258,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -317,7 +317,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -366,7 +366,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -415,7 +415,7 @@ public class SubscriberClientTest {
.setPushConfig(PushConfig.newBuilder().build())
.setAckDeadlineSeconds(2135351438)
.setRetainAckedMessages(true)
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.setEnableMessageOrdering(true)
.setExpirationPolicy(ExpirationPolicy.newBuilder().build())
.setFilter("filter-1274492040")
Expand Down Expand Up @@ -1013,7 +1013,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down Expand Up @@ -1053,7 +1053,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down Expand Up @@ -1181,7 +1181,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down Expand Up @@ -1224,7 +1224,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down Expand Up @@ -1267,7 +1267,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down Expand Up @@ -1310,7 +1310,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down Expand Up @@ -1353,7 +1353,7 @@ public class SubscriberClientTest {
Snapshot.newBuilder()
.setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
.setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
.putAllLabels(new HashMap<String>())
.putAllLabels(new HashMap<String, String>())
.build();
mockSubscriber.addResponse(expectedResponse);

Expand Down
16 changes: 6 additions & 10 deletions test/integration/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load(
"@com_google_googleapis_imports//:imports.bzl",
"proto_library_with_info",
java_gapic_assembly_gradle_pkg = "java_gapic_assembly_gradle_pkg2",
java_gapic_library = "java_gapic_library2",
)
load(
Expand Down Expand Up @@ -86,18 +87,13 @@ java_gapic_library(
],
)

# Logging API
java_gapic_library(
name = "redis_java_gapic",
srcs = ["redis_proto_with_info"],
grpc_service_config = "@com_google_googleapis//google/cloud/redis/v1:redis_grpc_service_config.json",
package = "google.cloud.redis.v1",
service_yaml = "@com_google_googleapis//google/cloud/redis/v1:redis_v1.yaml",
test_deps = [
"@com_google_googleapis//google/cloud/redis/v1:redis_java_grpc",
],
java_gapic_assembly_gradle_pkg(
name = "google-cloud-redis-v1-java",
deps = [
":redis_java_gapic",
"@com_google_googleapis//google/cloud/redis/v1:redis_java_grpc",
"@com_google_googleapis//google/cloud/redis/v1:redis_java_proto",
"@com_google_googleapis//google/cloud/redis/v1:redis_proto",
],
)

Expand Down

0 comments on commit 797695b

Please sign in to comment.