Search in sources :

Example 1 with ReplicaInfo

use of com.google.spanner.admin.instance.v1.ReplicaInfo in project java-spanner by googleapis.

the class InstanceAdminClientTest method getInstanceConfigTest.

@Test
public void getInstanceConfigTest() throws Exception {
    InstanceConfig expectedResponse = InstanceConfig.newBuilder().setName(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()).setDisplayName("displayName1714148973").addAllReplicas(new ArrayList<ReplicaInfo>()).addAllLeaderOptions(new ArrayList<String>()).build();
    mockInstanceAdmin.addResponse(expectedResponse);
    InstanceConfigName name = InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]");
    InstanceConfig actualResponse = client.getInstanceConfig(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetInstanceConfigRequest actualRequest = ((GetInstanceConfigRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) InstanceConfig(com.google.spanner.admin.instance.v1.InstanceConfig) ReplicaInfo(com.google.spanner.admin.instance.v1.ReplicaInfo) GetInstanceConfigRequest(com.google.spanner.admin.instance.v1.GetInstanceConfigRequest) ArrayList(java.util.ArrayList) InstanceConfigName(com.google.spanner.admin.instance.v1.InstanceConfigName) Test(org.junit.Test)

Example 2 with ReplicaInfo

use of com.google.spanner.admin.instance.v1.ReplicaInfo in project java-spanner by googleapis.

the class InstanceAdminClientTest method getInstanceConfigTest2.

@Test
public void getInstanceConfigTest2() throws Exception {
    InstanceConfig expectedResponse = InstanceConfig.newBuilder().setName(InstanceConfigName.of("[PROJECT]", "[INSTANCE_CONFIG]").toString()).setDisplayName("displayName1714148973").addAllReplicas(new ArrayList<ReplicaInfo>()).addAllLeaderOptions(new ArrayList<String>()).build();
    mockInstanceAdmin.addResponse(expectedResponse);
    String name = "name3373707";
    InstanceConfig actualResponse = client.getInstanceConfig(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetInstanceConfigRequest actualRequest = ((GetInstanceConfigRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) InstanceConfig(com.google.spanner.admin.instance.v1.InstanceConfig) ReplicaInfo(com.google.spanner.admin.instance.v1.ReplicaInfo) GetInstanceConfigRequest(com.google.spanner.admin.instance.v1.GetInstanceConfigRequest) ArrayList(java.util.ArrayList) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)2 GetInstanceConfigRequest (com.google.spanner.admin.instance.v1.GetInstanceConfigRequest)2 InstanceConfig (com.google.spanner.admin.instance.v1.InstanceConfig)2 ReplicaInfo (com.google.spanner.admin.instance.v1.ReplicaInfo)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 ByteString (com.google.protobuf.ByteString)1 InstanceConfigName (com.google.spanner.admin.instance.v1.InstanceConfigName)1