use of com.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);
Mockito.when(dbaseOps.getTableList(any(Context.class))).thenReturn(Arrays.asList("user_table", "tb1"));
BDDMockito.when(AppCtx.getDbaseOps()).thenReturn(dbaseOps);
LocalCache localCache = new LocalCache();
localCache.init();
localCache.handleEvent(null);
BDDMockito.when(AppCtx.getLocalCache()).thenReturn(localCache);
}
Aggregations