Search in sources :

Example 11 with GetInstanceRequest

use of com.google.cloud.redis.v1beta1.GetInstanceRequest in project java-spanner by googleapis.

the class InstanceAdminClientTest method getInstanceTest.

@Test
public void getInstanceTest() throws Exception {
    Instance expectedResponse = Instance.newBuilder().setName(InstanceName.of("[PROJECT]", "[INSTANCE]").toString()).setConfig(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()).setDisplayName("displayName1714148973").setNodeCount(1539922066).setProcessingUnits(-329117885).putAllLabels(new HashMap<String, String>()).addAllEndpointUris(new ArrayList<String>()).build();
    mockInstanceAdmin.addResponse(expectedResponse);
    InstanceName name = InstanceName.of("[PROJECT]", "[INSTANCE]");
    Instance actualResponse = client.getInstance(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetInstanceRequest actualRequest = ((GetInstanceRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : InstanceName(com.google.spanner.admin.instance.v1.InstanceName) AbstractMessage(com.google.protobuf.AbstractMessage) GetInstanceRequest(com.google.spanner.admin.instance.v1.GetInstanceRequest) Instance(com.google.spanner.admin.instance.v1.Instance) ArrayList(java.util.ArrayList) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)7 GetInstanceRequest (com.google.bigtable.admin.v2.GetInstanceRequest)4 AbstractMessage (com.google.protobuf.AbstractMessage)4 ByteString (com.google.protobuf.ByteString)4 GetInstanceRequest (com.google.spanner.admin.instance.v1.GetInstanceRequest)3 Instance (com.google.bigtable.admin.v2.Instance)2 Instance (com.google.cloud.bigtable.admin.v2.models.Instance)2 GetInstanceRequest (com.google.cloud.compute.v1.GetInstanceRequest)2 Instance (com.google.cloud.compute.v1.Instance)2 InstancesClient (com.google.cloud.compute.v1.InstancesClient)2 Instance (com.google.spanner.admin.instance.v1.Instance)2 ArrayList (java.util.ArrayList)2 GrpcCallContext (com.google.api.gax.grpc.GrpcCallContext)1 InstanceName (com.google.bigtable.admin.v2.InstanceName)1 CustomerEncryptionKeyProtectedDisk (com.google.cloud.compute.v1.CustomerEncryptionKeyProtectedDisk)1 InstancesStartWithEncryptionKeyRequest (com.google.cloud.compute.v1.InstancesStartWithEncryptionKeyRequest)1 Operation (com.google.cloud.compute.v1.Operation)1 SetLabelsInstanceRequest (com.google.cloud.compute.v1.SetLabelsInstanceRequest)1 StartWithEncryptionKeyInstanceRequest (com.google.cloud.compute.v1.StartWithEncryptionKeyInstanceRequest)1 GetInstanceRequest (com.google.cloud.notebooks.v1beta1.GetInstanceRequest)1