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

    https://github.com/apache/geode/pull/318#discussion_r92678100
  
    --- 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");
    +    });
    +
    +    vm0.invoke(() -> {
    +      QueryService qs = getCache().getQueryService();
    +      SelectResults<Struct> results = (SelectResults) qs
    +          .newQuery("<trace> select assetId,document from /region where 
document='B' limit 1000")
    +          .execute();
    +
    +      assertEquals(3, results.size());
    +      final Index index = qs.getIndex(getCache().getRegion("region"), 
"ContractDocumentIndex");
    +      assertEquals(1, index.getStatistics().getTotalUses());
    +    });
    +  }
    +
    +  @Test
    +  public void testFailureToCreateIndexOnRemoteNodeThrowsException() {
    --- End diff --
    
    Should there be a test for create index on local node fails but remotes are 
ok?


---
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