use of com.google.cloud.redis.v1beta1.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.cloud.redis.v1beta1.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.cloud.redis.v1beta1.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.cloud.redis.v1beta1.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.");
}
use of com.google.cloud.redis.v1beta1.Instance in project omegat by omegat-org.
the class FilterMaster method getDefaultSettingsFromFilter.
/**
* Create default filter's config.
*
* @param filterClassname
* filter's classname
* @return default filter's config
*/
public static Filter getDefaultSettingsFromFilter(final String filterClassname) {
IFilter f = getFilterInstance(filterClassname);
if (f == null) {
return null;
}
Filter fc = new Filter();
fc.setClassName(f.getClass().getName());
fc.setEnabled(true);
for (Instance ins : f.getDefaultInstances()) {
Files ff = new Files();
ff.setSourceEncoding(ins.getSourceEncoding());
ff.setSourceFilenameMask(ins.getSourceFilenameMask());
ff.setTargetEncoding(ins.getTargetEncoding());
ff.setTargetFilenamePattern(ins.getTargetFilenamePattern());
fc.getFiles().add(ff);
}
return fc;
}
Aggregations