Search in sources :

Example 71 with Connection

use of org.osate.aadl2.Connection in project java-bigqueryconnection by googleapis.

the class ConnectionServiceClientTest method listConnectionsTest.

@Test
public void listConnectionsTest() throws Exception {
    Connection responsesElement = Connection.newBuilder().build();
    ListConnectionsResponse expectedResponse = ListConnectionsResponse.newBuilder().setNextPageToken("").addAllConnections(Arrays.asList(responsesElement)).build();
    mockConnectionService.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    ListConnectionsPagedResponse pagedListResponse = client.listConnections(parent);
    List<Connection> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getConnectionsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockConnectionService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListConnectionsRequest actualRequest = ((ListConnectionsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListConnectionsRequest(com.google.cloud.bigquery.connection.v1.ListConnectionsRequest) ListConnectionsResponse(com.google.cloud.bigquery.connection.v1.ListConnectionsResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Connection(com.google.cloud.bigquery.connection.v1.Connection) ListConnectionsPagedResponse(com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient.ListConnectionsPagedResponse) LocationName(com.google.cloud.bigquery.connection.v1.LocationName) Test(org.junit.Test)

Example 72 with Connection

use of org.osate.aadl2.Connection in project java-bigqueryconnection by googleapis.

the class ConnectionServiceClientTest method getConnectionTest2.

@Test
public void getConnectionTest2() throws Exception {
    Connection expectedResponse = Connection.newBuilder().setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString()).setFriendlyName("friendlyName461933014").setDescription("description-1724546052").setCreationTime(1932333101).setLastModifiedTime(-671513446).setHasCredential(true).build();
    mockConnectionService.addResponse(expectedResponse);
    String name = "name3373707";
    Connection actualResponse = client.getConnection(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockConnectionService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetConnectionRequest actualRequest = ((GetConnectionRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) Connection(com.google.cloud.bigquery.connection.v1.Connection) ByteString(com.google.protobuf.ByteString) GetConnectionRequest(com.google.cloud.bigquery.connection.v1.GetConnectionRequest) Test(org.junit.Test)

Example 73 with Connection

use of org.osate.aadl2.Connection in project java-bigqueryconnection by googleapis.

the class ConnectionServiceClientTest method updateConnectionTest2.

@Test
public void updateConnectionTest2() throws Exception {
    Connection expectedResponse = Connection.newBuilder().setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString()).setFriendlyName("friendlyName461933014").setDescription("description-1724546052").setCreationTime(1932333101).setLastModifiedTime(-671513446).setHasCredential(true).build();
    mockConnectionService.addResponse(expectedResponse);
    String name = "name3373707";
    Connection connection = Connection.newBuilder().build();
    FieldMask updateMask = FieldMask.newBuilder().build();
    Connection actualResponse = client.updateConnection(name, connection, updateMask);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockConnectionService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    UpdateConnectionRequest actualRequest = ((UpdateConnectionRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertEquals(connection, actualRequest.getConnection());
    Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) Connection(com.google.cloud.bigquery.connection.v1.Connection) UpdateConnectionRequest(com.google.cloud.bigquery.connection.v1.UpdateConnectionRequest) ByteString(com.google.protobuf.ByteString) FieldMask(com.google.protobuf.FieldMask) Test(org.junit.Test)

Example 74 with Connection

use of org.osate.aadl2.Connection in project java-bigqueryconnection by googleapis.

the class ConnectionServiceClientTest method listConnectionsTest2.

@Test
public void listConnectionsTest2() throws Exception {
    Connection responsesElement = Connection.newBuilder().build();
    ListConnectionsResponse expectedResponse = ListConnectionsResponse.newBuilder().setNextPageToken("").addAllConnections(Arrays.asList(responsesElement)).build();
    mockConnectionService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListConnectionsPagedResponse pagedListResponse = client.listConnections(parent);
    List<Connection> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getConnectionsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockConnectionService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListConnectionsRequest actualRequest = ((ListConnectionsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListConnectionsRequest(com.google.cloud.bigquery.connection.v1.ListConnectionsRequest) ListConnectionsResponse(com.google.cloud.bigquery.connection.v1.ListConnectionsResponse) AbstractMessage(com.google.protobuf.AbstractMessage) Connection(com.google.cloud.bigquery.connection.v1.Connection) ByteString(com.google.protobuf.ByteString) ListConnectionsPagedResponse(com.google.cloud.bigqueryconnection.v1.ConnectionServiceClient.ListConnectionsPagedResponse) Test(org.junit.Test)

Example 75 with Connection

use of org.osate.aadl2.Connection in project java-bigqueryconnection by googleapis.

the class ConnectionServiceClientTest method createConnectionTest.

@Test
public void createConnectionTest() throws Exception {
    Connection expectedResponse = Connection.newBuilder().setName(ConnectionName.of("[PROJECT]", "[LOCATION]", "[CONNECTION]").toString()).setFriendlyName("friendlyName461933014").setDescription("description-1724546052").setCreationTime(1932333101).setLastModifiedTime(-671513446).setHasCredential(true).build();
    mockConnectionService.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    Connection connection = Connection.newBuilder().build();
    String connectionId = "connectionId1923106969";
    Connection actualResponse = client.createConnection(parent, connection, connectionId);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockConnectionService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateConnectionRequest actualRequest = ((CreateConnectionRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(connection, actualRequest.getConnection());
    Assert.assertEquals(connectionId, actualRequest.getConnectionId());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) Connection(com.google.cloud.bigquery.connection.v1.Connection) ByteString(com.google.protobuf.ByteString) CreateConnectionRequest(com.google.cloud.bigquery.connection.v1.CreateConnectionRequest) LocationName(com.google.cloud.bigquery.connection.v1.LocationName) Test(org.junit.Test)

Aggregations

IOException (java.io.IOException)82 Connection (com.trilead.ssh2.Connection)69 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)64 Connection (org.ovirt.engine.sdk4.Connection)64 Connection (org.osate.aadl2.Connection)57 ConnectionInstance (org.osate.aadl2.instance.ConnectionInstance)51 Connection (ch.ethz.ssh2.Connection)37 ArrayList (java.util.ArrayList)36 FeatureInstance (org.osate.aadl2.instance.FeatureInstance)35 Session (com.trilead.ssh2.Session)33 Connection (org.jboss.remoting3.Connection)33 Connection (okhttp3.Connection)32 Test (org.junit.Test)32 ConnectionInstanceEnd (org.osate.aadl2.instance.ConnectionInstanceEnd)32 Connection (com.google.cloud.bigquery.connection.v1.Connection)31 InputStream (java.io.InputStream)31 VmsService (org.ovirt.engine.sdk4.services.VmsService)30 Vm (org.ovirt.engine.sdk4.types.Vm)30 ConnectionReference (org.osate.aadl2.instance.ConnectionReference)29 Subcomponent (org.osate.aadl2.Subcomponent)28