use of doitincloud.rdbcache.repositories.SimpleKeyInfoRepo in project rdbcache by rdbcache.
the class RequestTest method setUp.
@Before
public void setUp() throws Exception {
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("test-keyinfos.json");
assertNotNull(inputStream);
String text = null;
try (final Reader reader = new InputStreamReader(inputStream)) {
text = CharStreams.toString(reader);
}
assertNotNull(text);
Map<String, Object> map = Utils.toMap(text);
assertNotNull(map);
PowerMockito.mockStatic(AppCtx.class);
keyInfoRepo = new SimpleKeyInfoRepo(map);
BDDMockito.when(AppCtx.getKeyInfoRepo()).thenReturn(keyInfoRepo);
DbaseOps dbaseOps = mock(DbaseOps.class, Mockito.RETURNS_DEEP_STUBS);
assertNotNull(dbaseOps);
Map<String, Object> tablesMap = new LinkedHashMap<>();
tablesMap.put("user_table", "data");
tablesMap.put("tb1", "data");
Mockito.when(dbaseOps.getTablesMap(any(Context.class))).thenReturn(tablesMap);
BDDMockito.when(AppCtx.getDbaseOps()).thenReturn(dbaseOps);
CacheOps cacheOps = new CacheOps();
cacheOps.init();
cacheOps.handleEvent(null);
BDDMockito.when(AppCtx.getCacheOps()).thenReturn(cacheOps);
}
Aggregations