use of org.apache.samza.operators.TableImpl in project samza by apache.
the class StreamApplicationDescriptorImpl method getTable.
@Override
public <K, V> Table<KV<K, V>> getTable(TableDescriptor<K, V, ?> tableDescriptor) {
addTableDescriptor(tableDescriptor);
if (tableDescriptor instanceof LocalTableDescriptor) {
LocalTableDescriptor localTableDescriptor = (LocalTableDescriptor) tableDescriptor;
getOrCreateTableSerdes(localTableDescriptor.getTableId(), localTableDescriptor.getSerde());
}
return new TableImpl(tableDescriptor);
}
use of org.apache.samza.operators.TableImpl in project samza by apache.
the class TestStreamApplicationDescriptorImpl method testGetTable.
@Test
public void testGetTable() throws Exception {
Config mockConfig = getConfig();
String tableId = "t1";
BaseTableDescriptor mockTableDescriptor = mock(BaseTableDescriptor.class);
when(mockTableDescriptor.getTableId()).thenReturn(tableId);
AtomicReference<TableImpl> table = new AtomicReference<>();
StreamApplicationDescriptorImpl streamAppDesc = new StreamApplicationDescriptorImpl(appDesc -> {
table.set((TableImpl) appDesc.getTable(mockTableDescriptor));
}, mockConfig);
assertEquals(tableId, table.get().getTableId());
}
Aggregations