You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eagle.apache.org by ha...@apache.org on 2015/11/19 11:47:18 UTC

[11/55] [abbrv] [partial] incubator-eagle git commit: [EAGLE-46] Rename package name as "org.apache.eagle"

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/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
new file mode 100755
index 0000000..1839a99
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/TestTestLogAPIEntity.java
@@ -0,0 +1,405 @@
+/*
+ * 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.log.entity;
+
+import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
+import org.apache.eagle.log.entity.index.UniqueIndexLogReader;
+import org.apache.eagle.log.entity.meta.EntityConstants;
+import org.apache.eagle.log.entity.meta.EntityDefinition;
+import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
+import org.apache.eagle.log.entity.meta.IndexDefinition;
+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.Test;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class TestTestLogAPIEntity extends TestHBaseBase {
+
+	@Test 
+	public void testGetValue() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+		EntityDefinition ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+		if (ed == null) {
+			EntityDefinitionManager.registerEntity(TestLogAPIEntity.class);
+			ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+		}
+
+		Assert.assertNotNull(ed);
+		Assert.assertNotNull(ed.getQualifierGetterMap());
+		TestLogAPIEntity e = new TestLogAPIEntity();
+		e.setField1(1);
+		e.setField2(2);
+		e.setField3(3);
+		e.setField4(4L);
+		e.setField5(5.0);
+		e.setField6(6.0);
+		e.setField7("7");
+		e.setTags(new HashMap<String, String>());
+		e.getTags().put("tag1", "value1");
+
+		Assert.assertNotNull(ed.getQualifierGetterMap().get("field1"));
+		Assert.assertEquals(1, ed.getValue(e, "field1"));
+		Assert.assertEquals(2, ed.getValue(e, "field2"));
+		Assert.assertEquals(3L, ed.getValue(e, "field3"));
+		Assert.assertEquals(4L, ed.getValue(e, "field4"));
+		Assert.assertEquals(5.0, ed.getValue(e, "field5"));
+		Assert.assertEquals(6.0, ed.getValue(e, "field6"));
+		Assert.assertEquals("7", ed.getValue(e, "field7"));
+		Assert.assertEquals("value1", ed.getValue(e, "tag1"));
+	}
+	
+	@Test
+	public void testIndexDefinition() throws InstantiationException, IllegalAccessException {
+		
+		EntityDefinition ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+		if (ed == null) {
+			EntityDefinitionManager.registerEntity(TestLogAPIEntity.class);
+			ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+		}
+		Assert.assertNotNull(ed);
+		IndexDefinition[] indexDefinitions = ed.getIndexes();
+		Assert.assertNotNull(indexDefinitions);
+		Assert.assertEquals(2, indexDefinitions.length);
+		for (IndexDefinition def : indexDefinitions) {
+			Assert.assertNotNull(def.getIndexName());
+			Assert.assertNotNull(def.getIndexColumns());
+			Assert.assertEquals(1, def.getIndexColumns().length);
+		}
+	}
+	
+	@Test
+	public void testWriteEmptyIndexFieldAndDeleteWithoutPartition() throws Exception {
+		EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+		hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
+
+		EntityDefinition ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+		if (ed == null) {
+			EntityDefinitionManager.registerEntity(TestLogAPIEntity.class);
+			ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+		}
+		String[] partitions = ed.getPartitions();
+		ed.setPartitions(null);
+		
+		try {
+			List<TestLogAPIEntity> list = new ArrayList<TestLogAPIEntity>();
+			TestLogAPIEntity e = new TestLogAPIEntity();
+			e.setField1(1);
+			e.setField2(2);
+			e.setField3(3);
+			e.setField4(4L);
+			e.setField5(5.0);
+			e.setField6(5.0);
+			e.setField7("7");
+			e.setTags(new HashMap<String, String>());
+            e.getTags().put("tag1", "value1");
+			list.add(e);
+	
+			GenericEntityWriter writer = new GenericEntityWriter(ed.getService());
+			List<String> result = writer.write(list);
+			Assert.assertNotNull(result);
+			
+			List<byte[]> indexRowkeys = new ArrayList<byte[]>();
+			IndexDefinition[] indexDefs = ed.getIndexes();
+			for (IndexDefinition index : indexDefs) {
+				byte[] indexRowkey = index.generateIndexRowkey(e);
+				indexRowkeys.add(indexRowkey);
+			}
+			byte[][] qualifiers = new byte[7][];
+			qualifiers[0] = "a".getBytes();
+			qualifiers[1] = "b".getBytes();
+			qualifiers[2] = "c".getBytes();
+			qualifiers[3] = "d".getBytes();
+			qualifiers[4] = "e".getBytes();
+			qualifiers[5] = "f".getBytes();
+			qualifiers[6] = "g".getBytes();
+			
+			UniqueIndexLogReader reader = new UniqueIndexLogReader(indexDefs[0], indexRowkeys, qualifiers, null);
+			reader.open();
+			InternalLog log = reader.read();
+			Assert.assertNotNull(log);
+	
+			TaggedLogAPIEntity newEntity = HBaseInternalLogHelper.buildEntity(log, ed);
+			Assert.assertEquals(TestLogAPIEntity.class, newEntity.getClass());
+			TestLogAPIEntity e1 = (TestLogAPIEntity)newEntity;
+			Assert.assertEquals(e.getField1(), e1.getField1());
+			Assert.assertEquals(e.getField2(), e1.getField2());
+			Assert.assertEquals(e.getField3(), e1.getField3());
+			Assert.assertEquals(e.getField4(), e1.getField4());
+			Assert.assertEquals(e.getField5(), e1.getField5(), 0.001);
+			Assert.assertEquals(e.getField6(), e1.getField6());
+			Assert.assertEquals(e.getField7(), e1.getField7());
+			
+			log = reader.read();
+			Assert.assertNotNull(log);
+			newEntity = HBaseInternalLogHelper.buildEntity(log, ed);
+			Assert.assertEquals(TestLogAPIEntity.class, newEntity.getClass());
+			e1 = (TestLogAPIEntity)newEntity;
+			Assert.assertEquals(e.getField1(), e1.getField1());
+			Assert.assertEquals(e.getField2(), e1.getField2());
+			Assert.assertEquals(e.getField3(), e1.getField3());
+			Assert.assertEquals(e.getField4(), e1.getField4());
+			Assert.assertEquals(e.getField5(), e1.getField5(), 0.001);
+			Assert.assertEquals(e.getField6(), e1.getField6());
+			Assert.assertEquals(e.getField7(), e1.getField7());
+			
+			log = reader.read();
+			Assert.assertNull(log);
+			reader.close();
+	
+			GenericDeleter deleter = new GenericDeleter(ed.getTable(), ed.getColumnFamily());
+			deleter.delete(list);
+			
+			reader = new UniqueIndexLogReader(indexDefs[0], indexRowkeys, qualifiers, null);
+			reader.open();
+			log = reader.read();
+			Assert.assertNull(log);
+			reader.close();
+		} finally {
+			ed.setPartitions(partitions);
+		}
+		hbase.deleteTable(entityDefinition.getTable());
+	}
+	
+
+	/*
+	 *  testWriteEmptyIndexFieldAndDeleteWithPartition(eagle.log.entity.TestTestLogAPIEntity): expected:<86400000> but was:<0>
+	 */
+	//@Test
+	public void testWriteEmptyIndexFieldAndDeleteWithPartition() throws Exception {
+        EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+        hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
+
+		EntityDefinition ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+		if (ed == null) {
+			EntityDefinitionManager.registerEntity(TestLogAPIEntity.class);
+			ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+		}
+		String[] partitions = ed.getPartitions();
+		String[] newPart = new String[2];
+		newPart[0] = "cluster";
+		newPart[1] = "datacenter";
+		ed.setPartitions(newPart);
+		
+		try {
+			List<TestLogAPIEntity> list = new ArrayList<TestLogAPIEntity>();
+			TestLogAPIEntity e = new TestLogAPIEntity();
+			e.setField1(1);
+			e.setField2(2);
+			e.setField3(3);
+			e.setField4(4L);
+			e.setField5(5.0);
+			e.setField6(5.0);
+			e.setField7("7");
+			e.setTags(new HashMap<String, String>());
+			e.getTags().put("cluster", "test4UT");
+			e.getTags().put("datacenter", "dc1");
+			list.add(e);
+	
+			GenericEntityWriter writer = new GenericEntityWriter(ed.getService());
+			List<String> result = writer.write(list);
+			Assert.assertNotNull(result);
+			
+			List<byte[]> indexRowkeys = new ArrayList<byte[]>();
+			IndexDefinition[] indexDefs = ed.getIndexes();
+			for (IndexDefinition index : indexDefs) {
+				byte[] indexRowkey = index.generateIndexRowkey(e);
+				indexRowkeys.add(indexRowkey);
+			}
+			byte[][] qualifiers = new byte[9][];
+			qualifiers[0] = "a".getBytes();
+			qualifiers[1] = "b".getBytes();
+			qualifiers[2] = "c".getBytes();
+			qualifiers[3] = "d".getBytes();
+			qualifiers[4] = "e".getBytes();
+			qualifiers[5] = "f".getBytes();
+			qualifiers[6] = "g".getBytes();
+			qualifiers[7] = "cluster".getBytes();
+			qualifiers[8] = "datacenter".getBytes();
+			
+			UniqueIndexLogReader reader = new UniqueIndexLogReader(indexDefs[0], indexRowkeys, qualifiers, null);
+			reader.open();
+			InternalLog log = reader.read();
+			Assert.assertNotNull(log);
+	
+			TaggedLogAPIEntity newEntity = HBaseInternalLogHelper.buildEntity(log, ed);
+			Assert.assertEquals(TestLogAPIEntity.class, newEntity.getClass());
+			TestLogAPIEntity e1 = (TestLogAPIEntity)newEntity;
+			Assert.assertEquals(e.getField1(), e1.getField1());
+			Assert.assertEquals(e.getField2(), e1.getField2());
+			Assert.assertEquals(e.getField3(), e1.getField3());
+			Assert.assertEquals(e.getField4(), e1.getField4());
+			Assert.assertEquals(e.getField5(), e1.getField5(), 0.001);
+			Assert.assertEquals(e.getField6(), e1.getField6());
+			Assert.assertEquals(e.getField7(), e1.getField7());
+			Assert.assertEquals("test4UT", e1.getTags().get("cluster"));
+			Assert.assertEquals("dc1", e1.getTags().get("datacenter"));
+			Assert.assertEquals(EntityConstants.FIXED_WRITE_TIMESTAMP, e1.getTimestamp());
+
+			log = reader.read();
+			Assert.assertNotNull(log);
+			newEntity = HBaseInternalLogHelper.buildEntity(log, ed);
+			Assert.assertEquals(TestLogAPIEntity.class, newEntity.getClass());
+			e1 = (TestLogAPIEntity)newEntity;
+			Assert.assertEquals(e.getField1(), e1.getField1());
+			Assert.assertEquals(e.getField2(), e1.getField2());
+			Assert.assertEquals(e.getField3(), e1.getField3());
+			Assert.assertEquals(e.getField4(), e1.getField4());
+			Assert.assertEquals(e.getField5(), e1.getField5(), 0.001);
+			Assert.assertEquals(e.getField6(), e1.getField6());
+			Assert.assertEquals(e.getField7(), e1.getField7());
+			Assert.assertEquals("test4UT", e1.getTags().get("cluster"));
+			Assert.assertEquals("dc1", e1.getTags().get("datacenter"));
+			Assert.assertEquals(EntityConstants.FIXED_WRITE_TIMESTAMP, e1.getTimestamp());
+
+			log = reader.read();
+			Assert.assertNull(log);
+			reader.close();
+
+			GenericDeleter deleter = new GenericDeleter(ed.getTable(), ed.getColumnFamily());
+			deleter.delete(list);
+			
+			reader = new UniqueIndexLogReader(indexDefs[0], indexRowkeys, qualifiers, null);
+			reader.open();
+			log = reader.read();
+			Assert.assertNull(log);
+			reader.close();
+		} finally {
+			ed.setPartitions(partitions);
+		}
+		hbase.deleteTable(entityDefinition.getTable());
+	}
+
+	/**
+	 * testWriteEmptyIndexFieldAndDeleteWithPartitionAndTimeSeries(eagle.log.entity.TestTestLogAPIEntity): expected:<1434809555569> but was:<0>
+	 */
+	
+	//@Test
+	public void testWriteEmptyIndexFieldAndDeleteWithPartitionAndTimeSeries() throws Exception {
+        EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+        hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
+
+		EntityDefinition ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+		if (ed == null) {
+			EntityDefinitionManager.registerEntity(TestLogAPIEntity.class);
+			ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+		}
+		String[] partitions = ed.getPartitions();
+		String[] newPart = new String[2];
+		newPart[0] = "cluster";
+		newPart[1] = "datacenter";
+		ed.setPartitions(newPart);
+		boolean isTimeSeries = ed.isTimeSeries();
+		ed.setTimeSeries(true);
+		long now = System.currentTimeMillis();
+		
+		try {
+			List<TestLogAPIEntity> list = new ArrayList<TestLogAPIEntity>();
+			TestLogAPIEntity e = new TestLogAPIEntity();
+			e.setField1(1);
+			e.setField2(2);
+			e.setField3(3);
+			e.setField4(4L);
+			e.setField5(5.0);
+			e.setField6(5.0);
+			e.setField7("7");
+			e.setTags(new HashMap<String, String>());
+			e.getTags().put("cluster", "test4UT");
+			e.getTags().put("datacenter", "dc1");
+			e.setTimestamp(now);
+			list.add(e);
+	
+			GenericEntityWriter writer = new GenericEntityWriter(ed.getService());
+			List<String> result = writer.write(list);
+			Assert.assertNotNull(result);
+			
+			List<byte[]> indexRowkeys = new ArrayList<byte[]>();
+			IndexDefinition[] indexDefs = ed.getIndexes();
+			for (IndexDefinition index : indexDefs) {
+				byte[] indexRowkey = index.generateIndexRowkey(e);
+				indexRowkeys.add(indexRowkey);
+			}
+			byte[][] qualifiers = new byte[9][];
+			qualifiers[0] = "a".getBytes();
+			qualifiers[1] = "b".getBytes();
+			qualifiers[2] = "c".getBytes();
+			qualifiers[3] = "d".getBytes();
+			qualifiers[4] = "e".getBytes();
+			qualifiers[5] = "f".getBytes();
+			qualifiers[6] = "g".getBytes();
+			qualifiers[7] = "cluster".getBytes();
+			qualifiers[8] = "datacenter".getBytes();
+			
+			UniqueIndexLogReader reader = new UniqueIndexLogReader(indexDefs[0], indexRowkeys, qualifiers, null);
+			reader.open();
+			InternalLog log = reader.read();
+			Assert.assertNotNull(log);
+	
+			TaggedLogAPIEntity newEntity = HBaseInternalLogHelper.buildEntity(log, ed);
+			Assert.assertEquals(TestLogAPIEntity.class, newEntity.getClass());
+			TestLogAPIEntity e1 = (TestLogAPIEntity)newEntity;
+			Assert.assertEquals(e.getField1(), e1.getField1());
+			Assert.assertEquals(e.getField2(), e1.getField2());
+			Assert.assertEquals(e.getField3(), e1.getField3());
+			Assert.assertEquals(e.getField4(), e1.getField4());
+			Assert.assertEquals(e.getField5(), e1.getField5(), 0.001);
+			Assert.assertEquals(e.getField6(), e1.getField6());
+			Assert.assertEquals(e.getField7(), e1.getField7());
+			Assert.assertEquals("test4UT", e1.getTags().get("cluster"));
+			Assert.assertEquals("dc1", e1.getTags().get("datacenter"));
+			Assert.assertEquals(now, e1.getTimestamp());
+
+			log = reader.read();
+			Assert.assertNotNull(log);
+			newEntity = HBaseInternalLogHelper.buildEntity(log, ed);
+			Assert.assertEquals(TestLogAPIEntity.class, newEntity.getClass());
+			e1 = (TestLogAPIEntity)newEntity;
+			Assert.assertEquals(e.getField1(), e1.getField1());
+			Assert.assertEquals(e.getField2(), e1.getField2());
+			Assert.assertEquals(e.getField3(), e1.getField3());
+			Assert.assertEquals(e.getField4(), e1.getField4());
+			Assert.assertEquals(e.getField5(), e1.getField5(), 0.001);
+			Assert.assertEquals(e.getField6(), e1.getField6());
+			Assert.assertEquals(e.getField7(), e1.getField7());
+			Assert.assertEquals("test4UT", e1.getTags().get("cluster"));
+			Assert.assertEquals("dc1", e1.getTags().get("datacenter"));
+			Assert.assertEquals(now, e1.getTimestamp());
+
+			log = reader.read();
+			Assert.assertNull(log);
+			reader.close();
+
+			GenericDeleter deleter = new GenericDeleter(ed.getTable(), ed.getColumnFamily());
+			deleter.delete(list);
+			
+			reader = new UniqueIndexLogReader(indexDefs[0], indexRowkeys, qualifiers, null);
+			reader.open();
+			log = reader.read();
+			Assert.assertNull(log);
+			reader.close();
+		} finally {
+			ed.setPartitions(partitions);
+			ed.setTimeSeries(isTimeSeries);
+		}
+		hbase.deleteTable(entityDefinition.getTable());
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java
new file mode 100755
index 0000000..db7ce41
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java
@@ -0,0 +1,91 @@
+/*
+ * 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.log.entity.base.taggedlog;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
+import org.apache.eagle.log.entity.meta.Column;
+import junit.framework.Assert;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.junit.Test;
+
+public class TestTaggedLogAPIEntity {
+    ObjectMapper objectMapper = new ObjectMapper();
+
+    @JsonSerialize(include=JsonSerialize.Inclusion.NON_NULL)
+    private class MockSubTaggedLogAPIEntity extends TaggedLogAPIEntity {
+        public double getField1() {
+            return field1;
+        }
+
+        public void setField1(double value) {
+            this.field1 = value;
+            _pcs.firePropertyChange("field1", null, null);
+        }
+
+        @Column("a")
+        private double field1;
+
+        public String getField2() {
+            return field2;
+        }
+
+        public void setField2(String field2) {
+            this.field2 = field2;
+            _pcs.firePropertyChange("field2", null, null);
+        }
+
+        @Column("b")
+        private String field2;
+    }
+
+    @SuppressWarnings("serial")
+	@Test
+    public void testJsonSerializeFilter() throws IOException {
+        MockSubTaggedLogAPIEntity mock = new MockSubTaggedLogAPIEntity();
+        Assert.assertTrue(mock instanceof TaggedLogAPIEntity);
+
+        long timestamp = System.currentTimeMillis();
+        mock.setTimestamp(timestamp);
+        mock.setEncodedRowkey("test_encoded_row_key");
+        mock.setPrefix("mock");
+        mock.setField2("ok");
+        String json = objectMapper.filteredWriter(TaggedLogAPIEntity.getFilterProvider()).writeValueAsString(mock);
+        System.out.println(json);
+        Assert.assertTrue(json.contains("field2"));
+        Assert.assertTrue(!json.contains("field1"));
+        mock.setTimestamp(timestamp);
+        mock.setEncodedRowkey("test_encoded_row_key");
+        mock.setPrefix("mock");
+        mock.setField2("ok");
+        mock.setField1(12.345);
+        mock.setTags(new HashMap<String, String>(){{
+            put("tagName", "tagValue");
+        }});
+        mock.setExp(new HashMap<String, Object>() {{
+            put("extra_field", 3.14);
+        }});
+        json = objectMapper.filteredWriter(TaggedLogAPIEntity.getFilterProvider()).writeValueAsString(mock);
+        System.out.println(json);
+        Assert.assertTrue(json.contains("field2"));
+        Assert.assertTrue(json.contains("field1"));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestEntityQualifierHelper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestEntityQualifierHelper.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestEntityQualifierHelper.java
new file mode 100755
index 0000000..090fbc8
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestEntityQualifierHelper.java
@@ -0,0 +1,182 @@
+/*
+ * 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.log.entity.filter;
+
+import org.apache.eagle.log.entity.EntityQualifierUtils;
+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 junit.framework.Assert;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.List;
+
+/**
+* @since : 10/15/14 2014
+*/
+public class TestEntityQualifierHelper {
+	private EntityDefinition ed;
+	@Before
+	public void setUp(){
+		try {
+			if(EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity") == null){
+				EntityDefinitionManager.registerEntity(TestLogAPIEntity.class);
+			}
+			ed = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity");
+		} catch (InstantiationException e) {
+			e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+		} catch (IllegalAccessException e) {
+			e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+		}
+	}
+
+	@Test
+	public void testEd(){
+		Assert.assertNotNull(ed);
+		Assert.assertNotNull(ed.getQualifierNameMap().get("a"));
+		Assert.assertNull(ed.getQualifierNameMap().get("notexist"));
+	}
+
+	@Test
+	public void  testIntEntityQualifierHelper(){
+		byte[] value = EntityQualifierUtils.toBytes(ed, "field1", "2");
+		Assert.assertTrue(Bytes.compareTo(value, Bytes.toBytes(1)) > 0);
+		Assert.assertTrue(Bytes.compareTo(value, Bytes.toBytes(2)) == 0);
+		Assert.assertTrue(Bytes.compareTo(value, Bytes.toBytes(3)) < 0);
+	}
+
+	@Test
+	public void  testStringEntityQualifierHelper(){
+		byte[] value = EntityQualifierUtils.toBytes(ed, "field7", "xyz");
+		Assert.assertTrue(Bytes.compareTo(value, Bytes.toBytes("xyy")) > 0);
+		Assert.assertTrue(Bytes.compareTo(value, Bytes.toBytes("xyz")) == 0);
+		Assert.assertTrue(Bytes.compareTo(value, Bytes.toBytes("xzz")) < 0);
+
+		Assert.assertTrue(Bytes.compareTo(value, Bytes.toBytes("xy")) > 0);
+	}
+
+	@Test
+	public void  testDoubleEntityQualifierHelper(){
+		byte[] value = EntityQualifierUtils.toBytes(ed, "field5", "1.0");
+		Assert.assertTrue(Bytes.compareTo(value,Bytes.toBytes(0.5)) > 0);
+		Assert.assertTrue(Bytes.compareTo(value, Bytes.toBytes(1.0)) == 0);
+		Assert.assertTrue(Bytes.compareTo(value, Bytes.toBytes(2.2)) < 0);
+
+//      TODO There is problem with negative double
+//		Assert.assertTrue(Bytes.compareTo(Bytes.toBytes(-0.6),Bytes.toBytes(-0.5)) < 0);
+	}
+
+	@Test
+	public void  testLongEntityQualifierHelper(){
+		byte[] value = EntityQualifierUtils.toBytes(ed, "field4", "100000");
+		Assert.assertTrue(Bytes.compareTo(value,Bytes.toBytes(100000l-1l )) > 0);
+		Assert.assertTrue(Bytes.compareTo(value, Bytes.toBytes(100000l)) == 0);
+		Assert.assertTrue(Bytes.compareTo(value, Bytes.toBytes(100000l + 1l)) < 0);
+	}
+
+	@Test
+	public void  testNegativeLongEntityQualifierHelper(){
+		Exception ex = null;
+		try{
+			byte[] value = EntityQualifierUtils.toBytes(ed, "field4", "-100000");
+		}catch (IllegalArgumentException e){
+			ex = e;
+		}
+		Assert.assertNull(ex);
+	}
+
+	@Test
+	public void testParseAsList(){
+		List<String> set = EntityQualifierUtils.parseList("(\"abc1\",\"abc2\")");
+		Assert.assertEquals(2,set.size());
+		Assert.assertEquals("abc1",set.toArray()[0]);
+		Assert.assertEquals("abc2",set.toArray()[1]);
+
+		set = EntityQualifierUtils.parseList("(1,\"abc2\")");
+		Assert.assertEquals(2,set.size());
+		Assert.assertEquals("1",set.toArray()[0]);
+		Assert.assertEquals("abc2",set.toArray()[1]);
+
+		set = EntityQualifierUtils.parseList("(-1.5,\"abc2\")");
+		Assert.assertEquals(2,set.size());
+		Assert.assertEquals("-1.5",set.toArray()[0]);
+		Assert.assertEquals("abc2",set.toArray()[1]);
+
+		set = EntityQualifierUtils.parseList("(-1.5,\"-1.5,abc\")");
+		Assert.assertEquals(2,set.size());
+		Assert.assertEquals("-1.5",set.toArray()[0]);
+		Assert.assertEquals("-1.5,abc",set.toArray()[1]);
+
+		set = EntityQualifierUtils.parseList("(-1.5,\"\\\"abc\\\"\")");
+		Assert.assertEquals(2,set.size());
+		Assert.assertEquals("-1.5",set.toArray()[0]);
+		Assert.assertEquals("\"abc\"",set.toArray()[1]);
+
+		set = EntityQualifierUtils.parseList("(-1.5,\"-1.5,\\\"abc\")");
+		Assert.assertEquals(2,set.size());
+		Assert.assertEquals("-1.5",set.toArray()[0]);
+		Assert.assertEquals("-1.5,\"abc",set.toArray()[1]);
+
+		set = EntityQualifierUtils.parseList("(\"\\\"-1.5\\\",abc1\",\"-1.5,\\\"abc2\")");
+		Assert.assertEquals(2,set.size());
+		Assert.assertEquals("\"-1.5\",abc1",set.toArray()[0]);
+		Assert.assertEquals("-1.5,\"abc2",set.toArray()[1]);
+
+		set = EntityQualifierUtils.parseList("(-1.5,\"-1.5,\"abc\")");
+		Assert.assertEquals(2,set.size());
+		Assert.assertEquals("-1.5",set.toArray()[0]);
+		Assert.assertEquals("-1.5,\"abc",set.toArray()[1]);
+
+		set = EntityQualifierUtils.parseList("(\"\\\"value1,part1\\\",\\\"value1,part2\\\"\",\"value2\")");
+		Assert.assertEquals(2,set.size());
+		Assert.assertEquals("\"value1,part1\",\"value1,part2\"",set.toArray()[0]);
+		Assert.assertEquals("value2",set.toArray()[1]);
+
+		////////////////////////////////
+		// Bad Format
+		////////////////////////////////
+		set = EntityQualifierUtils.parseList("(\"a,b)");
+		Assert.assertEquals(1,set.size());
+		Assert.assertEquals("a,b",set.toArray()[0]);
+
+		set = EntityQualifierUtils.parseList("(a,b\")");
+		Assert.assertEquals(2,set.size());
+		Assert.assertEquals("a",set.toArray()[0]);
+		Assert.assertEquals("b",set.toArray()[1]);
+
+		set = EntityQualifierUtils.parseList("(a\",b)");
+		Assert.assertEquals(1,set.size());
+		Assert.assertEquals("a\",b",set.toArray()[0]);
+
+		set = EntityQualifierUtils.parseList("(abc,def)");
+		Assert.assertEquals(2,set.size());
+		Assert.assertEquals("abc",set.toArray()[0]);
+		Assert.assertEquals("def",set.toArray()[1]);
+
+		set = EntityQualifierUtils.parseList("(1.5,def)");
+		Assert.assertEquals(2,set.size());
+		Assert.assertEquals("1.5",set.toArray()[0]);
+		Assert.assertEquals("def",set.toArray()[1]);
+	}
+
+//	@Test
+//	public void testEscapeRegExp(){
+//		Assert.assertEquals("abc\\.def",EntityQualifierHelper.escapeRegExp("abc.def"));
+//	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestExpressionComparator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestExpressionComparator.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestExpressionComparator.java
new file mode 100755
index 0000000..bdeed52
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestExpressionComparator.java
@@ -0,0 +1,195 @@
+/*
+ * 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.log.entity.filter;
+
+import org.apache.eagle.log.entity.meta.EntityDefinition;
+import org.apache.eagle.query.parser.ComparisonOperator;
+import org.apache.eagle.query.parser.TokenType;
+import junit.framework.Assert;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TestExpressionComparator {
+    @Test
+    public void testCompareToForEval(){
+        QualifierFilterEntity entity = new QualifierFilterEntity();
+        // a+b >= a+100.0
+        entity.setKey("a/b");
+        entity.setKeyType(TokenType.EXP);
+        entity.setValue("c");
+        entity.setValueType(TokenType.EXP);
+        entity.setOp(ComparisonOperator.GREATER_OR_EQUAL);
+        EntityDefinition qualifierDisplayNameMap = null;
+        BooleanExpressionComparator comparator = new BooleanExpressionComparator(entity,qualifierDisplayNameMap);
+
+        Map<String,Double> context = new HashMap<String,Double>();
+        Assert.assertEquals("Should return 0 because not given enough variable",0,comparator.compareTo(context));
+
+        context.put("a", 80.0);
+        context.put("b",20.0);
+        context.put("c",3.0);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        context.put("a",80.0);
+        context.put("b",20.0);
+        context.put("c",4.0);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        context.put("a",80.0);
+        context.put("b",20.0);
+        context.put("c",5.0);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        // Return false once any Double.isInfinite ( 80.0 / 0.0 )
+        Assert.assertTrue(Double.isInfinite( 80.0 / 0.0 ));
+        context.put("a",80.0);
+        context.put("b",0.0);
+        context.put("c", 5.0);
+        Assert.assertEquals(0,comparator.compareTo(context));
+    }
+
+    @Test
+    public void testCompareToForOp(){
+        QualifierFilterEntity entity = new QualifierFilterEntity();
+
+        // a+b >= a+100.0
+        entity.setKey("a + b");
+        entity.setValue("a + 100.0");
+        entity.setOp(ComparisonOperator.GREATER_OR_EQUAL);
+        EntityDefinition qualifierDisplayNameMap = new EntityDefinition();
+
+        BooleanExpressionComparator comparator = new BooleanExpressionComparator(entity,qualifierDisplayNameMap);
+
+        Map<String,Double> context = new HashMap<String,Double>();
+        context.put("a",100.1);
+        context.put("b",100.1);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        context.put("a",100.1);
+        context.put("b",100.0);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        context.put("a",100.0);
+        context.put("b",99.9);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        context.put("a",-200.0);
+        context.put("b",100.0);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        context.put("a",-200.0);
+        context.put("b",-100.0);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        // a+b = a+100.0
+        entity.setOp(ComparisonOperator.GREATER);
+        comparator = new BooleanExpressionComparator(entity,qualifierDisplayNameMap);
+
+        context.put("a",100.1);
+        context.put("b",100.1);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        context.put("a",100.1);
+        context.put("b",100.0);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        context.put("a",100.0);
+        context.put("b",99.9);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        context.put("a",-200.0);
+        context.put("b",100.0);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        context.put("a",-200.0);
+        context.put("b",-100.0);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        // a+b = a+100.0
+        entity.setOp(ComparisonOperator.LESS);
+        comparator = new BooleanExpressionComparator(entity,qualifierDisplayNameMap);
+
+        context.put("a",100.1);
+        context.put("b",100.1);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        context.put("a",100.1);
+        context.put("b",100.0);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        context.put("a",100.0);
+        context.put("b",99.9);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        context.put("a",-200.0);
+        context.put("b",100.0);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        context.put("a",-200.0);
+        context.put("b",-100.0);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        // a+b <= a+100.0
+        entity.setOp(ComparisonOperator.LESS_OR_EQUAL);
+        comparator = new BooleanExpressionComparator(entity,qualifierDisplayNameMap);
+
+        context.put("a",100.1);
+        context.put("b",100.1);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        context.put("a",100.1);
+        context.put("b",100.0);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        context.put("a",100.0);
+        context.put("b",99.9);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        context.put("a",-200.0);
+        context.put("b",100.0);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        context.put("a",-200.0);
+        context.put("b",-100.0);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        entity.setOp(ComparisonOperator.NOT_EQUAL);
+        comparator = new BooleanExpressionComparator(entity,qualifierDisplayNameMap);
+
+        context.put("a",100.1);
+        context.put("b",100.1);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        context.put("a",100.1);
+        context.put("b",100.0);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        context.put("a",100.0);
+        context.put("b",99.9);
+        Assert.assertEquals(1,comparator.compareTo(context));
+
+        context.put("a",-200.0);
+        context.put("b",100.0);
+        Assert.assertEquals(0,comparator.compareTo(context));
+
+        context.put("a",-200.0);
+        context.put("b", -100.0);
+        Assert.assertEquals(1,comparator.compareTo(context));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestHBaseFilterBuilder.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestHBaseFilterBuilder.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestHBaseFilterBuilder.java
new file mode 100755
index 0000000..968be28
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestHBaseFilterBuilder.java
@@ -0,0 +1,282 @@
+/*
+ * 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.log.entity.filter;
+
+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.EagleQueryParseException;
+import org.apache.eagle.query.parser.EagleQueryParser;
+import org.apache.eagle.query.parser.ORExpression;
+import junit.framework.Assert;
+import org.apache.hadoop.hbase.filter.Filter;
+import org.apache.hadoop.hbase.filter.FilterList;
+import org.apache.hadoop.hbase.filter.RowFilter;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestHBaseFilterBuilder {
+	private final static Logger LOG = LoggerFactory.getLogger(TestHBaseFilterBuilder.class);
+	private EntityDefinition ed;
+
+	private Filter buildFilter(String query) throws EagleQueryParseException {
+		ORExpression expression = new EagleQueryParser(query).parse();
+		HBaseFilterBuilder builder = new HBaseFilterBuilder(ed,expression);
+		Filter filterList =  builder.buildFilters();
+		LOG.info("\n" + expression + " \n=> " + filterList);
+		return filterList;
+	}
+
+	@Before
+	public void setUp(){
+		try {
+			ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+			if(ed == null){
+				EntityDefinitionManager.registerEntity(TestLogAPIEntity.class);
+				ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
+			}
+		} catch (InstantiationException e) {
+			Assert.fail(e.getMessage());
+		} catch (IllegalAccessException e) {
+			Assert.fail(e.getMessage());
+		}
+	}
+
+	/**
+	 * Should success without exception
+	 */
+	@Test
+	public void testQueryParseAndBuildFilterSuccess(){
+		String[] queries = new String[]{
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID = \"job_1234\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID = \"PigLatin: \\\"quoted_pig_job_name_value\\\"\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID in (\"job_1234\",\"job_4567\")",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID in (1234,\"job_4567\")",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID in (1234,\"sample job name: \\\"quoted_job_name_value\\\"\")",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID CONTAINS \"job_1234\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID CONTAINS job_1234",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID NOT CONTAINS \"job_456\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID is \"job_789\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID is not \"job_789\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID is null",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID is not null",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID is NULL",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID is not NULL",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID = NULL",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID != null",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID =~ \".*job_1234.*\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID !=~ \".*job_1234.*\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID !=~ \"\\\\|_\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 = 1 ",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 = 1 and @field3 = 100000",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 = 1 and @field5 = 1.56",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 = 1 and @field5 > 1.56",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 = 1 and @field5 >= 1.56",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 = 1 and @field5 < 1.56",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 = 1 and @field5 <= 1.56",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and ( @field3 = 100000 or @field3 < 100000)\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and ( @field3 = 100000 or @field3 in (\"100000\",\"1\"))\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and ( @field3 = 100000 or @field3 in (\"100000\",\"1\"))\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and ( @field3 = 100000 or @field7 in (\"\\\"value1-part1,value1-part2\\\"\",\"value2\"))\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and ( @field3 = 100000 or @field3 not in (\"100000\",\"1\"))\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and ( @field3 = 100000 or @field3 NOT IN (\"100000\",\"1\"))\"",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and ( @field3 = 100000 or @field7 NOT IN (\"\\\"value1-part1,value1-part2\\\"\",\"value2\"))\"",
+			// expression filter
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and EXP{field3/field7 - field2} > 12",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field5 > EXP{field3/field7 - field2}",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and EXP{field3/field7 - field2} > EXP{field1 * field2}",
+			"@cluster = \"cluster1\" and @datacenter = \"dc1\" and EXP{field3/field7 - field2} > EXP{field1 * field2}",
+		};
+		for(String query: queries){
+			try {
+				Filter filter = buildFilter(query);
+				Assert.assertNotNull(filter);
+			} catch (EagleQueryParseException e) {
+				Assert.fail(e.getMessage());
+			} catch (Exception ex){
+				Assert.fail(ex.getMessage());
+			}
+		}
+	}
+
+	/**
+	 * Should throw exception
+	 */
+	@Test
+	public void testNegativeQueryParseSuccessfullyButBuildFilterFailed(){
+		String[] queries = new String[]{
+				"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @tag < \"job_1234\"",
+				"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @tag <= \"job_1234\"",
+				"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @tag >= \"job_1234\"",
+				"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 < null",
+				"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 <= null",
+				"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 > NULL",
+				"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 >= NULL",
+				"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 =~ NULL",
+				"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 !=~ NULL",
+				"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 contains NULL",
+				"@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field1 not contains NULL"
+		};
+		for(String query: queries){
+			try {
+				@SuppressWarnings("unused")
+				Filter filter = buildFilter(query);
+				Assert.fail("Should throw exception: "+query);
+			} catch (IllegalArgumentException e) {
+				LOG.info("Expect exception: " + e.getMessage());
+			} catch (EagleQueryParseException e) {
+				Assert.fail("Should parse successfully: "+query);
+			}
+		}
+	}
+
+	@Test
+	public void testParsedFilter(){
+		String q1 = "@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field3 = 100000";
+		try {
+			FilterList filterList = (FilterList) buildFilter(q1);
+			Assert.assertEquals(FilterList.Operator.MUST_PASS_ONE,filterList.getOperator());
+			Assert.assertEquals(1,filterList.getFilters().size());
+			Assert.assertEquals(2,((FilterList) filterList.getFilters().get(0)).getFilters().size());
+		} catch (EagleQueryParseException e) {
+			Assert.fail(e.getMessage());
+		}
+
+		String q2 = "@cluster = \"cluster1\" and @datacenter = \"dc1\" and ( @field3 = 100000 or @field3 < 100000)";
+		try {
+			FilterList filterList = (FilterList) buildFilter(q2);
+			Assert.assertEquals(FilterList.Operator.MUST_PASS_ONE,filterList.getOperator());
+			Assert.assertEquals(2,filterList.getFilters().size());
+			Assert.assertEquals(2,((FilterList) filterList.getFilters().get(0)).getFilters().size());
+		} catch (EagleQueryParseException e) {
+			Assert.fail(e.getMessage());
+		}
+
+		// Test parse success but bad type of value
+		String q3 = "@cluster = \"cluster1\" and @datacenter = \"dc1\" and ( @field3 = 100000 or @field3 < \"bad_int_100000\")";
+		boolean q3Ex = false;
+		try {
+			Assert.assertNull(buildFilter(q3));
+		} catch (EagleQueryParseException e) {
+			Assert.fail(e.getMessage());
+		} catch (IllegalArgumentException e){
+			LOG.debug("Expect: ", e);
+			Assert.assertTrue(e.getCause() instanceof NumberFormatException);
+			q3Ex = true;
+		}
+		Assert.assertTrue(q3Ex);
+	}
+
+	@Test
+	public void testWithUnescapedString(){
+		///////////////////////////////////
+		// Tag filter with IN or EQUAL
+		// Should use RowKeyFilter only
+		///////////////////////////////////
+		String query = "@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID = \"job.1234\"";
+		try {
+			FilterList filter = (FilterList) buildFilter(query);
+			Assert.assertEquals(RowFilter.class, ((FilterList) filter.getFilters().get(0)).getFilters().get(0).getClass());
+			Assert.assertFalse("Should use rowkey filter only",filter.toString().matches(".*job.1234.*"));
+		} catch (EagleQueryParseException e) {
+			Assert.fail(e.getMessage());
+		} catch (Exception ex){
+			Assert.fail(ex.getMessage());
+		}
+
+		query = "@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID in (\"job_1234\")";
+		try {
+			FilterList filter = (FilterList) buildFilter(query);
+			Assert.assertEquals(RowFilter.class, ((FilterList) filter.getFilters().get(0)).getFilters().get(0).getClass());
+			Assert.assertFalse("Should use rowkey filter only",filter.toString().matches(".*job_1234.*"));
+		} catch (EagleQueryParseException e) {
+			Assert.fail(e.getMessage());
+		} catch (Exception ex){
+			Assert.fail(ex.getMessage());
+		}
+
+		query = "@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID in (\"job.1234\")";
+		try {
+			FilterList filter = (FilterList) buildFilter(query);
+			Assert.assertEquals(RowFilter.class, ((FilterList) filter.getFilters().get(0)).getFilters().get(0).getClass());
+			Assert.assertFalse("Should use rowkey filter only",filter.toString().matches(".*job.*1234.*"));
+		} catch (EagleQueryParseException e) {
+			Assert.fail(e.getMessage());
+		} catch (Exception ex){
+			Assert.fail(ex.getMessage());
+		}
+
+		///////////////////////////////
+		// Tag with other operators
+		///////////////////////////////
+		query = "@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID =~ \"job_1234\"";
+
+		try {
+			FilterList filter = (FilterList) buildFilter(query);
+			Assert.assertEquals(RowFilter.class, ((FilterList) filter.getFilters().get(0)).getFilters().get(0).getClass());
+			Assert.assertTrue(filter.toString().matches(".*job_1234.*"));
+		} catch (EagleQueryParseException e) {
+			Assert.fail(e.getMessage());
+		} catch (Exception ex){
+			Assert.fail(ex.getMessage());
+		}
+
+		query = "@cluster = \"cluster1\" and @datacenter = \"dc1\" and @jobID =~ \"job.1234\"";
+
+		try {
+			FilterList filter = (FilterList) buildFilter(query);
+			Assert.assertEquals(RowFilter.class, ((FilterList) filter.getFilters().get(0)).getFilters().get(0).getClass());
+			Assert.assertTrue(filter.toString().matches(".*job.1234.*"));
+		} catch (EagleQueryParseException e) {
+			Assert.fail(e.getMessage());
+		} catch (Exception ex){
+			Assert.fail(ex.getMessage());
+		}
+
+		///////////////////////////////
+		// Tag with IN
+		// Should escape regexp chars
+		///////////////////////////////
+		query = "@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field7 = \"job_1234\"";
+
+		try {
+			FilterList filter = (FilterList) buildFilter(query);
+			Assert.assertEquals(RowFilter.class, ((FilterList) filter.getFilters().get(0)).getFilters().get(0).getClass());
+			Assert.assertTrue(filter.toString().matches(".*job_1234.*"));
+		} catch (EagleQueryParseException e) {
+			Assert.fail(e.getMessage());
+		} catch (Exception ex){
+			ex.printStackTrace();
+			Assert.fail(ex.getMessage());
+		}
+
+		query = "@cluster = \"cluster1\" and @datacenter = \"dc1\" and @field7 in (\"job.1234\",\"others\")";
+
+		try {
+			FilterList filter = (FilterList) buildFilter(query);
+			Assert.assertEquals(RowFilter.class, ((FilterList) filter.getFilters().get(0)).getFilters().get(0).getClass());
+			Assert.assertTrue(filter.toString().matches(".*job\\.1234.*"));
+		} catch (EagleQueryParseException e) {
+			Assert.fail(e.getMessage());
+		} catch (Exception ex){
+			Assert.fail(ex.getMessage());
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestTypedByteArrayComparator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestTypedByteArrayComparator.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestTypedByteArrayComparator.java
new file mode 100755
index 0000000..1c0f416
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/filter/TestTypedByteArrayComparator.java
@@ -0,0 +1,61 @@
+/*
+ * 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.log.entity.filter;
+
+import org.apache.eagle.log.entity.meta.DoubleSerDeser;
+import org.apache.eagle.log.entity.meta.EntitySerDeser;
+import org.apache.eagle.log.entity.meta.IntSerDeser;
+import org.apache.eagle.log.entity.meta.LongSerDeser;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @since 2014/11/17
+ */
+public class TestTypedByteArrayComparator {
+    @Test
+    public void testCompare(){
+        EntitySerDeser serDeser = new DoubleSerDeser();
+        TypedByteArrayComparator comparator = new TypedByteArrayComparator(serDeser.serialize(0.9),serDeser.type());
+        Assert.assertTrue(comparator.compareTo(serDeser.serialize(0.8)) > 0);
+        Assert.assertTrue(comparator.compareTo(serDeser.serialize(1.1)) < 0);
+        Assert.assertTrue(comparator.compareTo(serDeser.serialize(0.9)) == 0);
+        Assert.assertTrue(comparator.compareTo(serDeser.serialize(- 0.9)) > 0);
+
+        serDeser = new IntSerDeser();
+        comparator = new TypedByteArrayComparator(serDeser.serialize(9),serDeser.type());
+        Assert.assertTrue(comparator.compareTo(serDeser.serialize(8)) > 0);
+        Assert.assertTrue(comparator.compareTo(serDeser.serialize(11)) < 0);
+        Assert.assertTrue(comparator.compareTo(serDeser.serialize(9)) == 0);
+        Assert.assertTrue(comparator.compareTo(serDeser.serialize(-9)) > 0);
+
+        serDeser = new LongSerDeser();
+        comparator = new TypedByteArrayComparator(serDeser.serialize(9l),serDeser.type());
+        Assert.assertTrue(comparator.compareTo(serDeser.serialize(8l)) > 0);
+        Assert.assertTrue(comparator.compareTo(serDeser.serialize(11l)) < 0);
+        Assert.assertTrue(comparator.compareTo(serDeser.serialize(9l)) == 0);
+        Assert.assertTrue(comparator.compareTo(serDeser.serialize(-9l)) > 0);
+    }
+
+    @Test
+    public void testClassName(){
+        Assert.assertEquals("long",long.class.getName());
+        Assert.assertEquals("java.lang.Long", Long.class.getName());
+        Assert.assertEquals("long",long.class.toString());
+        Assert.assertEquals("class java.lang.Long", Long.class.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestArraySerDeser.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestArraySerDeser.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestArraySerDeser.java
new file mode 100755
index 0000000..4807b07
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestArraySerDeser.java
@@ -0,0 +1,64 @@
+/*
+ * 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.log.entity.meta;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+public class TestArraySerDeser {
+	
+	@Test
+	public void testIntArraySerDeser(){
+		IntArraySerDeser serDeser = new IntArraySerDeser();
+		int[] ints = new int[] {1, 34, 21, 82};
+		byte[] bytes = serDeser.serialize(ints);
+		Assert.assertEquals((ints.length+1)*4, bytes.length);
+		int[] targets = serDeser.deserialize(bytes);
+		Assert.assertEquals(ints.length, targets.length);
+		for(int i=0; i<ints.length; i++){
+			Assert.assertEquals(ints[i], targets[i]);
+		}
+	}
+	
+	@Test
+	public void testDoubleArraySerDeser(){
+		DoubleArraySerDeser serDeser = new DoubleArraySerDeser();
+		double[] doubles = new double[] {1.0, 34.0, 21.0, 82.0};
+		byte[] bytes = serDeser.serialize(doubles);
+		Assert.assertEquals(4 + doubles.length*8, bytes.length);
+		double[] targets = serDeser.deserialize(bytes);
+		Assert.assertEquals(doubles.length, targets.length);
+		for(int i=0; i<doubles.length; i++){
+			Assert.assertEquals(doubles[i], targets[i]);
+		}
+	}
+
+	@Test
+	public void testStringArraySerDeser(){
+		StringArraySerDeser serDeser = new StringArraySerDeser();
+		String[] sources = new String[] {"a", "", "1", "2", "3"};
+		byte[] bytes = serDeser.serialize(sources);
+		Assert.assertEquals(4 + sources.length*4 + 4, bytes.length);
+		String[] targets = serDeser.deserialize(bytes);
+		Assert.assertEquals(sources.length, targets.length);
+		for(int i=0; i<sources.length; i++){
+			Assert.assertEquals(sources[i], targets[i]);
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestEntityDefinitionManager.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestEntityDefinitionManager.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestEntityDefinitionManager.java
new file mode 100755
index 0000000..ccbca71
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestEntityDefinitionManager.java
@@ -0,0 +1,35 @@
+/*
+ * 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.log.entity.meta;
+
+import org.apache.eagle.log.entity.GenericMetricEntity;
+import org.apache.eagle.log.entity.test.TestLogAPIEntity;
+import junit.framework.Assert;
+import org.junit.Test;
+
+public class TestEntityDefinitionManager {
+    @Test
+    public void testCreateEntityDefinition(){
+        EntityDefinition entityDefinition = EntityDefinitionManager.createEntityDefinition(TestLogAPIEntity.class);
+        Assert.assertNotNull(entityDefinition);
+    }
+    @Test
+    public void testCreateMetricEntityDefinition(){
+        EntityDefinition entityDefinition = EntityDefinitionManager.createEntityDefinition(GenericMetricEntity.class);
+        Assert.assertNotNull(entityDefinition);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestListSerDeser.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestListSerDeser.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestListSerDeser.java
new file mode 100644
index 0000000..6908815
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestListSerDeser.java
@@ -0,0 +1,101 @@
+/*
+ * 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.log.entity.meta;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+public class TestListSerDeser {
+
+	@SuppressWarnings("rawtypes")
+	@Test
+	public void testStringListSerDeser() {
+		ListSerDeser serDeser = new ListSerDeser();
+		List<String> sources = new ArrayList<String>();
+		sources.add("value1");
+		sources.add("value2");
+		sources.add("value3");		
+				
+		byte[] bytes = serDeser.serialize(sources);
+		Assert.assertEquals(4 + sources.size() * 8 + 18, bytes.length);
+		List targets = serDeser.deserialize(bytes);
+		Assert.assertEquals(sources.size(), targets.size());
+		
+		Assert.assertTrue(targets.contains("value1"));
+		Assert.assertTrue(targets.contains("value2"));
+		Assert.assertTrue(targets.contains("value3"));
+	}
+
+	
+	@SuppressWarnings("rawtypes")
+	@Test
+	public void testIntegerMapSerDeser() {
+		ListSerDeser serDeser = new ListSerDeser();
+		List<Integer> sources = new ArrayList<Integer>();
+		sources.add(1);
+		sources.add(2);
+		sources.add(3);
+		
+		byte[] bytes = serDeser.serialize(sources);
+		Assert.assertEquals(4 + sources.size() * 8 + 12, bytes.length);
+		List targets = serDeser.deserialize(bytes);
+		Assert.assertEquals(sources.size(), targets.size());
+		
+		Assert.assertTrue(targets.contains(1));
+		Assert.assertTrue(targets.contains(2));
+		Assert.assertTrue(targets.contains(3));
+	}
+
+	
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	@Test
+	public void testListListSerDeser() {
+		ListSerDeser serDeser = new ListSerDeser();
+		List<List<String>> sources = new ArrayList<List<String>>();
+		List<String> list1 = new ArrayList<String>();
+		list1.add("value1");
+		list1.add("value2");
+		list1.add("value3");
+		sources.add(list1);
+		
+		List<String> list2 = new ArrayList<String>();
+		list2.add("value4");
+		list2.add("value5");		
+		sources.add(list2);
+		
+		byte[] bytes = serDeser.serialize(sources);
+		List targets = serDeser.deserialize(bytes);
+		Assert.assertEquals(sources.size(), targets.size());
+
+		list1 = (List)targets.get(0);
+		Assert.assertNotNull(list1);
+		Assert.assertEquals(3, list1.size());
+		Assert.assertTrue(list1.contains("value1"));
+		Assert.assertTrue(list1.contains("value2"));
+		Assert.assertTrue(list1.contains("value3"));
+
+		list2 = (List)targets.get(1);
+		Assert.assertNotNull(list2);
+		Assert.assertEquals(2, list2.size());
+		Assert.assertTrue(list2.contains("value4"));
+		Assert.assertTrue(list2.contains("value5"));
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestMapSerDeser.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestMapSerDeser.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestMapSerDeser.java
new file mode 100644
index 0000000..29a704d
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/meta/TestMapSerDeser.java
@@ -0,0 +1,106 @@
+/*
+ * 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.log.entity.meta;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+public class TestMapSerDeser {
+
+	@SuppressWarnings("rawtypes")
+	@Test
+	public void testStringToStringMapSerDeser() {
+		MapSerDeser serDeser = new MapSerDeser();
+		Map<String, String> sources = new HashMap<String, String>();
+		sources.put("test1", "value1");
+		sources.put("test2", null);
+		sources.put("test3", "value3");
+		
+		byte[] bytes = serDeser.serialize(sources);
+		Assert.assertEquals(4 + sources.size() * 16 + 27, bytes.length);
+		Map targets = serDeser.deserialize(bytes);
+		Assert.assertEquals(sources.size(), targets.size());
+		
+		Assert.assertEquals("value1", targets.get("test1"));
+		Assert.assertNull(targets.get("test2"));
+		Assert.assertEquals("value3", targets.get("test3"));
+	}
+
+	
+	@SuppressWarnings("rawtypes")
+	@Test
+	public void testStringToIntegerMapSerDeser() {
+		MapSerDeser serDeser = new MapSerDeser();
+		Map<String, Integer> sources = new HashMap<String, Integer>();
+		sources.put("test1", 1);
+		sources.put("test2", null);
+		sources.put("test3", 3);
+		
+		byte[] bytes = serDeser.serialize(sources);
+		Assert.assertEquals(4 + sources.size() * 16 + 23, bytes.length);
+		Map targets = serDeser.deserialize(bytes);
+		Assert.assertEquals(sources.size(), targets.size());
+		
+		Assert.assertEquals(1, targets.get("test1"));
+		Assert.assertNull(targets.get("test2"));
+		Assert.assertEquals(3, targets.get("test3"));
+	}
+
+	
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	@Test
+	public void testStringToMapMapSerDeser() {
+		MapSerDeser serDeser = new MapSerDeser();
+		Map<String, Map<String, String>> sources = new HashMap<String, Map<String, String>>();
+		Map<String, String> map1 = new HashMap<String, String>();
+		map1.put("key11", "value11");
+		map1.put("key12", null);
+		map1.put("key13", "value13");
+		sources.put("test1", map1);
+		sources.put("test2", null);
+		Map<String, String> map3 = new HashMap<String, String>();
+		map3.put("key31", "value31");
+		map3.put("key32", null);
+		map3.put("key33", "value33");
+		sources.put("test3", map3);
+		
+		byte[] bytes = serDeser.serialize(sources);
+		Map targets = serDeser.deserialize(bytes);
+		Assert.assertEquals(sources.size(), targets.size());
+
+		map1 = (Map)targets.get("test1");
+		Assert.assertNotNull(map1);
+		Assert.assertEquals(3, map1.size());
+		Assert.assertEquals("value11", map1.get("key11"));
+		Assert.assertNull(map1.get("key12"));
+		Assert.assertEquals("value13", map1.get("key13"));
+		
+		Assert.assertNull(targets.get("test2"));
+		
+		map3 = (Map)targets.get("test3");
+		Assert.assertNotNull(map3);
+		Assert.assertEquals(3, map3.size());
+		Assert.assertEquals("value31", map3.get("key31"));
+		Assert.assertNull(map3.get("key32"));
+		Assert.assertEquals("value33", map3.get("key33"));
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/repo/TestEntityRepositoryScanner.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/repo/TestEntityRepositoryScanner.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/repo/TestEntityRepositoryScanner.java
new file mode 100755
index 0000000..1b64b20
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/entity/repo/TestEntityRepositoryScanner.java
@@ -0,0 +1,30 @@
+/*
+ * 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.log.entity.repo;
+
+import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestEntityRepositoryScanner {
+
+	@Test
+	public void testScan() throws InstantiationException, IllegalAccessException {
+		EntityRepositoryScanner.scan();
+		Assert.assertNotNull(EntityDefinitionManager.getEntityByServiceName("MetricMetadataService"));
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/expression/TestExpressionParser.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/expression/TestExpressionParser.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/expression/TestExpressionParser.java
new file mode 100755
index 0000000..0206b68
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/expression/TestExpressionParser.java
@@ -0,0 +1,256 @@
+/*
+ * 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.log.expression;
+/**
+ * 
+ */
+
+import junit.framework.Assert;
+import org.junit.Test;
+
+import java.util.List;
+
+/**
+ * @since Nov 10, 2014
+ */
+public class TestExpressionParser {
+			
+	@Test
+	public void testSingleVariable() throws Exception{
+		String exprStr = "mapProgress";		
+		ExpressionParser parser = new ExpressionParser(exprStr);
+		Double value = parser.setVariable("mapProgress", 100.0)
+							 .eval();
+		Assert.assertEquals(value, 100.0);
+		List<String> dependentFields = parser.getDependentFields();
+		Assert.assertEquals(dependentFields.size(), 1);
+		Assert.assertEquals(dependentFields.get(0), "mapProgress");
+	}
+	
+	@Test
+	public void testgetDependency() throws Exception{
+		/** NOTICE: expression should be enclosure with "EXP{}" , This is for making antlr easy to parse  
+		  * variable name cannot be "pi" OR "E", there are parssi builtin constants */
+		String exprStr = "min(mAx, Max) / abs(MAX)";
+		ExpressionParser parser = new ExpressionParser(exprStr);
+		List<String> variables =  parser.getDependentFields();
+		Assert.assertEquals(variables.size(), 3);
+		Assert.assertTrue(variables.contains("mAx"));
+		Assert.assertTrue(variables.contains("Max"));
+		Assert.assertTrue(variables.contains("MAX"));
+	}
+
+	@Test
+	public void testFunction() throws Exception{
+		String exprStr = "min(mapProgress, reduceProgress) / abs(endTime - startTime)";
+		ExpressionParser parser = new ExpressionParser(exprStr);
+		Double value = parser.setVariable("mapProgress", 100.0)
+							 .setVariable("reduceProgress", 20.0)
+							 .setVariable("endTime", 1415590100000.0)
+							 .setVariable("startTime", 1415590000000.0)
+							 .eval();
+		Assert.assertEquals(value, 0.0002);
+	}
+	
+	@Test
+	public void testOperator() throws Exception{
+		String exprStr = "(a+b*c) / (2*(d-e))";
+		ExpressionParser parser = new ExpressionParser(exprStr);
+		Double value = parser.setVariable("a", 200.0)
+							 .setVariable("b", 400.0)
+							 .setVariable("c", 3.0)
+							 .setVariable("d", 225.0)
+							 .setVariable("e", -125.0)
+							 .eval();
+		Assert.assertEquals(value, 2.0);
+	}
+	
+	@Test
+	public void testOperatorWithFunction() throws Exception{
+		String exprStr = "(max(a, b)* min(a, b)) / abs(a-b+c-d)";
+		ExpressionParser parser = new ExpressionParser(exprStr);
+		Double value = parser.setVariable("a", 300.0)
+							 .setVariable("b", 200.0)
+							 .setVariable("c", -300.0)
+							 .setVariable("d", -300.0)
+							 .eval();
+		Assert.assertEquals(value, 600.0);
+	}
+
+	@Test
+	public void testWithAtFieldName() throws Exception{
+		String exprStr = "(max(a, b)* min(a, b)) / abs(a-b+c-d)";
+		ExpressionParser parser = new ExpressionParser(exprStr);
+		Double value = parser.setVariable("a", 300.0)
+							 .setVariable("b", 200.0)
+							 .setVariable("c", -300.0)
+							 .setVariable("d", -300.0)
+							 .eval();
+		Assert.assertEquals(value, 600.0);
+	}
+
+	@Test
+	public void testConstant() throws Exception {
+		String exprStr = "a";
+		ExpressionParser parser = new ExpressionParser(exprStr);
+		Double value = parser.setVariable("a", 300.0)
+				.setVariable("b", 200.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertEquals(value, 300.0);
+
+		value = parser.setVariable("a", 200.0)
+				.setVariable("b", 200.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertEquals(value, 200.0);
+	}
+
+	@Test
+	public void testBooleanExpression() throws Exception {
+		String exprStr = "a > b";
+		ExpressionParser parser = new ExpressionParser(exprStr);
+		Double value = parser.setVariable("a", 300.0)
+				.setVariable("b", 200.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertEquals(value, 1.0);
+
+		value = parser.setVariable("a", 100.0)
+				.setVariable("b", 200.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertEquals(value, 0.0);
+
+		exprStr = "a < b";
+		parser = new ExpressionParser(exprStr);
+		value = parser.setVariable("a", 300.0)
+				.setVariable("b", 300.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertTrue(value == 0.0);
+
+		value = parser.setVariable("a", 400.0)
+				.setVariable("b", 300.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertTrue(value == 0.0);
+
+		value = parser.setVariable("a", 100.0)
+				.setVariable("b", 200.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertTrue(value == 1.0);
+
+		// !!! Not support well >=
+		exprStr = "a >= b";
+		parser = new ExpressionParser(exprStr);
+		value = parser.setVariable("a", 300.0)
+				.setVariable("b", 300.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertTrue(value == 0.0); // expect 1.0
+
+		value = parser.setVariable("a", 400.0)
+				.setVariable("b", 300.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertTrue(value == 1.0); // expect 1.0
+
+		value = parser.setVariable("a", 100.0)
+				.setVariable("b", 200.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertTrue(value == 1.0); // expect 0.0
+
+		exprStr = "a <= b";
+		parser = new ExpressionParser(exprStr);
+		value = parser.setVariable("a", 300.0)
+				.setVariable("b", 300.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertTrue(value == 1.0);
+
+		value = parser.setVariable("a", 400.0)
+				.setVariable("b", 300.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertTrue(value == 0.0);
+
+		value = parser.setVariable("a", 100.0)
+				.setVariable("b", 200.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertTrue(value == 1.0);
+
+		exprStr = "a = b";
+		parser = new ExpressionParser(exprStr);
+		value = parser.setVariable("a", 300.0)
+				.setVariable("b", 300.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertEquals(value, 1.0);
+
+		value = parser.setVariable("a", 100.0)
+				.setVariable("b", 200.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertEquals(value, 0.0);
+	}
+
+	@Test
+	public void testParsiiBug() throws Exception {
+		// !!! Not support >=
+		String exprStr = "a >= b";
+		ExpressionParser parser = new ExpressionParser(exprStr);
+		Double value = parser.setVariable("a", 300.0)
+				.setVariable("b", 300.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertTrue(value == 0.0); // expect 1.0
+
+		value = parser.setVariable("a", 400.0)
+				.setVariable("b", 300.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertTrue(value == 1.0); // expect 1.0
+
+		value = parser.setVariable("a", 100.0)
+				.setVariable("b", 200.0)
+				.setVariable("c", -300.0)
+				.setVariable("d", -300.0)
+				.eval();
+		Assert.assertTrue(value == 1.0); // expect 0.0
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/expression/TestExpressionPerformance.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/expression/TestExpressionPerformance.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/expression/TestExpressionPerformance.java
new file mode 100755
index 0000000..0a2b729
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/test/java/org/apache/eagle/log/expression/TestExpressionPerformance.java
@@ -0,0 +1,120 @@
+/*
+ * 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.log.expression;
+
+import org.junit.Assert;
+import org.junit.Test;
+import parsii.eval.Expression;
+import parsii.eval.Parser;
+import parsii.eval.Scope;
+
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * @since Nov 4, 2014
+ */
+
+public class TestExpressionPerformance {
+
+	public interface ExpressionParser {
+		double parse(String exprStr, Map<String, Double> tuple) throws Exception;
+	}
+	
+	public class ParsiiParser implements ExpressionParser{
+		public Expression expression;
+		
+		public double parse(String exprStr, Map<String, Double> tuple) throws Exception{		
+			Scope scope = Scope.create();
+			if (expression == null) {
+				expression = Parser.parse(exprStr, scope);
+			}
+			for(String valName : tuple.keySet()) {
+				Object value = tuple.get(valName);
+				if(value instanceof Number) {
+					scope.getVariable(valName).setValue(((Number)value).doubleValue());
+				}
+			}
+			return expression.evaluate();
+		}
+	}
+	
+	public long doParse(ExpressionParser parser, String exprStr, List<String> parameters) throws Exception{
+		long startTime = System.currentTimeMillis();
+		int parNum = parameters.size();
+		Map<String, Double> tuple = new HashMap<String, Double>();
+		for (int i = 1; i < 100000; i++) {
+			for (int j = 0; j < parNum; j++) {
+				tuple.put(parameters.get(j), (double) (i * 3 + j));				
+			}
+			parser.parse(exprStr, tuple);
+		}
+		long endTime = System.currentTimeMillis();
+		return endTime - startTime;
+	}
+	
+	@Test
+	public void TestPerformance() throws Exception{
+		List<ExpressionParser> parsers = new ArrayList<ExpressionParser>();
+		parsers.add(new ParsiiParser());
+
+		String exprStr = "a + b / c * 2"; 
+		List<String> parameters = new ArrayList<String>();
+		parameters.add("a");
+		parameters.add("b");
+		parameters.add("c");
+		
+		Map<String, Long> timeComsued = new HashMap<String, Long>();
+		
+		for (int i = 0; i < 10; i++) {
+			for (ExpressionParser parser : parsers) {
+				String name = parser.getClass().getName();
+				if (timeComsued.get(name) == null) {
+					timeComsued.put(name, 0L);
+				}
+				timeComsued.put(name, timeComsued.get(name) + doParse(parser, exprStr, parameters));			
+			}
+		}
+		for (Entry<String, Long> time : timeComsued.entrySet()) {
+			System.out.println("time consumed of " + time.getKey() + ": " + time.getValue() +"ms");
+		}
+	}
+
+	@Test
+	public void TestEvaluatoinValid() throws Exception{
+		List<ExpressionParser> parsers = new ArrayList<ExpressionParser>();
+		parsers.add(new ParsiiParser());
+
+		String exprStr = "max(a, 3 * b) + min(b, 10000) / abs(c * 2)";
+		Map<String ,Double> tuples = new HashMap<String, Double>();
+		tuples.put("a", 20.5);
+		tuples.put("b", 123.7);
+		tuples.put("c", 97.57);
+		DecimalFormat df = new DecimalFormat("#.00");
+		for (ExpressionParser parser : parsers) {			
+			System.out.println(parser.getClass().getName() + " : " + parser.parse(exprStr, tuples));
+			Assert.assertEquals(df.format(parser.parse(exprStr, tuples)), "371.73");
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-query-base/src/main/java/eagle/query/GenericEntityQuery.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-query-base/src/main/java/eagle/query/GenericEntityQuery.java b/eagle-core/eagle-query/eagle-query-base/src/main/java/eagle/query/GenericEntityQuery.java
deleted file mode 100755
index 8f43513..0000000
--- a/eagle-core/eagle-query/eagle-query-base/src/main/java/eagle/query/GenericEntityQuery.java
+++ /dev/null
@@ -1,74 +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 eagle.query;
-
-import eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import eagle.log.entity.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @since : 10/30/14,2014
- */
-public class GenericEntityQuery implements GenericQuery,EntityCreationListener {
-	private static final Logger LOG = LoggerFactory.getLogger(GenericEntityQuery.class);
-
-	private List<TaggedLogAPIEntity> entities = new ArrayList<TaggedLogAPIEntity>();
-	private StreamReader reader;
-
-	public GenericEntityQuery(String serviceName, SearchCondition condition, String metricName) throws IllegalAccessException, InstantiationException {
-		if(serviceName.equals(GenericMetricEntity.GENERIC_METRIC_SERVICE)){
-			if(LOG.isDebugEnabled()) LOG.debug("List metric query");
-			if(metricName == null || metricName.isEmpty()){
-				throw new IllegalArgumentException("metricName should not be empty for metric list query");
-			}
-			if(!condition.getOutputFields().contains(GenericMetricEntity.VALUE_FIELD)){
-				condition.getOutputFields().add(GenericMetricEntity.VALUE_FIELD);
-			}
-			reader = new GenericEntityStreamReader(serviceName, condition,metricName);
-		}else{
-			if(LOG.isDebugEnabled()) LOG.debug("List entity query");
-			reader = new GenericEntityStreamReader(serviceName, condition);
-		}
-		reader.register(this);
-	}
-
-	@Override
-	public long getLastTimestamp() {
-		return reader.getLastTimestamp();
-	}
-
-	@Override
-	public void entityCreated(TaggedLogAPIEntity entity){
-		entities.add(entity);
-	}
-
-	@Override
-	public List<TaggedLogAPIEntity> result() throws Exception{
-		if(LOG.isDebugEnabled()) LOG.debug("Start reading as batch mode");
-		reader.readAsStream();
-		return entities;
-	}
-
-	@Override
-	public long getFirstTimeStamp() {
-		return reader.getFirstTimestamp();
-	}
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-query-base/src/main/java/eagle/query/GenericQuery.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-query-base/src/main/java/eagle/query/GenericQuery.java b/eagle-core/eagle-query/eagle-query-base/src/main/java/eagle/query/GenericQuery.java
deleted file mode 100755
index 913468d..0000000
--- a/eagle-core/eagle-query/eagle-query-base/src/main/java/eagle/query/GenericQuery.java
+++ /dev/null
@@ -1,46 +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 eagle.query;
-
-import java.util.List;
-
-/**
- * @since : 10/30/14,2014
- */
-public interface GenericQuery {
-	/**
-	 * Throw all exceptions to http server
-	 *
-     * @param <T> result entity type
-	 * @return result entities list
-	 *
-     * @throws Exception
-	 */
-	<T> List<T> result() throws Exception;
-
-	/**
-	 * Get last/largest timestamp on all rows
-	 *
-	 * @return last timestamp
-	 */
-	long getLastTimestamp();
-
-	/**
-	 * Get first timestamp on all rows
-	 */
-	long getFirstTimeStamp();
-}
\ No newline at end of file