Search in sources :

Example 11 with Agent

use of com.google.cloud.dialogflow.cx.v3.Agent in project java-dialogflow-cx by googleapis.

the class PageManagementIT method setUp.

@BeforeClass
public static void setUp() throws IOException {
    stdOut = new ByteArrayOutputStream();
    System.setOut(new PrintStream(stdOut));
    Builder build = Agent.newBuilder();
    build.setDefaultLanguageCode("en");
    build.setDisplayName("temp_agent_" + UUID.randomUUID().toString());
    build.setTimeZone("America/Los_Angeles");
    Agent agent = build.build();
    String apiEndpoint = "global-dialogflow.googleapis.com:443";
    String parentPath = "projects/" + PROJECT_ID + "/locations/global";
    AgentsSettings agentsSettings = AgentsSettings.newBuilder().setEndpoint(apiEndpoint).build();
    AgentsClient client = AgentsClient.create(agentsSettings);
    parent = client.createAgent(parentPath, agent).getName();
    agentID = parent.split("/")[5];
}
Also used : PrintStream(java.io.PrintStream) Agent(com.google.cloud.dialogflow.cx.v3.Agent) AgentsSettings(com.google.cloud.dialogflow.cx.v3.AgentsSettings) AgentsClient(com.google.cloud.dialogflow.cx.v3.AgentsClient) Builder(com.google.cloud.dialogflow.cx.v3.Agent.Builder) ByteArrayOutputStream(java.io.ByteArrayOutputStream) BeforeClass(org.junit.BeforeClass)

Example 12 with Agent

use of com.google.cloud.dialogflow.cx.v3.Agent in project java-dialogflow-cx by googleapis.

the class DeploymentsClientTest method listDeploymentsTest.

@Test
public void listDeploymentsTest() throws Exception {
    Deployment responsesElement = Deployment.newBuilder().build();
    ListDeploymentsResponse expectedResponse = ListDeploymentsResponse.newBuilder().setNextPageToken("").addAllDeployments(Arrays.asList(responsesElement)).build();
    mockDeployments.addResponse(expectedResponse);
    EnvironmentName parent = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
    ListDeploymentsPagedResponse pagedListResponse = client.listDeployments(parent);
    List<Deployment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getDeploymentsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDeployments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListDeploymentsRequest actualRequest = ((ListDeploymentsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListDeploymentsPagedResponse(com.google.cloud.dialogflow.cx.v3.DeploymentsClient.ListDeploymentsPagedResponse) Test(org.junit.Test)

Example 13 with Agent

use of com.google.cloud.dialogflow.cx.v3.Agent in project java-dialogflow-cx by googleapis.

the class EntityTypesClientTest method listEntityTypesTest.

@Test
public void listEntityTypesTest() throws Exception {
    EntityType responsesElement = EntityType.newBuilder().build();
    ListEntityTypesResponse expectedResponse = ListEntityTypesResponse.newBuilder().setNextPageToken("").addAllEntityTypes(Arrays.asList(responsesElement)).build();
    mockEntityTypes.addResponse(expectedResponse);
    AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
    ListEntityTypesPagedResponse pagedListResponse = client.listEntityTypes(parent);
    List<EntityType> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEntityTypesList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEntityTypes.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListEntityTypesRequest actualRequest = ((ListEntityTypesRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListEntityTypesPagedResponse(com.google.cloud.dialogflow.cx.v3.EntityTypesClient.ListEntityTypesPagedResponse) Test(org.junit.Test)

Example 14 with Agent

use of com.google.cloud.dialogflow.cx.v3.Agent in project java-dialogflow-cx by googleapis.

the class EnvironmentsClientTest method listContinuousTestResultsTest.

@Test
public void listContinuousTestResultsTest() throws Exception {
    ContinuousTestResult responsesElement = ContinuousTestResult.newBuilder().build();
    ListContinuousTestResultsResponse expectedResponse = ListContinuousTestResultsResponse.newBuilder().setNextPageToken("").addAllContinuousTestResults(Arrays.asList(responsesElement)).build();
    mockEnvironments.addResponse(expectedResponse);
    EnvironmentName parent = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
    ListContinuousTestResultsPagedResponse pagedListResponse = client.listContinuousTestResults(parent);
    List<ContinuousTestResult> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getContinuousTestResultsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEnvironments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListContinuousTestResultsRequest actualRequest = ((ListContinuousTestResultsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListContinuousTestResultsPagedResponse(com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.ListContinuousTestResultsPagedResponse) Test(org.junit.Test)

Example 15 with Agent

use of com.google.cloud.dialogflow.cx.v3.Agent in project java-dialogflow-cx by googleapis.

the class EnvironmentsClientTest method lookupEnvironmentHistoryTest.

@Test
public void lookupEnvironmentHistoryTest() throws Exception {
    Environment responsesElement = Environment.newBuilder().build();
    LookupEnvironmentHistoryResponse expectedResponse = LookupEnvironmentHistoryResponse.newBuilder().setNextPageToken("").addAllEnvironments(Arrays.asList(responsesElement)).build();
    mockEnvironments.addResponse(expectedResponse);
    EnvironmentName name = EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]");
    LookupEnvironmentHistoryPagedResponse pagedListResponse = client.lookupEnvironmentHistory(name);
    List<Environment> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getEnvironmentsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockEnvironments.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    LookupEnvironmentHistoryRequest actualRequest = ((LookupEnvironmentHistoryRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) LookupEnvironmentHistoryPagedResponse(com.google.cloud.dialogflow.cx.v3.EnvironmentsClient.LookupEnvironmentHistoryPagedResponse) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)23 AbstractMessage (com.google.protobuf.AbstractMessage)18 AgentsClient (com.google.cloud.dialogflow.cx.v3.AgentsClient)5 AgentsSettings (com.google.cloud.dialogflow.cx.v3.AgentsSettings)5 Agent (com.google.cloud.dialogflow.cx.v3.Agent)4 Builder (com.google.cloud.dialogflow.cx.v3.Agent.Builder)4 Agent (com.google.cloud.dialogflow.cx.v3beta1.Agent)4 Agent (com.google.cloud.dialogflow.v2.Agent)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 ListAgentsPagedResponse (com.google.cloud.dialogflow.cx.v3.AgentsClient.ListAgentsPagedResponse)2 Struct (com.google.protobuf.Struct)2 PrintStream (java.io.PrintStream)2 Agent (lcm2.Agent)2 Action (lcm2.simulation.Action)2 NamespaceBinding (org.sbolstandard.core.datatree.Datatree.NamespaceBinding)2 NamespaceBinding (org.sbolstandard.core.datatree.NamespaceBinding)2 Activity (org.sbolstandard.core2.Activity)2 Agent (org.sbolstandard.core2.Agent)2 ComponentDefinition (org.sbolstandard.core2.ComponentDefinition)2 SBOLDocument (org.sbolstandard.core2.SBOLDocument)2