use of com.vmware.connectors.github.pr.v3.PullRequest in project spring-cloud-gcp by spring-cloud.
the class PubSubSampleApplicationTests method getMessagesFromSubscription.
private List<String> getMessagesFromSubscription(String subscriptionName) {
String projectSubscriptionName = ProjectSubscriptionName.format(projectName, subscriptionName);
PullRequest pullRequest = PullRequest.newBuilder().setReturnImmediately(true).setMaxMessages(10).setSubscription(projectSubscriptionName).build();
PullResponse pullResponse = subscriptionAdminClient.getStub().pullCallable().call(pullRequest);
return pullResponse.getReceivedMessagesList().stream().map((message) -> message.getMessage().getData().toStringUtf8()).collect(Collectors.toList());
}
use of com.vmware.connectors.github.pr.v3.PullRequest in project spring-cloud-gcp by spring-cloud.
the class DefaultSubscriberFactoryTests method testCreatePullRequest_nonNullMaxMessages.
@Test
public void testCreatePullRequest_nonNullMaxMessages() {
DefaultSubscriberFactory factory = new DefaultSubscriberFactory(() -> "project");
factory.setCredentialsProvider(this.credentialsProvider);
PullRequest request = factory.createPullRequest("test", null, true);
assertThat(request.getMaxMessages()).isEqualTo(Integer.MAX_VALUE);
}
Aggregations