use of com.google.cloud.dialogflow.cx.v3beta1.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);
}
use of com.google.cloud.dialogflow.cx.v3beta1.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);
}
use of com.google.cloud.dialogflow.cx.v3beta1.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()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.Agent in project java-dialogflow-cx by googleapis.
the class AgentsClientTest method listAgentsTest.
@Test
public void listAgentsTest() throws Exception {
Agent responsesElement = Agent.newBuilder().build();
ListAgentsResponse expectedResponse = ListAgentsResponse.newBuilder().setNextPageToken("").addAllAgents(Arrays.asList(responsesElement)).build();
mockAgents.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListAgentsPagedResponse pagedListResponse = client.listAgents(parent);
List<Agent> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getAgentsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockAgents.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListAgentsRequest actualRequest = ((ListAgentsRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.dialogflow.cx.v3beta1.Agent in project java-dialogflow-cx by googleapis.
the class AgentsClientTest method listAgentsTest2.
@Test
public void listAgentsTest2() throws Exception {
Agent responsesElement = Agent.newBuilder().build();
ListAgentsResponse expectedResponse = ListAgentsResponse.newBuilder().setNextPageToken("").addAllAgents(Arrays.asList(responsesElement)).build();
mockAgents.addResponse(expectedResponse);
String parent = "parent-995424086";
ListAgentsPagedResponse pagedListResponse = client.listAgents(parent);
List<Agent> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getAgentsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockAgents.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListAgentsRequest actualRequest = ((ListAgentsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations