use of com.microsoft.azuretools.core.mvp.ui.rediscache.RedisScanResult in project azure-tools-for-java by microsoft.
the class RedisExplorerIntegrationTest method testScanMoreKey.
@Test
public void testScanMoreKey() throws Exception {
final String testCursor = "3";
List<String> expectedList = Arrays.asList(STRING_KEY, ZSET_KEY, HASHSET_KEY);
Collections.sort(expectedList);
redisExplorerPresenter.onKeyList(TEST_DB, testCursor, TEST_PATTERN);
testSchedulerProvider.triggerActions();
ArgumentCaptor<RedisScanResult> argument = ArgumentCaptor.forClass(RedisScanResult.class);
verify(redisExplorerMvpViewMock).showScanResult(argument.capture());
List<String> keys = argument.getValue().getKeys();
Collections.sort(keys);
assertEquals(keys, expectedList);
}
use of com.microsoft.azuretools.core.mvp.ui.rediscache.RedisScanResult in project azure-tools-for-java by microsoft.
the class RedisExplorerPresenter method onKeyList.
/**
* Called when Scan button is clicked.
*
* @param sid
* subscription id of Redis Cache
* @param id
* resource id of Redis Cache
* @param db
* index of Redis Cache database
* @param cursor
* scan cursor for Redis Cache
* @param pattern
* scan match pattern for Redis Cache
*/
public void onKeyList(int db, String cursor, String pattern) {
Operation operation = TelemetryManager.createOperation(TelemetryConstants.REDIS, TelemetryConstants.REDIS_SCAN);
operation.start();
Observable.fromCallable(() -> {
return RedisExplorerMvpModel.getInstance().scanKeys(sid, id, db, cursor, pattern);
}).subscribeOn(getSchedulerProvider().io()).subscribe(result -> {
DefaultLoader.getIdeHelper().invokeLater(() -> {
if (isViewDetached()) {
return;
}
getMvpView().showScanResult(new RedisScanResult(result));
operation.complete();
});
}, e -> {
EventUtil.logError(operation, ErrorType.userError, new Exception(e), null, null);
operation.complete();
errorHandler(CANNOT_GET_REDIS_INFO, (Exception) e);
});
}
use of com.microsoft.azuretools.core.mvp.ui.rediscache.RedisScanResult in project azure-tools-for-java by microsoft.
the class RedisExplorerIntegrationTest method testScanPatternFilter.
@Test
public void testScanPatternFilter() throws Exception {
String patternFilter = "testS*";
List<String> expectedList = Arrays.asList(STRING_KEY, SET_KEY);
Collections.sort(expectedList);
redisExplorerPresenter.onKeyList(TEST_DB, TEST_CURSOR, patternFilter);
testSchedulerProvider.triggerActions();
ArgumentCaptor<RedisScanResult> argument = ArgumentCaptor.forClass(RedisScanResult.class);
verify(redisExplorerMvpViewMock).showScanResult(argument.capture());
List<String> keys = argument.getValue().getKeys();
Collections.sort(keys);
assertEquals(keys, expectedList);
}
use of com.microsoft.azuretools.core.mvp.ui.rediscache.RedisScanResult in project azure-tools-for-java by Microsoft.
the class RedisExplorerIntegrationTest method testScanMoreKey.
@Test
public void testScanMoreKey() throws Exception {
final String testCursor = "3";
List<String> expectedList = Arrays.asList(STRING_KEY, ZSET_KEY, HASHSET_KEY);
Collections.sort(expectedList);
redisExplorerPresenter.onKeyList(TEST_DB, testCursor, TEST_PATTERN);
testSchedulerProvider.triggerActions();
ArgumentCaptor<RedisScanResult> argument = ArgumentCaptor.forClass(RedisScanResult.class);
verify(redisExplorerMvpViewMock).showScanResult(argument.capture());
List<String> keys = argument.getValue().getKeys();
Collections.sort(keys);
assertEquals(keys, expectedList);
}
use of com.microsoft.azuretools.core.mvp.ui.rediscache.RedisScanResult in project azure-tools-for-java by Microsoft.
the class RedisExplorerIntegrationTest method testScanPatternFilter.
@Test
public void testScanPatternFilter() throws Exception {
String patternFilter = "testS*";
List<String> expectedList = Arrays.asList(STRING_KEY, SET_KEY);
Collections.sort(expectedList);
redisExplorerPresenter.onKeyList(TEST_DB, TEST_CURSOR, patternFilter);
testSchedulerProvider.triggerActions();
ArgumentCaptor<RedisScanResult> argument = ArgumentCaptor.forClass(RedisScanResult.class);
verify(redisExplorerMvpViewMock).showScanResult(argument.capture());
List<String> keys = argument.getValue().getKeys();
Collections.sort(keys);
assertEquals(keys, expectedList);
}
Aggregations