/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
*/

package org.apache.kylin.query;

import java.util.Arrays;
import java.util.Collection;
import java.util.Map;

import org.apache.kylin.metadata.realization.RealizationType;
import org.apache.kylin.query.routing.Candidate;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import com.google.common.collect.Maps;

/**
 */
@RunWith(Parameterized.class)
public class ITIIQueryTest extends ITKylinQueryTest {
    @BeforeClass
    public static void setUp() throws Exception {

        // give II higher priority than other realizations
        Map<RealizationType, Integer> priorities = Maps.newHashMap();
        priorities.put(RealizationType.INVERTED_INDEX, 0);
        priorities.put(RealizationType.HYBRID, 1);
        priorities.put(RealizationType.CUBE, 2);
        Candidate.setPriorities(priorities);
    }

    @AfterClass
    public static void tearDown() throws Exception {
        ITKylinQueryTest.tearDown();//invoke super class
        Candidate.restorePriorities();
    }

    @Parameterized.Parameters
    public static Collection<Object[]> configs() {
        return Arrays.asList(new Object[][] { { "inner" }, { "left" } });
    }

    public ITIIQueryTest(String joinType) throws Exception {

        ITKylinQueryTest.clean();

        ITKylinQueryTest.joinType = joinType;
        ITKylinQueryTest.setupAll();

    }

    @Test
    public void testSingleRunQuery() throws Exception {
        super.testSingleRunQuery();
    }

    @Test
    public void testDetailedQuery() throws Exception {
        execAndCompQuery("src/test/resources/query/sql_ii", null, true);
    }

    @Override
    @Test
    @Ignore("Skip Precisely Distinct Count Queries for II")
    public void testPreciselyDistinctCountQuery() {
    }

    @Override
    @Test
    @Ignore("Skip Dimension Distinct Count Queries for II")
    public void testDimDistinctCountQuery() {
    }
}

@@ -1251,16 +1251,62 @@
 /**%0A */%0A
+@Ignore(%22II query is no longer maintained%22)%0A//
 @RunWith

disable ITIIQueryTest temporarily