@Test @SuppressWarnings("all") public void listSubscriptionsTest() { String nextPageToken = ""; Subscription subscriptionsElement = Subscription.newBuilder().build(); List<Subscription> subscriptions = Arrays.asList(subscriptionsElement); ListSubscriptionsResponse expectedResponse = ListSubscriptionsResponse.newBuilder() .setNextPageToken(nextPageToken) .addAllSubscriptions(subscriptions) .build(); mockSubscriber.addResponse(expectedResponse); ProjectName project = ProjectName.of("[PROJECT]"); ListSubscriptionsPagedResponse pagedListResponse = client.listSubscriptions(project); List<Subscription> resources = Lists.newArrayList(pagedListResponse.iterateAll()); Assert.assertEquals(1, resources.size()); Assert.assertEquals(expectedResponse.getSubscriptionsList().get(0), resources.get(0)); List<GeneratedMessageV3> actualRequests = mockSubscriber.getRequests(); Assert.assertEquals(1, actualRequests.size()); ListSubscriptionsRequest actualRequest = (ListSubscriptionsRequest) actualRequests.get(0); Assert.assertEquals(project, ProjectName.parse(actualRequest.getProject())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
public Builder mergeFrom(com.google.pubsub.v1.Subscription other) { if (other == com.google.pubsub.v1.Subscription.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getTopic().isEmpty()) { topic_ = other.topic_; onChanged(); } if (other.hasPushConfig()) { mergePushConfig(other.getPushConfig()); } if (other.getAckDeadlineSeconds() != 0) { setAckDeadlineSeconds(other.getAckDeadlineSeconds()); } if (other.getRetainAckedMessages() != false) { setRetainAckedMessages(other.getRetainAckedMessages()); } if (other.hasMessageRetentionDuration()) { mergeMessageRetentionDuration(other.getMessageRetentionDuration()); } internalGetMutableLabels().mergeFrom(other.internalGetLabels()); if (other.hasExpirationPolicy()) { mergeExpirationPolicy(other.getExpirationPolicy()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
input.readMessage(com.google.pubsub.v1.Subscription.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(subscription_); subscription_ = subBuilder.buildPartial();
input.readMessage(com.google.pubsub.v1.Subscription.parser(), extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(subscription_); subscription_ = subBuilder.buildPartial();
com.google.pubsub.v1.ExpirationPolicy.Builder, com.google.pubsub.v1.ExpirationPolicyOrBuilder>( getExpirationPolicy(), getParentForChildren(), isClean()); expirationPolicy_ = null;
com.google.protobuf.Duration.Builder, com.google.protobuf.DurationOrBuilder>( getMessageRetentionDuration(), getParentForChildren(), isClean()); messageRetentionDuration_ = null;
public Builder mergeFrom(com.google.pubsub.v1.Subscription other) { if (other == com.google.pubsub.v1.Subscription.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getTopic().isEmpty()) { topic_ = other.topic_; onChanged(); } if (other.hasPushConfig()) { mergePushConfig(other.getPushConfig()); } if (other.getAckDeadlineSeconds() != 0) { setAckDeadlineSeconds(other.getAckDeadlineSeconds()); } if (other.getRetainAckedMessages() != false) { setRetainAckedMessages(other.getRetainAckedMessages()); } if (other.hasMessageRetentionDuration()) { mergeMessageRetentionDuration(other.getMessageRetentionDuration()); } internalGetMutableLabels().mergeFrom(other.internalGetLabels()); if (other.hasExpirationPolicy()) { mergeExpirationPolicy(other.getExpirationPolicy()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
/** * * * <pre> * If push delivery is used with this subscription, this field is * used to configure it. An empty `pushConfig` signifies that the subscriber * will pull and ack messages using API methods. * </pre> * * <code>.google.pubsub.v1.PushConfig push_config = 4;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.pubsub.v1.PushConfig, com.google.pubsub.v1.PushConfig.Builder, com.google.pubsub.v1.PushConfigOrBuilder> getPushConfigFieldBuilder() { if (pushConfigBuilder_ == null) { pushConfigBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.pubsub.v1.PushConfig, com.google.pubsub.v1.PushConfig.Builder, com.google.pubsub.v1.PushConfigOrBuilder>( getPushConfig(), getParentForChildren(), isClean()); pushConfig_ = null; } return pushConfigBuilder_; }
/** * * * <pre> * The updated subscription object. * </pre> * * <code>.google.pubsub.v1.Subscription subscription = 1;</code> */ public Builder mergeSubscription(com.google.pubsub.v1.Subscription value) { if (subscriptionBuilder_ == null) { if (subscription_ != null) { subscription_ = com.google.pubsub.v1.Subscription.newBuilder(subscription_) .mergeFrom(value) .buildPartial(); } else { subscription_ = value; } onChanged(); } else { subscriptionBuilder_.mergeFrom(value); } return this; } /**
/** * * * <pre> * The subscriptions that match the request. * </pre> * * <code>repeated .google.pubsub.v1.Subscription subscriptions = 1;</code> */ public Builder setSubscriptions( int index, com.google.pubsub.v1.Subscription.Builder builderForValue) { if (subscriptionsBuilder_ == null) { ensureSubscriptionsIsMutable(); subscriptions_.set(index, builderForValue.build()); onChanged(); } else { subscriptionsBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
/** * * * <pre> * The subscriptions that match the request. * </pre> * * <code>repeated .google.pubsub.v1.Subscription subscriptions = 1;</code> */ public Builder addSubscriptions( int index, com.google.pubsub.v1.Subscription.Builder builderForValue) { if (subscriptionsBuilder_ == null) { ensureSubscriptionsIsMutable(); subscriptions_.add(index, builderForValue.build()); onChanged(); } else { subscriptionsBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * <code>optional .google.pubsub.v1.PushConfig push_config = 4;</code> * * <pre> * If push delivery is used with this subscription, this field is * used to configure it. An empty `pushConfig` signifies that the subscriber * will pull and ack messages using API methods. * </pre> */ private com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.PushConfig, com.google.pubsub.v1.PushConfig.Builder, com.google.pubsub.v1.PushConfigOrBuilder> getPushConfigFieldBuilder() { if (pushConfigBuilder_ == null) { pushConfigBuilder_ = new com.google.protobuf.SingleFieldBuilder< com.google.pubsub.v1.PushConfig, com.google.pubsub.v1.PushConfig.Builder, com.google.pubsub.v1.PushConfigOrBuilder>( getPushConfig(), getParentForChildren(), isClean()); pushConfig_ = null; } return pushConfigBuilder_; }
/** * <pre> * If push delivery is used with this subscription, this field is * used to configure it. An empty `pushConfig` signifies that the subscriber * will pull and ack messages using API methods. * </pre> * * <code>optional .google.pubsub.v1.PushConfig push_config = 4;</code> */ private com.google.protobuf.SingleFieldBuilderV3< com.google.pubsub.v1.PushConfig, com.google.pubsub.v1.PushConfig.Builder, com.google.pubsub.v1.PushConfigOrBuilder> getPushConfigFieldBuilder() { if (pushConfigBuilder_ == null) { pushConfigBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< com.google.pubsub.v1.PushConfig, com.google.pubsub.v1.PushConfig.Builder, com.google.pubsub.v1.PushConfigOrBuilder>( getPushConfig(), getParentForChildren(), isClean()); pushConfig_ = null; } return pushConfigBuilder_; }
/** * * * <pre> * The subscriptions that match the request. * </pre> * * <code>repeated .google.pubsub.v1.Subscription subscriptions = 1;</code> */ public Builder addSubscriptions(com.google.pubsub.v1.Subscription.Builder builderForValue) { if (subscriptionsBuilder_ == null) { ensureSubscriptionsIsMutable(); subscriptions_.add(builderForValue.build()); onChanged(); } else { subscriptionsBuilder_.addMessage(builderForValue.build()); } return this; } /**
/** * <pre> * The subscriptions that match the request. * </pre> * * <code>repeated .google.pubsub.v1.Subscription subscriptions = 1;</code> */ public Builder setSubscriptions( int index, com.google.pubsub.v1.Subscription.Builder builderForValue) { if (subscriptionsBuilder_ == null) { ensureSubscriptionsIsMutable(); subscriptions_.set(index, builderForValue.build()); onChanged(); } else { subscriptionsBuilder_.setMessage(index, builderForValue.build()); } return this; } /**
/** * <pre> * The subscriptions that match the request. * </pre> * * <code>repeated .google.pubsub.v1.Subscription subscriptions = 1;</code> */ public Builder addSubscriptions( int index, com.google.pubsub.v1.Subscription.Builder builderForValue) { if (subscriptionsBuilder_ == null) { ensureSubscriptionsIsMutable(); subscriptions_.add(index, builderForValue.build()); onChanged(); } else { subscriptionsBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * <code>repeated .google.pubsub.v1.Subscription subscriptions = 1;</code> * * <pre> * The subscriptions that match the request. * </pre> */ public Builder addSubscriptions( int index, com.google.pubsub.v1.Subscription.Builder builderForValue) { if (subscriptionsBuilder_ == null) { ensureSubscriptionsIsMutable(); subscriptions_.add(index, builderForValue.build()); onChanged(); } else { subscriptionsBuilder_.addMessage(index, builderForValue.build()); } return this; } /**
/** * * * <pre> * The updated subscription object. * </pre> * * <code>.google.pubsub.v1.Subscription subscription = 1;</code> */ public Builder setSubscription(com.google.pubsub.v1.Subscription.Builder builderForValue) { if (subscriptionBuilder_ == null) { subscription_ = builderForValue.build(); onChanged(); } else { subscriptionBuilder_.setMessage(builderForValue.build()); } return this; } /**
public Builder mergeFrom(com.google.pubsub.v1.Subscription other) { if (other == com.google.pubsub.v1.Subscription.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } if (!other.getTopic().isEmpty()) { topic_ = other.topic_; onChanged(); } if (other.hasPushConfig()) { mergePushConfig(other.getPushConfig()); } if (other.getAckDeadlineSeconds() != 0) { setAckDeadlineSeconds(other.getAckDeadlineSeconds()); } onChanged(); return this; }
/** * <code>repeated .google.pubsub.v1.Subscription subscriptions = 1;</code> * * <pre> * The subscriptions that match the request. * </pre> */ public Builder addSubscriptions( com.google.pubsub.v1.Subscription.Builder builderForValue) { if (subscriptionsBuilder_ == null) { ensureSubscriptionsIsMutable(); subscriptions_.add(builderForValue.build()); onChanged(); } else { subscriptionsBuilder_.addMessage(builderForValue.build()); } return this; } /**