Repository: incubator-eagle Updated Branches: refs/heads/master 53a74633e -> 327351b92
[EAGLE-754] Refactor - move ignored test class to corresponding module With this commit, improving code coverage of eagle-entity-base to 51%, code coverage of eagle-query-base to 54% Author: chang chen <baibaic...@gmail.com> Closes #628 from baibaichen/feature/UT. Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/327351b9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/327351b9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/327351b9 Branch: refs/heads/master Commit: 327351b92ce2f050d4cfc6a3cd6f3990b22555a5 Parents: 53a7463 Author: chang chen <baibaic...@gmail.com> Authored: Wed Nov 9 16:46:44 2016 +0800 Committer: Hao Chen <h...@apache.org> Committed: Wed Nov 9 16:46:44 2016 +0800 ---------------------------------------------------------------------- .../TestGenericEntityIndexStreamReader.java | 2 - .../eagle/log/entity/TestTestLogAPIEntity.java | 2 - eagle-core/eagle-query/eagle-query-base/pom.xml | 13 + .../apache/eagle/query/TestHBaseLogReader2.java | 160 ++++++++++++ .../eagle/query/TestListQueryCompiler.java | 243 +++++++++++++++++++ .../service/generic/TestHBaseLogReader2.java | 164 ------------- .../service/generic/TestListQueryCompiler.java | 243 ------------------- .../service/generic/TestListQueryResource.java | 1 - 8 files changed, 416 insertions(+), 412 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/327351b9/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/TestGenericEntityIndexStreamReader.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/TestGenericEntityIndexStreamReader.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/TestGenericEntityIndexStreamReader.java index ae07f4e..1e9e6cb 100755 --- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/TestGenericEntityIndexStreamReader.java +++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/TestGenericEntityIndexStreamReader.java @@ -26,14 +26,12 @@ import org.apache.eagle.log.entity.test.TestLogAPIEntity; import org.apache.eagle.query.parser.EagleQueryParser; import org.apache.eagle.service.hbase.TestHBaseBase; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -@Ignore public class TestGenericEntityIndexStreamReader extends TestHBaseBase { @Test http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/327351b9/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/TestTestLogAPIEntity.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/TestTestLogAPIEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/TestTestLogAPIEntity.java index 2c8dbea..1839a99 100755 --- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/TestTestLogAPIEntity.java +++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/TestTestLogAPIEntity.java @@ -26,7 +26,6 @@ import org.apache.eagle.log.entity.old.GenericDeleter; import org.apache.eagle.log.entity.test.TestLogAPIEntity; import org.apache.eagle.service.hbase.TestHBaseBase; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import java.lang.reflect.InvocationTargetException; @@ -34,7 +33,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -@Ignore public class TestTestLogAPIEntity extends TestHBaseBase { @Test http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/327351b9/eagle-core/eagle-query/eagle-query-base/pom.xml ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-query/eagle-query-base/pom.xml b/eagle-core/eagle-query/eagle-query-base/pom.xml index f0eda4d..f830c27 100644 --- a/eagle-core/eagle-query/eagle-query-base/pom.xml +++ b/eagle-core/eagle-query/eagle-query-base/pom.xml @@ -44,5 +44,18 @@ <artifactId>commons-lang3</artifactId> <version>${commons-lang3.version}</version> </dependency> + <dependency> + <groupId>org.apache.eagle</groupId> + <artifactId>eagle-embed-hbase</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.eagle</groupId> + <artifactId>eagle-embed-hbase</artifactId> + <version>${project.version}</version> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/327351b9/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestHBaseLogReader2.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestHBaseLogReader2.java b/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestHBaseLogReader2.java new file mode 100755 index 0000000..e3db5c0 --- /dev/null +++ b/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestHBaseLogReader2.java @@ -0,0 +1,160 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.eagle.query;; + +import org.apache.eagle.common.ByteUtil; +import org.apache.eagle.common.DateTimeUtil; +import org.apache.eagle.log.entity.GenericEntityBatchReader; +import org.apache.eagle.log.entity.GenericEntityWriter; +import org.apache.eagle.log.entity.SearchCondition; +import org.apache.eagle.log.entity.meta.EntityDefinition; +import org.apache.eagle.log.entity.meta.EntityDefinitionManager; +import org.apache.eagle.log.entity.test.TestTimeSeriesAPIEntity; +import org.apache.eagle.query.ListQueryCompiler; +import org.apache.eagle.service.hbase.EmbeddedHbase; +import org.apache.hadoop.hbase.util.Bytes; +import org.junit.Assert; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +public class TestHBaseLogReader2 { + private final static Logger LOG = LoggerFactory.getLogger(TestHBaseLogReader2.class); + private static EmbeddedHbase hbase = EmbeddedHbase.getInstance(); + + @SuppressWarnings("serial") + @Test + public void testStartTimeInclusiveEndTimeExclusive() throws Exception { + EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestTimeSeriesAPIEntity.class); + hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily()); + + EntityDefinitionManager.registerEntity(TestTimeSeriesAPIEntity.class); + + final String cluster = "cluster1"; + final String datacenter = "dc1"; + String serviceName = "TestTimeSeriesAPIEntity"; + GenericEntityWriter writer = new GenericEntityWriter(serviceName); + List<TestTimeSeriesAPIEntity> entities = new ArrayList<TestTimeSeriesAPIEntity>(); + TestTimeSeriesAPIEntity entity = new TestTimeSeriesAPIEntity(); + long timestamp1 = DateTimeUtil.humanDateToSeconds("2014-04-08 03:00:00")*1000; + LOG.info("First entity timestamp:" + timestamp1); + entity.setTimestamp(timestamp1); + entity.setTags(new HashMap<String, String>(){{ + put("cluster", cluster); + put("datacenter", datacenter); + }}); + entity.setField7("field7"); + entities.add(entity); + + entity = new TestTimeSeriesAPIEntity(); + long timestamp2 = DateTimeUtil.humanDateToSeconds("2014-05-08 04:00:00")*1000; + LOG.info("Second entity timestamp:" + timestamp2); + entity.setTimestamp(timestamp2); + entity.setTags(new HashMap<String, String>(){{ + put("cluster", cluster); + put("datacenter", datacenter); + }}); + entity.setField7("field7_2"); + entities.add(entity); + writer.write(entities); + + // for timezone difference between UTC & localtime, enlarge the search range + long queryStartTimestamp = timestamp1-24*60*60*1000; + long queryEndTimestamp = timestamp1+24*60*60*1000; + LOG.info("Query start timestamp:" + queryStartTimestamp); + LOG.info("Query end timestamp:" + queryEndTimestamp); + + String format = "%s[@cluster=\"%s\" AND @datacenter=\"%s\"]{%s}"; + String query = String.format(format, serviceName, cluster, datacenter, "@field7"); + ListQueryCompiler comp = new ListQueryCompiler(query); + SearchCondition condition = new SearchCondition(); + condition.setFilter(comp.filter()); + condition.setQueryExpression(comp.getQueryExpression()); + condition.setOutputFields(comp.outputFields()); + + final List<String[]> partitionValues = comp.getQueryPartitionValues(); + if (partitionValues != null) { + condition.setPartitionValues(Arrays.asList(partitionValues.get(0))); + } + + condition.setStartRowkey(null); + condition.setPageSize(Integer.MAX_VALUE); + condition.setStartTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(0)); + condition.setEndTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryEndTimestamp)); + + GenericEntityBatchReader reader = new GenericEntityBatchReader(serviceName, condition); + List<TestTimeSeriesAPIEntity> list = reader.read(); + + Assert.assertEquals(1, list.size()); + Assert.assertEquals(timestamp1, list.get(0).getTimestamp()); + Assert.assertEquals("field7", list.get(0).getField7()); + + // for timezone difference between UTC & localtime, enlarge the search range + queryStartTimestamp = timestamp1-24*60*60*1000; + queryEndTimestamp = timestamp2+24*60*60*1000; // eagle timestamp is rounded to seconds + condition.setStartTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryStartTimestamp)); + condition.setEndTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryEndTimestamp)); + reader = new GenericEntityBatchReader(serviceName, condition); + list = reader.read(); + Assert.assertEquals(2, list.size()); + + queryStartTimestamp = timestamp1; + queryEndTimestamp = timestamp1; // eagle timestamp is rounded to seconds + condition.setStartTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryStartTimestamp)); + condition.setEndTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryEndTimestamp)); + reader = new GenericEntityBatchReader(serviceName, condition); + list = reader.read(); + Assert.assertEquals(0, list.size()); + hbase.deleteTable(entityDefinition.getTable()); + + } + + @Test + public void testByteComparison(){ + byte[] byte1 = new byte[]{-23, 12, 63}; + byte[] byte2 = ByteUtil.concat(byte1, new byte[]{0}); + Assert.assertTrue(Bytes.compareTo(byte1, byte2) < 0); + byte[] byte3 = ByteUtil.concat(byte1, new byte[]{127}); + Assert.assertTrue(Bytes.compareTo(byte2, byte3) < 0); + byte[] byte4 = ByteUtil.concat(byte1, new byte[]{-128}); + Assert.assertTrue(Bytes.compareTo(byte4, byte3) > 0); + } + + @Test + public void testMaxByteInBytesComparision(){ + int max = -1000000; +// int maxb = -1000000; + System.out.println("Byte MaxValue: " + Byte.MAX_VALUE); + System.out.println("Byte MaxValue: " + Byte.MIN_VALUE); + for(int i=-128; i<128; i++){ + byte b = (byte)i; + int tmp = b & 0xff; + max = Math.max(max, tmp); + } + System.out.println(max); + + byte b = -1; + System.out.println(b & 0xff); + } +} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/327351b9/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestListQueryCompiler.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestListQueryCompiler.java b/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestListQueryCompiler.java new file mode 100755 index 0000000..341c976 --- /dev/null +++ b/eagle-core/eagle-query/eagle-query-base/src/test/java/org/apache/eagle/query/TestListQueryCompiler.java @@ -0,0 +1,243 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * + */ +package org.apache.eagle.query; + +import org.apache.eagle.log.entity.meta.EntityDefinition; +import org.apache.eagle.log.entity.meta.EntityDefinitionManager; +import org.apache.eagle.log.entity.test.TestLogAPIEntity; +import org.apache.eagle.query.parser.ORExpression; +import org.apache.eagle.query.aggregate.AggregateFunctionType; +import org.apache.eagle.query.ListQueryCompiler; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; + +/** + * @since Nov 10, 2014 + */ +public class TestListQueryCompiler { + + private static final Logger LOG = LoggerFactory.getLogger(TestListQueryCompiler.class); + + @Before + public void prepare() throws Exception{ + String[] partitions = new String[2]; + partitions[0] = "cluster"; + partitions[1] = "datacenter"; + EntityDefinitionManager.registerEntity(TestLogAPIEntity.class); + EntityDefinition entityDef = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity"); + entityDef.setPartitions(partitions); + entityDef.setTimeSeries(true); + } + + /**************************************************************************************************/ + /*********************************** Test Expression In List Query*********************************/ + /**************************************************************************************************/ + + @Test + public void testListQueryWithoutExpression() throws Exception{ + String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND @field5 > 0.05]{@cluster, @field1}"; + ListQueryCompiler compiler = new ListQueryCompiler(query, false); + ORExpression filter = compiler.getQueryExpression(); + Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND @field5>0.05)"); + List<String> aggFields = compiler.aggregateFields(); + Assert.assertTrue(aggFields == null); + List<String> outputFields = compiler.outputFields(); + Assert.assertEquals(outputFields.size(), 2); + Assert.assertTrue(outputFields.contains("cluster")); + Assert.assertTrue(outputFields.contains("field1")); + } + + @Test + public void testListQueryWithExpressionEndWithNumberInFilter() throws Exception{ + String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@field5 + @field6} > 0.05]{@cluster, @field1}"; + ListQueryCompiler compiler = new ListQueryCompiler(query, false); + ORExpression filter = compiler.getQueryExpression(); + Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND field5 + field6>0.05)"); + List<String> aggFields = compiler.aggregateFields(); + Assert.assertTrue(aggFields == null); + List<String> outputFields = compiler.outputFields(); + Assert.assertEquals(outputFields.size(), 2); + Assert.assertTrue(outputFields.contains("cluster")); + Assert.assertTrue(outputFields.contains("field1")); + } + + @Test + public void testListQueryWithExpressionEndWithRPARENInFilter() throws Exception{ + String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND (EXP{@field5 + @field6} > 0.05)]{@cluster, @field1}"; + ListQueryCompiler compiler = new ListQueryCompiler(query, false); + ORExpression filter = compiler.getQueryExpression(); + LOG.info(filter.toString()); + Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND field5 + field6>0.05)"); + List<String> aggFields = compiler.aggregateFields(); + Assert.assertTrue(aggFields == null); + List<String> outputFields = compiler.outputFields(); + Assert.assertEquals(outputFields.size(), 2); + Assert.assertTrue(outputFields.contains("cluster")); + Assert.assertTrue(outputFields.contains("field1")); + + query = "TestLogAPIEntity[(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND (EXP{@field5 + @field6} > 0.05))]{@cluster, @field1}"; + compiler = new ListQueryCompiler(query, false); + filter = compiler.getQueryExpression(); + Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND field5 + field6>0.05)"); + aggFields = compiler.aggregateFields(); + Assert.assertTrue(aggFields == null); + outputFields = compiler.outputFields(); + Assert.assertEquals(outputFields.size(), 2); + Assert.assertTrue(outputFields.contains("cluster")); + Assert.assertTrue(outputFields.contains("field1")); + } + + @Test + public void testListQueryWithExpressionEndWithRBRACEInFilter() throws Exception{ + String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{0.05 + @c + @d}]{@cluster, EXP{@a + @b}}"; + ListQueryCompiler compiler = new ListQueryCompiler(query, false); + ORExpression filter = compiler.getQueryExpression(); + Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>0.05 + c + d)"); + List<String> aggFields = compiler.aggregateFields(); + Assert.assertTrue(aggFields == null); + List<String> outputFields = compiler.outputFields(); +// Assert.assertEquals(outputFields.size(), 2); + Assert.assertTrue(outputFields.contains("cluster")); + Assert.assertTrue(outputFields.contains("EXP{a + b}")); + } + + /**************************************************************************************************/ + /*********************************** Test Expression In Group By Query*********************************/ + /**************************************************************************************************/ + + @Test + public void testGroupByQueryAggWithoutExpressionInAggFunc() throws Exception{ + String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{@c + @d} AND EXP{@a + @c} < EXP{@b + @d + 0.05}]<@cluster, @datacenter>{sum(@a), avg(@b)}"; + ListQueryCompiler compiler = new ListQueryCompiler(query, false); + ORExpression filter = compiler.getQueryExpression(); + LOG.info(filter.toString()); + Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>c + d AND a + c<b + d + 0.05)"); + + List<String> groupByFields = compiler.groupbyFields(); + Assert.assertEquals(groupByFields.size(), 2); + Assert.assertTrue(groupByFields.contains("cluster")); + Assert.assertTrue(groupByFields.contains("datacenter")); + + List<AggregateFunctionType> functions = compiler.aggregateFunctionTypes(); + Assert.assertEquals(functions.size(), 2); + Assert.assertTrue(functions.contains(AggregateFunctionType.sum)); + Assert.assertTrue(functions.contains(AggregateFunctionType.avg)); + + List<String> aggFields = compiler.aggregateFields(); + Assert.assertEquals(aggFields.size(), 2); + Assert.assertTrue(aggFields.contains("a")); + Assert.assertTrue(aggFields.contains("b")); + } + + @Test + public void testGroupByQueryAggWithExpressionInAggFunc() throws Exception{ + String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{@c + @d} AND EXP{@a + @c} < EXP{@b + @d + 0.07}]<@cluster, @datacenter>{sum(EXP{@a+@b+20.0}), avg(EXP{(@a+@c + 2.5)/@d}), count}"; + ListQueryCompiler compiler = new ListQueryCompiler(query, false); + ORExpression filter = compiler.getQueryExpression(); + LOG.info(filter.toString()); + Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>c + d AND a + c<b + d + 0.07)"); + + List<String> groupByFields = compiler.groupbyFields(); + Assert.assertEquals(groupByFields.size(), 2); + Assert.assertTrue(groupByFields.contains("cluster")); + Assert.assertTrue(groupByFields.contains("datacenter")); + + List<AggregateFunctionType> functions = compiler.aggregateFunctionTypes(); + Assert.assertEquals(functions.size(), 3); + Assert.assertTrue(functions.contains(AggregateFunctionType.sum)); + Assert.assertTrue(functions.contains(AggregateFunctionType.avg)); + Assert.assertTrue(functions.contains(AggregateFunctionType.count)); + + List<String> aggFields = compiler.aggregateFields(); + Assert.assertEquals(aggFields.size(), 3); + Assert.assertTrue(aggFields.contains("EXP{a+b+20.0}")); + Assert.assertTrue(aggFields.contains("EXP{(a+c + 2.5)/d}")); + Assert.assertTrue(aggFields.contains("count")); + } + + /**************************************************************************************************/ + /*********************************** Test Expression In Sort Query*********************************/ + /**************************************************************************************************/ + + @Test + public void testSortQueryWithoutExpressionInSort() throws Exception{ + String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{@c + @d} AND EXP{@a + @c} < EXP{@b + @d}]<@cluster, @datacenter>" + + "{sum(@a), count}.{sum(@a) asc}"; + ListQueryCompiler compiler = new ListQueryCompiler(query, false); + ORExpression filter = compiler.getQueryExpression(); + LOG.info(filter.toString()); + Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>c + d AND a + c<b + d)"); + + List<String> groupByFields = compiler.groupbyFields(); + Assert.assertEquals(groupByFields.size(), 2); + Assert.assertTrue(groupByFields.contains("cluster")); + Assert.assertTrue(groupByFields.contains("datacenter")); + + List<AggregateFunctionType> functions = compiler.aggregateFunctionTypes(); + Assert.assertEquals(functions.size(), 2); + Assert.assertTrue(functions.contains(AggregateFunctionType.sum)); + Assert.assertTrue(functions.contains(AggregateFunctionType.count)); + + List<String> aggFields = compiler.aggregateFields(); + Assert.assertEquals(aggFields.size(), 2); + Assert.assertTrue(aggFields.contains("a")); + Assert.assertTrue(aggFields.contains("count")); + + List<String> sortFields = compiler.sortFields(); + Assert.assertEquals(sortFields.size(), 1); + Assert.assertTrue(sortFields.contains("a")); + } + + @Test + public void testSortQuerySortWithExpressionInSort() throws Exception{ + String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{@c + @d} AND EXP{@a + @c} < EXP{@b + @d + 0.05}]<@cluster, @datacenter>" + + "{sum(EXP{@a+@b+0.07}), max(EXP{(@a+@c)/@d}), min(EXP{@a+@b})}.{sum(EXP{@a+@b+0.07}) asc}"; + ListQueryCompiler compiler = new ListQueryCompiler(query, false); + ORExpression filter = compiler.getQueryExpression(); + LOG.info(filter.toString()); + Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>c + d AND a + c<b + d + 0.05)"); + + List<String> groupByFields = compiler.groupbyFields(); + Assert.assertEquals(groupByFields.size(), 2); + Assert.assertTrue(groupByFields.contains("cluster")); + Assert.assertTrue(groupByFields.contains("datacenter")); + + List<String> aggFields = compiler.aggregateFields(); + Assert.assertEquals(aggFields.size(), 3); + Assert.assertTrue(aggFields.contains("EXP{a+b+0.07}")); + Assert.assertTrue(aggFields.contains("EXP{(a+c)/d}")); + Assert.assertTrue(aggFields.contains("EXP{a+b}")); + + List<AggregateFunctionType> functions = compiler.aggregateFunctionTypes(); + Assert.assertEquals(functions.size(), 3); + Assert.assertTrue(functions.contains(AggregateFunctionType.sum)); + Assert.assertTrue(functions.contains(AggregateFunctionType.max)); + Assert.assertTrue(functions.contains(AggregateFunctionType.min)); + + List<String> sortFields = compiler.sortFields(); + Assert.assertEquals(sortFields.size(), 1); + Assert.assertTrue(sortFields.contains("EXP{a+b+0.07}")); + } +} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/327351b9/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestHBaseLogReader2.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestHBaseLogReader2.java b/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestHBaseLogReader2.java deleted file mode 100755 index 701a805..0000000 --- a/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestHBaseLogReader2.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.eagle.service.generic; - -import org.apache.eagle.common.ByteUtil; -import org.apache.eagle.common.DateTimeUtil; -import org.apache.eagle.log.entity.GenericEntityBatchReader; -import org.apache.eagle.log.entity.GenericEntityWriter; -import org.apache.eagle.log.entity.SearchCondition; -import org.apache.eagle.log.entity.meta.EntityDefinition; -import org.apache.eagle.log.entity.meta.EntityDefinitionManager; -import org.apache.eagle.log.entity.test.TestTimeSeriesAPIEntity; -import org.apache.eagle.query.ListQueryCompiler; -import org.apache.eagle.service.hbase.EmbeddedHbase; -import org.apache.hadoop.hbase.util.Bytes; -import org.junit.Assert; -import org.junit.Ignore; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; - -@Ignore -public class TestHBaseLogReader2 { - private final static Logger LOG = LoggerFactory.getLogger(TestHBaseLogReader2.class); - private static EmbeddedHbase hbase = EmbeddedHbase.getInstance(); - - @SuppressWarnings("serial") - @Test - public void testStartTimeInclusiveEndTimeExclusive() throws IOException, IllegalAccessException, InstantiationException { - EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestTimeSeriesAPIEntity.class); - hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily()); - - EntityDefinitionManager.registerEntity(TestTimeSeriesAPIEntity.class); - try{ - final String cluster = "cluster1"; - final String datacenter = "dc1"; - String serviceName = "TestTimeSeriesAPIEntity"; - GenericEntityWriter writer = new GenericEntityWriter(serviceName); - List<TestTimeSeriesAPIEntity> entities = new ArrayList<TestTimeSeriesAPIEntity>(); - TestTimeSeriesAPIEntity entity = new TestTimeSeriesAPIEntity(); - long timestamp1 = DateTimeUtil.humanDateToSeconds("2014-04-08 03:00:00")*1000; - LOG.info("First entity timestamp:" + timestamp1); - entity.setTimestamp(timestamp1); - entity.setTags(new HashMap<String, String>(){{ - put("cluster", cluster); - put("datacenter", datacenter); - }}); - entity.setField7("field7"); - entities.add(entity); - - entity = new TestTimeSeriesAPIEntity(); - long timestamp2 = DateTimeUtil.humanDateToSeconds("2014-05-08 04:00:00")*1000; - LOG.info("Second entity timestamp:" + timestamp2); - entity.setTimestamp(timestamp2); - entity.setTags(new HashMap<String, String>(){{ - put("cluster", cluster); - put("datacenter", datacenter); - }}); - entity.setField7("field7_2"); - entities.add(entity); - writer.write(entities); - - // for timezone difference between UTC & localtime, enlarge the search range - long queryStartTimestamp = timestamp1-24*60*60*1000; - long queryEndTimestamp = timestamp1+24*60*60*1000; - LOG.info("Query start timestamp:" + queryStartTimestamp); - LOG.info("Query end timestamp:" + queryEndTimestamp); - - String format = "%s[@cluster=\"%s\" AND @datacenter=\"%s\"]{%s}"; - String query = String.format(format, serviceName, cluster, datacenter, "@field7"); - ListQueryCompiler comp = new ListQueryCompiler(query); - SearchCondition condition = new SearchCondition(); - condition.setFilter(comp.filter()); - condition.setQueryExpression(comp.getQueryExpression()); - condition.setOutputFields(comp.outputFields()); - - final List<String[]> partitionValues = comp.getQueryPartitionValues(); - if (partitionValues != null) { - condition.setPartitionValues(Arrays.asList(partitionValues.get(0))); - } - - condition.setStartRowkey(null); - condition.setPageSize(Integer.MAX_VALUE); - condition.setStartTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(0)); - condition.setEndTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryEndTimestamp)); - - GenericEntityBatchReader reader = new GenericEntityBatchReader(serviceName, condition); - List<TestTimeSeriesAPIEntity> list = reader.read(); - - Assert.assertEquals(1, list.size()); - Assert.assertEquals(timestamp1, list.get(0).getTimestamp()); - Assert.assertEquals("field7", list.get(0).getField7()); - - // for timezone difference between UTC & localtime, enlarge the search range - queryStartTimestamp = timestamp1-24*60*60*1000; - queryEndTimestamp = timestamp2+24*60*60*1000; // eagle timestamp is rounded to seconds - condition.setStartTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryStartTimestamp)); - condition.setEndTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryEndTimestamp)); - reader = new GenericEntityBatchReader(serviceName, condition); - list = reader.read(); - Assert.assertEquals(2, list.size()); - - queryStartTimestamp = timestamp1; - queryEndTimestamp = timestamp1; // eagle timestamp is rounded to seconds - condition.setStartTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryStartTimestamp)); - condition.setEndTime(DateTimeUtil.millisecondsToHumanDateWithSeconds(queryEndTimestamp)); - reader = new GenericEntityBatchReader(serviceName, condition); - list = reader.read(); - Assert.assertEquals(0, list.size()); - hbase.deleteTable(entityDefinition.getTable()); - }catch(Exception ex){ - LOG.error("error", ex); - Assert.fail(); - } - } - - @Test - public void testByteComparison(){ - byte[] byte1 = new byte[]{-23, 12, 63}; - byte[] byte2 = ByteUtil.concat(byte1, new byte[]{0}); - Assert.assertTrue(Bytes.compareTo(byte1, byte2) < 0); - byte[] byte3 = ByteUtil.concat(byte1, new byte[]{127}); - Assert.assertTrue(Bytes.compareTo(byte2, byte3) < 0); - byte[] byte4 = ByteUtil.concat(byte1, new byte[]{-128}); - Assert.assertTrue(Bytes.compareTo(byte4, byte3) > 0); - } - - @Test - public void testMaxByteInBytesComparision(){ - int max = -1000000; -// int maxb = -1000000; - System.out.println("Byte MaxValue: " + Byte.MAX_VALUE); - System.out.println("Byte MaxValue: " + Byte.MIN_VALUE); - for(int i=-128; i<128; i++){ - byte b = (byte)i; - int tmp = b & 0xff; - max = Math.max(max, tmp); - } - System.out.println(max); - - byte b = -1; - System.out.println(b & 0xff); - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/327351b9/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryCompiler.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryCompiler.java b/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryCompiler.java deleted file mode 100755 index 9610e54..0000000 --- a/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryCompiler.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/** - * - */ -package org.apache.eagle.service.generic; - -import org.apache.eagle.log.entity.meta.EntityDefinition; -import org.apache.eagle.log.entity.meta.EntityDefinitionManager; -import org.apache.eagle.log.entity.test.TestLogAPIEntity; -import org.apache.eagle.query.parser.ORExpression; -import org.apache.eagle.query.aggregate.AggregateFunctionType; -import org.apache.eagle.query.ListQueryCompiler; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -/** - * @since Nov 10, 2014 - */ -public class TestListQueryCompiler { - - private static final Logger LOG = LoggerFactory.getLogger(TestListQueryCompiler.class); - - @Before - public void prepare() throws Exception{ - String[] partitions = new String[2]; - partitions[0] = "cluster"; - partitions[1] = "datacenter"; - EntityDefinitionManager.registerEntity(TestLogAPIEntity.class); - EntityDefinition entityDef = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity"); - entityDef.setPartitions(partitions); - entityDef.setTimeSeries(true); - } - - /**************************************************************************************************/ - /*********************************** Test Expression In List Query*********************************/ - /**************************************************************************************************/ - - @Test - public void testListQueryWithoutExpression() throws Exception{ - String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND @field5 > 0.05]{@cluster, @field1}"; - ListQueryCompiler compiler = new ListQueryCompiler(query, false); - ORExpression filter = compiler.getQueryExpression(); - Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND @field5>0.05)"); - List<String> aggFields = compiler.aggregateFields(); - Assert.assertTrue(aggFields == null); - List<String> outputFields = compiler.outputFields(); - Assert.assertEquals(outputFields.size(), 2); - Assert.assertTrue(outputFields.contains("cluster")); - Assert.assertTrue(outputFields.contains("field1")); - } - - @Test - public void testListQueryWithExpressionEndWithNumberInFilter() throws Exception{ - String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@field5 + @field6} > 0.05]{@cluster, @field1}"; - ListQueryCompiler compiler = new ListQueryCompiler(query, false); - ORExpression filter = compiler.getQueryExpression(); - Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND field5 + field6>0.05)"); - List<String> aggFields = compiler.aggregateFields(); - Assert.assertTrue(aggFields == null); - List<String> outputFields = compiler.outputFields(); - Assert.assertEquals(outputFields.size(), 2); - Assert.assertTrue(outputFields.contains("cluster")); - Assert.assertTrue(outputFields.contains("field1")); - } - - @Test - public void testListQueryWithExpressionEndWithRPARENInFilter() throws Exception{ - String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND (EXP{@field5 + @field6} > 0.05)]{@cluster, @field1}"; - ListQueryCompiler compiler = new ListQueryCompiler(query, false); - ORExpression filter = compiler.getQueryExpression(); - LOG.info(filter.toString()); - Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND field5 + field6>0.05)"); - List<String> aggFields = compiler.aggregateFields(); - Assert.assertTrue(aggFields == null); - List<String> outputFields = compiler.outputFields(); - Assert.assertEquals(outputFields.size(), 2); - Assert.assertTrue(outputFields.contains("cluster")); - Assert.assertTrue(outputFields.contains("field1")); - - query = "TestLogAPIEntity[(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND (EXP{@field5 + @field6} > 0.05))]{@cluster, @field1}"; - compiler = new ListQueryCompiler(query, false); - filter = compiler.getQueryExpression(); - Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND field5 + field6>0.05)"); - aggFields = compiler.aggregateFields(); - Assert.assertTrue(aggFields == null); - outputFields = compiler.outputFields(); - Assert.assertEquals(outputFields.size(), 2); - Assert.assertTrue(outputFields.contains("cluster")); - Assert.assertTrue(outputFields.contains("field1")); - } - - @Test - public void testListQueryWithExpressionEndWithRBRACEInFilter() throws Exception{ - String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{0.05 + @c + @d}]{@cluster, EXP{@a + @b}}"; - ListQueryCompiler compiler = new ListQueryCompiler(query, false); - ORExpression filter = compiler.getQueryExpression(); - Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>0.05 + c + d)"); - List<String> aggFields = compiler.aggregateFields(); - Assert.assertTrue(aggFields == null); - List<String> outputFields = compiler.outputFields(); -// Assert.assertEquals(outputFields.size(), 2); - Assert.assertTrue(outputFields.contains("cluster")); - Assert.assertTrue(outputFields.contains("EXP{a + b}")); - } - - /**************************************************************************************************/ - /*********************************** Test Expression In Group By Query*********************************/ - /**************************************************************************************************/ - - @Test - public void testGroupByQueryAggWithoutExpressionInAggFunc() throws Exception{ - String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{@c + @d} AND EXP{@a + @c} < EXP{@b + @d + 0.05}]<@cluster, @datacenter>{sum(@a), avg(@b)}"; - ListQueryCompiler compiler = new ListQueryCompiler(query, false); - ORExpression filter = compiler.getQueryExpression(); - LOG.info(filter.toString()); - Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>c + d AND a + c<b + d + 0.05)"); - - List<String> groupByFields = compiler.groupbyFields(); - Assert.assertEquals(groupByFields.size(), 2); - Assert.assertTrue(groupByFields.contains("cluster")); - Assert.assertTrue(groupByFields.contains("datacenter")); - - List<AggregateFunctionType> functions = compiler.aggregateFunctionTypes(); - Assert.assertEquals(functions.size(), 2); - Assert.assertTrue(functions.contains(AggregateFunctionType.sum)); - Assert.assertTrue(functions.contains(AggregateFunctionType.avg)); - - List<String> aggFields = compiler.aggregateFields(); - Assert.assertEquals(aggFields.size(), 2); - Assert.assertTrue(aggFields.contains("a")); - Assert.assertTrue(aggFields.contains("b")); - } - - @Test - public void testGroupByQueryAggWithExpressionInAggFunc() throws Exception{ - String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{@c + @d} AND EXP{@a + @c} < EXP{@b + @d + 0.07}]<@cluster, @datacenter>{sum(EXP{@a+@b+20.0}), avg(EXP{(@a+@c + 2.5)/@d}), count}"; - ListQueryCompiler compiler = new ListQueryCompiler(query, false); - ORExpression filter = compiler.getQueryExpression(); - LOG.info(filter.toString()); - Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>c + d AND a + c<b + d + 0.07)"); - - List<String> groupByFields = compiler.groupbyFields(); - Assert.assertEquals(groupByFields.size(), 2); - Assert.assertTrue(groupByFields.contains("cluster")); - Assert.assertTrue(groupByFields.contains("datacenter")); - - List<AggregateFunctionType> functions = compiler.aggregateFunctionTypes(); - Assert.assertEquals(functions.size(), 3); - Assert.assertTrue(functions.contains(AggregateFunctionType.sum)); - Assert.assertTrue(functions.contains(AggregateFunctionType.avg)); - Assert.assertTrue(functions.contains(AggregateFunctionType.count)); - - List<String> aggFields = compiler.aggregateFields(); - Assert.assertEquals(aggFields.size(), 3); - Assert.assertTrue(aggFields.contains("EXP{a+b+20.0}")); - Assert.assertTrue(aggFields.contains("EXP{(a+c + 2.5)/d}")); - Assert.assertTrue(aggFields.contains("count")); - } - - /**************************************************************************************************/ - /*********************************** Test Expression In Sort Query*********************************/ - /**************************************************************************************************/ - - @Test - public void testSortQueryWithoutExpressionInSort() throws Exception{ - String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{@c + @d} AND EXP{@a + @c} < EXP{@b + @d}]<@cluster, @datacenter>" - + "{sum(@a), count}.{sum(@a) asc}"; - ListQueryCompiler compiler = new ListQueryCompiler(query, false); - ORExpression filter = compiler.getQueryExpression(); - LOG.info(filter.toString()); - Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>c + d AND a + c<b + d)"); - - List<String> groupByFields = compiler.groupbyFields(); - Assert.assertEquals(groupByFields.size(), 2); - Assert.assertTrue(groupByFields.contains("cluster")); - Assert.assertTrue(groupByFields.contains("datacenter")); - - List<AggregateFunctionType> functions = compiler.aggregateFunctionTypes(); - Assert.assertEquals(functions.size(), 2); - Assert.assertTrue(functions.contains(AggregateFunctionType.sum)); - Assert.assertTrue(functions.contains(AggregateFunctionType.count)); - - List<String> aggFields = compiler.aggregateFields(); - Assert.assertEquals(aggFields.size(), 2); - Assert.assertTrue(aggFields.contains("a")); - Assert.assertTrue(aggFields.contains("count")); - - List<String> sortFields = compiler.sortFields(); - Assert.assertEquals(sortFields.size(), 1); - Assert.assertTrue(sortFields.contains("a")); - } - - @Test - public void testSortQuerySortWithExpressionInSort() throws Exception{ - String query = "TestLogAPIEntity[@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND EXP{@a + @b} > EXP{@c + @d} AND EXP{@a + @c} < EXP{@b + @d + 0.05}]<@cluster, @datacenter>" - + "{sum(EXP{@a+@b+0.07}), max(EXP{(@a+@c)/@d}), min(EXP{@a+@b})}.{sum(EXP{@a+@b+0.07}) asc}"; - ListQueryCompiler compiler = new ListQueryCompiler(query, false); - ORExpression filter = compiler.getQueryExpression(); - LOG.info(filter.toString()); - Assert.assertEquals(filter.toString(), "(@cluster=\"cluster\" AND @datacenter=\"datacenter\" AND a + b>c + d AND a + c<b + d + 0.05)"); - - List<String> groupByFields = compiler.groupbyFields(); - Assert.assertEquals(groupByFields.size(), 2); - Assert.assertTrue(groupByFields.contains("cluster")); - Assert.assertTrue(groupByFields.contains("datacenter")); - - List<String> aggFields = compiler.aggregateFields(); - Assert.assertEquals(aggFields.size(), 3); - Assert.assertTrue(aggFields.contains("EXP{a+b+0.07}")); - Assert.assertTrue(aggFields.contains("EXP{(a+c)/d}")); - Assert.assertTrue(aggFields.contains("EXP{a+b}")); - - List<AggregateFunctionType> functions = compiler.aggregateFunctionTypes(); - Assert.assertEquals(functions.size(), 3); - Assert.assertTrue(functions.contains(AggregateFunctionType.sum)); - Assert.assertTrue(functions.contains(AggregateFunctionType.max)); - Assert.assertTrue(functions.contains(AggregateFunctionType.min)); - - List<String> sortFields = compiler.sortFields(); - Assert.assertEquals(sortFields.size(), 1); - Assert.assertTrue(sortFields.contains("EXP{a+b+0.07}")); - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/327351b9/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryResource.java ---------------------------------------------------------------------- diff --git a/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryResource.java b/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryResource.java index 0f5a049..7384c70 100755 --- a/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryResource.java +++ b/eagle-core/eagle-query/eagle-service-base/src/test/java/org/apache/eagle/service/generic/TestListQueryResource.java @@ -38,7 +38,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -@Ignore public class TestListQueryResource extends TestHBaseBase { HTableInterface table;