@Override public VerifyResult verify(ApplicationId appId, T input) { // Checks if DataSet name is an ID String name = getName(input); if (!EntityId.isValidId(name)) { return VerifyResult.failure(Err.NOT_AN_ID, name); } return VerifyResult.success(); } protected abstract String getName(T input);
@Override public VerifyResult verify(ApplicationId appId, T input) { // Checks if DataSet name is an ID String name = getName(input); if (!EntityId.isValidId(name)) { return VerifyResult.failure(Err.NOT_AN_ID, name); } return VerifyResult.success(); } protected abstract String getName(T input);
/** * Verifies {@link ApplicationSpecification} being provide. * * @param input to be verified * @return An instance of {@link VerifyResult} depending of status of verification. */ @Override public VerifyResult verify(ApplicationId appId, final ApplicationSpecification input) { VerifyResult verifyResult = super.verify(appId, input); if (!verifyResult.isSuccess()) { return verifyResult; } // Check if there is at least one of the following : Flow or MapReduce or Workflow for now. // TODO (terence): Logic here is really not good. Need to refactor. if (input.getFlows().isEmpty() && input.getMapReduce().isEmpty() && input.getSpark().isEmpty() && input.getWorkflows().isEmpty() && input.getServices().isEmpty() && input.getWorkers().isEmpty()) { return VerifyResult.failure(Err.Application.ATLEAST_ONE_PROCESSOR, input.getName()); } return VerifyResult.success(); }
/** * Verifies {@link ApplicationSpecification} being provide. * * @param input to be verified * @return An instance of {@link VerifyResult} depending of status of verification. */ @Override public VerifyResult verify(ApplicationId appId, final ApplicationSpecification input) { VerifyResult verifyResult = super.verify(appId, input); if (!verifyResult.isSuccess()) { return verifyResult; } // Check if there is at least one program // Loop through all program types. For each program type, get the number of programs of that type. // Then sum up total number of programs. int numberOfPrograms = Arrays.stream(ProgramType.values()) .mapToInt(t -> input.getProgramsByType(t).size()) .reduce(0, (l, r) -> l + r); if (numberOfPrograms <= 0) { return VerifyResult.failure(Err.Application.ATLEAST_ONE_PROCESSOR, input.getName()); } return VerifyResult.success(); }
return VerifyResult.success();