Search in sources :

Example 1 with ValidationResult

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());
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) ValidationResult(alluxio.hub.proto.ValidationResult) ValidationTaskResult(alluxio.cli.ValidationTaskResult) BaseHubTest(alluxio.hub.test.BaseHubTest) Test(org.junit.Test)

Aggregations

ValidationTaskResult (alluxio.cli.ValidationTaskResult)1 ValidationResult (alluxio.hub.proto.ValidationResult)1 BaseHubTest (alluxio.hub.test.BaseHubTest)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Test (org.junit.Test)1