DonalEvans commented on a change in pull request #6096:
URL: https://github.com/apache/geode/pull/6096#discussion_r590790779



##########
File path: 
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/MapRangeIndexMaintenanceJUnitTest.java
##########
@@ -341,6 +341,155 @@ public void 
testNullMapValuesInIndexOnLocalRegionForCompactMap() throws Exceptio
     assertEquals(1, result.size());
   }
 
+  @Test
+  public void testQueriesForValueInMapFieldWithoutIndex() throws Exception {
+    region =
+        
CacheUtils.getCache().createRegionFactory(RegionShortcut.REPLICATE).create("portfolio");
+    qs = CacheUtils.getQueryService();
+    testQueriesForValueInMapField(region, qs);
+  }
+
+  @Test
+  public void testQueriesForValueInMapFieldWithMapIndexWithOneKey() throws 
Exception {
+    region =
+        
CacheUtils.getCache().createRegionFactory(RegionShortcut.REPLICATE).create("portfolio");
+    qs = CacheUtils.getQueryService();
+
+    keyIndex1 = qs.createIndex(INDEX_NAME, "positions['SUN']", SEPARATOR + 
"portfolio ");
+    assertTrue(keyIndex1 instanceof CompactMapRangeIndex);
+    testQueriesForValueInMapField(region, qs);
+
+    long keys = ((CompactMapRangeIndex) 
keyIndex1).internalIndexStats.getNumberOfKeys();
+    long mapIndexKeys =
+        ((CompactMapRangeIndex) 
keyIndex1).internalIndexStats.getNumberOfMapIndexKeys();
+    long values =
+        ((CompactMapRangeIndex) 
keyIndex1).internalIndexStats.getNumberOfValues();
+    assertEquals(3, keys);
+    assertEquals(1, mapIndexKeys);
+    assertEquals(3, values);
+  }
+
+  @Test
+  public void testQueriesForValueInMapFieldWithMapIndexWithSeveralKeys() 
throws Exception {
+    region =
+        
CacheUtils.getCache().createRegionFactory(RegionShortcut.REPLICATE).create("portfolio");
+    qs = CacheUtils.getQueryService();
+
+    keyIndex1 =
+        qs.createIndex(INDEX_NAME, "positions['SUN', 'ERICSSON']", SEPARATOR + 
"portfolio ");
+    assertTrue(keyIndex1 instanceof CompactMapRangeIndex);
+    testQueriesForValueInMapField(region, qs);
+
+    long keys = ((CompactMapRangeIndex) 
keyIndex1).internalIndexStats.getNumberOfKeys();
+    long mapIndexKeys =
+        ((CompactMapRangeIndex) 
keyIndex1).internalIndexStats.getNumberOfMapIndexKeys();
+    long values =
+        ((CompactMapRangeIndex) 
keyIndex1).internalIndexStats.getNumberOfValues();
+    assertEquals(3, keys);
+    assertEquals(1, mapIndexKeys);
+    assertEquals(3, values);
+  }
+
+  @Test
+  public void testQueriesForValueInMapFieldWithMapIndexWithStar() throws 
Exception {
+    region =
+        
CacheUtils.getCache().createRegionFactory(RegionShortcut.REPLICATE).create("portfolio");
+    qs = CacheUtils.getQueryService();
+
+    keyIndex1 = qs.createIndex(INDEX_NAME, "positions[*]", SEPARATOR + 
"portfolio ");
+    assertTrue(keyIndex1 instanceof CompactMapRangeIndex);
+    testQueriesForValueInMapField(region, qs);
+
+    long keys = ((CompactMapRangeIndex) 
keyIndex1).internalIndexStats.getNumberOfKeys();
+    long mapIndexKeys =
+        ((CompactMapRangeIndex) 
keyIndex1).internalIndexStats.getNumberOfMapIndexKeys();
+    long values =
+        ((CompactMapRangeIndex) 
keyIndex1).internalIndexStats.getNumberOfValues();
+    assertEquals(5, keys);
+    assertEquals(4, mapIndexKeys);
+    assertEquals(5, values);
+  }
+
+  public void testQueriesForValueInMapField(Region region, QueryService qs) 
throws Exception {
+    // Empty map
+    Portfolio p = new Portfolio(1, 1);
+    p.positions = new HashMap();

Review comment:
       It looks like this use of the raw class instead of the parameterized one 
got missed in the last set of changes.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to