當前位置: 首頁>>代碼示例>>Java>>正文


Java IValidatorRule類代碼示例

本文整理匯總了Java中org.apache.kylin.cube.model.validation.IValidatorRule的典型用法代碼示例。如果您正苦於以下問題:Java IValidatorRule類的具體用法?Java IValidatorRule怎麽用?Java IValidatorRule使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IValidatorRule類屬於org.apache.kylin.cube.model.validation包,在下文中一共展示了IValidatorRule類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testCombinationIntOverflow

import org.apache.kylin.cube.model.validation.IValidatorRule; //導入依賴的package包/類
@Test
public void testCombinationIntOverflow() throws IOException {
    for (File f : new File(LocalFileMetadataTestCase.LOCALMETA_TEMP_DATA + "/cube_desc/").listFiles()) {
        if (f.getName().endsWith("bad")) {
            String path = f.getPath();
            f.renameTo(new File(path.substring(0, path.length() - 4)));
        }
    }

    ValidateContext vContext = new ValidateContext();
    CubeDesc desc = JsonUtil.readValue(new FileInputStream(LocalFileMetadataTestCase.LOCALMETA_TEMP_DATA + "/cube_desc/ut_cube_desc_combination_int_overflow.json"), CubeDesc.class);

    IValidatorRule<CubeDesc> rule = getAggregationGroupRule();
    try {
        desc.init(getTestConfig());
    } catch (Exception ex) {
        // as it's a failure case, it should throw exception
    }
    rule.validate(desc, vContext);
    assertEquals(1, vContext.getResults().length);
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:22,代碼來源:AggregationGroupRuleTest.java

示例2: testOneMandatoryColumn

import org.apache.kylin.cube.model.validation.IValidatorRule; //導入依賴的package包/類
@Test
public void testOneMandatoryColumn() {
    IValidatorRule<CubeDesc> rule = new AggregationGroupSizeRule() {
        /*
         * (non-Javadoc)
         * 
         * @see
         * org.apache.kylin.metadata.validation.rule.AggregationGroupSizeRule
         * #getMaxAgrGroupSize()
         */
        @Override
        protected int getMaxAgrGroupSize() {
            return 3;
        }
    };
    rule.validate(cube, vContext);
    vContext.print(System.out);
    assertEquals("Failed to validate aggragation group error", vContext.getResults().length, 2);
    assertTrue("Failed to validate aggragation group error", vContext.getResults()[0].getMessage().startsWith("Length of the number"));
    assertTrue("Failed to validate aggragation group error", vContext.getResults()[1].getMessage().startsWith("Length of the number"));
    // assertTrue("Failed to validate aggragation group error",
    // vContext.getResults()[2].getMessage()
    // .startsWith("Hierachy column"));
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:25,代碼來源:AggregationGroupSizeRuleTest.java

示例3: testGoodDesc2

import org.apache.kylin.cube.model.validation.IValidatorRule; //導入依賴的package包/類
@Test
public void testGoodDesc2() throws IOException {

    ValidateContext vContext = new ValidateContext();
    CubeDesc desc = JsonUtil.readValue(new FileInputStream(LocalFileMetadataTestCase.LOCALMETA_TEMP_DATA + "/cube_desc/test_kylin_cube_with_slr_desc.json"), CubeDesc.class);
    desc.getAggregationGroups().get(0).getSelectRule().jointDims = new String[][] { //
            new String[] { "lstg_format_name", "lstg_site_id", "slr_segment_cd", "CATEG_LVL2_NAME" } };

    IValidatorRule<CubeDesc> rule = getAggregationGroupRule();
    rule.validate(desc, vContext);
    //vContext.print(System.out);
    assertEquals(1, vContext.getResults().length);
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:14,代碼來源:AggregationGroupRuleTest.java

示例4: testBadDesc1

import org.apache.kylin.cube.model.validation.IValidatorRule; //導入依賴的package包/類
@Test
public void testBadDesc1() throws IOException {

    ValidateContext vContext = new ValidateContext();
    CubeDesc desc = JsonUtil.readValue(new FileInputStream(LocalFileMetadataTestCase.LOCALMETA_TEMP_DATA + "/cube_desc/test_kylin_cube_with_slr_desc.json"), CubeDesc.class);
    String[] temp = Arrays.asList(desc.getAggregationGroups().get(0).getIncludes()).subList(0, 3).toArray(new String[3]);

    desc.getAggregationGroups().get(0).setIncludes(temp);
    IValidatorRule<CubeDesc> rule = getAggregationGroupRule();
    rule.validate(desc, vContext);
    //vContext.print(System.out);
    assertEquals(1, vContext.getResults().length);
    assertEquals("Aggregation group 1 'includes' dimensions not include all the dimensions:[seller_id, META_CATEG_NAME, lstg_format_name, lstg_site_id, slr_segment_cd]", (vContext.getResults()[0].getMessage()));
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:15,代碼來源:AggregationGroupRuleTest.java

示例5: testBadDesc2

import org.apache.kylin.cube.model.validation.IValidatorRule; //導入依賴的package包/類
@Test
public void testBadDesc2() throws IOException {

    ValidateContext vContext = new ValidateContext();
    CubeDesc desc = JsonUtil.readValue(new FileInputStream(LocalFileMetadataTestCase.LOCALMETA_TEMP_DATA + "/cube_desc/test_kylin_cube_with_slr_desc.json"), CubeDesc.class);
    desc.getAggregationGroups().get(0).getSelectRule().jointDims = new String[][] { //
            new String[] { "lstg_format_name", "lstg_site_id", "slr_segment_cd", "META_CATEG_NAME", "CATEG_LVL2_NAME" } };

    IValidatorRule<CubeDesc> rule = getAggregationGroupRule();
    rule.validate(desc, vContext);
    //vContext.print(System.out);
    assertEquals(2, vContext.getResults().length);
    assertEquals("Aggregation group 1 joint dimensions has overlap with more than 1 dimensions in same hierarchy: [CATEG_LVL2_NAME, META_CATEG_NAME]", (vContext.getResults()[0].getMessage()));
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:15,代碼來源:AggregationGroupRuleTest.java

示例6: testGoodDesc

import org.apache.kylin.cube.model.validation.IValidatorRule; //導入依賴的package包/類
@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);
    }
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:12,代碼來源:RowKeyAttrRuleTest.java

示例7: testBadDesc

import org.apache.kylin.cube.model.validation.IValidatorRule; //導入依賴的package包/類
@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()));
}
 
開發者ID:apache,項目名稱:kylin,代碼行數:12,代碼來源:RowKeyAttrRuleTest.java

示例8: testOneMandatoryColumn

import org.apache.kylin.cube.model.validation.IValidatorRule; //導入依賴的package包/類
@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"));
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:9,代碼來源:RowKeyAttrRuleTest.java

示例9: testOneMandatoryColumn

import org.apache.kylin.cube.model.validation.IValidatorRule; //導入依賴的package包/類
@Test
public void testOneMandatoryColumn() {
    IValidatorRule<CubeDesc> rule = new MandatoryColumnRule();
    rule.validate(cube, vContext);
    assertTrue("Failed to validate mandatory error", vContext.getResults().length == 1);
    assertTrue("Failed to validate mandatory error", vContext.getResults()[0].getMessage().startsWith("mandatory column"));
}
 
開發者ID:KylinOLAP,項目名稱:Kylin,代碼行數:8,代碼來源:MandatoryColumnRuleTest.java


注:本文中的org.apache.kylin.cube.model.validation.IValidatorRule類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。