Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* 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.
*/
/*
* IndexCreationInternalsTest.java
* JUnit based test
*
* Created on February 22, 2005, 11:24 AM
*/
package com.gemstone.gemfire.cache.query.internal.index;
import java.util.List;
import junit.framework.TestCase;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.query.CacheUtils;
import com.gemstone.gemfire.cache.query.QueryInvalidException;
import com.gemstone.gemfire.cache.query.internal.CompiledID;
import com.gemstone.gemfire.cache.query.internal.CompiledIteratorDef;
import com.gemstone.gemfire.cache.query.internal.CompiledPath;
import com.gemstone.gemfire.cache.query.internal.CompiledRegion;
import com.gemstone.gemfire.cache.query.internal.QCompiler;
import com.gemstone.gemfire.cache.query.internal.types.TypeUtils;
import com.gemstone.gemfire.internal.cache.LocalRegion;
import io.snappydata.test.dunit.DistributedTestBase;
/**
*
* @author ericz
*/
public class IndexCreationInternalsTest extends TestCase {
protected String childThreadName1 = "";
protected String childThreadName2 = "";
public IndexCreationInternalsTest(String testName) {
super(testName);
}
protected void setUp() throws Exception {
CacheUtils.startCache();
}
protected void tearDown() throws Exception {
CacheUtils.closeCache();
}
public void testLoneFromClause() throws Exception {
// compileFromClause returns a List
QCompiler compiler = new QCompiler(CacheUtils.getLogger().convertToLogWriterI18n());
List list = compiler.compileFromClause("/pos p, p.positions");
assertEquals(2, list.size());
CompiledIteratorDef first = (CompiledIteratorDef)list.get(0);
assertEquals("p", first.getName());
assertEquals("/pos", ((CompiledRegion)first.getCollectionExpr()).getRegionPath());
assertEquals(TypeUtils.OBJECT_TYPE, first.getElementType());
CompiledIteratorDef second = (CompiledIteratorDef)list.get(1);
assertNull(second.getName());
CompiledPath path = (CompiledPath)second.getCollectionExpr();
assertEquals("p", ((CompiledID)path.getReceiver()).getId());
assertEquals("positions", path.getTailID());
assertEquals(TypeUtils.OBJECT_TYPE, second.getElementType());
}
public void testLoneProjectionAttributes() throws Exception {
// compileProjectionAttributes returns a List or null.
// null if '*', or a List