Source:
public void testGlobalImmutableIndexCreate() throws Exception { if (localIndex || transactionProvider != null) { return; } Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); String tableName = "TBL_" + generateUniqueName(); String indexName = "IND_" + generateUniqueName(); String fullTableName = SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName); String fullIndexName = SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName); TABLE_NAME = fullTableName; try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.setAutoCommit(true); int numRows = 1; createAndPopulateTableAndIndexForConsistentIndex(conn, fullTableName, fullIndexName, numRows); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT COUNT(*) FROM " + TABLE_NAME); assertTrue(rs.next()); assertEquals(numRows, rs.getInt(1)); rs = conn.createStatement().executeQuery("SELECT COUNT(*) FROM " + fullIndexName); assertTrue(rs.next()); assertEquals(numRows, rs.getInt(1)); verifyRowsForEmptyColValue(conn, fullIndexName, IndexRegionObserver.VERIFIED_BYTES); try (Admin admin = conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin();) { admin.disableTable(TableName.valueOf(fullIndexName)); boolean isWriteOnDisabledIndexFailed = false; try { upsertRows(conn, fullTableName, numRows); } catch (CommitException ex) { isWriteOnDisabledIndexFailed = true; } assertEquals(true, isWriteOnDisabledIndexFailed); PIndexState indexState = TestUtil.getIndexState(conn, fullIndexName); assertEquals(PIndexState.ACTIVE, indexState); } } }

Target:
public void testGlobalImmutableIndexCreate() throws Exception { if (localIndex || transactionProvider != null) { return; } Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); ArrayList<String> immutableStorageProps = new ArrayList<String>(); immutableStorageProps.add(null); if (!tableDDLOptions.contains(IMMUTABLE_STORAGE_SCHEME)) { immutableStorageProps.add(SINGLE_CELL_ARRAY_WITH_OFFSETS.toString()); } try (Connection conn = DriverManager.getConnection(getUrl(), props)) { conn.setAutoCommit(true); for (String storageProp : immutableStorageProps) { String tableName = "TBL_" + generateUniqueName(); String indexName = "IND_" + generateUniqueName(); String fullTableName = SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName); String fullIndexName = SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName); TABLE_NAME = fullTableName; int numRows = 1; createAndPopulateTableAndIndexForConsistentIndex(conn, fullTableName, fullIndexName, numRows, storageProp); ResultSet rs; rs = conn.createStatement().executeQuery("SELECT COUNT(*) FROM " + TABLE_NAME); assertTrue(rs.next()); assertEquals(numRows, rs.getInt(1)); rs = conn.createStatement().executeQuery("SELECT COUNT(*) FROM " + fullIndexName); assertTrue(rs.next()); assertEquals(numRows, rs.getInt(1)); assertEquals(true, verifyRowsForEmptyColValue(conn, fullIndexName, IndexRegionObserver.VERIFIED_BYTES)); try (Admin admin = conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin();) { admin.disableTable(TableName.valueOf(fullIndexName)); boolean isWriteOnDisabledIndexFailed = false; try { upsertRows(conn, fullTableName, numRows); } catch (SQLException ex) { isWriteOnDisabledIndexFailed = true; } assertEquals(true, isWriteOnDisabledIndexFailed); PIndexState indexState = TestUtil.getIndexState(conn, fullIndexName); assertEquals(PIndexState.ACTIVE, indexState); } } } }