use of alluxio.hub.proto.ValidationResult in project alluxio by Alluxio.
the class ManagerProcessContextTest method testConvertValidationResult.
@Test
public void testConvertValidationResult() {
Map<ValidationUtils.State, List<ValidationTaskResult>> res = new HashMap<>();
List<ValidationTaskResult> results = new ArrayList<>();
results.add(new ValidationTaskResult().setName("test1").setState(ValidationUtils.State.FAILED).setDesc("aaaa").setOutput("bbbb").setAdvice("adv1"));
List<ValidationTaskResult> results2 = new ArrayList<>();
results2.add(new ValidationTaskResult().setName("test2").setState(ValidationUtils.State.SKIPPED).setDesc("cccc").setOutput("dddd").setOutput("out2").setAdvice("adv2"));
res.put(ValidationUtils.State.FAILED, results);
res.put(ValidationUtils.State.SKIPPED, results2);
List<ValidationResult> conv = HubUtil.convertValidationResult(res);
assertEquals(2, conv.size());
assertEquals(1, conv.stream().filter(f -> f.getName().equals("test1")).count());
assertEquals(1, conv.stream().filter(f -> f.getName().equals("test2")).count());
ValidationResult t1 = conv.stream().filter(f -> f.getName().equals("test1")).findAny().orElseThrow(() -> new RuntimeException("Didn't have test1 object"));
assertEquals(ValidationStatus.FAILED, t1.getTestResult());
assertEquals("adv1", t1.getAdvice());
assertEquals("aaaa", t1.getDescription());
assertEquals("bbbb", t1.getOutput());
}
Aggregations