use of com.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest in project java-dialogflow-cx by googleapis.
the class ITSystemTest method listVersionsTest.
@Test
public void listVersionsTest() {
ListVersionsRequest versionsRequest = ListVersionsRequest.newBuilder().setParent(flowName).build();
VersionsClient.ListVersionsPagedResponse pagedListResponse = versionsClient.listVersions(versionsRequest);
List<Version> versions = Lists.newArrayList(pagedListResponse.iterateAll());
boolean isVersionNameExists = false;
for (Version version : versions) {
if (version.getName().equals(versionName)) {
assertVersionDetails(version);
isVersionNameExists = true;
}
}
assertTrue(isVersionNameExists);
}
use of com.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest in project java-dialogflow-cx by googleapis.
the class VersionsClientTest method listVersionsTest2.
@Test
public void listVersionsTest2() throws Exception {
Version responsesElement = Version.newBuilder().build();
ListVersionsResponse expectedResponse = ListVersionsResponse.newBuilder().setNextPageToken("").addAllVersions(Arrays.asList(responsesElement)).build();
mockVersions.addResponse(expectedResponse);
String parent = "parent-995424086";
ListVersionsPagedResponse pagedListResponse = client.listVersions(parent);
List<Version> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getVersionsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockVersions.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListVersionsRequest actualRequest = ((ListVersionsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest in project java-dialogflow-cx by googleapis.
the class VersionsClientTest method listVersionsTest.
@Test
public void listVersionsTest() throws Exception {
Version responsesElement = Version.newBuilder().build();
ListVersionsResponse expectedResponse = ListVersionsResponse.newBuilder().setNextPageToken("").addAllVersions(Arrays.asList(responsesElement)).build();
mockVersions.addResponse(expectedResponse);
FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
ListVersionsPagedResponse pagedListResponse = client.listVersions(parent);
List<Version> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getVersionsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockVersions.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListVersionsRequest actualRequest = ((ListVersionsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations