use of org.apache.geode.cache.query.data.PortfolioData in project geode by apache.
the class PRBasicIndexCreationDUnitTest method testCreateIndexAndAddAnAccessor.
/**
* Test for bug fix 37985, NullPointerException in IndexCreationMsg operateOnPartitionedRegion.
* This bug show up when an accessor (PR with max memory = 0) vm joins the PR system when there
* are index on the PR and an index creation message is sent to this accessor VM.
*/
@Test
public void testCreateIndexAndAddAnAccessor() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
setCacheInVMs(vm0, vm1, vm2, vm3);
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio, cnt, cntDest));
// create index from a data store.
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "PrIndexOnStatus", "p.status", null, "p"));
// create an accessor vm.
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name, redundancy, PortfolioData.class));
}
use of org.apache.geode.cache.query.data.PortfolioData in project geode by apache.
the class PRBasicIndexCreationDUnitTest method testPRBasicIndexCreate.
/**
* Tests basic index creation on a partitioned system.
*
* @throws Exception if an exception is generated
*/
@Test
public void testPRBasicIndexCreate() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
setCacheInVMs(vm0, vm1, vm2, vm3);
LogWriterUtils.getLogWriter().info("PRBasicIndexCreationDUnitTest.testPRBasicIndexCreate started ....");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name, redundancy, PortfolioData.class));
// Creating the Datastores Nodes in the VM1.
LogWriterUtils.getLogWriter().info("PRBasicIndexCreationDUnitTest : creating all the prs ");
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio, cnt, cntDest));
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "PrIndexOnStatus", "p.status", null, "p"));
// creating a duplicate index, should throw a IndexExistsException and if not
// will throw a RuntimeException.
vm1.invoke(PRQHelp.getCacheSerializableRunnableForDuplicatePRIndexCreate(name, "PrIndexOnStatus", "p.status", null, "p"));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForDuplicatePRIndexCreate(name, "PrIndexOnStatus", "p.status", null, "p"));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForDuplicatePRIndexCreate(name, "PrIndexOnStatus", "p.status", null, "p"));
LogWriterUtils.getLogWriter().info("PRBasicIndexCreationDUnitTest.testPRBasicIndexCreate is done ");
}
use of org.apache.geode.cache.query.data.PortfolioData in project geode by apache.
the class PRBasicIndexCreationDUnitTest method testCreatePartitionedIndexWithKeysValuesAndFunction.
/**
* Creats partitioned index on keys and values of a bucket regions.
*/
@Test
public void testCreatePartitionedIndexWithKeysValuesAndFunction() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
setCacheInVMs(vm0, vm1);
final String fileName = "PRIndexCreation.xml";
LogWriterUtils.getLogWriter().info("PRBasicIndexCreation.testCreatePartitionedIndexThroughXML started");
LogWriterUtils.getLogWriter().info("Starting and initializing partitioned regions and indexes using xml");
LogWriterUtils.getLogWriter().info("Starting a pr asynchronously using an xml file name : " + fileName);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio, cnt, cntDest));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "index8", "k", "/PartionedPortfolios.keys k", ""));
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "index7", "nvl(k.status.toString(),'nopes')", "/PartionedPortfolios.values k", ""));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio, cnt, cntDest));
LogWriterUtils.getLogWriter().info("PRBasicIndexCreation.testCreatePartitionedIndexThroughXML is done ");
}
use of org.apache.geode.cache.query.data.PortfolioData in project geode by apache.
the class PRBasicIndexCreationDUnitTest method testPRMultiIndexCreation.
/**
* Tests creation of multiple index creation on a partitioned region system.
*
* @throws Exception if any excpetion are generated
*/
@Test
public void testPRMultiIndexCreation() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
setCacheInVMs(vm0, vm1, vm2, vm3);
LogWriterUtils.getLogWriter().info("PRBasicIndexCreation.testPRMultiIndexCreation Test Started");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRAccessorCreate(name, redundancy, PortfolioData.class));
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio, cnt, cntDest));
// should create a sucessful index.
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "PrIndexOnStatus", "p.status", null, "p"));
// creating a duplicate index should throw a IndexExistsException and if not
// will throw a RuntimeException.
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "PrIndexOnID", "p.ID", null, "p"));
LogWriterUtils.getLogWriter().info("PRQBasicIndexCreationTest.testPRMultiIndexCreation ENDED");
}
use of org.apache.geode.cache.query.data.PortfolioData in project geode by apache.
the class PRBasicIndexCreationDUnitTest method testPartitionedQueryWithIndexOnIdBug37089.
/**
* Test for bug 37089 where if there is an index on one attribute (CompiledComparision) of the
* where clause query produces wrong results.
*/
@Test
public void testPartitionedQueryWithIndexOnIdBug37089() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
setCacheInVMs(vm0, vm1, vm2, vm3);
LogWriterUtils.getLogWriter().info("PRBasicIndexCreationDUnitTest.testPartitionedQueryWithIndexOnIdBug37089 started ");
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm1.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm2.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm3.invoke(PRQHelp.getCacheSerializableRunnableForPRCreate(name, redundancy, PortfolioData.class));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRIndexCreate(name, "PrIndexOnId", "p.ID", null, "p"));
final PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(name, portfolio, cnt, cntDest));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForLocalRegionCreation(localName, PortfolioData.class));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRPuts(localName, portfolio, cnt, cntDest));
vm0.invoke(PRQHelp.getCacheSerializableRunnableForPRQueryAndCompareResults(name, localName));
// validation on index usage with queries over a pr
LogWriterUtils.getLogWriter().info("PRBasicIndexCreationDUnitTest.testPartitionedQueryWithIndexOnIdBug37089 done ");
}
Aggregations