Search in sources :

Example 1 with CreateClusterRequest

use of com.google.container.v1beta1.CreateClusterRequest in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClientTest method createClusterTest.

@Test
public void createClusterTest() throws Exception {
    Cluster expectedResponse = Cluster.newBuilder().setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString()).setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()).setServeNodes(-1288838783).setDefaultStorageType(StorageType.forNumber(0)).setEncryptionConfig(Cluster.EncryptionConfig.newBuilder().build()).build();
    Operation resultOperation = Operation.newBuilder().setName("createClusterTest").setDone(true).setResponse(Any.pack(expectedResponse)).build();
    mockBigtableInstanceAdmin.addResponse(resultOperation);
    InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
    String clusterId = "clusterId561939637";
    Cluster cluster = Cluster.newBuilder().build();
    Cluster actualResponse = client.createClusterAsync(parent, clusterId, cluster).get();
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateClusterRequest actualRequest = ((CreateClusterRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertEquals(clusterId, actualRequest.getClusterId());
    Assert.assertEquals(cluster, actualRequest.getCluster());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : InstanceName(com.google.bigtable.admin.v2.InstanceName) CreateClusterRequest(com.google.bigtable.admin.v2.CreateClusterRequest) AbstractMessage(com.google.protobuf.AbstractMessage) Cluster(com.google.bigtable.admin.v2.Cluster) Operation(com.google.longrunning.Operation) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 2 with CreateClusterRequest

use of com.google.container.v1beta1.CreateClusterRequest in project java-bigtable by googleapis.

the class BaseBigtableInstanceAdminClientTest method createClusterTest2.

@Test
public void createClusterTest2() throws Exception {
    Cluster expectedResponse = Cluster.newBuilder().setName(ClusterName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]").toString()).setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()).setServeNodes(-1288838783).setDefaultStorageType(StorageType.forNumber(0)).setEncryptionConfig(Cluster.EncryptionConfig.newBuilder().build()).build();
    Operation resultOperation = Operation.newBuilder().setName("createClusterTest").setDone(true).setResponse(Any.pack(expectedResponse)).build();
    mockBigtableInstanceAdmin.addResponse(resultOperation);
    String parent = "parent-995424086";
    String clusterId = "clusterId561939637";
    Cluster cluster = Cluster.newBuilder().build();
    Cluster actualResponse = client.createClusterAsync(parent, clusterId, cluster).get();
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockBigtableInstanceAdmin.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateClusterRequest actualRequest = ((CreateClusterRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertEquals(clusterId, actualRequest.getClusterId());
    Assert.assertEquals(cluster, actualRequest.getCluster());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : CreateClusterRequest(com.google.bigtable.admin.v2.CreateClusterRequest) AbstractMessage(com.google.protobuf.AbstractMessage) Cluster(com.google.bigtable.admin.v2.Cluster) Operation(com.google.longrunning.Operation) ByteString(com.google.protobuf.ByteString) Test(org.junit.Test)

Example 3 with CreateClusterRequest

use of com.google.container.v1beta1.CreateClusterRequest in project java-container by googleapis.

the class ClusterManagerClientTest method createClusterTest.

@Test
public void createClusterTest() throws Exception {
    Operation expectedResponse = Operation.newBuilder().setName("name3373707").setZone("zone3744684").setDetail("detail-1335224239").setStatusMessage("statusMessage-958704715").setSelfLink("selfLink1191800166").setTargetLink("targetLink486368555").setLocation("location1901043637").setStartTime("startTime-2129294769").setEndTime("endTime-1607243192").setProgress(OperationProgress.newBuilder().build()).addAllClusterConditions(new ArrayList<StatusCondition>()).addAllNodepoolConditions(new ArrayList<StatusCondition>()).setError(Status.newBuilder().build()).build();
    mockClusterManager.addResponse(expectedResponse);
    String parent = "parent-995424086";
    Cluster cluster = Cluster.newBuilder().build();
    Operation actualResponse = client.createCluster(parent, cluster);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockClusterManager.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateClusterRequest actualRequest = ((CreateClusterRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertEquals(cluster, actualRequest.getCluster());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : CreateClusterRequest(com.google.container.v1.CreateClusterRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ArrayList(java.util.ArrayList) Cluster(com.google.container.v1.Cluster) Operation(com.google.container.v1.Operation) StatusCondition(com.google.container.v1.StatusCondition) Test(org.junit.Test)

Example 4 with CreateClusterRequest

use of com.google.container.v1beta1.CreateClusterRequest in project java-container by googleapis.

the class ClusterManagerClientTest method createClusterTest.

@Test
public void createClusterTest() throws Exception {
    Operation expectedResponse = Operation.newBuilder().setName("name3373707").setZone("zone3744684").setDetail("detail-1335224239").setStatusMessage("statusMessage-958704715").setSelfLink("selfLink1191800166").setTargetLink("targetLink486368555").setLocation("location1901043637").setStartTime("startTime-2129294769").setEndTime("endTime-1607243192").setProgress(OperationProgress.newBuilder().build()).addAllClusterConditions(new ArrayList<StatusCondition>()).addAllNodepoolConditions(new ArrayList<StatusCondition>()).setError(Status.newBuilder().build()).build();
    mockClusterManager.addResponse(expectedResponse);
    String projectId = "projectId-894832108";
    String zone = "zone3744684";
    Cluster cluster = Cluster.newBuilder().build();
    Operation actualResponse = client.createCluster(projectId, zone, cluster);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockClusterManager.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateClusterRequest actualRequest = ((CreateClusterRequest) actualRequests.get(0));
    Assert.assertEquals(projectId, actualRequest.getProjectId());
    Assert.assertEquals(zone, actualRequest.getZone());
    Assert.assertEquals(cluster, actualRequest.getCluster());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : CreateClusterRequest(com.google.container.v1beta1.CreateClusterRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ArrayList(java.util.ArrayList) Cluster(com.google.container.v1beta1.Cluster) Operation(com.google.container.v1beta1.Operation) StatusCondition(com.google.container.v1beta1.StatusCondition) Test(org.junit.Test)

Example 5 with CreateClusterRequest

use of com.google.container.v1beta1.CreateClusterRequest in project java-container by googleapis.

the class ClusterManagerClientTest method createClusterTest2.

@Test
public void createClusterTest2() throws Exception {
    Operation expectedResponse = Operation.newBuilder().setName("name3373707").setZone("zone3744684").setDetail("detail-1335224239").setStatusMessage("statusMessage-958704715").setSelfLink("selfLink1191800166").setTargetLink("targetLink486368555").setLocation("location1901043637").setStartTime("startTime-2129294769").setEndTime("endTime-1607243192").setProgress(OperationProgress.newBuilder().build()).addAllClusterConditions(new ArrayList<StatusCondition>()).addAllNodepoolConditions(new ArrayList<StatusCondition>()).setError(Status.newBuilder().build()).build();
    mockClusterManager.addResponse(expectedResponse);
    String projectId = "projectId-894832108";
    String zone = "zone3744684";
    Cluster cluster = Cluster.newBuilder().build();
    Operation actualResponse = client.createCluster(projectId, zone, cluster);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockClusterManager.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    CreateClusterRequest actualRequest = ((CreateClusterRequest) actualRequests.get(0));
    Assert.assertEquals(projectId, actualRequest.getProjectId());
    Assert.assertEquals(zone, actualRequest.getZone());
    Assert.assertEquals(cluster, actualRequest.getCluster());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : CreateClusterRequest(com.google.container.v1.CreateClusterRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ArrayList(java.util.ArrayList) Cluster(com.google.container.v1.Cluster) Operation(com.google.container.v1.Operation) StatusCondition(com.google.container.v1.StatusCondition) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)5 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)3 Cluster (com.google.bigtable.admin.v2.Cluster)2 CreateClusterRequest (com.google.bigtable.admin.v2.CreateClusterRequest)2 Cluster (com.google.container.v1.Cluster)2 CreateClusterRequest (com.google.container.v1.CreateClusterRequest)2 Operation (com.google.container.v1.Operation)2 StatusCondition (com.google.container.v1.StatusCondition)2 Operation (com.google.longrunning.Operation)2 ByteString (com.google.protobuf.ByteString)2 InstanceName (com.google.bigtable.admin.v2.InstanceName)1 Cluster (com.google.container.v1beta1.Cluster)1 CreateClusterRequest (com.google.container.v1beta1.CreateClusterRequest)1 Operation (com.google.container.v1beta1.Operation)1 StatusCondition (com.google.container.v1beta1.StatusCondition)1