use of org.apache.geode.management.internal.cli.util.CommandStringBuilder in project geode by apache.
the class LuceneIndexCommandsDUnitTest method searchIndexShouldReturnCorrectKeys.
@Test
public void searchIndexShouldReturnCorrectKeys() throws Exception {
final VM vm1 = Host.getHost(0).getVM(1);
createIndex(vm1);
Map<String, TestObject> entries = new HashMap<>();
entries.put("A", new TestObject("value1 ", "value2", "value3"));
entries.put("B", new TestObject("ABC", "EFG", "HIJ"));
entries.put("C", new TestObject("value1", "QWE", "RTY"));
entries.put("D", new TestObject("ABC", "EFG", "HIJ"));
entries.put("E", new TestObject("value1", "ABC", "EFG"));
entries.put("F", new TestObject("ABC", "EFG", "HIJ"));
entries.put("G", new TestObject("value1", "JKR", "POW"));
entries.put("H", new TestObject("ABC", "EFG", "H2J"));
putEntries(vm1, entries, 8);
CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_SEARCH_INDEX);
csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME, INDEX_NAME);
csb.addOption(LuceneCliStrings.LUCENE__REGION_PATH, REGION_NAME);
csb.addOption(LuceneCliStrings.LUCENE_SEARCH_INDEX__QUERY_STRING, "value1");
csb.addOption(LuceneCliStrings.LUCENE_SEARCH_INDEX__DEFAULT_FIELD, "field1");
csb.addOption(LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY, "true");
executeCommandAndLogResult(csb);
TabularResultData data = (TabularResultData) executeCommandAndGetResult(csb).getResultData();
assertEquals(4, data.retrieveAllValues("key").size());
}
use of org.apache.geode.management.internal.cli.util.CommandStringBuilder in project geode by apache.
the class LuceneIndexCommandsDUnitTest method listIndexWithStatsShouldReturnCorrectStats.
@Test
public void listIndexWithStatsShouldReturnCorrectStats() throws Exception {
final VM vm1 = Host.getHost(0).getVM(1);
createIndex(vm1);
Map<String, TestObject> entries = new HashMap<>();
entries.put("A", new TestObject("field1:value1", "field2:value2", "field3:value3"));
entries.put("B", new TestObject("ABC", "EFG", "HIJ"));
putEntries(vm1, entries, 2);
queryAndVerify(vm1, "field1:value1", "field1", Collections.singletonList("A"));
CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_LIST_INDEX);
csb.addOption(LuceneCliStrings.LUCENE_LIST_INDEX__STATS, "true");
TabularResultData data = (TabularResultData) executeCommandAndGetResult(csb).getResultData();
assertEquals(Collections.singletonList(INDEX_NAME), data.retrieveAllValues("Index Name"));
assertEquals(Collections.singletonList("Initialized"), data.retrieveAllValues("Status"));
assertEquals(Collections.singletonList("/region"), data.retrieveAllValues("Region Path"));
assertEquals(Collections.singletonList("1"), data.retrieveAllValues("Query Executions"));
assertEquals(Collections.singletonList("2"), data.retrieveAllValues("Commits"));
assertEquals(Collections.singletonList("2"), data.retrieveAllValues("Updates"));
assertEquals(Collections.singletonList("2"), data.retrieveAllValues("Documents"));
}
use of org.apache.geode.management.internal.cli.util.CommandStringBuilder in project geode by apache.
the class LuceneIndexCommandsDUnitTest method describeIndexWithoutRegionShouldReturnErrorMessage.
@Test
public void describeIndexWithoutRegionShouldReturnErrorMessage() throws Exception {
final VM vm1 = Host.getHost(0).getVM(1);
createIndexWithoutRegion(vm1);
CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_DESCRIBE_INDEX);
csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME, "notAnIndex");
csb.addOption(LuceneCliStrings.LUCENE__REGION_PATH, REGION_NAME);
String resultAsString = executeCommandAndLogResult(csb);
assertTrue(resultAsString.contains(getRegionNotFoundErrorMessage(REGION_NAME)));
}
use of org.apache.geode.management.internal.cli.util.CommandStringBuilder in project geode by apache.
the class ClusterConfigurationDUnitTest method createMockRegionExtension.
private void createMockRegionExtension(final String regionName, final String value) {
CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.CREATE_MOCK_REGION_EXTENSION);
csb.addOption(MockExtensionCommands.OPTION_REGION_NAME, regionName);
csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
executeAndVerifyCommand(csb.toString());
}
use of org.apache.geode.management.internal.cli.util.CommandStringBuilder in project geode by apache.
the class ClusterConfigurationDUnitTest method createMockCacheExtension.
private void createMockCacheExtension(final String value) {
CommandStringBuilder csb = new CommandStringBuilder(MockExtensionCommands.CREATE_MOCK_CACHE_EXTENSION);
csb.addOption(MockExtensionCommands.OPTION_VALUE, value);
executeAndVerifyCommand(csb.toString());
}
Aggregations