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:20 UTC

[13/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/main/java/org/apache/eagle/log/expression/ExpressionParser.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/expression/ExpressionParser.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/expression/ExpressionParser.java
new file mode 100755
index 0000000..4f74715
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/expression/ExpressionParser.java
@@ -0,0 +1,207 @@
+/*
+ * 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.apache.eagle.log.base.taggedlog.TaggedLogAPIEntity;
+import org.apache.eagle.log.entity.EntityQualifierUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import parsii.eval.Expression;
+import parsii.eval.Parser;
+import parsii.eval.Scope;
+import parsii.eval.Variable;
+import parsii.tokenizer.ParseException;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * <h1>Expression Evaluation</h1>
+ *
+ * Given expression in string and set context variables, return value in double
+ *
+ * <br/>
+ * <br/>
+ * For example:
+ * <code>EXP{(max(a, b)* min(a, b)) / abs(a-b+c-d)} => 600.0</code>
+ *
+ * <br/>
+ * <br/>
+ * <b>NOTE:</b>  Expression variable <b>must</b> be in format: <code>fieldName</code> instead of <code>@fieldName</code>
+ *
+ * <br/>
+ * <br/>
+ * <h2>Dependencies:</h2>
+ * <ul>
+ *     <li>
+ *         <a href="https://github.com/scireum/parsii">scireum/parsii</a>
+ *         <i>Super fast and simple evaluator for mathematical expressions written in Java</i>
+ *     </li>
+ * </ul>
+ *
+ */
+public class ExpressionParser{
+	private final static Logger LOG = LoggerFactory.getLogger(ExpressionParser.class);
+
+	private String exprStr;
+	private Expression expression;
+	private Scope scope;
+
+	@SuppressWarnings("unused")
+	public Scope getScope() {
+		return scope;
+	}
+
+	private List<String> dependentFields;
+
+	/**
+	 * @param exprStr expression string in format like: <code>(max(a, b)* min(a, b)) / abs(a-b+c-d)</code>
+	 *
+	 * @throws ParseException
+	 * @throws ParsiiInvalidException
+	 */
+	public ExpressionParser(String exprStr) throws ParseException, ParsiiInvalidException{
+		this.exprStr = exprStr;
+		scope = Scope.create();
+		expression = Parser.parse(this.exprStr,scope);
+	}
+
+	@SuppressWarnings("unused")
+	public ExpressionParser(String exprStr, Map<String, Double> context) throws ParsiiInvalidException, ParseException, ParsiiUnknowVariableException {
+		this(exprStr);
+		setVariables(context);
+	}
+	
+	public ExpressionParser setVariables(Map<String, Double> tuple) throws ParsiiUnknowVariableException{
+//		for(String valName : tuple.keySet()) {
+//			Double value = tuple.get(valName);
+		for(Map.Entry<String,Double> entry : tuple.entrySet()) {
+            String valName = entry.getKey();
+            Double value = entry.getValue();
+			Variable variable = scope.getVariable(valName);
+			if(variable!=null && value !=null) {
+				variable.setValue(value);
+			}else{
+				if(LOG.isDebugEnabled()) LOG.warn("Variable for "+valName+" is null in scope of expression: "+this.exprStr);
+			}
+		}
+		return this;
+	}
+
+	@SuppressWarnings("unused")
+	public ExpressionParser setVariable(Entry<String, Double> tuple) throws ParsiiUnknowVariableException{
+		if (getDependentFields().contains(tuple.getKey())) {
+			scope.getVariable(tuple.getKey()).setValue(tuple.getValue());
+		}
+		else {
+			throw new ParsiiUnknowVariableException("unknown variable: " + tuple.getKey());
+		}
+		return this;
+	}
+	
+	public ExpressionParser setVariable(String key, Double value) throws ParsiiUnknowVariableException{
+		scope.getVariable(key).setValue(value);
+		return this;
+	}
+
+	public double eval() throws Exception{
+		return expression.evaluate();
+	}
+
+	/**
+	 * Thread safe
+	 *
+	 * @param tuple
+	 * @return
+	 * @throws ParsiiUnknowVariableException
+	 */
+	public double eval(Map<String, Double> tuple) throws Exception {
+		synchronized (this){
+			this.setVariables(tuple);
+			return this.eval();
+		}
+	}
+
+	public List<String> getDependentFields() {
+		if (dependentFields == null) {
+			dependentFields = new ArrayList<String>();
+			for (String variable : scope.getNames()) {
+				if (!variable.equals("pi") && !variable.equals("E") && !variable.equals("euler"))
+					dependentFields.add(variable);
+			}
+		}
+		return dependentFields; 
+	}
+
+	private final static Map<String, ExpressionParser> _exprParserCache = new HashMap<String, ExpressionParser>();
+
+	/**
+	 * Thread safe
+	 *
+	 * @param expr
+	 * @return
+	 * @throws ParsiiInvalidException
+	 * @throws ParseException
+	 */
+	public static ExpressionParser parse(String expr) throws ParsiiInvalidException, ParseException {
+		if(expr == null) throw new IllegalStateException("Expression to parse is null");
+		synchronized (_exprParserCache) {
+			ExpressionParser parser = _exprParserCache.get(expr);
+			if (parser == null) {
+				parser = new ExpressionParser(expr);
+				_exprParserCache.put(expr, parser);
+			}
+			return parser;
+		}
+	}
+	public static double eval(String expression,Map<String,Double> context) throws Exception {
+		ExpressionParser parser = parse(expression);
+		return parser.eval(context);
+	}
+
+	private static final Map<String,Method> _entityMethodCache = new HashMap<String, Method>();
+	public static double eval(String expression,TaggedLogAPIEntity entity) throws Exception {
+		ExpressionParser parser = parse(expression);
+		List<String> dependencies = parser.getDependentFields();
+		Map<String,Double> context = new HashMap<String,Double>();
+		for(String field:dependencies){
+			String methodName = "get"+field.substring(0, 1).toUpperCase() + field.substring(1);
+			String methodUID = entity.getClass().getName()+"."+methodName;
+
+			Method m;
+			synchronized (_entityMethodCache) {
+				m = _entityMethodCache.get(methodUID);
+				if (m == null) {
+					m = entity.getClass().getMethod(methodName);
+					_entityMethodCache.put(methodUID, m);
+				}
+			}
+			Object obj = m.invoke(entity);
+			Double doubleValue = EntityQualifierUtils.convertObjToDouble(obj);
+			// if(doubleValue == Double.NaN) throw new IllegalArgumentException("Field "+field+": "+obj+" in expression "+expression+" is not number");
+			context.put(field,doubleValue);
+		}
+		return parser.eval(context);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/expression/ParsiiInvalidException.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/expression/ParsiiInvalidException.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/expression/ParsiiInvalidException.java
new file mode 100755
index 0000000..22301f8
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/expression/ParsiiInvalidException.java
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+/**
+ * @since Nov 7, 2014
+ */
+public class ParsiiInvalidException extends Exception{
+	
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Default constructor
+	 */
+	public ParsiiInvalidException() {
+		super();
+	}
+
+	/**
+	 * @param message
+	 * @param cause
+	 */
+	public ParsiiInvalidException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	/**
+	 * @param message
+	 */
+	public ParsiiInvalidException(String message) {
+		super(message);
+	}
+
+	/**
+	 * @param cause
+	 */
+	public ParsiiInvalidException(Throwable cause) {
+		super(cause);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/expression/ParsiiUnknowVariableException.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/expression/ParsiiUnknowVariableException.java b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/expression/ParsiiUnknowVariableException.java
new file mode 100755
index 0000000..1573a08
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-entity-base/src/main/java/org/apache/eagle/log/expression/ParsiiUnknowVariableException.java
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+/**
+ * @since Nov 7, 2014
+ */
+public class ParsiiUnknowVariableException extends Exception{
+	
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Default constructor
+	 */
+	public ParsiiUnknowVariableException() {
+		super();
+	}
+
+	/**
+	 * @param message
+	 * @param cause
+	 */
+	public ParsiiUnknowVariableException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	/**
+	 * @param message
+	 */
+	public ParsiiUnknowVariableException(String message) {
+		super(message);
+	}
+
+	/**
+	 * @param cause
+	 */
+	public ParsiiUnknowVariableException(Throwable cause) {
+		super(cause);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/TestGenericServiceAPIResponseEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/TestGenericServiceAPIResponseEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/TestGenericServiceAPIResponseEntity.java
deleted file mode 100644
index 32ee8b0..0000000
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/TestGenericServiceAPIResponseEntity.java
+++ /dev/null
@@ -1,92 +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.log;
-
-import eagle.log.entity.GenericServiceAPIResponseEntity;
-import junit.framework.Assert;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedList;
-
-/**
- * @since 3/18/15
- */
-public class TestGenericServiceAPIResponseEntity {
-    final static Logger LOG = LoggerFactory.getLogger(TestGenericServiceAPIResponseEntity.class);
-
-    ObjectMapper objectMapper;
-
-    @Before
-    public void setUp(){
-        objectMapper = new ObjectMapper();
-    }
-
-    @JsonSerialize
-    public static class Item{
-        public Item(){}
-        public Item(String name,Double value){
-            this.name = name;
-            this.value = value;
-        }
-        private String name;
-        private Double value;
-
-        public String getName() {
-            return name;
-        }
-        public void setName(String name) {
-            this.name = name;
-        }
-        public Double getValue() {
-            return value;
-        }
-        public void setValue(Double value) {
-            this.value = value;
-        }
-    }
-
-    @Test
-    public void testSerDeserialize() throws IOException {
-        // mock up service side to serialize
-        GenericServiceAPIResponseEntity<Item> entity = new GenericServiceAPIResponseEntity<Item>(Item.class);
-        entity.setObj(Arrays.asList(new Item("a",1.2),new Item("b",1.3),new Item("c",1.4)));
-        entity.setMeta(new HashMap<String, Object>(){{
-            put("tag1","val1");
-            put("tag2","val2");
-        }});
-
-//        entity.setTypeByObj();
-        entity.setSuccess(true);
-        String json = objectMapper.writeValueAsString(entity);
-        LOG.info(json);
-
-        // mock up client side to deserialize
-        GenericServiceAPIResponseEntity deserEntity = objectMapper.readValue(json,GenericServiceAPIResponseEntity.class);
-        Assert.assertEquals(json,objectMapper.writeValueAsString(deserEntity));
-        Assert.assertEquals(3, deserEntity.getObj().size());
-        Assert.assertEquals(LinkedList.class,deserEntity.getObj().getClass());
-        Assert.assertEquals(Item.class,deserEntity.getObj().get(0).getClass());
-    }
-}
\ 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/eagle/log/entity/TestDouble2DArraySerDeser.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestDouble2DArraySerDeser.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestDouble2DArraySerDeser.java
deleted file mode 100644
index 6727291..0000000
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestDouble2DArraySerDeser.java
+++ /dev/null
@@ -1,48 +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.log.entity;
-
-import eagle.log.entity.meta.Double2DArraySerDeser;
-import org.junit.Test;
-
-/**
- * @since 7/22/15
- */
-public class TestDouble2DArraySerDeser {
-    private Double2DArraySerDeser double2DArraySerDeser = new Double2DArraySerDeser();
-
-    @Test
-    public void testSerDeser(){
-        double[][] data = new double[][]{
-                {0,1,2,4},
-                {4,2,1,0},
-                {4},
-                null,
-                {}
-        };
-
-        byte[] bytes = double2DArraySerDeser.serialize(data);
-        double[][] data2 = double2DArraySerDeser.deserialize(bytes);
-
-        assert  data.length == data2.length;
-        assert data[0].length == data2[0].length;
-        assert data[1].length == data2[1].length;
-        assert data[2].length == data2[2].length;
-        assert data[3] == data2[3] && data2[3] == null;
-        assert data[4].length == data2[4].length;
-    }
-}
\ 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/eagle/log/entity/TestDoubleSerDeser.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestDoubleSerDeser.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestDoubleSerDeser.java
deleted file mode 100644
index c2a2f64..0000000
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestDoubleSerDeser.java
+++ /dev/null
@@ -1,58 +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.log.entity;
-
-import eagle.log.entity.meta.DoubleSerDeser;
-import eagle.common.ByteUtil;
-import junit.framework.Assert;
-import org.apache.hadoop.hbase.filter.BinaryComparator;
-import org.junit.Test;
-
-public class TestDoubleSerDeser {
-
-	@Test
-	public void test() {
-		DoubleSerDeser dsd = new DoubleSerDeser();
-		//byte[] t = {'N', 'a', 'N'};
-		byte [] t = dsd.serialize(Double.NaN); 
-	
-		Double d = dsd.deserialize(t);
-		System.out.println(d);
-		//Double d = dsd.deserialize(t);		
-	}
-
-	/**
-	 * @link http://en.wikipedia.org/wiki/Double-precision_floating-point_format
-	 */
-	@Test
-	public void testIEEE754_Binary64_DoublePrecisionFloatingPointFormat(){
-		for(Double last = null,i=Math.pow(-2.0,33);i< Math.pow(2.0,33);i+=Math.pow(2.0,10)){
-			if(last != null){
-				Assert.assertTrue(i > last);
-				if(last < 0 && i <0){
-					Assert.assertTrue("Negative double value and its  serialization Binary array have negative correlation", new BinaryComparator(ByteUtil.doubleToBytes(i)).compareTo(ByteUtil.doubleToBytes(last)) < 0);
-				}else if(last < 0 && i >=0){
-					Assert.assertTrue("Binary array for negative double is always greater than any positive doubles' ",new BinaryComparator(ByteUtil.doubleToBytes(i)).compareTo(ByteUtil.doubleToBytes(last)) < 0);
-				}else if(last >= 0){
-					Assert.assertTrue("Positive double value and its  serialization Binary array have positive correlation",new BinaryComparator(ByteUtil.doubleToBytes(i)).compareTo(ByteUtil.doubleToBytes(last)) > 0);
-				}
-			}
-			last = i;
-		}
-		Assert.assertTrue("Binary array for negative double is always greater than any positive doubles'",new BinaryComparator(ByteUtil.doubleToBytes(-1.0)).compareTo(ByteUtil.doubleToBytes(Math.pow(2.0,32)))>0) ;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestGenericEntityIndexStreamReader.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestGenericEntityIndexStreamReader.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestGenericEntityIndexStreamReader.java
deleted file mode 100755
index 4306771..0000000
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestGenericEntityIndexStreamReader.java
+++ /dev/null
@@ -1,169 +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.log.entity;
-
-import eagle.log.entity.index.NonClusteredIndexStreamReader;
-import eagle.log.entity.index.UniqueIndexStreamReader;
-import eagle.log.entity.meta.EntityDefinition;
-import eagle.log.entity.meta.EntityDefinitionManager;
-import eagle.log.entity.meta.IndexDefinition;
-import eagle.log.entity.old.GenericDeleter;
-import eagle.log.entity.test.TestLogAPIEntity;
-import eagle.query.parser.EagleQueryParser;
-import eagle.service.hbase.TestHBaseBase;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-public class TestGenericEntityIndexStreamReader extends TestHBaseBase {
-
-	@Test
-	public void testUniqueIndexRead() throws Exception {
-		EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
-		hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
-
-		EntityDefinitionManager.registerEntity(TestLogAPIEntity.class);
-		EntityDefinition ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
-		
-		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("jobID", "index_test_job_id");
-		e.getTags().put("hostname", "testhost");
-		list.add(e);
-
-		GenericEntityWriter writer = new GenericEntityWriter(ed.getService());
-		List<String> result = writer.write(list);
-		Assert.assertNotNull(result);
-		
-		IndexDefinition indexDef = ed.getIndexes()[0];
-		SearchCondition condition = new SearchCondition();
-		condition.setOutputFields(new ArrayList<String>());
-		condition.getOutputFields().add("field1");
-		condition.getOutputFields().add("field2");
-		condition.getOutputFields().add("field3");
-		condition.getOutputFields().add("field4");
-		condition.getOutputFields().add("field5");
-		condition.getOutputFields().add("field6");
-		condition.getOutputFields().add("field7");
-
-		String query = "@field7 = \"7\" AND @jobID = \"index_test_job_id\" ";
-		EagleQueryParser parser = new EagleQueryParser(query);
-		condition.setQueryExpression(parser.parse());
-
-		UniqueIndexStreamReader indexReader = new UniqueIndexStreamReader(indexDef, condition);
-		GenericEntityBatchReader batchReader = new GenericEntityBatchReader(indexReader);
-		List<TestLogAPIEntity> entities =  batchReader.read();
-		Assert.assertNotNull(entities);
-		Assert.assertTrue(entities.size() >= 1);
-		TestLogAPIEntity e1 = entities.get(0);
-		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());
-		
-		GenericDeleter deleter = new GenericDeleter(ed.getTable(), ed.getColumnFamily());
-		deleter.delete(list);
-		
-		indexReader = new UniqueIndexStreamReader(indexDef, condition);
-		batchReader = new GenericEntityBatchReader(indexReader);
-		entities =  batchReader.read();
-		hbase.deleteTable(entityDefinition.getTable());
-		Assert.assertNotNull(entities);
-		Assert.assertTrue(entities.isEmpty());
-	}
-
-	@Test
-	public void testNonClusterIndexRead() throws Exception {
-        EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
-        hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
-
-		EntityDefinitionManager.registerEntity(TestLogAPIEntity.class);
-		EntityDefinition ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
-		
-		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("jobID", "index_test_job_id");
-		e.getTags().put("hostname", "testhost");
-		list.add(e);
-
-		GenericEntityWriter writer = new GenericEntityWriter(ed.getService());
-		List<String> result = writer.write(list);
-		Assert.assertNotNull(result);
-		
-		IndexDefinition indexDef = ed.getIndexes()[1];
-		SearchCondition condition = new SearchCondition();
-		condition.setOutputFields(new ArrayList<String>());
-		condition.getOutputFields().add("field1");
-		condition.getOutputFields().add("field2");
-		condition.getOutputFields().add("field3");
-		condition.getOutputFields().add("field4");
-		condition.getOutputFields().add("field5");
-		condition.getOutputFields().add("field6");
-		condition.getOutputFields().add("field7");
-
-		String query = "@field7 = \"7\" AND @jobID = \"index_test_job_id\" AND @hostname = \"testhost\"";
-		EagleQueryParser parser = new EagleQueryParser(query);
-		condition.setQueryExpression(parser.parse());
-
-		NonClusteredIndexStreamReader indexReader = new NonClusteredIndexStreamReader(indexDef, condition);
-		GenericEntityBatchReader batchReader = new GenericEntityBatchReader(indexReader);
-		List<TestLogAPIEntity> entities =  batchReader.read();
-		Assert.assertNotNull(entities);
-		Assert.assertTrue(entities.size() >= 1);
-		TestLogAPIEntity e1 = entities.get(0);
-		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());
-
-
-		GenericDeleter deleter = new GenericDeleter(ed.getTable(), ed.getColumnFamily());
-		deleter.delete(list);
-		
-		indexReader = new NonClusteredIndexStreamReader(indexDef, condition);
-		batchReader = new GenericEntityBatchReader(indexReader);
-		entities =  batchReader.read();
-		hbase.deleteTable(entityDefinition.getTable());
-		Assert.assertNotNull(entities);
-		Assert.assertTrue(entities.isEmpty());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestHBaseIntegerLogHelper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestHBaseIntegerLogHelper.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestHBaseIntegerLogHelper.java
deleted file mode 100755
index 22d50a3..0000000
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestHBaseIntegerLogHelper.java
+++ /dev/null
@@ -1,67 +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.log.entity;
-
-import eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import eagle.log.entity.meta.EntityDefinition;
-import eagle.log.entity.meta.EntityDefinitionManager;
-import eagle.log.entity.test.TestTimeSeriesAPIEntity;
-import eagle.common.ByteUtil;
-import junit.framework.Assert;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @since : 11/10/14,2014
- */
-public class TestHBaseIntegerLogHelper {
-	@Test
-	public void testTimeSeriesAPIEntity(){
-		InternalLog internalLog = new InternalLog();
-		Map<String,byte[]> map = new HashMap<String,byte[]>();
-		TestTimeSeriesAPIEntity apiEntity = new TestTimeSeriesAPIEntity();
-		EntityDefinition ed = null;
-		try {
-			ed = EntityDefinitionManager.getEntityByServiceName("TestTimeSeriesAPIEntity");
-		} catch (InstantiationException e) {
-			e.printStackTrace();
-		} catch (IllegalAccessException e) {
-			e.printStackTrace();
-		}
-		map.put("a", ByteUtil.intToBytes(12));
-		map.put("c", ByteUtil.longToBytes(123432432l));
-		map.put("cluster", new String("cluster4ut").getBytes());
-		map.put("datacenter", new String("datacenter4ut").getBytes());
-
-		internalLog.setQualifierValues(map);
-		internalLog.setTimestamp(System.currentTimeMillis());
-
-		try {
-			TaggedLogAPIEntity entity = HBaseInternalLogHelper.buildEntity(internalLog, ed);
-			Assert.assertTrue(entity instanceof TestTimeSeriesAPIEntity);
-			TestTimeSeriesAPIEntity tsentity = (TestTimeSeriesAPIEntity) entity;
-			Assert.assertEquals("cluster4ut",tsentity.getTags().get("cluster"));
-			Assert.assertEquals("datacenter4ut",tsentity.getTags().get("datacenter"));
-			Assert.assertEquals(12,tsentity.getField1());
-			Assert.assertEquals(123432432l,tsentity.getField3());
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestHBaseWriteEntitiesPerformance.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestHBaseWriteEntitiesPerformance.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestHBaseWriteEntitiesPerformance.java
deleted file mode 100755
index 186853b..0000000
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestHBaseWriteEntitiesPerformance.java
+++ /dev/null
@@ -1,132 +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.log.entity;
-
-import eagle.log.entity.meta.EntityDefinition;
-import eagle.log.entity.meta.EntityDefinitionManager;
-import eagle.log.entity.test.TestLogAPIEntity;
-import eagle.service.hbase.TestHBaseBase;
-import junit.framework.Assert;
-import org.apache.commons.lang.time.StopWatch;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-
-public class TestHBaseWriteEntitiesPerformance extends TestHBaseBase {
-	private EntityDefinition ed;
-	private final static Logger LOG = LoggerFactory.getLogger(TestHBaseWriteEntitiesPerformance.class);
-
-	@Before
-	public void setUp() throws IllegalAccessException, InstantiationException, IOException {
-		EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
-		hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
-
-		EntityDefinitionManager.registerEntity(TestLogAPIEntity.class);
-		try {
-			ed = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
-			ed.setTimeSeries(true);
-		} catch (InstantiationException | IllegalAccessException e) {
-			Assert.fail(e.getMessage());
-		}
-    }
-
-	@After
-	public void cleanUp() throws IllegalAccessException, InstantiationException, IOException {
-		EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(TestLogAPIEntity.class);
-		hbase.deleteTable(entityDefinition.getTable());
-	}
-
-	private List<String> writeEntities(int count){
-		GenericEntityWriter writer = null;
-		try {
-			writer = new GenericEntityWriter(ed.getService());
-		} catch (InstantiationException e1) {
-			Assert.fail(e1.getMessage());
-		} catch (IllegalAccessException e1) {
-			Assert.fail(e1.getMessage());
-		}
-
-		if(LOG.isDebugEnabled()) LOG.debug("Start to write "+count+" entities");
-		int wroteCount = 0;
-		List<String> rowkeys = new ArrayList<String>();
-		List<TestLogAPIEntity> list = new ArrayList<TestLogAPIEntity>();
-		for(int i=0;i<= count;i++){
-			TestLogAPIEntity e = new TestLogAPIEntity();
-			e.setTimestamp(new Date().getTime());
-			e.setField1(i);
-			e.setField2(i);
-			e.setField3(i);
-			e.setField4(new Long(i));
-			e.setField5(new Double(i));
-			e.setField6(new Double(i));
-			e.setField7(String.valueOf(i));
-			e.setTags(new HashMap<String, String>());
-			e.getTags().put("jobID", "index_test_job_id");
-			e.getTags().put("hostname", "testhost");
-			e.getTags().put("index", String.valueOf(i));
-			e.getTags().put("class", e.toString());
-			list.add(e);
-
-			if(list.size()>=1000){
-				try {
-					StopWatch watch = new StopWatch();
-					watch.start();
-					rowkeys.addAll(writer.write(list));
-					watch.stop();
-					wroteCount += list.size();
-					if(LOG.isDebugEnabled()) LOG.debug("Wrote "+wroteCount+" / "+count+" entities"+" in "+watch.getTime()+" ms");
-					list.clear();
-				} catch (Exception e1) {
-					Assert.fail(e1.getMessage());
-				}
-			}
-		}
-
-		try {
-			rowkeys.addAll(writer.write(list));
-			wroteCount += list.size();
-			if(LOG.isDebugEnabled()) LOG.debug("wrote "+wroteCount+" / "+count+" entities");
-		} catch (Exception e) {
-			Assert.fail(e.getMessage());
-		}
-		if(LOG.isDebugEnabled()) LOG.debug("done "+count+" entities");
-		return rowkeys;
-	}
-
-	@SuppressWarnings("unused")
-	@Test
-	public void testWrite1MLogAPIEntities(){
-		Date startTime = new Date();
-		LOG.info("Start time: " + startTime);
-		StopWatch watch = new StopWatch();
-		watch.start();
-		List<String> rowKeys = writeEntities(10);
-		Assert.assertNotNull(rowKeys);
-		watch.stop();
-		Date endTime = new Date();
-		LOG.info("End time: " + endTime);
-		LOG.info("Totally take " + watch.getTime() * 1.0 / 1000 + " s");
-	}
-}
\ 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/eagle/log/entity/TestHbaseWritePerformance.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestHbaseWritePerformance.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestHbaseWritePerformance.java
deleted file mode 100644
index 0d70b77..0000000
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestHbaseWritePerformance.java
+++ /dev/null
@@ -1,100 +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.log.entity;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import eagle.common.config.EagleConfigFactory;
-import org.apache.hadoop.hbase.client.HTableInterface;
-import org.apache.hadoop.hbase.client.Put;
-import org.junit.Test;
-
-public class TestHbaseWritePerformance {
-
-	public static void main(String[] args) throws IOException {
-		
-		HTableInterface tbl = EagleConfigFactory.load().getHTable("unittest");
-
-		int putSize = 1000;
-		List<Put> list = new ArrayList<Put>(putSize);
-		for (int i = 0; i < putSize; ++i) {
-			byte[] v = Integer.toString(i).getBytes();
-			Put p = new Put(v);
-			p.add("f".getBytes(), "a".getBytes(), 100, v);
-			list.add(p);
-		}
-
-		// Case 1
-		System.out.println("Case 1: autoflush = true, individual put");
-		tbl.setAutoFlush(true);
-		long startTime = System.currentTimeMillis();
-		for (int i = 0; i < 1; ++i) {
-			for (Put p : list) {
-				tbl.put(p);
-			}
-			tbl.flushCommits();
-		}
-		long endTime = System.currentTimeMillis();
-		System.out.println("Case 1: " + (endTime - startTime) + " ms");
-		
-		
-		// Case 2
-		System.out.println("Case 2: autoflush = true, multi-put");
-		tbl.setAutoFlush(true);
-		startTime = System.currentTimeMillis();
-		for (int i = 0; i < 1; ++i) {
-			tbl.put(list);
-			tbl.flushCommits();
-		}
-		endTime = System.currentTimeMillis();
-		System.out.println("Case 2: " + (endTime - startTime) + " ms");
-
-		
-		// Case 3
-		System.out.println("Case 3: autoflush = false, multi-put");
-		tbl.setAutoFlush(false);
-		startTime = System.currentTimeMillis();
-		for (int i = 0; i < 1; ++i) {
-			tbl.put(list);
-			tbl.flushCommits();
-		}
-		endTime = System.currentTimeMillis();
-		System.out.println("Case 3: " + (endTime - startTime) + " ms");
-
-		
-		// Case 4
-		System.out.println("Case 4: autoflush = false, individual put");
-		tbl.setAutoFlush(true);
-		startTime = System.currentTimeMillis();
-		for (int i = 0; i < 1; ++i) {
-			for (Put p : list) {
-				tbl.put(p);
-			}
-			tbl.flushCommits();
-		}
-		endTime = System.currentTimeMillis();
-		System.out.println("Case 4: " + (endTime - startTime) + " ms");
-
-	}
-	
-	@Test
-	public void test() {
-		
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestTestLogAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestTestLogAPIEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestTestLogAPIEntity.java
deleted file mode 100755
index bcbec34..0000000
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/TestTestLogAPIEntity.java
+++ /dev/null
@@ -1,405 +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.log.entity;
-
-import eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import eagle.log.entity.index.UniqueIndexLogReader;
-import eagle.log.entity.meta.EntityConstants;
-import eagle.log.entity.meta.EntityDefinition;
-import eagle.log.entity.meta.EntityDefinitionManager;
-import eagle.log.entity.meta.IndexDefinition;
-import eagle.log.entity.old.GenericDeleter;
-import eagle.log.entity.test.TestLogAPIEntity;
-import 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/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java
deleted file mode 100755
index 1cfe467..0000000
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/base/taggedlog/TestTaggedLogAPIEntity.java
+++ /dev/null
@@ -1,91 +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.log.entity.base.taggedlog;
-
-import java.io.IOException;
-import java.util.HashMap;
-
-import eagle.log.base.taggedlog.TaggedLogAPIEntity;
-import 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/eagle/log/entity/filter/TestEntityQualifierHelper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/filter/TestEntityQualifierHelper.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/filter/TestEntityQualifierHelper.java
deleted file mode 100755
index bfa7b36..0000000
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/filter/TestEntityQualifierHelper.java
+++ /dev/null
@@ -1,182 +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.log.entity.filter;
-
-import eagle.log.entity.EntityQualifierUtils;
-import eagle.log.entity.meta.EntityDefinition;
-import eagle.log.entity.meta.EntityDefinitionManager;
-import 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/eagle/log/entity/filter/TestExpressionComparator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/filter/TestExpressionComparator.java b/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/filter/TestExpressionComparator.java
deleted file mode 100755
index 476ce3a..0000000
--- a/eagle-core/eagle-query/eagle-entity-base/src/test/java/eagle/log/entity/filter/TestExpressionComparator.java
+++ /dev/null
@@ -1,195 +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.log.entity.filter;
-
-import eagle.log.entity.meta.EntityDefinition;
-import eagle.query.parser.ComparisonOperator;
-import 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));
-    }
-}