private String getColInAggrGroup(AggregationGroup g, String name) { for (String c : g.getIncludes()) { if (c.toLowerCase(Locale.ROOT).contains(name.toLowerCase(Locale.ROOT))) return c; } throw new IllegalStateException(); }
if (agg.getIncludes() == null) { logger.error("Aggregation group " + index + " 'includes' field not set"); throw new IllegalStateException("Aggregation group " + index + " includes field not set"); getDims(includeDims, agg.getIncludes());
if (agg.getIncludes() == null) { context.addResult(ResultLevel.ERROR, AGGREGATION_GROUP + index + " 'includes' field not set"); continue; if (agg.getIncludes() != null) { for (String include : agg.getIncludes()) { includeDims.add(include);
@Test public void testBadInit3() throws Exception { thrown.expect(IllegalStateException.class); thrown.expectMessage("Aggregation group 1 'includes' dimensions not include all the dimensions:"); CubeDesc cubeDesc = CubeDescManager.getInstance(getTestConfig()).getCubeDesc(CUBE_WITH_SLR_DESC); String[] temp = Arrays.asList(cubeDesc.getAggregationGroups().get(0).getIncludes()).subList(0, 3) .toArray(new String[3]); cubeDesc.getAggregationGroups().get(0).setIncludes(temp); cubeDesc.init(getTestConfig()); }
@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())); }
AggregationGroup lag = lc.getAggregationGroups().get(i); AggregationGroup iag = ic.getAggregationGroups().get(i); assertArrayEquals(lag.getIncludes(), iag.getIncludes()); assertArrayEquals(lag.getSelectRule().mandatoryDims, iag.getSelectRule().mandatoryDims); assertArrayEquals(lag.getSelectRule().hierarchyDims, iag.getSelectRule().hierarchyDims);
if (agg.getIncludes() == null) { logger.error("Aggregation group " + index + " 'includes' field not set"); throw new IllegalStateException("Aggregation group " + index + " includes field not set"); getDims(includeDims, agg.getIncludes());
if (agg.getIncludes() == null) { context.addResult(ResultLevel.ERROR, AGGREGATION_GROUP + index + " 'includes' field not set"); continue; if (agg.getIncludes() != null) { for (String include : agg.getIncludes()) { includeDims.add(include);