### Question:
UpgradeCatalog270 extends AbstractUpgradeCatalog { protected String updateInfraSolrEnv(String content) { return content.replaceAll("SOLR_KERB_NAME_RULES=\".*\"", "") .replaceAll("#*SOLR_HOST=\".*\"", "SOLR_HOST=`hostname -f`") .replaceAll("SOLR_AUTHENTICATION_CLIENT_CONFIGURER=\".*\"", "SOLR_AUTH_TYPE=\"kerberos\""); } @Inject  UpgradeCatalog270(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion(); static final String[] COMPONENT_NAME_SERVICE_NAME_CLUSTER_ID_KEY_COLUMNS; static final String[] SERVICE_NAME_CLUSTER_ID_KEY_COLUMNS; static final String AMBARI_INFRA_OLD_NAME; static final String AMBARI_INFRA_NEW_NAME; static final String SERVICE_CONFIG_MAPPING_TABLE; static final String CLUSTER_CONFIG_TABLE; static final String FK_HOSTCOMPONENTDESIREDSTATE_COMPONENT_NAME; static final String FK_HOSTCOMPONENTSTATE_COMPONENT_NAME; static final String FK_SERVICECOMPONENTDESIREDSTATE_SERVICE_NAME; }### Answer:
@Test public void testupdateInfraSolrEnv() { String solrConfigXml = "#SOLR_HOST=\"192.168.1.1\"\n" + "SOLR_HOST=\"192.168.1.1\"\n" + "SOLR_KERB_NAME_RULES=\"{{infra_solr_kerberos_name_rules}}\"\n" + "SOLR_AUTHENTICATION_CLIENT_CONFIGURER=\"org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer\""; UpgradeCatalog270 upgradeCatalog270 = createMockBuilder(UpgradeCatalog270.class) .createMock(); replay(upgradeCatalog270); String updated = upgradeCatalog270.updateInfraSolrEnv(solrConfigXml); assertThat(updated, is("SOLR_HOST=`hostname -f`\nSOLR_HOST=`hostname -f`\n\nSOLR_AUTH_TYPE=\"kerberos\"")); verify(upgradeCatalog270); }