org.apache.kylin.cube.model.validation.rule.RowKeyAttrRule Java Examples

The following examples show how to use org.apache.kylin.cube.model.validation.rule.RowKeyAttrRule. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RowKeyAttrRuleTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testGoodDesc() throws IOException {
    for (File f : new File(LocalFileMetadataTestCase.LOCALMETA_TEST_DATA + "/cube_desc/").listFiles()) {
        CubeDesc desc = JsonUtil.readValue(new FileInputStream(f), CubeDesc.class);
        ValidateContext vContext = new ValidateContext();
        IValidatorRule<CubeDesc> rule = new RowKeyAttrRule();
        rule.validate(desc, vContext);
        vContext.print(System.out);
        assertTrue(vContext.getResults().length == 0);
    }
}
 
Example #2
Source File: RowKeyAttrRuleTest.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testBadDesc() throws IOException {
    ValidateContext vContext = new ValidateContext();
    CubeDesc desc = JsonUtil.readValue(new FileInputStream(LocalFileMetadataTestCase.LOCALMETA_TEST_DATA + "/cube_desc/test_kylin_cube_with_slr_desc.json"), CubeDesc.class);
    desc.getRowkey().getRowKeyColumns()[2].setColumn("");
    IValidatorRule<CubeDesc> rule = new RowKeyAttrRule();
    rule.validate(desc, vContext);
    vContext.print(System.out);
    assertTrue(vContext.getResults().length == 1);
    assertTrue("Rowkey column empty".equalsIgnoreCase(vContext.getResults()[0].getMessage()));
}
 
Example #3
Source File: RowKeyAttrRuleTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testGoodDesc() throws IOException {
    for (File f : new File(LocalFileMetadataTestCase.LOCALMETA_TEST_DATA + "/cube_desc/").listFiles()) {
        CubeDesc desc = JsonUtil.readValue(new FileInputStream(f), CubeDesc.class);
        ValidateContext vContext = new ValidateContext();
        IValidatorRule<CubeDesc> rule = new RowKeyAttrRule();
        rule.validate(desc, vContext);
        vContext.print(System.out);
        assertTrue(vContext.getResults().length == 0);
    }
}
 
Example #4
Source File: RowKeyAttrRuleTest.java    From kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testBadDesc() throws IOException {
    ValidateContext vContext = new ValidateContext();
    CubeDesc desc = JsonUtil.readValue(new FileInputStream(LocalFileMetadataTestCase.LOCALMETA_TEST_DATA + "/cube_desc/test_kylin_cube_with_slr_desc.json"), CubeDesc.class);
    desc.getRowkey().getRowKeyColumns()[2].setColumn("");
    IValidatorRule<CubeDesc> rule = new RowKeyAttrRule();
    rule.validate(desc, vContext);
    vContext.print(System.out);
    assertTrue(vContext.getResults().length == 1);
    assertTrue("Rowkey column empty".equalsIgnoreCase(vContext.getResults()[0].getMessage()));
}
 
Example #5
Source File: RowKeyAttrRuleTest.java    From Kylin with Apache License 2.0 5 votes vote down vote up
@Test
public void testOneMandatoryColumn() {
    IValidatorRule<CubeDesc> rule = new RowKeyAttrRule();
    rule.validate(cube, vContext);
    vContext.print(System.out);
    assertTrue("Failed to validate rowkey", vContext.getResults().length == 1);
    assertTrue("Failed to validate mandatory error", vContext.getResults()[0].getMessage().startsWith("Rowkey column"));
}