Search in sources :

Example 1 with BackupRequestsConfigurationArray

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);
    }
}
Also used : IOException(java.io.IOException) BackupRequestsConfigurationArray(com.linkedin.d2.BackupRequestsConfigurationArray)

Example 2 with BackupRequestsConfigurationArray

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);
}
Also used : BackupRequestsConfiguration(com.linkedin.d2.BackupRequestsConfiguration) BoundedCostBackupRequests(com.linkedin.d2.BoundedCostBackupRequests) BackupRequestsConfigurationArray(com.linkedin.d2.BackupRequestsConfigurationArray) Test(org.testng.annotations.Test)

Example 3 with BackupRequestsConfigurationArray

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);
}
Also used : BackupRequestsConfigurationArray(com.linkedin.d2.BackupRequestsConfigurationArray) Test(org.testng.annotations.Test)

Aggregations

BackupRequestsConfigurationArray (com.linkedin.d2.BackupRequestsConfigurationArray)3 Test (org.testng.annotations.Test)2 BackupRequestsConfiguration (com.linkedin.d2.BackupRequestsConfiguration)1 BoundedCostBackupRequests (com.linkedin.d2.BoundedCostBackupRequests)1 IOException (java.io.IOException)1