Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 045653edd -> 686caebff


PHOENIX-4260 Breakup NotQueryIT into multiple test classes


Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/686caebf
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/686caebf
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/686caebf

Branch: refs/heads/4.x-HBase-0.98
Commit: 686caebffa94822dcb32de0e298ddf2bc24eac6a
Parents: 045653e
Author: Samarth Jain <[email protected]>
Authored: Fri Sep 29 13:16:46 2017 -0700
Committer: Samarth Jain <[email protected]>
Committed: Fri Sep 29 13:16:46 2017 -0700

----------------------------------------------------------------------
 .../org/apache/phoenix/end2end/BaseQueryIT.java | 81 +++++++++++++-------
 .../apache/phoenix/end2end/CaseStatementIT.java |  2 +-
 .../apache/phoenix/end2end/CastAndCoerceIT.java |  2 +-
 .../org/apache/phoenix/end2end/GroupByIT.java   |  2 +-
 .../org/apache/phoenix/end2end/InQueryIT.java   |  2 +-
 .../apache/phoenix/end2end/IntArithmeticIT.java |  2 +-
 .../org/apache/phoenix/end2end/NotQueryIT.java  | 12 +--
 .../org/apache/phoenix/end2end/RangeScanIT.java |  2 +-
 .../org/apache/phoenix/end2end/UngroupedIT.java |  2 +-
 9 files changed, 63 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/686caebf/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
index 7f7416b..53391f1 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/BaseQueryIT.java
@@ -51,27 +51,41 @@ public abstract class BaseQueryIT extends 
ParallelStatsDisabledIT {
     protected static final String tenantId = getOrganizationId();
     protected static final String ATABLE_INDEX_NAME = "ATABLE_IDX";
     protected static final long BATCH_SIZE = 3;
-    protected static final String[] INDEX_DDLS = new String[] {
-            "CREATE INDEX %s ON %s (a_integer DESC) INCLUDE ("
-                    + "    A_STRING, " + "    B_STRING, " + "    A_DATE) %s",
-            "CREATE INDEX %s ON %s (a_integer, a_string) INCLUDE ("
-                    + "    B_STRING, " + "    A_DATE) %s",
-            "CREATE INDEX %s ON %s (a_integer) INCLUDE ("
-                    + "    A_STRING, " + "    B_STRING, " + "    A_DATE) %s",
-            "CREATE LOCAL INDEX %s ON %s (a_integer DESC) INCLUDE ("
-                    + "    A_STRING, " + "    B_STRING, " + "    A_DATE) %s",
-            "CREATE LOCAL INDEX %s ON %s (a_integer, a_string) INCLUDE (" + "  
  B_STRING, "
-                    + "    A_DATE) %s",
-            "CREATE LOCAL INDEX %s ON %s (a_integer) INCLUDE ("
-                    + "    A_STRING, " + "    B_STRING, " + "    A_DATE) %s",
-            "" };
-
+    protected static final String NO_INDEX = "";
+    protected static final String[] GLOBAL_INDEX_DDLS =
+            new String[] {
+                    "CREATE INDEX %s ON %s (a_integer DESC) INCLUDE (" + "    
A_STRING, "
+                            + "    B_STRING, " + "    A_DATE) %s",
+                    "CREATE INDEX %s ON %s (a_integer, a_string) INCLUDE (" + 
"    B_STRING, "
+                            + "    A_DATE) %s",
+                    "CREATE INDEX %s ON %s (a_integer) INCLUDE (" + "    
A_STRING, "
+                            + "    B_STRING, " + "    A_DATE) %s",
+                    NO_INDEX };
+    protected static final String[] LOCAL_INDEX_DDLS =
+            new String[] {
+                    "CREATE LOCAL INDEX %s ON %s (a_integer DESC) INCLUDE (" + 
"    A_STRING, "
+                            + "    B_STRING, " + "    A_DATE) %s",
+                    "CREATE LOCAL INDEX %s ON %s (a_integer, a_string) INCLUDE 
(" + "    B_STRING, "
+                            + "    A_DATE) %s",
+                    "CREATE LOCAL INDEX %s ON %s (a_integer) INCLUDE (" + "    
A_STRING, "
+                            + "    B_STRING, " + "    A_DATE) %s" };
+    protected static String[] INDEX_DDLS;
+    static {
+        INDEX_DDLS = new String[GLOBAL_INDEX_DDLS.length + 
LOCAL_INDEX_DDLS.length];
+        int i = 0;
+        for (String s : GLOBAL_INDEX_DDLS) {
+            INDEX_DDLS[i++] = s;
+        }
+        for (String s : LOCAL_INDEX_DDLS) {
+            INDEX_DDLS[i++] = s;
+        }
+    }
     protected Date date;
     private String indexDDL;
     private String tableDDLOptions;
     protected String tableName;
     protected String indexName;
-    
+
     private static final Logger logger = 
LoggerFactory.getLogger(BaseQueryIT.class);
 
     public BaseQueryIT(String idxDdl, boolean mutable, boolean columnEncoded,
@@ -81,23 +95,23 @@ public abstract class BaseQueryIT extends 
ParallelStatsDisabledIT {
             optionBuilder.append("COLUMN_ENCODED_BYTES=0");
         }
         if (!mutable) {
-            if (optionBuilder.length()>0)
-                optionBuilder.append(",");
+            if (optionBuilder.length() > 0) optionBuilder.append(",");
             optionBuilder.append("IMMUTABLE_ROWS=true");
             if (!columnEncoded) {
-                
optionBuilder.append(",IMMUTABLE_STORAGE_SCHEME="+PTableImpl.ImmutableStorageScheme.ONE_CELL_PER_COLUMN);
+                optionBuilder.append(",IMMUTABLE_STORAGE_SCHEME="
+                        + 
PTableImpl.ImmutableStorageScheme.ONE_CELL_PER_COLUMN);
             }
         }
         if (keepDeletedCells) {
-            if (optionBuilder.length()>0)
-                optionBuilder.append(",");
+            if (optionBuilder.length() > 0) optionBuilder.append(",");
             optionBuilder.append("KEEP_DELETED_CELLS=true");
         }
         this.tableDDLOptions = optionBuilder.toString();
         try {
             this.tableName =
                     initATableValues(generateUniqueName(), tenantId, 
getDefaultSplits(tenantId),
-                        date = new Date(System.currentTimeMillis()), null, 
getUrl(), tableDDLOptions);
+                        date = new Date(System.currentTimeMillis()), null, 
getUrl(),
+                        tableDDLOptions);
         } catch (Exception e) {
             logger.error("Exception when creating aTable ", e);
             throw e;
@@ -116,13 +130,26 @@ public abstract class BaseQueryIT extends 
ParallelStatsDisabledIT {
             }
         }
     }
-    
-    @Parameters(name="indexDDL={0},mutable={1},columnEncoded={2}")
-    public static Collection<Object> data() {
+
+    @Parameters(name = "indexDDL={0},mutable={1},columnEncoded={2}")
+    public static Collection<Object> allIndexes() {
         List<Object> testCases = Lists.newArrayList();
         for (String indexDDL : INDEX_DDLS) {
-            for (boolean mutable : new boolean[]{false}) {
-                for (boolean columnEncoded : new boolean[]{false}) {
+            for (boolean mutable : new boolean[] { false }) {
+                for (boolean columnEncoded : new boolean[] { false }) {
+                    testCases.add(new Object[] { indexDDL, mutable, 
columnEncoded });
+                }
+            }
+        }
+        return testCases;
+    }
+
+    @Parameters(name = "localIndexDDL={0}")
+    public static Collection<Object> localIndexes() {
+        List<Object> testCases = Lists.newArrayList();
+        for (String indexDDL : LOCAL_INDEX_DDLS) {
+            for (boolean mutable : new boolean[] { false }) {
+                for (boolean columnEncoded : new boolean[] { false }) {
                     testCases.add(new Object[] { indexDDL, mutable, 
columnEncoded });
                 }
             }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/686caebf/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java
index a1cb05f..ef67de7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CaseStatementIT.java
@@ -59,7 +59,7 @@ public class CaseStatementIT extends BaseQueryIT {
     
     @Parameters(name="CaseStatementIT_{index}") // name is used by failsafe as 
file name in reports
     public static Collection<Object> data() {
-        return QueryIT.data();
+        return QueryIT.allIndexes();
     }    
     
     @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/686caebf/phoenix-core/src/it/java/org/apache/phoenix/end2end/CastAndCoerceIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CastAndCoerceIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CastAndCoerceIT.java
index c4e334a..8c35992 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/CastAndCoerceIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/CastAndCoerceIT.java
@@ -49,7 +49,7 @@ public class CastAndCoerceIT extends BaseQueryIT {
     
     @Parameters(name="CastAndCoerceIT_{index}") // name is used by failsafe as 
file name in reports
     public static Collection<Object> data() {
-        return QueryIT.data();
+        return QueryIT.allIndexes();
     }
     
     @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/686caebf/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
index 2f2bf1d..46f9703 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/GroupByIT.java
@@ -58,7 +58,7 @@ public class GroupByIT extends BaseQueryIT {
     
     @Parameters(name="GroupByIT_{index}") // name is used by failsafe as file 
name in reports
     public static Collection<Object> data() {
-        return QueryIT.data();
+        return QueryIT.allIndexes();
     }
     
     @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/686caebf/phoenix-core/src/it/java/org/apache/phoenix/end2end/InQueryIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InQueryIT.java
index c5e6e63..9d1d8b6 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/InQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/InQueryIT.java
@@ -57,7 +57,7 @@ public class InQueryIT extends BaseQueryIT {
 
     @Parameters(name="InQueryIT_{index}") // name is used by failsafe as file 
name in reports
     public static Collection<Object> data() {
-        return QueryIT.data();
+        return QueryIT.allIndexes();
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/686caebf/phoenix-core/src/it/java/org/apache/phoenix/end2end/IntArithmeticIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IntArithmeticIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IntArithmeticIT.java
index d21cde8..bbd9d7f 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/IntArithmeticIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/IntArithmeticIT.java
@@ -53,7 +53,7 @@ public class IntArithmeticIT extends BaseQueryIT {
     
     @Parameters(name="IntArithmeticIT_{index}") // name is used by failsafe as 
file name in reports
     public static Collection<Object> data() {
-        return QueryIT.data();
+        return QueryIT.allIndexes();
     }
     
     @Test

http://git-wip-us.apache.org/repos/asf/phoenix/blob/686caebf/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryIT.java
index 9a285ff..94e95d8 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/NotQueryIT.java
@@ -35,32 +35,24 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
-import java.util.Collection;
 import java.util.Properties;
 
-import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
 
 import com.google.common.primitives.Doubles;
 import com.google.common.primitives.Floats;
 
 
 @RunWith(Parameterized.class)
-public class NotQueryIT extends BaseQueryIT {
+public abstract class NotQueryIT extends BaseQueryIT {
 
-    public NotQueryIT(String indexDDL, boolean mutable, boolean columnEncoded) 
throws Exception {
+    protected NotQueryIT(String indexDDL, boolean mutable, boolean 
columnEncoded) throws Exception {
         super(indexDDL, mutable, columnEncoded, false);
     }
     
-    @Parameters(name="NotQueryIT_{index}") // name is used by failsafe as file 
name in reports
-    public static Collection<Object> data() {
-        return QueryIT.data();
-    }
-    
     @Test
     public void testNotInList() throws Exception {
         String query = "SELECT entity_id FROM " + tableName + " WHERE 
organization_id=? and entity_id NOT IN (?,?,?,?,?,?)";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/686caebf/phoenix-core/src/it/java/org/apache/phoenix/end2end/RangeScanIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RangeScanIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RangeScanIT.java
index 3d2e375..a9cc2c4 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RangeScanIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RangeScanIT.java
@@ -53,7 +53,7 @@ public class RangeScanIT extends BaseQueryIT {
     
     @Parameters(name="RangeScanIT_{index}") // name is used by failsafe as 
file name in reports
     public static Collection<Object> data() {
-        return QueryIT.data();
+        return QueryIT.allIndexes();
     }
 
     public RangeScanIT(String indexDDL, boolean mutable, boolean 
columnEncoded) throws Exception {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/686caebf/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedIT.java
index e562501..fa1e4dd 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UngroupedIT.java
@@ -51,7 +51,7 @@ public class UngroupedIT extends BaseQueryIT {
 
     @Parameters(name="UngroupedIT_{index}") // name is used by failsafe as 
file name in reports
     public static Collection<Object> data() {
-        return QueryIT.data();
+        return QueryIT.allIndexes();
     }
     
     @Test

Reply via email to