use of io.dingodb.meta.MetaService in project dingo by dingodb.
the class MockMetaServiceProvider method get.
@Override
public MetaService get() {
MetaService metaService = Mockito.spy(MetaService.class);
try {
when(metaService.getTableDefinitions()).thenReturn(ImmutableMap.of(TABLE_NAME, TableDefinition.readJson(getClass().getResourceAsStream("/table-test.json")), TABLE_1_NAME, TableDefinition.readJson(getClass().getResourceAsStream("/table-test1.json"))));
when(metaService.getTableKey(anyString())).then(args -> {
String tableName = args.getArgument(0);
return tableName.getBytes(StandardCharsets.UTF_8);
});
} catch (IOException e) {
e.printStackTrace();
}
when(metaService.getPartLocations(TABLE_NAME)).thenReturn(ImmutableMap.of("0", LOC_0, "1", LOC_1));
when(metaService.currentLocation()).thenReturn(LOC_0);
return metaService;
}
Aggregations