Source:
public void testCreateCoprocs() throws Exception { String schemaName = "S" + generateUniqueName(); String tableName = "T_" + generateUniqueName(); String indexName = "I_" + generateUniqueName(); String physicalTableName = SchemaUtil.getPhysicalHBaseTableName(schemaName, tableName, isNamespaceMapped).getString(); String physicalIndexName = SchemaUtil.getPhysicalHBaseTableName(schemaName, indexName, isNamespaceMapped).getString(); Admin admin = ((PhoenixConnection) getConnection()).getQueryServices().getAdmin(); createBaseTable(schemaName, tableName, isMultiTenant, 0, null); createIndexTable(schemaName, tableName, indexName); HTableDescriptor baseDescriptor = admin.getTableDescriptor(TableName.valueOf(physicalTableName)); HTableDescriptor indexDescriptor = admin.getTableDescriptor(TableName.valueOf(physicalIndexName)); assertCoprocsContains(IndexRegionObserver.class, baseDescriptor); assertCoprocsContains(GlobalIndexChecker.class, indexDescriptor); removeCoproc(IndexRegionObserver.class, baseDescriptor, admin); removeCoproc(IndexRegionObserver.class, indexDescriptor, admin); removeCoproc(GlobalIndexChecker.class, indexDescriptor, admin); Map<String, String> props = new HashMap<String, String>(); props.put(NonTxIndexBuilder.CODEC_CLASS_NAME_KEY, PhoenixIndexCodec.class.getName()); Indexer.enableIndexing(baseDescriptor, NonTxIndexBuilder.class, props, 100); admin.modifyTable(baseDescriptor.getTableName(), baseDescriptor); baseDescriptor = admin.getTableDescriptor(TableName.valueOf(physicalTableName)); indexDescriptor = admin.getTableDescriptor(TableName.valueOf(physicalIndexName)); assertUsingOldCoprocs(baseDescriptor, indexDescriptor); createBaseTable(schemaName, tableName, true, 0, null); baseDescriptor = admin.getTableDescriptor(TableName.valueOf(physicalTableName)); indexDescriptor = admin.getTableDescriptor(TableName.valueOf(physicalIndexName)); assertUsingOldCoprocs(baseDescriptor, indexDescriptor); }

Target:
public void testCreateCoprocs() throws Exception { String schemaName = "S_" + generateUniqueName(); String tableName = "T_" + generateUniqueName(); String indexName = "I_" + generateUniqueName(); String physicalTableName = SchemaUtil.getPhysicalHBaseTableName(schemaName, tableName, isNamespaceMapped).getString(); String physicalIndexName = SchemaUtil.getPhysicalHBaseTableName(schemaName, indexName, isNamespaceMapped).getString(); Admin admin = ((PhoenixConnection) getConnection()).getQueryServices().getAdmin(); createBaseTable(schemaName, tableName, isMultiTenant, 0, null); createIndexTable(schemaName, tableName, indexName); HTableDescriptor baseDescriptor = admin.getTableDescriptor(TableName.valueOf(physicalTableName)); HTableDescriptor indexDescriptor = admin.getTableDescriptor(TableName.valueOf(physicalIndexName)); assertUsingNewCoprocs(baseDescriptor, indexDescriptor); downgradeIndexCoprocs(admin, baseDescriptor, indexDescriptor); baseDescriptor = admin.getTableDescriptor(TableName.valueOf(physicalTableName)); indexDescriptor = admin.getTableDescriptor(TableName.valueOf(physicalIndexName)); assertUsingOldCoprocs(baseDescriptor, indexDescriptor); createBaseTable(schemaName, tableName, true, 0, null); baseDescriptor = admin.getTableDescriptor(TableName.valueOf(physicalTableName)); indexDescriptor = admin.getTableDescriptor(TableName.valueOf(physicalIndexName)); assertUsingOldCoprocs(baseDescriptor, indexDescriptor); }