http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java
index dbe767b..f26e6dd 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDMLIT.java
@@ -28,13 +28,11 @@ import static org.junit.Assert.fail;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
-import java.sql.SQLException;
 import java.util.List;
 import java.util.Properties;
 
 import org.apache.phoenix.query.KeyRange;
 import org.apache.phoenix.schema.TableNotFoundException;
-import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Test;
 
@@ -43,23 +41,20 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
        
        @Test
        public void testSelectWithLimit() throws Exception {
-               Connection conn = 
nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
+               Connection conn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, 
PropertiesUtil.deepCopy(TEST_PROPERTIES));
         ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM " + 
TENANT_TABLE_NAME + " LIMIT 100");
                while(rs.next()) {}
        }
        
     @Test
     public void testBasicUpsertSelect() throws Exception {
-        Connection conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
+        Connection conn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, 
PropertiesUtil.deepCopy(TEST_PROPERTIES));
         try {
             conn.setAutoCommit(false);
             conn.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " (id, tenant_col) values (1, 'Cheap Sunglasses')");
             conn.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " (id, tenant_col) values (2, 'Viva Las Vegas')");
             conn.commit();
-            conn.close();
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
             analyzeTable(conn, TENANT_TABLE_NAME);
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
             ResultSet rs = conn.createStatement().executeQuery("select 
tenant_col from " + TENANT_TABLE_NAME + " where id = 1");
             assertTrue("Expected 1 row in result set", rs.next());
             assertEquals("Cheap Sunglasses", rs.getString(1));
@@ -72,49 +67,37 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
     
     @Test
     public void testBasicUpsertSelect2() throws Exception {
-        Connection conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-        createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, TENANT_TABLE_DDL, 
null, nextTimestamp());
-        Connection conn2 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2);
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn1 = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
+        createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, TENANT_TABLE_DDL);
+        Connection conn2 = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, props);
         try {
             conn1.setAutoCommit(false);
             conn1.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " values ('me','" + TENANT_TYPE_ID + "',1,'Cheap 
Sunglasses')");
             conn1.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " values ('you','" + TENANT_TYPE_ID +"',2,'Viva Las 
Vegas')");
             conn1.commit();
-            conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
             analyzeTable(conn1, TENANT_TABLE_NAME);
-            conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
             
             conn2.setAutoCommit(true);
             conn2.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " values ('them','" + TENANT_TYPE_ID + "',1,'Long Hair')");
             conn2.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " values ('us','" + TENANT_TYPE_ID + "',2,'Black Hat')");
-            conn2.close();
-            conn1.close();
-            conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
             ResultSet rs = conn1.createStatement().executeQuery("select * from 
" + TENANT_TABLE_NAME + " where id = 1");
             assertTrue("Expected 1 row in result set", rs.next());
             assertEquals(1, rs.getInt(3));
             assertEquals("Cheap Sunglasses", rs.getString(4));
             assertFalse("Expected 1 row in result set", rs.next());
-            conn2 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2);
             analyzeTable(conn2, TENANT_TABLE_NAME);
-            conn2 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2);
 
             rs = conn2.createStatement().executeQuery("select * from " + 
TENANT_TABLE_NAME + " where id = 2");
             assertTrue("Expected 1 row in result set", rs.next());
             assertEquals(2, rs.getInt(3));
             assertEquals("Black Hat", rs.getString(4));
             assertFalse("Expected 1 row in result set", rs.next());
-            conn2.close();
-            conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
             analyzeTable(conn1, TENANT_TABLE_NAME);
-            conn1.close();
             
-            conn2 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2);
             conn2.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " select * from " + TENANT_TABLE_NAME );
             conn2.commit();
-            conn2.close();
             
-            conn2 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2);
             rs = conn2.createStatement().executeQuery("select * from " + 
TENANT_TABLE_NAME);
             assertTrue("Expected row in result set", rs.next());
             assertEquals(1, rs.getInt(3));
@@ -123,14 +106,10 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
             assertEquals(2, rs.getInt(3));
             assertEquals("Black Hat", rs.getString(4));
             assertFalse("Expected 2 rows total", rs.next());
-            conn2.close();
             
-            conn2 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2);
             conn2.setAutoCommit(true);;
             conn2.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " select 'all', tenant_type_id, id, 'Big ' || tenant_col 
from " + TENANT_TABLE_NAME );
-            conn2.close();
 
-            conn2 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL2);
             analyzeTable(conn2, TENANT_TABLE_NAME);
             rs = conn2.createStatement().executeQuery("select * from " + 
TENANT_TABLE_NAME);
             assertTrue("Expected row in result set", rs.next());
@@ -144,8 +123,6 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
             assertEquals(2, rs.getInt(3));
             assertEquals("Big Black Hat", rs.getString(4));
             assertFalse("Expected 2 rows total", rs.next());
-            conn2.close();
-            conn1 = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
             rs = conn1.createStatement().executeQuery("select * from " + 
TENANT_TABLE_NAME);
             assertTrue("Expected row row in result set", rs.next());
             assertEquals(1, rs.getInt(3));
@@ -163,34 +140,23 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
         }
     }
     
-    private Connection nextConnection(String url) throws SQLException {
-        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(nextTimestamp()));
-        return DriverManager.getConnection(url, props);
-    }
-    
     @Test
     public void testJoinWithGlobalTable() throws Exception {
-        Connection conn = nextConnection(getUrl());
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.createStatement().execute("create table foo (k INTEGER NOT NULL 
PRIMARY KEY)");
-        conn.close();
 
-        conn = nextConnection(getUrl());
         conn.createStatement().execute("upsert into foo(k) values(1)");
         conn.commit();
-        conn.close();
 
-        conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
+        conn = DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, 
props);
         try {
             conn.setAutoCommit(false);
             conn.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " (id, tenant_col) values (1, 'Cheap Sunglasses')");
             conn.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " (id, tenant_col) values (2, 'Viva Las Vegas')");
             conn.commit();
-            conn.close();
             
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
             analyzeTable(conn, TENANT_TABLE_NAME);
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
             ResultSet rs = conn.createStatement().executeQuery("select 
tenant_col from " + TENANT_TABLE_NAME + " join foo on k=id");
             assertTrue("Expected 1 row in result set", rs.next());
             assertEquals("Cheap Sunglasses", rs.getString(1));
@@ -203,20 +169,16 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
     
     @Test
     public void testSelectOnlySeesTenantData() throws Exception {
-        Connection conn = nextConnection(getUrl());
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("delete from " + 
PARENT_TABLE_NAME);
-            conn.close();
-            
-            conn = nextConnection(getUrl());
-            conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('AC/DC', 
'abc', 1, 'Bon Scott')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('" + 
TENANT_ID + "', '" + TENANT_TYPE_ID + "', 1, 'Billy Gibbons')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('" + 
TENANT_ID + "', 'def', 1, 'Billy Gibbons')");
-            conn.close();
             
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
+            conn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
             ResultSet rs = conn.createStatement().executeQuery("select user 
from " + TENANT_TABLE_NAME);
             assertTrue("Expected 1 row in result set", rs.next());
             assertEquals("Billy Gibbons", rs.getString(1));
@@ -235,34 +197,24 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
     
     @Test
     public void testDeleteOnlyDeletesTenantData() throws Exception {
-        Connection conn = nextConnection(getUrl());
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("delete from " + 
PARENT_TABLE_NAME);
-            conn.close();
-            
-            conn = nextConnection(getUrl());
-            conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('AC/DC', 
'abc', 1, 'Bon Scott')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('" + 
TENANT_ID + "', '" + TENANT_TYPE_ID + "', 1, 'Billy Gibbons')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('" + 
TENANT_ID + "', 'def', 1, 'Billy Gibbons')");
-            conn.close();
             
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
+            conn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
             conn.setAutoCommit(true);
             int count = conn.createStatement().executeUpdate("delete from " + 
TENANT_TABLE_NAME);
             assertEquals("Expected 1 row have been deleted", 1, count);
-            conn.close();
-            
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            conn.setAutoCommit(true);
             ResultSet rs = conn.createStatement().executeQuery("select * from 
" + TENANT_TABLE_NAME);
             assertFalse("Expected no rows in result set", rs.next());
-            conn.close();
             
-            conn = nextConnection(getUrl());
+            conn = DriverManager.getConnection(getUrl(), props);
             analyzeTable(conn, PARENT_TABLE_NAME);
-            conn = nextConnection(getUrl());
             rs = conn.createStatement().executeQuery("select count(*) from " + 
PARENT_TABLE_NAME);
             rs.next();
             assertEquals(2, rs.getInt(1));
@@ -274,38 +226,25 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
     
     @Test
     public void testDeleteWhenImmutableIndex() throws Exception {
-        Connection conn = nextConnection(getUrl());
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("delete from " + 
PARENT_TABLE_NAME);
-            conn.close();
-            
-            conn = nextConnection(getUrl());
-            conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('AC/DC', 
'abc', 1, 'Bon Scott')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('" + 
TENANT_ID + "', '" + TENANT_TYPE_ID + "', 1, 'Billy Gibbons')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('" + 
TENANT_ID + "', 'def', 1, 'Billy Gibbons')");
-            conn.close();
             
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            conn.createStatement().executeUpdate("create index idx1 on " + 
TENANT_TABLE_NAME + "(user)");
-            conn.close();
-            
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            conn.setAutoCommit(true);
-            int count = conn.createStatement().executeUpdate("delete from " + 
TENANT_TABLE_NAME + " where user='Billy Gibbons'");
+            Connection tsConn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
+            tsConn.setAutoCommit(true);
+            tsConn.createStatement().executeUpdate("create index idx1 on " + 
TENANT_TABLE_NAME + "(user)");
+            int count = tsConn.createStatement().executeUpdate("delete from " 
+ TENANT_TABLE_NAME + " where user='Billy Gibbons'");
             assertEquals("Expected 1 row have been deleted", 1, count);
-            conn.close();
-            
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            conn.setAutoCommit(true);
-            ResultSet rs = conn.createStatement().executeQuery("select * from 
" + TENANT_TABLE_NAME);
+            ResultSet rs = tsConn.createStatement().executeQuery("select * 
from " + TENANT_TABLE_NAME);
             assertFalse("Expected no rows in result set", rs.next());
-            conn.close();
+            tsConn.close();
             
-            conn = nextConnection(getUrl());
             analyzeTable(conn, PARENT_TABLE_NAME);
-            conn = nextConnection(getUrl());
             rs = conn.createStatement().executeQuery("select count(*) from " + 
PARENT_TABLE_NAME);
             rs.next();
             assertEquals(2, rs.getInt(1));
@@ -317,30 +256,22 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
     
     @Test
     public void testDeleteOnlyDeletesTenantDataWithNoTenantTypeId() throws 
Exception {
-        Connection conn = nextConnection(getUrl());
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("delete from " + 
PARENT_TABLE_NAME_NO_TENANT_TYPE_ID);
-            conn.close();
-            
-            conn = nextConnection(getUrl());
-            conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME_NO_TENANT_TYPE_ID + " (tenant_id, id, user) values ('AC/DC', 
1, 'Bon Scott')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME_NO_TENANT_TYPE_ID + " (tenant_id, id, user) values ('" + 
TENANT_ID + "', 1, 'Billy Gibbons')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME_NO_TENANT_TYPE_ID + " (tenant_id, id, user) values ('" + 
TENANT_ID + "', 2, 'Billy Gibbons')");
-            conn.close();
             
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            conn.setAutoCommit(true);
-            int count = conn.createStatement().executeUpdate("delete from " + 
TENANT_TABLE_NAME_NO_TENANT_TYPE_ID);
+            Connection tsConn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
+            tsConn.setAutoCommit(true);
+            int count = tsConn.createStatement().executeUpdate("delete from " 
+ TENANT_TABLE_NAME_NO_TENANT_TYPE_ID);
             assertEquals("Expected 2 rows have been deleted", 2, count);
-            conn.close();
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            ResultSet rs = conn.createStatement().executeQuery("select * from 
" + TENANT_TABLE_NAME_NO_TENANT_TYPE_ID);
+            ResultSet rs = tsConn.createStatement().executeQuery("select * 
from " + TENANT_TABLE_NAME_NO_TENANT_TYPE_ID);
             assertFalse("Expected no rows in result set", rs.next());
-            conn.close();
             
-            conn = nextConnection(getUrl());
             rs = conn.createStatement().executeQuery("select count(*) from " + 
PARENT_TABLE_NAME_NO_TENANT_TYPE_ID);
             rs.next();
             assertEquals(1, rs.getInt(1));
@@ -352,146 +283,121 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
     
     @Test
     public void testDeleteAllTenantTableData() throws Exception {
-        Connection conn = nextConnection(getUrl());
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
+        Connection tsConn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
         try {
             conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("delete from " + 
PARENT_TABLE_NAME);
-            conn.close();
-            
-            conn = nextConnection(getUrl());
-            conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('AC/DC', 
'abc', 1, 'Bon Scott')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('" + 
TENANT_ID + "', '" + TENANT_TYPE_ID + "', 1, 'Billy Gibbons')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('" + 
TENANT_ID + "', 'def', 1, 'Billy Gibbons')");
-            conn.close();
             
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            analyzeTable(conn, PARENT_TABLE_NAME);
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            conn.createStatement().execute("delete from " + TENANT_TABLE_NAME);
-            conn.commit();
-            conn.close();
+            analyzeTable(tsConn, PARENT_TABLE_NAME);
+            tsConn.createStatement().execute("delete from " + 
TENANT_TABLE_NAME);
+            tsConn.commit();
             
-            conn = nextConnection(getUrl());
             ResultSet rs = conn.createStatement().executeQuery("select 
count(*) from " + PARENT_TABLE_NAME);
             rs.next();
             assertEquals(2, rs.getInt(1));
         }
         finally {
-            conn.close();
+            if (conn != null) conn.close();
+            if (tsConn != null) tsConn.close();
         }
     }
     
     @Test
     public void testDropTenantTableDeletesNoData() throws Exception {
-        Connection conn = nextConnection(getUrl());
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
+        Connection tsConn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
         try {
             conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("delete from " + 
PARENT_TABLE_NAME_NO_TENANT_TYPE_ID);
-            conn.close();
-            
-            conn = nextConnection(getUrl());
-            conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME_NO_TENANT_TYPE_ID + " (tenant_id, id, user) values ('AC/DC', 
1, 'Bon Scott')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME_NO_TENANT_TYPE_ID + " (tenant_id, id, user) values ('" + 
TENANT_ID + "', 1, 'Billy Gibbons')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME_NO_TENANT_TYPE_ID + " (tenant_id, id, user) values ('" + 
TENANT_ID + "', 2, 'Billy Gibbons')");
-            conn.close();
             
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            conn.createStatement().execute("drop view " + 
TENANT_TABLE_NAME_NO_TENANT_TYPE_ID);
-            conn.close();
+            tsConn.createStatement().execute("drop view " + 
TENANT_TABLE_NAME_NO_TENANT_TYPE_ID);
             
-            conn = nextConnection(getUrl());
             analyzeTable(conn, PARENT_TABLE_NAME_NO_TENANT_TYPE_ID);
-            conn = nextConnection(getUrl());
             ResultSet rs = conn.createStatement().executeQuery("select 
count(*) from " + PARENT_TABLE_NAME_NO_TENANT_TYPE_ID);
             rs.next();
             assertEquals(3, rs.getInt(1));
         }
         finally {
-            conn.close();
+            if (conn != null) conn.close();
+            if (tsConn != null) tsConn.close();
         }
     }
     
     @Test
     public void testUpsertSelectOnlyUpsertsTenantData() throws Exception {
-        Connection conn = nextConnection(getUrl());
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
+        Connection tsConn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
         try {
             conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("delete from " + 
PARENT_TABLE_NAME);
-            conn.close();
-            
-            conn = nextConnection(getUrl());
-            conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('AC/DC', 
'aaa', 1, 'Bon Scott')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('" + 
TENANT_ID + "', '" + TENANT_TYPE_ID + "', 1, 'Billy Gibbons')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('" + 
TENANT_ID + "', 'def', 2, 'Billy Gibbons')");
-            conn.close();
             
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            analyzeTable(conn, TENANT_TABLE_NAME);
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            conn.setAutoCommit(true);
-            int count = conn.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + "(id, user) select id+100, user from " + TENANT_TABLE_NAME);
+            analyzeTable(tsConn, TENANT_TABLE_NAME);
+            int count = tsConn.createStatement().executeUpdate("upsert into " 
+ TENANT_TABLE_NAME + "(id, user) select id+100, user from " + 
TENANT_TABLE_NAME);
+            tsConn.commit();
             assertEquals("Expected 1 row to have been inserted", 1, count);
-            conn.close();
             
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            ResultSet rs = conn.createStatement().executeQuery("select 
count(*) from " + TENANT_TABLE_NAME);
+            ResultSet rs = tsConn.createStatement().executeQuery("select 
count(*) from " + TENANT_TABLE_NAME);
             rs.next();
             assertEquals(2, rs.getInt(1));
         }
         finally {
-            conn.close();
+            if (conn != null) conn.close();
+            if (tsConn != null) tsConn.close();
         }
     }
     
     @Test
     public void 
testUpsertSelectOnlyUpsertsTenantDataWithDifferentTenantTable() throws 
Exception {
-        createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL, "CREATE VIEW 
ANOTHER_TENANT_TABLE ( " + 
-            "tenant_col VARCHAR) AS SELECT * FROM " + PARENT_TABLE_NAME + " 
WHERE tenant_type_id = 'def'", null, nextTimestamp(), false);
+        String anotherTableName = "V_" + generateRandomString();
+        createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL, "CREATE VIEW " + 
anotherTableName + " ( " + 
+            "tenant_col VARCHAR) AS SELECT * FROM " + PARENT_TABLE_NAME + " 
WHERE tenant_type_id = 'def'");
         
-        Connection conn = nextConnection(getUrl());
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
+        Connection tsConn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
         try {
             conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("delete from " + 
PARENT_TABLE_NAME);
-            conn.close();
-            
-            conn = nextConnection(getUrl());
-            conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('AC/DC', 
'aaa', 1, 'Bon Scott')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('" + 
TENANT_ID + "', '" + TENANT_TYPE_ID + "', 1, 'Billy Gibbons')");
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_id, tenant_type_id, id, user) values ('" + 
TENANT_ID + "', 'def', 2, 'Billy Gibbons')");
-            conn.close();
             
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            analyzeTable(conn, TENANT_TABLE_NAME);
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            conn.setAutoCommit(true);
-            int count = conn.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + "(id, user) select id+100, user from ANOTHER_TENANT_TABLE 
where id=2");
+            analyzeTable(tsConn, TENANT_TABLE_NAME);
+            tsConn.setAutoCommit(true);
+            int count = tsConn.createStatement().executeUpdate("upsert into " 
+ TENANT_TABLE_NAME + "(id, user)"
+                    + "select id+100, user from " + anotherTableName + " where 
id=2");
             assertEquals("Expected 1 row to have been inserted", 1, count);
-            conn.close();
-            
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            ResultSet rs = conn.createStatement().executeQuery("select 
count(*) from " + TENANT_TABLE_NAME);
+            ResultSet rs = tsConn.createStatement().executeQuery("select 
count(*) from " + TENANT_TABLE_NAME);
             rs.next();
             assertEquals(2, rs.getInt(1));
         }
         finally {
-            conn.close();
+            if (conn != null) conn.close();
+            if (tsConn != null) tsConn.close();
         }
     }
     
     @Test
     public void testUpsertValuesOnlyUpsertsTenantData() throws Exception {
-        Connection conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
         try {
-            conn.setAutoCommit(true);
             int count = conn.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME + " (id, user) values (1, 'Bon Scott')");
+            conn.commit();
             assertEquals("Expected 1 row to have been inserted", 1, count);
-            conn.close();
-            
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
             ResultSet rs = conn.createStatement().executeQuery("select 
count(*) from " + TENANT_TABLE_NAME);
             rs.next();
             assertEquals(1, rs.getInt(1));
@@ -503,19 +409,14 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
     
     @Test
     public void testBaseTableCanBeUsedInStatementsInMultitenantConnections() 
throws Exception {
-        Connection conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
         try {
             ResultSet rs = conn.createStatement().executeQuery("select * from 
" + PARENT_TABLE_NAME);
             assertFalse(rs.next());
-            conn.close();
-            
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-            conn.setAutoCommit(true);
             conn.createStatement().executeUpdate("upsert into " + 
PARENT_TABLE_NAME + " (tenant_type_id, id, user) values ('" + TENANT_TYPE_ID + 
"', 1, 'Billy Gibbons')");
-            conn.close();
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
+            conn.commit();
             analyzeTable(conn, PARENT_TABLE_NAME);
-            conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
             rs = conn.createStatement().executeQuery("select user from " + 
PARENT_TABLE_NAME);
             assertTrue(rs.next());
             assertEquals(rs.getString(1),"Billy Gibbons");
@@ -528,7 +429,8 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
     
     @Test
     public void 
testTenantTableCannotBeUsedInStatementsInNonMultitenantConnections() throws 
Exception {
-        Connection conn = nextConnection(getUrl());
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             try {
                 conn.createStatement().execute("select * from " + 
TENANT_TABLE_NAME);
@@ -543,16 +445,17 @@ public class TenantSpecificTablesDMLIT extends 
BaseTenantSpecificTablesIT {
     
     @Test
     public void testUpsertValuesUsingViewWithNoWhereClause() throws Exception {
-        Connection conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-        conn.setAutoCommit(true);
-        conn.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME_NO_TENANT_TYPE_ID + " (id) values (0)");
-        conn.close();
-        
-        conn = nextConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL);
-        ResultSet rs = conn.createStatement().executeQuery("select id from " + 
TENANT_TABLE_NAME_NO_TENANT_TYPE_ID);
-        assertTrue(rs.next());
-        assertEquals(0, rs.getInt(1));
-        assertFalse(rs.next());
-        conn.close();
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
+        Connection conn = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
+        try {
+            conn.createStatement().executeUpdate("upsert into " + 
TENANT_TABLE_NAME_NO_TENANT_TYPE_ID + " (id) values (0)");
+            conn.commit();
+            ResultSet rs = conn.createStatement().executeQuery("select id from 
" + TENANT_TABLE_NAME_NO_TENANT_TYPE_ID);
+            assertTrue(rs.next());
+            assertEquals(0, rs.getInt(1));
+            assertFalse(rs.next());
+        } finally {
+            conn.close();
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TransactionalViewIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TransactionalViewIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TransactionalViewIT.java
index e5cd578..95e7266 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TransactionalViewIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TransactionalViewIT.java
@@ -30,14 +30,21 @@ import java.util.Map;
 import org.apache.phoenix.query.KeyRange;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.util.TestUtil;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 import com.google.common.collect.Maps;
 
-public class TransactionalViewIT extends BaseOwnClusterHBaseManagedTimeIT {
+public class TransactionalViewIT extends ParallelStatsEnabledIT {
+
+    private String fullTableName;
+    private String fullViewName;
 
     @BeforeClass
+    @Shadower(classBeingShadowed = ParallelStatsEnabledIT.class)
     public static void doSetup() throws Exception {
         Map<String,String> props = Maps.newHashMapWithExpectedSize(3);
         props.put(QueryServices.STATS_GUIDEPOST_WIDTH_BYTES_ATTRIB, 
Integer.toString(20));
@@ -45,36 +52,46 @@ public class TransactionalViewIT extends 
BaseOwnClusterHBaseManagedTimeIT {
         setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
     
+    @Before
+    public void generateTableNames() {
+        String schemaName = TestUtil.DEFAULT_SCHEMA_NAME;
+        String tableName = "T_" + generateRandomString();
+        fullTableName = SchemaUtil.getTableName(schemaName, tableName);
+        String viewName = "V_" + generateRandomString();
+        fullViewName = SchemaUtil.getTableName(schemaName, viewName);
+    }
+
     @Test
     public void testReadOwnWritesWithStats() throws Exception {
         try (Connection conn1 = DriverManager.getConnection(getUrl()); 
                 Connection conn2 = DriverManager.getConnection(getUrl())) {
-            String ddl = "CREATE TABLE t (k INTEGER NOT NULL PRIMARY KEY, v1 
DATE) TRANSACTIONAL=true";
+            String ddl = "CREATE TABLE " + fullTableName
+                    + " (k INTEGER NOT NULL PRIMARY KEY, v1 DATE) 
TRANSACTIONAL=true";
             conn1.createStatement().execute(ddl);
-            ddl = "CREATE VIEW v (v2 VARCHAR) AS SELECT * FROM t where k>5";
+            ddl = "CREATE VIEW " + fullViewName + " (v2 VARCHAR) AS SELECT * 
FROM " + fullTableName + " where k>5";
             conn1.createStatement().execute(ddl);
             for (int i = 0; i < 10; i++) {
-                conn1.createStatement().execute("UPSERT INTO t VALUES(" + i + 
")");
+                conn1.createStatement().execute("UPSERT INTO " + fullTableName 
+ " VALUES(" + i + ")");
             }
     
             // verify you can read your own writes
             int count = 0;
-            ResultSet rs = conn1.createStatement().executeQuery("SELECT k FROM 
t");
+            ResultSet rs = conn1.createStatement().executeQuery("SELECT k FROM 
" + fullTableName);
             while (rs.next()) {
                 assertEquals(count++, rs.getInt(1));
             }
             assertEquals(10, count);
             
             count = 0;
-            rs = conn1.createStatement().executeQuery("SELECT k FROM v");
+            rs = conn1.createStatement().executeQuery("SELECT k FROM " + 
fullViewName);
             while (rs.next()) {
                 assertEquals(6+count++, rs.getInt(1));
             }
             assertEquals(4, count);
             
             // verify stats can see the read own writes rows
-            analyzeTable(conn2, "v", true);
-            List<KeyRange> splits = getAllSplits(conn2, "v");
+            analyzeTable(conn2, fullViewName, true);
+            List<KeyRange> splits = getAllSplits(conn2, fullViewName);
             assertEquals(4, splits.size());
         }
     }
@@ -83,24 +100,25 @@ public class TransactionalViewIT extends 
BaseOwnClusterHBaseManagedTimeIT {
     public void testInvalidRowsWithStats() throws Exception {
         try (Connection conn1 = DriverManager.getConnection(getUrl()); 
                 Connection conn2 = DriverManager.getConnection(getUrl())) {
-            String ddl = "CREATE TABLE t (k INTEGER NOT NULL PRIMARY KEY, v1 
DATE) TRANSACTIONAL=true";
+            String ddl = "CREATE TABLE " + fullTableName
+                    + " (k INTEGER NOT NULL PRIMARY KEY, v1 DATE) 
TRANSACTIONAL=true";
             conn1.createStatement().execute(ddl);
-            ddl = "CREATE VIEW v (v2 VARCHAR) AS SELECT * FROM t where k>5";
+            ddl = "CREATE VIEW " + fullViewName + " (v2 VARCHAR) AS SELECT * 
FROM " + fullTableName + " where k>5";
             conn1.createStatement().execute(ddl);
             for (int i = 0; i < 10; i++) {
-                conn1.createStatement().execute("UPSERT INTO t VALUES(" + i + 
")");
+                conn1.createStatement().execute("UPSERT INTO " + fullTableName 
+ " VALUES(" + i + ")");
             }
     
             // verify you can read your own writes
             int count = 0;
-            ResultSet rs = conn1.createStatement().executeQuery("SELECT k FROM 
t");
+            ResultSet rs = conn1.createStatement().executeQuery("SELECT k FROM 
" + fullTableName);
             while (rs.next()) {
                 assertEquals(count++, rs.getInt(1));
             }
             assertEquals(10, count);
             
             count = 0;
-            rs = conn1.createStatement().executeQuery("SELECT k FROM v");
+            rs = conn1.createStatement().executeQuery("SELECT k FROM " + 
fullViewName);
             while (rs.next()) {
                 assertEquals(6+count++, rs.getInt(1));
             }
@@ -110,8 +128,8 @@ public class TransactionalViewIT extends 
BaseOwnClusterHBaseManagedTimeIT {
             // assertEquals("There should be one invalid transaction", 1, 
txManager.getInvalidSize());
             
             // verify stats can see the rows from the invalid transaction
-            analyzeTable(conn2, "v", true);
-            List<KeyRange> splits = getAllSplits(conn2, "v");
+            analyzeTable(conn2, fullViewName, true);
+            List<KeyRange> splits = getAllSplits(conn2, fullViewName);
             assertEquals(4, splits.size());
         }
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java
index bdd94a2..84fa217 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UpgradeIT.java
@@ -34,6 +34,8 @@ import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.Properties;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -62,24 +64,30 @@ import org.apache.phoenix.util.MetaDataUtil;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.SchemaUtil;
 import org.apache.phoenix.util.UpgradeUtil;
+import org.junit.Before;
 import org.junit.Test;
 
-public class UpgradeIT extends BaseHBaseManagedTimeIT {
+public class UpgradeIT extends ParallelStatsDisabledIT {
 
-    private static String TENANT_ID = "tenantId";
+    private String tenantId;
+    
+    @Before
+    public void generateTenantId() {
+        tenantId = "T_" + generateRandomString();
+    }
 
     @Test
     public void testUpgradeForTenantViewWithSameColumnsAsBaseTable() throws 
Exception {
         String tableWithViewName = generateRandomString();
         String viewTableName = generateRandomString();
-        testViewUpgrade(true, TENANT_ID, null, tableWithViewName + "1", null, 
viewTableName + "1", ColumnDiff.EQUAL);
-        testViewUpgrade(true, TENANT_ID, "TABLESCHEMA", tableWithViewName + 
"", null, viewTableName + "2",
+        testViewUpgrade(true, tenantId, null, tableWithViewName + "1", null, 
viewTableName + "1", ColumnDiff.EQUAL);
+        testViewUpgrade(true, tenantId, "TABLESCHEMA", tableWithViewName + "", 
null, viewTableName + "2",
             ColumnDiff.EQUAL);
-        testViewUpgrade(true, TENANT_ID, null, tableWithViewName + "3", 
viewTableName + "SCHEMA", viewTableName + "3",
+        testViewUpgrade(true, tenantId, null, tableWithViewName + "3", 
viewTableName + "SCHEMA", viewTableName + "3",
             ColumnDiff.EQUAL);
-        testViewUpgrade(true, TENANT_ID, "TABLESCHEMA", tableWithViewName + 
"4", viewTableName + "SCHEMA", viewTableName + "4",
+        testViewUpgrade(true, tenantId, "TABLESCHEMA", tableWithViewName + 
"4", viewTableName + "SCHEMA", viewTableName + "4",
             ColumnDiff.EQUAL);
-        testViewUpgrade(true, TENANT_ID, "SAMESCHEMA", tableWithViewName + 
"5", "SAMESCHEMA", viewTableName + "5",
+        testViewUpgrade(true, tenantId, "SAMESCHEMA", tableWithViewName + "5", 
"SAMESCHEMA", viewTableName + "5",
             ColumnDiff.EQUAL);
     }
 
@@ -87,14 +95,14 @@ public class UpgradeIT extends BaseHBaseManagedTimeIT {
     public void testUpgradeForTenantViewWithMoreColumnsThanBaseTable() throws 
Exception {
         String tableWithViewName = generateRandomString();
         String viewTableName = generateRandomString();
-        testViewUpgrade(true, TENANT_ID, null, tableWithViewName + "1", null, 
viewTableName + "1", ColumnDiff.MORE);
-        testViewUpgrade(true, TENANT_ID, "TABLESCHEMA", tableWithViewName + 
"", null, viewTableName + "2",
+        testViewUpgrade(true, tenantId, null, tableWithViewName + "1", null, 
viewTableName + "1", ColumnDiff.MORE);
+        testViewUpgrade(true, tenantId, "TABLESCHEMA", tableWithViewName + "", 
null, viewTableName + "2",
             ColumnDiff.MORE);
-        testViewUpgrade(true, TENANT_ID, null, tableWithViewName + "3", 
"VIEWSCHEMA", viewTableName + "3",
+        testViewUpgrade(true, tenantId, null, tableWithViewName + "3", 
"VIEWSCHEMA", viewTableName + "3",
             ColumnDiff.MORE);
-        testViewUpgrade(true, TENANT_ID, "TABLESCHEMA", tableWithViewName + 
"4", "VIEWSCHEMA", viewTableName + "4",
+        testViewUpgrade(true, tenantId, "TABLESCHEMA", tableWithViewName + 
"4", "VIEWSCHEMA", viewTableName + "4",
             ColumnDiff.MORE);
-        testViewUpgrade(true, TENANT_ID, "SAMESCHEMA", tableWithViewName + 
"5", "SAMESCHEMA", viewTableName + "5",
+        testViewUpgrade(true, tenantId, "SAMESCHEMA", tableWithViewName + "5", 
"SAMESCHEMA", viewTableName + "5",
             ColumnDiff.MORE);
     }
 
@@ -130,14 +138,14 @@ public class UpgradeIT extends BaseHBaseManagedTimeIT {
     public void testSettingBaseColumnCountWhenBaseTableColumnDropped() throws 
Exception {
         String tableWithViewName = generateRandomString();
         String viewTableName = generateRandomString();
-        testViewUpgrade(true, TENANT_ID, null, tableWithViewName + "1", null, 
viewTableName + "1", ColumnDiff.MORE);
-        testViewUpgrade(true, TENANT_ID, "TABLESCHEMA", tableWithViewName + 
"", null, viewTableName + "2",
+        testViewUpgrade(true, tenantId, null, tableWithViewName + "1", null, 
viewTableName + "1", ColumnDiff.MORE);
+        testViewUpgrade(true, tenantId, "TABLESCHEMA", tableWithViewName + "", 
null, viewTableName + "2",
             ColumnDiff.LESS);
-        testViewUpgrade(true, TENANT_ID, null, tableWithViewName + "3", 
"VIEWSCHEMA", viewTableName + "3",
+        testViewUpgrade(true, tenantId, null, tableWithViewName + "3", 
"VIEWSCHEMA", viewTableName + "3",
             ColumnDiff.LESS);
-        testViewUpgrade(true, TENANT_ID, "TABLESCHEMA", tableWithViewName + 
"4", "VIEWSCHEMA", viewTableName + "4",
+        testViewUpgrade(true, tenantId, "TABLESCHEMA", tableWithViewName + 
"4", "VIEWSCHEMA", viewTableName + "4",
             ColumnDiff.LESS);
-        testViewUpgrade(true, TENANT_ID, "SAMESCHEMA", tableWithViewName + 
"5", "SAMESCHEMA", viewTableName + "5",
+        testViewUpgrade(true, tenantId, "SAMESCHEMA", tableWithViewName + "5", 
"SAMESCHEMA", viewTableName + "5",
             ColumnDiff.LESS);
     }
 
@@ -385,19 +393,24 @@ public class UpgradeIT extends BaseHBaseManagedTimeIT {
 
     @Test
     public void testSettingBaseColumnCountForMultipleViewsOnTable() throws 
Exception {
-        String baseSchema = "XYZ";
-        String baseTable = "BASE_TABLE";
+        String baseSchema = "S_" + generateRandomString();
+        String baseTable = "T_" + generateRandomString();
         String fullBaseTableName = SchemaUtil.getTableName(baseSchema, 
baseTable);
         try (Connection conn = DriverManager.getConnection(getUrl())) {
             String baseTableDDL = "CREATE TABLE " + fullBaseTableName + " 
(TENANT_ID VARCHAR NOT NULL, PK1 VARCHAR NOT NULL, V1 INTEGER, V2 INTEGER 
CONSTRAINT NAME_PK PRIMARY KEY(TENANT_ID, PK1)) MULTI_TENANT = true";
             conn.createStatement().execute(baseTableDDL);
 
-            for (int i = 1; i <=2; i++) {
+            String[] tenants = new String[] {"T_" + generateRandomString(), 
"T_" + generateRandomString()};
+            Collections.sort(Arrays.asList(tenants));
+            String[] tenantViews = new String[] {"V_" + 
generateRandomString(), "V_" + generateRandomString(), "V_" + 
generateRandomString()};
+            Collections.sort(Arrays.asList(tenantViews));
+            String[] globalViews = new String[] {"G_" + 
generateRandomString(), "G_" + generateRandomString(), "G_" + 
generateRandomString()};
+            Collections.sort(Arrays.asList(globalViews));
+            for (int i = 0; i < 2; i++) {
                 // Create views for tenants;
-                String tenant = "tenant" + i;
+                String tenant = tenants[i];
                 try (Connection tenantConn = createTenantConnection(tenant)) {
-                    String view = "TENANT_VIEW1";
-
+                    String view = tenantViews[0];
                     // view with its own column
                     String viewDDL = "CREATE VIEW " + view + " AS SELECT * 
FROM " + fullBaseTableName;
                     tenantConn.createStatement().execute(viewDDL);
@@ -406,7 +419,7 @@ public class UpgradeIT extends BaseHBaseManagedTimeIT {
                     removeBaseColumnCountKV(tenant, null, view);
 
                     // view that has the last base table column removed
-                    view = "TENANT_VIEW2";
+                    view = tenantViews[1];
                     viewDDL = "CREATE VIEW " + view + " AS SELECT * FROM " + 
fullBaseTableName;
                     tenantConn.createStatement().execute(viewDDL);
                     String droplastBaseCol = "ALTER VIEW " + view + " DROP 
COLUMN V2";
@@ -414,7 +427,7 @@ public class UpgradeIT extends BaseHBaseManagedTimeIT {
                     removeBaseColumnCountKV(tenant, null, view);
 
                     // view that has the middle base table column removed
-                    view = "TENANT_VIEW3";
+                    view = tenantViews[2];
                     viewDDL = "CREATE VIEW " + view + " AS SELECT * FROM " + 
fullBaseTableName;
                     tenantConn.createStatement().execute(viewDDL);
                     String dropMiddileBaseCol = "ALTER VIEW " + view + " DROP 
COLUMN V1";
@@ -425,47 +438,46 @@ public class UpgradeIT extends BaseHBaseManagedTimeIT {
 
             // create global views
             try (Connection globalConn = 
DriverManager.getConnection(getUrl())) {
-                String view = "GLOBAL_VIEW1";
-
+                String globalView = globalViews[0];
                 // view with its own column
-                String viewDDL = "CREATE VIEW " + view + " AS SELECT * FROM " 
+ fullBaseTableName;
+                String viewDDL = "CREATE VIEW " + globalView + " AS SELECT * 
FROM " + fullBaseTableName;
                 globalConn.createStatement().execute(viewDDL);
-                String addCols = "ALTER VIEW " + view + " ADD COL1 VARCHAR ";
+                String addCols = "ALTER VIEW " + globalView + " ADD COL1 
VARCHAR ";
                 globalConn.createStatement().execute(addCols);
-                removeBaseColumnCountKV(null, null, view);
+                removeBaseColumnCountKV(null, null, globalView);
 
                 // view that has the last base table column removed
-                view = "GLOBAL_VIEW2";
-                viewDDL = "CREATE VIEW " + view + " AS SELECT * FROM " + 
fullBaseTableName;
+                globalView = globalViews[1];
+                viewDDL = "CREATE VIEW " + globalView + " AS SELECT * FROM " + 
fullBaseTableName;
                 globalConn.createStatement().execute(viewDDL);
-                String droplastBaseCol = "ALTER VIEW " + view + " DROP COLUMN 
V2";
+                String droplastBaseCol = "ALTER VIEW " + globalView + " DROP 
COLUMN V2";
                 globalConn.createStatement().execute(droplastBaseCol);
-                removeBaseColumnCountKV(null, null, view);
+                removeBaseColumnCountKV(null, null, globalView);
 
                 // view that has the middle base table column removed
-                view = "GLOBAL_VIEW3";
-                viewDDL = "CREATE VIEW " + view + " AS SELECT * FROM " + 
fullBaseTableName;
+                globalView = globalViews[2];
+                viewDDL = "CREATE VIEW " + globalView + " AS SELECT * FROM " + 
fullBaseTableName;
                 globalConn.createStatement().execute(viewDDL);
-                String dropMiddileBaseCol = "ALTER VIEW " + view + " DROP 
COLUMN V1";
+                String dropMiddileBaseCol = "ALTER VIEW " + globalView + " 
DROP COLUMN V1";
                 globalConn.createStatement().execute(dropMiddileBaseCol);
-                removeBaseColumnCountKV(null, null, view);
+                removeBaseColumnCountKV(null, null, globalView);
             }
             
             // run upgrade
             UpgradeUtil.upgradeTo4_5_0(conn.unwrap(PhoenixConnection.class));
             
             // Verify base column counts for tenant specific views
-            for (int i = 1; i <=2 ; i++) {
-                String tenantId = "tenant" + i;
-                checkBaseColumnCount(tenantId, null, "TENANT_VIEW1", 4);
-                checkBaseColumnCount(tenantId, null, "TENANT_VIEW2", 
DIVERGED_VIEW_BASE_COLUMN_COUNT);
-                checkBaseColumnCount(tenantId, null, "TENANT_VIEW3", 
DIVERGED_VIEW_BASE_COLUMN_COUNT);
+            for (int i = 0; i < 2 ; i++) {
+                String tenantId = tenants[i];
+                checkBaseColumnCount(tenantId, null, tenantViews[0], 4);
+                checkBaseColumnCount(tenantId, null, tenantViews[1], 
DIVERGED_VIEW_BASE_COLUMN_COUNT);
+                checkBaseColumnCount(tenantId, null, tenantViews[2], 
DIVERGED_VIEW_BASE_COLUMN_COUNT);
             }
             
             // Verify base column count for global views
-            checkBaseColumnCount(null, null, "GLOBAL_VIEW1", 4);
-            checkBaseColumnCount(null, null, "GLOBAL_VIEW2", 
DIVERGED_VIEW_BASE_COLUMN_COUNT);
-            checkBaseColumnCount(null, null, "GLOBAL_VIEW3", 
DIVERGED_VIEW_BASE_COLUMN_COUNT);
+            checkBaseColumnCount(null, null, globalViews[0], 4);
+            checkBaseColumnCount(null, null, globalViews[1], 
DIVERGED_VIEW_BASE_COLUMN_COUNT);
+            checkBaseColumnCount(null, null, globalViews[2], 
DIVERGED_VIEW_BASE_COLUMN_COUNT);
         }
         
         

http://git-wip-us.apache.org/repos/asf/phoenix/blob/2d27179b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
index 2565223..9f53d12 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/UserDefinedFunctionsIT.java
@@ -65,12 +65,13 @@ import org.apache.phoenix.schema.ValueRangeExcpetion;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.QueryUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.junit.After;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
 import com.google.common.collect.Maps;
 
-public class UserDefinedFunctionsIT extends BaseOwnClusterIT{
+public class UserDefinedFunctionsIT extends BaseOwnClusterIT {
     
     protected static final String TENANT_ID = "ZZTop";
     private static String url;
@@ -190,6 +191,10 @@ public class UserDefinedFunctionsIT extends 
BaseOwnClusterIT{
     private static Properties EMPTY_PROPS = new Properties();
     
 
+    @Override
+    @After
+    public void cleanUpAfterTest() throws Exception {}
+
     private static String getProgram(String className, String evaluateMethod, 
String returnType) {
         return new StringBuffer()
                 .append("package org.apache.phoenix.end2end;\n")

Reply via email to