use of com.linkedin.d2.BackupRequestsConfigurationArray in project rest.li by linkedin.
the class BackupRequestsConverter method toConfig.
public static BackupRequestsConfigurationArray toConfig(List<Map<String, Object>> properties) {
try {
String json = JacksonUtil.getObjectMapper().writeValueAsString(properties);
BackupRequestsConfigurationArray brca = new BackupRequestsConfigurationArray(CODEC.stringToList(json));
// fixes are applied in place
ValidateDataAgainstSchema.validate(brca, VALIDATION_OPTIONS);
return brca;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of com.linkedin.d2.BackupRequestsConfigurationArray in project rest.li by linkedin.
the class BackupRequestsConverterTest method testBackupRequestsConverter.
@Test
public void testBackupRequestsConverter() {
BackupRequestsConfigurationArray configArray = new BackupRequestsConfigurationArray();
BackupRequestsConfiguration config = new BackupRequestsConfiguration();
config.setOperation("myOperation");
BoundedCostBackupRequests boundedCostBackupRequests = new BoundedCostBackupRequests();
boundedCostBackupRequests.setCost(5);
boundedCostBackupRequests.setHistoryLength(4096);
boundedCostBackupRequests.setMaxBurst(45);
boundedCostBackupRequests.setMinBackupDelayMs(50);
boundedCostBackupRequests.setRequiredHistoryLength(456);
config.setStrategy(Strategy.create(boundedCostBackupRequests));
// round trip conversion test
Assert.assertEquals(BackupRequestsConverter.toConfig(BackupRequestsConverter.toProperties(configArray)), configArray);
}
use of com.linkedin.d2.BackupRequestsConfigurationArray in project rest.li by linkedin.
the class BackupRequestsConverterTest method testBackupRequestsConverterEmpty.
@Test
public void testBackupRequestsConverterEmpty() {
BackupRequestsConfigurationArray config = new BackupRequestsConfigurationArray();
// round trip conversion test
Assert.assertEquals(BackupRequestsConverter.toConfig(BackupRequestsConverter.toProperties(config)), config);
}
Aggregations