Search in sources :

Example 1 with Agent

use of com.google.cloud.dialogflow.cx.v3.Agent in project libSBOLj by SynBioDex.

the class Provenance_CodonOptimization method main.

public static void main(String[] args) throws Exception {
    NamespaceBinding myAppNs = NamespaceBinding("http://myapp.com/", "myapp");
    SBOLDocument document = new SBOLDocument();
    document.addNamespace(URI.create(myAppNs.getNamespaceURI()), myAppNs.getPrefix());
    document.setDefaultURIprefix(myAppNs.getNamespaceURI());
    ComponentDefinition optimizedCds = getCds(document, "codon_optimized", "Codon optimised CDS");
    ComponentDefinition sourceCds = getCds(document, "non_codon_optimized", "Non Codon optimised CDS");
    optimizedCds.addWasDerivedFrom(sourceCds.getIdentity());
    // Create the agent definition for the codon optimization software
    Agent agent = document.createAgent("codon_optimization_software");
    agent.setName("Codon Optimization Software");
    // Create the generic top level entity for the codon optimization activity
    Activity activity = document.createActivity("codon_optimization_activity");
    activity.setName("Codon Optimization Activity");
    // Create the qualifiedUsage annotation to describe the use of the non codon optimized CDS component
    activity.createUsage("usage", sourceCds.getIdentity()).addRole(URI.create("http://sbols.org/v2#source"));
    // Create the qualifiedAssociation annotation to describe the use of the software agent used in the activity
    activity.createAssociation("association", agent.getIdentity()).addRole(myAppNs.namespacedUri("codonoptimiser"));
    optimizedCds.addWasGeneratedBy(activity.getIdentity());
    SBOLWriter.write(document, System.out);
}
Also used : Agent(org.sbolstandard.core2.Agent) SBOLDocument(org.sbolstandard.core2.SBOLDocument) Activity(org.sbolstandard.core2.Activity) NamespaceBinding(org.sbolstandard.core.datatree.Datatree.NamespaceBinding) NamespaceBinding(org.sbolstandard.core.datatree.NamespaceBinding) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 2 with Agent

use of com.google.cloud.dialogflow.cx.v3.Agent in project libSBOLj by SynBioDex.

the class Provenance_StrainDerivation method main.

public static void main(String[] args) throws Exception {
    NamespaceBinding myAppNs = NamespaceBinding("http://myapp.com/", "myapp");
    SBOLDocument document = new SBOLDocument();
    document.addNamespace(URI.create(myAppNs.getNamespaceURI()), myAppNs.getPrefix());
    document.setDefaultURIprefix(myAppNs.getNamespaceURI());
    ComponentDefinition b168 = getCds(document, "bsubtilis168", "Bacillus subtilis 168");
    ComponentDefinition b3610 = getCds(document, "bsubtilisncimb3610", "Bacillus subtilis NCIMB 3610");
    b168.addWasDerivedFrom(b3610.getIdentity());
    // Create the agent definition to represent X-ray
    Agent agent = document.createAgent("x_ray");
    agent.setName("X-ray");
    // Create the generic top level entity for the X-ray mutagenesis activity
    Activity activity = document.createActivity("xraymutagenesis");
    activity.setName("X-ray mutagenesis");
    // Create the qualifiedUsage annotation to describe the use of the parent strain
    activity.createUsage("usage", b3610.getIdentity()).addRole(URI.create("http://sbols.org/v2#source"));
    // Create the qualifiedAssociation annotation to describe the use of the agent used in the activity
    activity.createAssociation("association", agent.getIdentity()).addRole(myAppNs.namespacedUri("mutagen"));
    b168.addWasGeneratedBy(activity.getIdentity());
    SBOLWriter.write(document, System.out);
}
Also used : Agent(org.sbolstandard.core2.Agent) SBOLDocument(org.sbolstandard.core2.SBOLDocument) Activity(org.sbolstandard.core2.Activity) NamespaceBinding(org.sbolstandard.core.datatree.Datatree.NamespaceBinding) NamespaceBinding(org.sbolstandard.core.datatree.NamespaceBinding) ComponentDefinition(org.sbolstandard.core2.ComponentDefinition)

Example 3 with Agent

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

the class TransitionRouteGroupsClientTest method listTransitionRouteGroupsTest.

@Test
public void listTransitionRouteGroupsTest() throws Exception {
    TransitionRouteGroup responsesElement = TransitionRouteGroup.newBuilder().build();
    ListTransitionRouteGroupsResponse expectedResponse = ListTransitionRouteGroupsResponse.newBuilder().setNextPageToken("").addAllTransitionRouteGroups(Arrays.asList(responsesElement)).build();
    mockTransitionRouteGroups.addResponse(expectedResponse);
    FlowName parent = FlowName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]");
    ListTransitionRouteGroupsPagedResponse pagedListResponse = client.listTransitionRouteGroups(parent);
    List<TransitionRouteGroup> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getTransitionRouteGroupsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockTransitionRouteGroups.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListTransitionRouteGroupsRequest actualRequest = ((ListTransitionRouteGroupsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListTransitionRouteGroupsPagedResponse(com.google.cloud.dialogflow.cx.v3.TransitionRouteGroupsClient.ListTransitionRouteGroupsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 4 with Agent

use of com.google.cloud.dialogflow.cx.v3.Agent 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()));
}
Also used : ListVersionsPagedResponse(com.google.cloud.dialogflow.cx.v3.VersionsClient.ListVersionsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Test(org.junit.Test)

Example 5 with Agent

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

the class TestCasesClientTest method listTestCaseResultsTest.

@Test
public void listTestCaseResultsTest() throws Exception {
    TestCaseResult responsesElement = TestCaseResult.newBuilder().build();
    ListTestCaseResultsResponse expectedResponse = ListTestCaseResultsResponse.newBuilder().setNextPageToken("").addAllTestCaseResults(Arrays.asList(responsesElement)).build();
    mockTestCases.addResponse(expectedResponse);
    TestCaseName parent = TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]");
    ListTestCaseResultsPagedResponse pagedListResponse = client.listTestCaseResults(parent);
    List<TestCaseResult> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getTestCaseResultsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockTestCases.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListTestCaseResultsRequest actualRequest = ((ListTestCaseResultsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListTestCaseResultsPagedResponse(com.google.cloud.dialogflow.cx.v3.TestCasesClient.ListTestCaseResultsPagedResponse) AbstractMessage(com.google.protobuf.AbstractMessage) 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