Search in sources :

Example 11 with IndexProtocol

use of org.apache.geode.cache.query.internal.index.IndexProtocol in project geode by apache.

the class IndexCreationJUnitTest method testIndexCreation.

@Test
public void testIndexCreation() throws Exception {
    QueryService qs;
    qs = CacheUtils.getQueryService();
    Index i1 = qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "status", "/portfolios, positions");
    // TASK ICM1
    Index i2 = qs.createIndex("secIdIndex", IndexType.FUNCTIONAL, "b.secId", "/portfolios pf, pf.positions.values b");
    // TASK ICM2
    Index i5 = qs.createIndex("intFunctionIndex", IndexType.FUNCTIONAL, "intFunction(pf.getID)", "/portfolios pf, pf.positions b");
    Index i6 = qs.createIndex("statusIndex6", IndexType.FUNCTIONAL, "a.status", "/portfolios.values.toArray a, positions");
    Index i7 = qs.createIndex("statusIndex7", IndexType.FUNCTIONAL, "a.status", "/portfolios.getValues().asList() a, positions");
    Index i8 = qs.createIndex("statusIndex8", IndexType.FUNCTIONAL, "a.status", "/portfolios.values.asSet a, positions");
    // TASK ICM6
    // remove any commented Index
    Object[] indices = { i1, i2, i5, i6, i7, i8 };
    for (int j = 0; j < indices.length; j++) {
        CacheUtils.log(((IndexProtocol) indices[j]).isValid());
        boolean r = ((IndexProtocol) indices[j]).isValid();
        assertTrue("Test: testIndexCreation FAILED", r);
        CacheUtils.log(((IndexProtocol) indices[j]).getName());
        CacheUtils.log("Test: testIndexCreation PASS");
    }
}
Also used : IndexProtocol(org.apache.geode.cache.query.internal.index.IndexProtocol) DefaultQueryService(org.apache.geode.cache.query.internal.DefaultQueryService) QueryService(org.apache.geode.cache.query.QueryService) RangeIndex(org.apache.geode.cache.query.internal.index.RangeIndex) CompactMapRangeIndex(org.apache.geode.cache.query.internal.index.CompactMapRangeIndex) Index(org.apache.geode.cache.query.Index) CompactRangeIndex(org.apache.geode.cache.query.internal.index.CompactRangeIndex) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Aggregations

IndexProtocol (org.apache.geode.cache.query.internal.index.IndexProtocol)11 Index (org.apache.geode.cache.query.Index)4 IndexData (org.apache.geode.cache.query.internal.index.IndexData)4 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)4 Test (org.junit.Test)4 QueryService (org.apache.geode.cache.query.QueryService)3 DefaultQueryService (org.apache.geode.cache.query.internal.DefaultQueryService)3 CompactMapRangeIndex (org.apache.geode.cache.query.internal.index.CompactMapRangeIndex)3 CompactRangeIndex (org.apache.geode.cache.query.internal.index.CompactRangeIndex)3 RangeIndex (org.apache.geode.cache.query.internal.index.RangeIndex)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Portfolio (org.apache.geode.cache.query.data.Portfolio)2 AbstractIndex (org.apache.geode.cache.query.internal.index.AbstractIndex)2 StructTypeImpl (org.apache.geode.cache.query.internal.types.StructTypeImpl)2 ObjectType (org.apache.geode.cache.query.types.ObjectType)2 StructType (org.apache.geode.cache.query.types.StructType)2 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 ListIterator (java.util.ListIterator)1