Search in sources :

Example 1 with BenderConfig

use of com.nextdoor.bender.config.BenderConfig in project bender by Nextdoor.

the class PartitionSpecTest method testLoadConfg.

@Test
public void testLoadConfg() {
    BenderConfig config = BenderConfig.load("/com/nextdoor/bender/partition/partition_config.json");
    PartitionOperationConfig op = (PartitionOperationConfig) config.getSources().get(0).getOperationConfigs().get(0);
    PartitionSpec spec = op.getPartitionSpecs().get(0);
    assertEquals("type", spec.getName());
    assertEquals(Interpreter.STRING, spec.getInterpreter());
    List<String> expected = Arrays.asList("one", "two", "three");
    assertEquals(expected, spec.getSources());
}
Also used : BenderConfig(com.nextdoor.bender.config.BenderConfig) Test(org.junit.Test)

Example 2 with BenderConfig

use of com.nextdoor.bender.config.BenderConfig in project bender by Nextdoor.

the class PartitionSpecTest method testStringFormatLower.

@Test
public void testStringFormatLower() {
    BenderConfig config = BenderConfig.load("/com/nextdoor/bender/partition/partition_config_format.json");
    PartitionOperationConfig op = (PartitionOperationConfig) config.getSources().get(0).getOperationConfigs().get(0);
    PartitionSpec spec = op.getPartitionSpecs().get(0);
    spec.setStringFormat(StringFormat.TOLOWER);
    assertEquals("type", spec.getName());
    assertEquals(Interpreter.STRING, spec.getInterpreter());
    assertEquals("thisisatest", spec.interpret("ThisIsATest"));
}
Also used : BenderConfig(com.nextdoor.bender.config.BenderConfig) Test(org.junit.Test)

Example 3 with BenderConfig

use of com.nextdoor.bender.config.BenderConfig in project bender by Nextdoor.

the class PartitionSpecTest method testLoadConfgTime.

@Test
public void testLoadConfgTime() {
    BenderConfig config = BenderConfig.load("/com/nextdoor/bender/partition/partition_config_time.json");
    PartitionOperationConfig op = (PartitionOperationConfig) config.getSources().get(0).getOperationConfigs().get(0);
    PartitionSpec spec = op.getPartitionSpecs().get(0);
    assertEquals("dt", spec.getName());
    assertEquals(Interpreter.SECONDS, spec.getInterpreter());
    List<String> expected = Arrays.asList("epoch");
    assertEquals(expected, spec.getSources());
    assertEquals("2017-01-19 05:05:59", spec.interpret("1484802359"));
}
Also used : BenderConfig(com.nextdoor.bender.config.BenderConfig) Test(org.junit.Test)

Example 4 with BenderConfig

use of com.nextdoor.bender.config.BenderConfig in project bender by Nextdoor.

the class PartitionSpecTest method testStringFormatUpper.

@Test
public void testStringFormatUpper() {
    BenderConfig config = BenderConfig.load("/com/nextdoor/bender/partition/partition_config_format.json");
    PartitionOperationConfig op = (PartitionOperationConfig) config.getSources().get(0).getOperationConfigs().get(0);
    PartitionSpec spec = op.getPartitionSpecs().get(0);
    assertEquals("type", spec.getName());
    assertEquals(Interpreter.STRING, spec.getInterpreter());
    assertEquals(StringFormat.TOUPPER, spec.getStringFormat());
    assertEquals("THISISATEST", spec.interpret("ThisIsATest"));
}
Also used : BenderConfig(com.nextdoor.bender.config.BenderConfig) Test(org.junit.Test)

Aggregations

BenderConfig (com.nextdoor.bender.config.BenderConfig)4 Test (org.junit.Test)4