@Test public void testRequired() throws Exception { RollingTestCheckImpl rollingCheck = new RollingTestCheckImpl(PrereqCheckType.SERVICE); Assert.assertTrue(rollingCheck.isRequired(UpgradeType.ROLLING)); Assert.assertFalse(rollingCheck.isRequired(UpgradeType.NON_ROLLING)); NotRequiredCheckTest notRequiredCheck = new NotRequiredCheckTest(PrereqCheckType.SERVICE); Assert.assertFalse(notRequiredCheck.isRequired(UpgradeType.ROLLING)); Assert.assertFalse(notRequiredCheck.isRequired(UpgradeType.NON_ROLLING)); Assert.assertFalse(notRequiredCheck.isRequired(UpgradeType.HOST_ORDERED)); TestCheckImpl requiredCheck = new TestCheckImpl(PrereqCheckType.SERVICE); Assert.assertTrue(requiredCheck.isRequired(UpgradeType.ROLLING)); Assert.assertTrue(requiredCheck.isRequired(UpgradeType.NON_ROLLING)); Assert.assertTrue(requiredCheck.isRequired(UpgradeType.HOST_ORDERED)); }
public boolean isRequired(UpgradeType upgradeType) { UpgradeType[] upgradeTypes = getClass().getAnnotation(UpgradeCheck.class).required(); for (UpgradeType requiredType : upgradeTypes) { if (upgradeType == requiredType) { return true; } } return false; }
AbstractCheckDescriptor { public boolean isRequired(UpgradeType upgradeType) { UpgradeType[] upgradeTypes = getClass().getAnnotation(UpgradeCheck.class).required(); for (UpgradeType requiredType : upgradeTypes) { if (upgradeType == requiredType) { return true; } } return false; } }
AbstractCheckDescriptor { public boolean isRequired(UpgradeType upgradeType) { UpgradeType[] upgradeTypes = getClass().getAnnotation(UpgradeCheck.class).required(); for (UpgradeType requiredType : upgradeTypes) { if (upgradeType == requiredType) { return true; } } return false; } protected  AbstractCheckDescriptor(CheckDescription description); }
AbstractCheckDescriptor { public boolean isRequired(UpgradeType upgradeType) { UpgradeType[] upgradeTypes = getClass().getAnnotation(UpgradeCheck.class).required(); for (UpgradeType requiredType : upgradeTypes) { if (upgradeType == requiredType) { return true; } } return false; } protected  AbstractCheckDescriptor(CheckDescription description); boolean isApplicable(PrereqCheckRequest request); boolean isApplicable(PrereqCheckRequest request, List<String> requiredServices, boolean requiredAll); abstract void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request); CheckDescription getDescription(); PrereqCheckType getType(); boolean isRequired(UpgradeType upgradeType); boolean isStackUpgradeAllowedToBypassPreChecks(); }
AbstractCheckDescriptor { public boolean isRequired(UpgradeType upgradeType) { UpgradeType[] upgradeTypes = getClass().getAnnotation(UpgradeCheck.class).required(); for (UpgradeType requiredType : upgradeTypes) { if (upgradeType == requiredType) { return true; } } return false; } protected  AbstractCheckDescriptor(CheckDescription description); boolean isApplicable(PrereqCheckRequest request); boolean isApplicable(PrereqCheckRequest request, List<String> requiredServices, boolean requiredAll); abstract void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request); CheckDescription getDescription(); PrereqCheckType getType(); boolean isRequired(UpgradeType upgradeType); boolean isStackUpgradeAllowedToBypassPreChecks();  }