Search in sources :

Example 1 with Version

use of com.google.cloud.dialogflow.cx.v3beta1.Version in project java-dialogflow-cx by googleapis.

the class ITSystemTest method tearDown.

@AfterClass
public static void tearDown() {
    /* delete version */
    DeleteVersionRequest deleteVersionRequest = DeleteVersionRequest.newBuilder().setName(versionName).build();
    versionsClient.deleteVersion(deleteVersionRequest);
    versionsClient.close();
    /* delete transition route groups */
    DeleteTransitionRouteGroupRequest deleteTransitionRouteGroupRequest = DeleteTransitionRouteGroupRequest.newBuilder().setName(transitionRouteGroupName).build();
    transitionRouteGroupsClient.deleteTransitionRouteGroup(deleteTransitionRouteGroupRequest);
    transitionRouteGroupsClient.close();
    /* delete session */
    sessionsClient.close();
    /* delete pages */
    DeletePageRequest deletePageRequest = DeletePageRequest.newBuilder().setName(pageName).build();
    pagesClient.deletePage(deletePageRequest);
    pagesClient.close();
    /* delete intents */
    DeleteIntentRequest deleteIntentRequest = DeleteIntentRequest.newBuilder().setName(intentsName).build();
    intentsClient.deleteIntent(deleteIntentRequest);
    intentsClient.close();
    /* delete flows */
    DeleteFlowRequest deleteFlowRequest = DeleteFlowRequest.newBuilder().setName(flowName).build();
    flowsClient.deleteFlow(deleteFlowRequest);
    DeleteFlowRequest deleteTrainFlowRequest = DeleteFlowRequest.newBuilder().setName(trainFlowName).build();
    flowsClient.deleteFlow(deleteTrainFlowRequest);
    flowsClient.close();
    /* delete entity types */
    DeleteEntityTypeRequest deleteEntityTypeRequest = DeleteEntityTypeRequest.newBuilder().setName(entityTypesName).build();
    entityTypesClient.deleteEntityType(deleteEntityTypeRequest);
    entityTypesClient.close();
    /* delete agents */
    DeleteAgentRequest deleteAgentRequest = DeleteAgentRequest.newBuilder().setName(agentName).build();
    agentsClient.deleteAgent(deleteAgentRequest);
    agentsClient.close();
}
Also used : DeleteFlowRequest(com.google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest) DeleteTransitionRouteGroupRequest(com.google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest) DeletePageRequest(com.google.cloud.dialogflow.cx.v3beta1.DeletePageRequest) DeleteEntityTypeRequest(com.google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest) DeleteAgentRequest(com.google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest) DeleteVersionRequest(com.google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest) DeleteIntentRequest(com.google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest) AfterClass(org.junit.AfterClass)

Example 2 with Version

use of com.google.cloud.dialogflow.cx.v3beta1.Version in project java-dialogflow-cx by googleapis.

the class ITSystemTest method updateVersionTest.

@Test
public void updateVersionTest() {
    Version version = Version.newBuilder().setName(versionName).setDisplayName(DISPLAY_NAME).setState(Version.State.SUCCEEDED).build();
    FieldMask updateMask = FieldMask.newBuilder().build();
    UpdateVersionRequest versionRequest = UpdateVersionRequest.newBuilder().setVersion(version).setUpdateMask(updateMask).build();
    Version updatedVersion = versionsClient.updateVersion(versionRequest);
    assertEquals(Version.State.SUCCEEDED, updatedVersion.getState());
}
Also used : Version(com.google.cloud.dialogflow.cx.v3beta1.Version) UpdateVersionRequest(com.google.cloud.dialogflow.cx.v3beta1.UpdateVersionRequest) FieldMask(com.google.protobuf.FieldMask) Test(org.junit.Test)

Example 3 with Version

use of com.google.cloud.dialogflow.cx.v3beta1.Version 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);
}
Also used : Version(com.google.cloud.dialogflow.cx.v3beta1.Version) VersionsClient(com.google.cloud.dialogflow.cx.v3beta1.VersionsClient) ListVersionsRequest(com.google.cloud.dialogflow.cx.v3beta1.ListVersionsRequest) Test(org.junit.Test)

Example 4 with Version

use of com.google.cloud.dialogflow.cx.v3beta1.Version in project java-dialogflow-cx by googleapis.

the class ITSystemTest method getVersionTest.

@Test
public void getVersionTest() {
    GetVersionRequest versionRequest = GetVersionRequest.newBuilder().setName(versionName).build();
    Version version = versionsClient.getVersion(versionRequest);
    assertVersionDetails(version);
}
Also used : Version(com.google.cloud.dialogflow.cx.v3beta1.Version) GetVersionRequest(com.google.cloud.dialogflow.cx.v3beta1.GetVersionRequest) Test(org.junit.Test)

Example 5 with Version

use of com.google.cloud.dialogflow.cx.v3beta1.Version in project dcache by dCache.

the class DCapDoorInterpreterV3Tests method versionShouldMatchTo.

@Test
public void versionShouldMatchTo() {
    Version v1_2 = new Version(1, 2);
    Version v1_1 = new Version(1, 1);
    Version v2_1 = new Version(2, 1);
    Version v1_1_1 = new Version(1, 1, 1, null);
    Version v1_1_2 = new Version(1, 1, 2, null);
    Version v1_1_1_1 = new Version(1, 1, 1, "1");
    Version v1_1_1_2 = new Version(1, 1, 1, "2");
    assertThat(v1_1.matches(v1_1), is(equalTo(0)));
    assertThat(v1_2.matches(v1_2), is(equalTo(0)));
    assertThat(v2_1.matches(v2_1), is(equalTo(0)));
    assertThat(v1_1_1.matches(v1_1_1), is(equalTo(0)));
    assertThat(v1_1_2.matches(v1_1_2), is(equalTo(0)));
    assertThat(v1_1_1_1.matches(v1_1_1_1), is(equalTo(0)));
    assertThat(v1_1_1_2.matches(v1_1_1_2), is(equalTo(0)));
    assertThat(v1_1.matches(v1_1_1), is(equalTo(0)));
    assertThat(v1_1.matches(v1_1_1_1), is(equalTo(0)));
    assertThat(v1_1_1.matches(v1_1_1_1), is(equalTo(0)));
    assertThat(v1_1.matches(v1_2), is(equalTo(-1)));
    assertThat(v1_2.matches(v1_1), is(equalTo(1)));
    assertThat(v1_1.matches(v1_2), is(equalTo(-1)));
    assertThat(v2_1.matches(v1_1), is(equalTo(1)));
    assertThat(v1_2.matches(v2_1), is(equalTo(-1)));
    assertThat(v2_1.matches(v1_2), is(equalTo(1)));
    assertThat(v1_1_1.matches(v1_1), is(equalTo(1)));
    assertThat(v1_1_1.matches(v1_1_2), is(equalTo(-1)));
    assertThat(v1_1_2.matches(v1_1_1), is(equalTo(1)));
    assertThat(v1_1_1_1.matches(v1_1_1), is(equalTo(1)));
    assertThat(v1_1_1_1.matches(v1_1_1_2), is(equalTo(-1)));
    assertThat(v1_1_1_2.matches(v1_1_1_1), is(equalTo(1)));
}
Also used : Version(diskCacheV111.doors.DCapDoorInterpreterV3.Version) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 Version (com.google.cloud.dialogflow.cx.v3beta1.Version)4 Version (diskCacheV111.doors.DCapDoorInterpreterV3.Version)3 ListVersionsPagedResponse (com.google.cloud.dialogflow.cx.v3beta1.VersionsClient.ListVersionsPagedResponse)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Agent (com.google.cloud.dialogflow.cx.v3beta1.Agent)1 CreateEntityTypeRequest (com.google.cloud.dialogflow.cx.v3beta1.CreateEntityTypeRequest)1 CreateFlowRequest (com.google.cloud.dialogflow.cx.v3beta1.CreateFlowRequest)1 CreateIntentRequest (com.google.cloud.dialogflow.cx.v3beta1.CreateIntentRequest)1 CreatePageRequest (com.google.cloud.dialogflow.cx.v3beta1.CreatePageRequest)1 CreateTransitionRouteGroupRequest (com.google.cloud.dialogflow.cx.v3beta1.CreateTransitionRouteGroupRequest)1 CreateVersionRequest (com.google.cloud.dialogflow.cx.v3beta1.CreateVersionRequest)1 DeleteAgentRequest (com.google.cloud.dialogflow.cx.v3beta1.DeleteAgentRequest)1 DeleteEntityTypeRequest (com.google.cloud.dialogflow.cx.v3beta1.DeleteEntityTypeRequest)1 DeleteFlowRequest (com.google.cloud.dialogflow.cx.v3beta1.DeleteFlowRequest)1 DeleteIntentRequest (com.google.cloud.dialogflow.cx.v3beta1.DeleteIntentRequest)1 DeletePageRequest (com.google.cloud.dialogflow.cx.v3beta1.DeletePageRequest)1 DeleteTransitionRouteGroupRequest (com.google.cloud.dialogflow.cx.v3beta1.DeleteTransitionRouteGroupRequest)1 DeleteVersionRequest (com.google.cloud.dialogflow.cx.v3beta1.DeleteVersionRequest)1 EntityType (com.google.cloud.dialogflow.cx.v3beta1.EntityType)1