UpgradeCatalog250 extends AbstractUpgradeCatalog { protected String getUpdatedTezHistoryUrlBase(String currentTezHistoryUrlBase) throws AmbariException{ String pattern = "(.*)(\\/views\\/TEZ\\/)(.*)"; Pattern regex = Pattern.compile(pattern); Matcher matcher = regex.matcher(currentTezHistoryUrlBase); String prefix; if (matcher.find()) { prefix = matcher.group(1); } else { throw new AmbariException("Cannot prepare the new value for property: 'tez.tez-ui.history-url.base' using the old value: '" + currentTezHistoryUrlBase + "'"); } return prefix + "/view/TEZ/tez_cluster_instance"; } @Inject  UpgradeCatalog250(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion(); static final String COMPONENT_TABLE; static final String COMPONENT_VERSION_TABLE; static final String COMPONENT_VERSION_PK; static final String COMPONENT_VERSION_FK_COMPONENT; static final String COMPONENT_VERSION_FK_REPO_VERSION; }
@Test(expected = AmbariException.class) public void shouldThrowExceptionWhenOldTezViewUrlIsInvalid() throws Exception { upgradeCatalog250.getUpdatedTezHistoryUrlBase("Invalid URL"); }
@Test public void shouldCreateRightTezAutoUrl() throws Exception { String newUrl = upgradeCatalog250.getUpdatedTezHistoryUrlBase("http: Assert.assertEquals("incorrect tez view url create.", "http: }