use of com.yahoo.elide.modelconfig.model.Type in project elide by yahoo.
the class TableTypeTest method testJoinField.
@Test
void testJoinField() throws Exception {
Table testTable1 = Table.builder().name("table1").join(Join.builder().definition("{{id }} = {{ table2.id}}").kind(Join.Kind.TOONE).type(Join.Type.INNER).name("join1").to("table2.dim2").build()).build();
Table testTable2 = Table.builder().name("table2").dimension(Dimension.builder().name("dim2").type(Type.BOOLEAN).build()).build();
TableType testType1 = new TableType(testTable1);
TableType testType2 = new TableType(testTable2);
Map<String, com.yahoo.elide.core.type.Type<?>> tables = new HashMap<>();
tables.put("table1", testType1);
tables.put("table2", testType2);
testType1.resolveJoins(tables);
Field field = testType1.getDeclaredField("join1");
assertNotNull(field);
com.yahoo.elide.datastores.aggregation.annotation.Join join = field.getAnnotation(com.yahoo.elide.datastores.aggregation.annotation.Join.class);
assertEquals(INNER, join.type());
assertEquals("{{id}} = {{table2.id}}", join.value());
}
Aggregations