diff --git a/src/main/java/com/google/api/generator/gapic/composer/DefaultValueComposer.java b/src/main/java/com/google/api/generator/gapic/composer/DefaultValueComposer.java index db69075920..98143f5574 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/DefaultValueComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/DefaultValueComposer.java @@ -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()); diff --git a/src/test/java/com/google/api/generator/gapic/composer/goldens/SubscriberClientTest.golden b/src/test/java/com/google/api/generator/gapic/composer/goldens/SubscriberClientTest.golden index 150a8926e5..0e03fd0e11 100644 --- a/src/test/java/com/google/api/generator/gapic/composer/goldens/SubscriberClientTest.golden +++ b/src/test/java/com/google/api/generator/gapic/composer/goldens/SubscriberClientTest.golden @@ -81,7 +81,7 @@ public class SubscriberClientTest { .setPushConfig(PushConfig.newBuilder().build()) .setAckDeadlineSeconds(2135351438) .setRetainAckedMessages(true) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .setEnableMessageOrdering(true) .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) .setFilter("filter-1274492040") @@ -140,7 +140,7 @@ public class SubscriberClientTest { .setPushConfig(PushConfig.newBuilder().build()) .setAckDeadlineSeconds(2135351438) .setRetainAckedMessages(true) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .setEnableMessageOrdering(true) .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) .setFilter("filter-1274492040") @@ -199,7 +199,7 @@ public class SubscriberClientTest { .setPushConfig(PushConfig.newBuilder().build()) .setAckDeadlineSeconds(2135351438) .setRetainAckedMessages(true) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .setEnableMessageOrdering(true) .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) .setFilter("filter-1274492040") @@ -258,7 +258,7 @@ public class SubscriberClientTest { .setPushConfig(PushConfig.newBuilder().build()) .setAckDeadlineSeconds(2135351438) .setRetainAckedMessages(true) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .setEnableMessageOrdering(true) .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) .setFilter("filter-1274492040") @@ -317,7 +317,7 @@ public class SubscriberClientTest { .setPushConfig(PushConfig.newBuilder().build()) .setAckDeadlineSeconds(2135351438) .setRetainAckedMessages(true) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .setEnableMessageOrdering(true) .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) .setFilter("filter-1274492040") @@ -366,7 +366,7 @@ public class SubscriberClientTest { .setPushConfig(PushConfig.newBuilder().build()) .setAckDeadlineSeconds(2135351438) .setRetainAckedMessages(true) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .setEnableMessageOrdering(true) .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) .setFilter("filter-1274492040") @@ -415,7 +415,7 @@ public class SubscriberClientTest { .setPushConfig(PushConfig.newBuilder().build()) .setAckDeadlineSeconds(2135351438) .setRetainAckedMessages(true) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .setEnableMessageOrdering(true) .setExpirationPolicy(ExpirationPolicy.newBuilder().build()) .setFilter("filter-1274492040") @@ -1013,7 +1013,7 @@ public class SubscriberClientTest { Snapshot.newBuilder() .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); @@ -1053,7 +1053,7 @@ public class SubscriberClientTest { Snapshot.newBuilder() .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); @@ -1181,7 +1181,7 @@ public class SubscriberClientTest { Snapshot.newBuilder() .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); @@ -1224,7 +1224,7 @@ public class SubscriberClientTest { Snapshot.newBuilder() .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); @@ -1267,7 +1267,7 @@ public class SubscriberClientTest { Snapshot.newBuilder() .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); @@ -1310,7 +1310,7 @@ public class SubscriberClientTest { Snapshot.newBuilder() .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); @@ -1353,7 +1353,7 @@ public class SubscriberClientTest { Snapshot.newBuilder() .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString()) .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString()) - .putAllLabels(new HashMap()) + .putAllLabels(new HashMap()) .build(); mockSubscriber.addResponse(expectedResponse); diff --git a/test/integration/BUILD.bazel b/test/integration/BUILD.bazel index f87f64f142..48f6c2ddbb 100644 --- a/test/integration/BUILD.bazel +++ b/test/integration/BUILD.bazel @@ -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( @@ -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", ], )