@Test public void testPerform() throws Exception { final Cluster cluster = Mockito.mock(Cluster.class); Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster); final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); Mockito.when(cluster.getDesiredConfigs()).thenReturn(Collections.singletonMap("yarn-site", desiredConfig)); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); final Map<String, String> properties = new HashMap<String, String>(); Mockito.when(config.getProperties()).thenReturn(properties); PrerequisiteCheck check = new PrerequisiteCheck(null, null); servicesYarnWorkPreservingCheck.perform(check, new PrereqCheckRequest("cluster")); Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus()); properties.put("yarn.resourcemanager.work-preserving-recovery.enabled", "true"); check = new PrerequisiteCheck(null, null); servicesYarnWorkPreservingCheck.perform(check, new PrereqCheckRequest("cluster")); Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus()); }
@Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { String propertyValue = getProperty(request, "yarn-site", "yarn.resourcemanager.work-preserving-recovery.enabled"); if (null == propertyValue || !BooleanUtils.toBoolean(propertyValue)) { prerequisiteCheck.getFailedOn().add("YARN"); prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } }
ServicesYarnWorkPreservingCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { String propertyValue = getProperty(request, "yarn-site", "yarn.resourcemanager.work-preserving-recovery.enabled"); if (null == propertyValue || !BooleanUtils.toBoolean(propertyValue)) { prerequisiteCheck.getFailedOn().add("YARN"); prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } }
ServicesYarnWorkPreservingCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { String propertyValue = getProperty(request, "yarn-site", "yarn.resourcemanager.work-preserving-recovery.enabled"); if (null == propertyValue || !BooleanUtils.toBoolean(propertyValue)) { prerequisiteCheck.getFailedOn().add("YARN"); prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } ServicesYarnWorkPreservingCheck(); }
ServicesYarnWorkPreservingCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { String propertyValue = getProperty(request, "yarn-site", "yarn.resourcemanager.work-preserving-recovery.enabled"); if (null == propertyValue || !BooleanUtils.toBoolean(propertyValue)) { prerequisiteCheck.getFailedOn().add("YARN"); prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } ServicesYarnWorkPreservingCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request); }
ServicesYarnWorkPreservingCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { String propertyValue = getProperty(request, "yarn-site", "yarn.resourcemanager.work-preserving-recovery.enabled"); if (null == propertyValue || !BooleanUtils.toBoolean(propertyValue)) { prerequisiteCheck.getFailedOn().add("YARN"); prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } ServicesYarnWorkPreservingCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request);  }