use of org.apache.samza.context.MockContext in project samza by apache.
the class TestTableManager method doTestInit.
private void doTestInit(Map<String, String> map) {
Map<String, StorageEngine> storageEngines = new HashMap<>();
storageEngines.put(TABLE_ID, mock(StorageEngine.class));
TableManager tableManager = new TableManager(new MapConfig(map));
tableManager.init(new MockContext());
for (int i = 0; i < 2; i++) {
Table table = tableManager.getTable(TABLE_ID);
verify(DummyTableProviderFactory.tableProvider, times(1)).init(anyObject());
verify(DummyTableProviderFactory.tableProvider, times(1)).getTable();
Assert.assertEquals(DummyTableProviderFactory.table, table);
}
Map<String, TableManager.TableCtx> ctxMap = getFieldValue(tableManager, "tableContexts");
TableManager.TableCtx ctx = ctxMap.get(TABLE_ID);
Assert.assertEquals(TABLE_ID, ctxMap.keySet().iterator().next());
TableProvider tableProvider = getFieldValue(ctx, "tableProvider");
Assert.assertNotNull(tableProvider);
}
Aggregations