本文整理汇总了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);
}
示例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"));
}
示例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);
}
示例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()));
}
示例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()));
}
示例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);
}
}
示例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()));
}
示例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"));
}
示例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"));
}