Github user jhuynh1 commented on a diff in the pull request:

    https://github.com/apache/geode/pull/318#discussion_r92691796
  
    --- Diff: 
geode-core/src/test/java/org/apache/geode/internal/cache/PartitionedRegionQueryDUnitTest.java
 ---
    @@ -149,6 +154,92 @@ public void run() {
         });
       }
     
    +  @Test
    +  public void testIndexDoesNotDeserializePdxObjects() {
    +    Host host = Host.getHost(0);
    +    VM vm0 = host.getVM(0);
    +    VM vm1 = host.getVM(1);
    +
    +    SerializableRunnableIF createPR = () -> {
    +      Cache cache = getCache();
    +      PartitionAttributesFactory paf = new PartitionAttributesFactory();
    +      paf.setTotalNumBuckets(10);
    +      
cache.createRegionFactory(RegionShortcut.PARTITION).setPartitionAttributes(paf.create())
    +          .create("region");
    +    };
    +    vm0.invoke(createPR);
    +    vm1.invoke(createPR);
    +
    +    // Do Puts. These objects can't be deserialized because they throw
    +    // and exception from the constructor
    +    vm0.invoke(() -> {
    +      Cache cache = getCache();
    +      Region region = cache.getRegion("region");
    +      region.put(0, new PdxNotDeserializableAsset(0, "B"));
    +      region.put(10, new PdxNotDeserializableAsset(1, "B"));
    +      region.put(1, new PdxNotDeserializableAsset(1, "B"));
    +      IntStream.range(11, 100)
    +          .forEach(i -> region.put(i, new PdxNotDeserializableAsset(i, 
Integer.toString(i))));
    +    });
    +
    +    // If this tries to deserialize the assets, it will fail
    +    vm0.invoke(() -> {
    +      Cache cache = getCache();
    +      cache.getQueryService().createHashIndex("ContractDocumentIndex", 
"document", "/region");
    --- End diff --
    
    Yeah, that's the hardest part about the query tests, there are so many test 
classes that it can get hard to figure out where the best place for it is.  If 
you feel ambitious/adventurous you can work on the hierarchy otherwise, I think 
this spot would be ok.  Hopefully one day we can revisit and organize them a 
bit better.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to