All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gemstone.gemfire.cache.query.functional.UseCase1SpecificOptimizationsTest Maven / Gradle / Ivy

There is a newer version: 2.0-BETA
Show newest version
/*
 * Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License. You
 * may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License. See accompanying
 * LICENSE file.
 */
package com.gemstone.gemfire.cache.query.functional;

import junit.framework.TestCase;
import com.gemstone.gemfire.cache.*;
import com.gemstone.gemfire.cache.query.CacheUtils;
import com.gemstone.gemfire.cache.query.FunctionDomainException;
import com.gemstone.gemfire.cache.query.IndexType;
import com.gemstone.gemfire.cache.query.NameResolutionException;
import com.gemstone.gemfire.cache.query.data.Portfolio;
import com.gemstone.gemfire.cache.query.data.Quote;
import com.gemstone.gemfire.cache.query.data.Restricted;
import com.gemstone.gemfire.cache.query.internal.ProjectionAttributeTest;
import com.gemstone.gemfire.cache.query.internal.QueryObserverAdapter;
import com.gemstone.gemfire.cache.query.internal.QueryObserverHolder;
import com.gemstone.gemfire.cache.query.internal.types.ObjectTypeImpl;
import com.gemstone.gemfire.cache.query.internal.types.StructTypeImpl;
import com.gemstone.gemfire.cache.query.Index;
import com.gemstone.gemfire.cache.query.Query;
import com.gemstone.gemfire.cache.query.QueryException;
import com.gemstone.gemfire.cache.query.QueryInvocationTargetException;
import com.gemstone.gemfire.cache.query.QueryService;
import com.gemstone.gemfire.cache.query.SelectResults;
import com.gemstone.gemfire.cache.query.types.ObjectType;
import com.gemstone.gemfire.cache.query.types.StructType;
import com.gemstone.gemfire.cache.query.TypeMismatchException;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import junit.framework.Test;
import junit.framework.TestSuite;

public class UseCase1SpecificOptimizationsTest extends TestCase
{
  public UseCase1SpecificOptimizationsTest(String testName) {
    super(testName);
  }
  
  public static void main(String[] args) {
    junit.textui.TestRunner.run(suite());
  }

  public static Test suite() {
    TestSuite suite = new TestSuite(UseCase1SpecificOptimizationsTest.class);
    return suite;
  }
  
  public void testProjectionEvaluationDuringIndexResults() throws QueryException {
    QueryService qs = CacheUtils.getQueryService();
    String[] queries = new String[] {
        "select  p.status from /pos p where p.ID > 0 " ,
        "select  p.status from /pos p, p.positions pos where p.ID > 0 " ,
        "select  p.status from /pos p  where p.ID > 0 and p.createTime > 0" ,
        "select  p.status as sts, p as pos from /pos p  where p.ID > 0 and p.createTime > 0" ,
        "select  p.status as sts, p as pos from /pos p  where p.ID IN  SET( 0,1,2,3) and p.createTime > 0", 
        "select  p.status as sts, p as pos from /pos p  where ( p.ID IN  SET( 0,1,2,3) and p.createTime > 0L) OR (p.ID IN  SET( 2,3) and p.createTime > 5L)"  
          
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i  0 " ,
        "select  p.status as sts, p as pos from /pos p  where ( p.ID IN  SET( 0,1,2,3) and p.createTime > 0L) OR (p.ID IN  SET( 2,3) and p.createTime > 5L)",  
        "select  p.status as sts, p as pos from /pos p  where  p.ID IN  SET( 0,1,2,3) and p.createTime > 0L"
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i  9l"        
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i  10) "
        
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i  9l"
        
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i  9l) OR (p.ID IN  SET( 20,30,110,120) AND p.createTime > 7l)"
        
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i  9l) OR (p.ID IN  SET( 20,30,110,120) AND p.createTime > 7l)"
        
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i   0 " 
        
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i  0 AND p.createTime <11 AND  p.ID IN  SET( 0) " 
        
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i  11 AND  p.ID < 20 AND  p.createTime <>9L " 
        
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i  11 AND  p.ID < 19 and  p.createTime IN  SET( 10L) " 
        
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i   0 AND  p.createTime = 10l" 
        
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i   0" 
        
        };
    SelectResults[][] sr = new SelectResults[queries.length][2];
    
    for(int i=0; i 




© 2015 - 2024 Weber Informatics LLC | Privacy Policy