use of com.google.bigtable.admin.v2.Instance in project java-redis by googleapis.
the class ITSystemTest method testGetInstance.
@Test
public void testGetInstance() {
Instance response = client.getInstance(INSTANCE_NAME);
assertEquals(TIER, response.getTier());
assertEquals(INSTANCE_NAME.toString(), response.getName());
}
use of com.google.bigtable.admin.v2.Instance in project java-redis by googleapis.
the class ITSystemTest method testUpdateInstance.
@Test
public void testUpdateInstance() throws ExecutionException, InterruptedException {
int memorySizeGb = 4;
FieldMask updateMask = FieldMask.newBuilder().addAllPaths(Arrays.asList("memory_size_gb")).build();
Instance instance = Instance.newBuilder().setName(INSTANCE_NAME.toString()).setMemorySizeGb(memorySizeGb).build();
UpdateInstanceRequest updateInstanceRequest = UpdateInstanceRequest.newBuilder().setInstance(instance).setUpdateMask(updateMask).build();
Instance actualInstance = client.updateInstanceAsync(updateInstanceRequest).get();
assertEquals(memorySizeGb, actualInstance.getMemorySizeGb());
}
use of com.google.bigtable.admin.v2.Instance in project java-redis by googleapis.
the class ITSystemTest method testListInstances.
@Test
public void testListInstances() {
List<Instance> instances = Lists.newArrayList(client.listInstances(PARENT).iterateAll());
for (Instance instance : instances) {
if (INSTANCE_NAME.toString().equals(instance.getName())) {
assertEquals(TIER, instance.getTier());
assertEquals(INSTANCE_NAME.toString(), instance.getName());
}
}
}
use of com.google.bigtable.admin.v2.Instance in project java-redis by googleapis.
the class ITSystemTest method testUpdateInstance.
@Test
public void testUpdateInstance() throws ExecutionException, InterruptedException {
int memorySizeGb = 4;
FieldMask updateMask = FieldMask.newBuilder().addAllPaths(Arrays.asList("memory_size_gb")).build();
Instance instance = Instance.newBuilder().setName(INSTANCE_NAME.toString()).setMemorySizeGb(memorySizeGb).build();
UpdateInstanceRequest updateInstanceRequest = UpdateInstanceRequest.newBuilder().setInstance(instance).setUpdateMask(updateMask).build();
Instance actualInstance = client.updateInstanceAsync(updateInstanceRequest).get();
assertEquals(memorySizeGb, actualInstance.getMemorySizeGb());
}
use of com.google.bigtable.admin.v2.Instance in project java-redis by googleapis.
the class ITSystemTest method setUp.
@BeforeClass
public static void setUp() throws Exception {
CloudRedisSettings.Builder cloudRedisSettingsBuilder = CloudRedisSettings.newBuilder();
cloudRedisSettingsBuilder.getInstanceSettings().setRetrySettings(cloudRedisSettingsBuilder.getInstanceSettings().getRetrySettings().toBuilder().setTotalTimeout(Duration.ofSeconds(900)).build());
CloudRedisSettings cloudRedisSettings = cloudRedisSettingsBuilder.build();
client = CloudRedisClient.create(cloudRedisSettings);
/* Creates a Redis instance based on the specified tier and memory size. */
Instance instance = Instance.newBuilder().setTier(TIER).setMemorySizeGb(1).setAuthorizedNetwork(AUTHORIZED_NETWORK).build();
client.createInstanceAsync(PARENT, INSTANCE, instance).get();
LOG.info("redis instance created successfully.");
}
Aggregations