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());
}
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"));
}
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"));
}
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"));
}
Aggregations