Source:
public void testNoAnnotationsIfChangeDetectionDisabled() throws Exception { Assume.assumeTrue(HbaseCompatCapabilities.hasPreWALAppend()); try (Connection conn = DriverManager.getConnection(getUrl())) { conn.setAutoCommit(true); SchemaBuilder builder = new SchemaBuilder(getUrl()); SchemaBuilder.TableOptions tableOptions = getTableOptions(); tableOptions.setChangeDetectionEnabled(false); builder.withTableOptions(tableOptions).build(); PTable table = PhoenixRuntime.getTableNoCache(conn, builder.getEntityTableName()); Assert.assertFalse("Change detection is enabled when it shouldn't be!", table.isChangeDetectionEnabled()); String upsertSql = "UPSERT INTO " + builder.getEntityTableName() + " VALUES" + " ('a', 'b', '2', 'bc', '3')"; conn.createStatement().execute(upsertSql); List<Map<String, byte[]>> entries = getEntriesForTable(TableName.valueOf(builder.getPhysicalTableName(false))); Assert.assertEquals(0, entries.size()); String enableSql = "ALTER TABLE " + builder.getEntityTableName() + " SET " + CHANGE_DETECTION_ENABLED + "=TRUE"; conn.createStatement().execute(enableSql); table = PhoenixRuntime.getTableNoCache(conn, builder.getEntityTableName()); Assert.assertTrue("Change detection is disabled when it should be enabled!", table.isChangeDetectionEnabled()); String disableSql = "ALTER TABLE " + builder.getEntityTableName() + " SET " + CHANGE_DETECTION_ENABLED + "=FALSE"; conn.createStatement().execute(disableSql); table = PhoenixRuntime.getTableNoCache(conn, builder.getEntityTableName()); Assert.assertFalse("Change detection is enabled when it should be disabled!", table.isChangeDetectionEnabled()); conn.createStatement().execute(upsertSql); entries = getEntriesForTable(TableName.valueOf(builder.getPhysicalTableName(false))); Assert.assertEquals(0, entries.size()); } }

Target:
public void testNoAnnotationsIfChangeDetectionDisabled() throws Exception { Assume.assumeTrue(HbaseCompatCapabilities.hasPreWALAppend()); try (Connection conn = DriverManager.getConnection(getUrl())) { conn.setAutoCommit(true); SchemaBuilder builder = new SchemaBuilder(getUrl()); SchemaBuilder.TableOptions tableOptions = getTableOptions(); tableOptions.setChangeDetectionEnabled(false); builder.withTableOptions(tableOptions).build(); PTable table = PhoenixRuntime.getTableNoCache(conn, builder.getEntityTableName()); assertFalse("Change detection is enabled when it shouldn't be!", table.isChangeDetectionEnabled()); String upsertSql = "UPSERT INTO " + builder.getEntityTableName() + " VALUES" + " ('a', 'b', '2', 'bc', '3')"; conn.createStatement().execute(upsertSql); List<Map<String, byte[]>> entries = getEntriesForTable(TableName.valueOf(builder.getPhysicalTableName(false))); assertEquals(0, entries.size()); String enableSql = "ALTER TABLE " + builder.getEntityTableName() + " SET " + CHANGE_DETECTION_ENABLED + "=TRUE"; conn.createStatement().execute(enableSql); table = PhoenixRuntime.getTableNoCache(conn, builder.getEntityTableName()); assertTrue("Change detection is disabled when it should be enabled!", table.isChangeDetectionEnabled()); String disableSql = "ALTER TABLE " + builder.getEntityTableName() + " SET " + CHANGE_DETECTION_ENABLED + "=FALSE"; conn.createStatement().execute(disableSql); table = PhoenixRuntime.getTableNoCache(conn, builder.getEntityTableName()); assertFalse("Change detection is enabled when it should be disabled!", table.isChangeDetectionEnabled()); conn.createStatement().execute(upsertSql); entries = getEntriesForTable(TableName.valueOf(builder.getPhysicalTableName(false))); assertEquals(0, entries.size()); } }