Search in sources :

Example 16 with NewPortfolio

use of parReg.query.unittest.NewPortfolio in project geode by apache.

the class PRColocatedEquiJoinDUnitTest method testPRRRCompactRangeAndNestedRangeIndexQuerying.

@Test
public void testPRRRCompactRangeAndNestedRangeIndexQuerying() throws Exception {
    Host host = Host.getHost(0);
    VM vm0 = host.getVM(0);
    setCacheInVMs(vm0);
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
    // Creting PR's on the participating VM's
    // Creating DataStore node on the VM0.
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Creating the DataStore node in the PR");
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, Portfolio.class));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "IdIndex1", "r1.ID", "/" + name + " r1", null));
    // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "IdIndex11",
    // "r1.status", "/"+name+" r1", null));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully created the DataStore node in the PR");
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully Created PR's across all VM's");
    // Creating Colocated Region DataStore node on the VM0.
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Creating the Colocated DataStore node in the PR");
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(coloName, Portfolio.class));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(coloName, "IdIndex2", "pos2.id", "/" + coloName + " r2, r2.positions.values pos2", null));
    // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(coloName, "IdIndex22",
    // "r2.status", "/"+coloName+" r2", null));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully created the Colocated DataStore node in the PR");
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully Created PR's across all VM's");
    // Creating local region on vm0 to compare the results of query.
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(localName, Portfolio.class));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(coloLocalName, Portfolio.class));
    // Generating portfolio object array to be populated across the PR's & Local
    // Regions
    final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
    final Portfolio[] newPortfolio = createPortfoliosAndPositions(cntDest);
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio, cnt, cntDest));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(coloLocalName, newPortfolio, cnt, cntDest));
    // Putting the data into the PR's created
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio, cnt, cntDest));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(coloName, newPortfolio, cnt, cntDest));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Inserted Portfolio data across PR's");
    // querying the VM for data and comparing the result with query result of
    // local region.
    // querying the VM for data
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAndRRQueryWithCompactAndRangeIndexAndCompareResults(name, coloName, localName, coloLocalName));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR's Test ENDED");
}
Also used : VM(org.apache.geode.test.dunit.VM) Portfolio(org.apache.geode.cache.query.data.Portfolio) NewPortfolio(parReg.query.unittest.NewPortfolio) Host(org.apache.geode.test.dunit.Host) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 17 with NewPortfolio

use of parReg.query.unittest.NewPortfolio in project geode by apache.

the class PRColocatedEquiJoinDUnitTest method testPRRRLocalQueryingWithIndexOnOnePRRegion.

/**
   * A very basic dunit test that <br>
   * 1. Creates two PR Data Stores with redundantCopies = 1. 2. Populates the region with test data.
   * 3. Fires a LOCAL query on one data store VM and verifies the result.
   * 
   * @throws Exception
   */
@Test
public void testPRRRLocalQueryingWithIndexOnOnePRRegion() throws Exception {
    Host host = Host.getHost(0);
    VM vm0 = host.getVM(0);
    setCacheInVMs(vm0);
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
    // Creting PR's on the participating VM's
    // Creating DataStore node on the VM0.
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Creating the DataStore node in the PR");
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, Portfolio.class));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "IdIndex1", "r1.ID", "/" + name + " r1", null));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "IdIndex11", "r1.status", "/" + name + " r1", null));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully created the DataStore node in the PR");
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully Created PR's across all VM's");
    // Creating Colocated Region DataStore node on the VM0.
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Creating the Colocated DataStore node in the PR");
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(coloName, NewPortfolio.class));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully created the Colocated DataStore node in the PR");
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully Created PR's across all VM's");
    // Creating local region on vm0 to compare the results of query.
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(localName, Portfolio.class));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(coloLocalName, NewPortfolio.class));
    // Generating portfolio object array to be populated across the PR's & Local
    // Regions
    final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
    final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio, cnt, cntDest));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(coloLocalName, newPortfolio, cnt, cntDest));
    // Putting the data into the PR's created
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio, cnt, cntDest));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(coloName, newPortfolio, cnt, cntDest));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Inserted Portfolio data across PR's");
    // querying the VM for data and comparing the result with query result of
    // local region.
    // querying the VM for data
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRColocatedDataSetQueryAndCompareResults(name, coloName, localName, coloLocalName));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR's Test ENDED");
}
Also used : NewPortfolio(parReg.query.unittest.NewPortfolio) VM(org.apache.geode.test.dunit.VM) Portfolio(org.apache.geode.cache.query.data.Portfolio) NewPortfolio(parReg.query.unittest.NewPortfolio) Host(org.apache.geode.test.dunit.Host) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 18 with NewPortfolio

use of parReg.query.unittest.NewPortfolio in project geode by apache.

the class PRColocatedEquiJoinDUnitTest method testPRRRLocalQueryingWithHetroIndexes.

@Test
public void testPRRRLocalQueryingWithHetroIndexes() throws Exception {
    Host host = Host.getHost(0);
    VM vm0 = host.getVM(0);
    setCacheInVMs(vm0);
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
    // Creting PR's on the participating VM's
    // Creating DataStore node on the VM0.
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Creating the DataStore node in the PR");
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, Portfolio.class));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "IdIndex1", "r1.ID", "/" + name + " r1", null));
    // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "IdIndex11",
    // "r1.status", "/"+name+" r1", null));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully created the DataStore node in the PR");
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully Created PR's across all VM's");
    // Creating Colocated Region DataStore node on the VM0.
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Creating the Colocated DataStore node in the PR");
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(coloName, NewPortfolio.class));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(coloName, "IdIndex2", "r2.id", "/" + coloName + " r2, r2.positions.values pos2", null));
    // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(coloName, "IdIndex22",
    // "r2.status", "/"+coloName+" r2", null));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully created the Colocated DataStore node in the PR");
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully Created PR's across all VM's");
    // Creating local region on vm0 to compare the results of query.
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(localName, Portfolio.class));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(coloLocalName, NewPortfolio.class));
    // Generating portfolio object array to be populated across the PR's & Local
    // Regions
    final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
    final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio, cnt, cntDest));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(coloLocalName, newPortfolio, cnt, cntDest));
    // Putting the data into the PR's created
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio, cnt, cntDest));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(coloName, newPortfolio, cnt, cntDest));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Inserted Portfolio data across PR's");
    // querying the VM for data and comparing the result with query result of
    // local region.
    // querying the VM for data
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAndRRQueryAndCompareResults(name, coloName, localName, coloLocalName));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR's Test ENDED");
}
Also used : NewPortfolio(parReg.query.unittest.NewPortfolio) VM(org.apache.geode.test.dunit.VM) Portfolio(org.apache.geode.cache.query.data.Portfolio) NewPortfolio(parReg.query.unittest.NewPortfolio) Host(org.apache.geode.test.dunit.Host) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 19 with NewPortfolio

use of parReg.query.unittest.NewPortfolio in project geode by apache.

the class PRColocatedEquiJoinDUnitTest method testRRPRLocalQueryingWithHetroIndexes.

@Test
// GEODE-2022
@Category(FlakyTest.class)
public void testRRPRLocalQueryingWithHetroIndexes() throws Exception {
    Host host = Host.getHost(0);
    VM vm0 = host.getVM(0);
    setCacheInVMs(vm0);
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR Test with DACK Started");
    // Creting PR's on the participating VM's
    // Creating DataStore node on the VM0.
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Creating the DataStore node in the PR");
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(coloName, redundancy, NewPortfolio.class));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(coloName, "IdIndex1", "r2.id", "/" + coloName + " r2", null));
    // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "IdIndex11",
    // "r1.status", "/"+name+" r1", null));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully created the DataStore node in the PR");
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully Created PR's across all VM's");
    // Creating Colocated Region DataStore node on the VM0.
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Creating the Colocated DataStore node in the PR");
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(name, Portfolio.class));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "IdIndex2", "r1.ID", "/" + name + " r1, r1.positions.values pos1", null));
    // vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(coloName, "IdIndex22",
    // "r2.status", "/"+coloName+" r2", null));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully created the Colocated DataStore node in the PR");
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Successfully Created PR's across all VM's");
    // Creating local region on vm0 to compare the results of query.
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(localName, Portfolio.class));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(coloLocalName, NewPortfolio.class));
    // Generating portfolio object array to be populated across the PR's & Local
    // Regions
    final Portfolio[] portfolio = createPortfoliosAndPositions(cntDest);
    final NewPortfolio[] newPortfolio = createNewPortfoliosAndPositions(cntDest);
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio, cnt, cntDest));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(coloLocalName, newPortfolio, cnt, cntDest));
    // Putting the data into the PR's created
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio, cnt, cntDest));
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(coloName, newPortfolio, cnt, cntDest));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Inserted Portfolio data across PR's");
    // querying the VM for data and comparing the result with query result of
    // local region.
    // querying the VM for data
    vm0.invoke(PRQHelp.getCacheSerializableRunnableForRRAndPRQueryAndCompareResults(name, coloName, localName, coloLocalName));
    LogWriterUtils.getLogWriter().info("PRQBasicQueryDUnitTest#testPRBasicQuerying: Querying PR's Test ENDED");
}
Also used : NewPortfolio(parReg.query.unittest.NewPortfolio) VM(org.apache.geode.test.dunit.VM) Portfolio(org.apache.geode.cache.query.data.Portfolio) NewPortfolio(parReg.query.unittest.NewPortfolio) Host(org.apache.geode.test.dunit.Host) Category(org.junit.experimental.categories.Category) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Aggregations

NewPortfolio (parReg.query.unittest.NewPortfolio)19 Test (org.junit.Test)17 Portfolio (org.apache.geode.cache.query.data.Portfolio)16 Host (org.apache.geode.test.dunit.Host)16 VM (org.apache.geode.test.dunit.VM)16 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)16 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)16 Region (org.apache.geode.cache.Region)5 QueryService (org.apache.geode.cache.query.QueryService)5 Cache (org.apache.geode.cache.Cache)4 Query (org.apache.geode.cache.query.Query)4 CacheClosedException (org.apache.geode.cache.CacheClosedException)3 CacheException (org.apache.geode.cache.CacheException)3 RegionDestroyedException (org.apache.geode.cache.RegionDestroyedException)3 QueryException (org.apache.geode.cache.query.QueryException)3 QueryInvocationTargetException (org.apache.geode.cache.query.QueryInvocationTargetException)3 CacheSerializableRunnable (org.apache.geode.cache30.CacheSerializableRunnable)3 ReplyException (org.apache.geode.distributed.internal.ReplyException)3 ForceReattemptException (org.apache.geode.internal.cache.ForceReattemptException)3 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)3