eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject [26/55] [abbrv] [partial] incubator-eagle git commit: [EAGLE-46] Rename package name as "org.apache.eagle"
Date Thu, 19 Nov 2015 10:47:33 GMT
http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-client-base/src/test/java/eagle/service/client/TestJackson.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-client-base/src/test/java/eagle/service/client/TestJackson.java b/eagle-core/eagle-query/eagle-client-base/src/test/java/eagle/service/client/TestJackson.java
deleted file mode 100644
index 941635d..0000000
--- a/eagle-core/eagle-query/eagle-client-base/src/test/java/eagle/service/client/TestJackson.java
+++ /dev/null
@@ -1,63 +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.service.client;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.junit.Test;
-
-// http://wiki.fasterxml.com/JacksonPolymorphicDeserialization
-public class TestJackson {
-
-	@Test
-	public void testBase() throws JsonGenerationException, JsonMappingException, IOException {
-		List<Base> objs = new ArrayList<Base>();
-		ClassA a = new ClassA();
-		a.setA(1);
-		ClassB b = new ClassB();
-		b.setB("2");
-		
-		objs.add(a);
-		objs.add(b);
-		
-		ObjectMapper om = new ObjectMapper();
-		om.enableDefaultTyping();
-//		om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
-		String value = om.writeValueAsString(objs);
-		
-		System.out.println("value = " + value);
-		
-		@SuppressWarnings("rawtypes")
-		List result = om.readValue(value, ArrayList.class);
-		System.out.println("size = " + result.size());
-		Object obj1 = result.get(0);
-		Object obj2 = result.get(1);
-		
-		Assert.assertEquals("ClassA", obj1.getClass().getSimpleName());
-		Assert.assertEquals(1, ((ClassA)obj1).getA());
-		Assert.assertEquals("ClassB", obj2.getClass().getSimpleName());
-		Assert.assertEquals("2", ((ClassB)obj2).getB());
-		
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-client-base/src/test/java/eagle/service/jackson/TestJacksonMarshalling.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-client-base/src/test/java/eagle/service/jackson/TestJacksonMarshalling.java b/eagle-core/eagle-query/eagle-client-base/src/test/java/eagle/service/jackson/TestJacksonMarshalling.java
deleted file mode 100644
index b9c3f41..0000000
--- a/eagle-core/eagle-query/eagle-client-base/src/test/java/eagle/service/jackson/TestJacksonMarshalling.java
+++ /dev/null
@@ -1,149 +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.service.jackson;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.Assert;
-
-import org.codehaus.jackson.JsonFactory;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestJacksonMarshalling {
-	private static Logger LOG = LoggerFactory.getLogger(TestJacksonMarshalling.class);
-
-	
-	
-	@Test
-	public void testJSonArrayMarshalling(){
-		String[] array = {"cluster", "datacenter", "rack", "hostname"};
-		JsonFactory factory = new JsonFactory(); 
-	    ObjectMapper mapper = new ObjectMapper(factory);
-	    String result = null;
-	    try{
-	    	result = mapper.writeValueAsString(array);
-	    }catch(Exception ex){
-	    	LOG.error("Cannot marshall", ex);
-	    	Assert.fail("cannot marshall an String array");
-	    }
-	    Assert.assertEquals("[\"cluster\",\"datacenter\",\"rack\",\"hostname\"]", result);
-	}
-	
-
-	static class Pojo{
-		private String field1;
-		private String field2;
-		public String getField1() {
-			return field1;
-		}
-		public void setField1(String field1) {
-			this.field1 = field1;
-		}
-		public String getField2() {
-			return field2;
-		}
-		public void setField2(String field2) {
-			this.field2 = field2;
-		}
-	}
-	
-	@Test
-	public void testPojoMarshalling(){
-		Pojo p = new Pojo();
-		p.setField1("field1");
-		p.setField2("field2");
-		
-		JsonFactory factory = new JsonFactory(); 
-	    ObjectMapper mapper = new ObjectMapper(factory);
-	    String result = null;
-	    try{
-	    	result = mapper.writeValueAsString(p);
-	    }catch(Exception ex){
-	    	LOG.error("Cannot marshall", ex);
-	    	Assert.fail("Cannot marshall a Pojo");
-	    }
-	    System.out.println(result);
-	    Assert.assertEquals("{\"field1\":\"field1\",\"field2\":\"field2\"}", result);
-	}
-	
-	@Test
-	public void testPojoArrayMashalling(){
-		Pojo[] ps = new Pojo[2];
-		ps[0] = new Pojo();
-		ps[0].setField1("0_field1");
-		ps[0].setField2("0_field2");
-		ps[1] = new Pojo();
-		ps[1].setField1("1_field1");
-		ps[1].setField2("1_field2");
-		
-		JsonFactory factory = new JsonFactory(); 
-	    ObjectMapper mapper = new ObjectMapper(factory);
-	    String result = null;
-	    try{
-	    	result = mapper.writeValueAsString(ps);
-	    }catch(Exception ex){
-	    	LOG.error("Cannot marshall", ex);
-	    	Assert.fail("Cannot marshall a Pojo array");
-	    }
-	    System.out.println(result);
-	    Assert.assertEquals("[{\"field1\":\"0_field1\",\"field2\":\"0_field2\"},{\"field1\":\"1_field1\",\"field2\":\"1_field2\"}]", result);
-	}
-	
-	@Test
-	public void testComplexMapMarshalling(){
-		Map<List<String>, String> map = new HashMap<List<String>, String>();
-		map.put(Arrays.asList("cluster1","dc1"), "123");
-		map.put(Arrays.asList("cluster1","dc1"), "456");
-		
-		JsonFactory factory = new JsonFactory(); 
-	    ObjectMapper mapper = new ObjectMapper(factory);
-	    String result = null;
-	    try{
-	    	result = mapper.writeValueAsString(map);
-	    }catch(Exception ex){
-	    	LOG.error("Cannot marshall", ex);
-	    	Assert.fail("Cannot marshall a complex map");
-	    }
-	    System.out.println(result);
-	}
-	
-	@Test
-	public void testMapMapMarshalling(){
-		Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>>();
-		Map<String, String> childmap1 = new HashMap<String, String>();
-		childmap1.put("dc1", "123");
-		childmap1.put("dc1", "456");
-		map.put("cluster1", childmap1);
-		
-		JsonFactory factory = new JsonFactory(); 
-	    ObjectMapper mapper = new ObjectMapper(factory);
-	    String result = null;
-	    try{
-	    	result = mapper.writeValueAsString(map);
-	    }catch(Exception ex){
-	    	LOG.error("Cannot marshall", ex);
-	    	Assert.fail("Cannot marshall a complex map");
-	    }
-	    System.out.println(result);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-client-base/src/test/java/eagle/service/jackson/TestJacksonUnmashalling.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-client-base/src/test/java/eagle/service/jackson/TestJacksonUnmashalling.java b/eagle-core/eagle-query/eagle-client-base/src/test/java/eagle/service/jackson/TestJacksonUnmashalling.java
deleted file mode 100644
index dc16905..0000000
--- a/eagle-core/eagle-query/eagle-client-base/src/test/java/eagle/service/jackson/TestJacksonUnmashalling.java
+++ /dev/null
@@ -1,149 +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.service.jackson;
-
-import java.io.File;
-import java.util.Map;
-
-import junit.framework.Assert;
-
-import org.codehaus.jackson.JsonFactory;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.type.TypeReference;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class TestJacksonUnmashalling {
-	private static Logger LOG = LoggerFactory.getLogger(TestJacksonUnmashalling.class);
-	private static File arrayJson;
-	private static File mapJson;
-	private static File pojoJson;
-	private static File pojoArrayJson;
-	@SuppressWarnings("unused")
-	private static File complexPojoJson;
-	
-	@BeforeClass
-	public static void prepare(){ 
-		try{
-			arrayJson = new File(TestJacksonUnmashalling.class.getResource("/arrayJson.txt").getPath());
-			mapJson = new File(TestJacksonUnmashalling.class.getResource("/mapJson.txt").getPath());
-			pojoJson = new File(TestJacksonUnmashalling.class.getResource("/pojoJson.txt").getPath());
-			pojoArrayJson = new File(TestJacksonUnmashalling.class.getResource("/pojoArrayJson.txt").getPath());
-			complexPojoJson = new File(TestJacksonUnmashalling.class.getResource("/complexPojoJson.txt").getPath());
-		}catch(Exception ex){
-			LOG.error("Cannot read json files", ex);
-			Assert.fail("Cannot read json files");
-		}
-	}
-	
-	@AfterClass
-	public static void end(){
-	}
-	
-	@Test
-	public void testArrayJsonUnmashalling(){
-		try{
-			JsonFactory factory = new JsonFactory(); 
-			ObjectMapper mapper = new ObjectMapper(factory);
-			TypeReference<String[]> type = new TypeReference<String[]>() {};
-			String[] array = mapper.readValue(arrayJson, type);
-			StringBuffer sb = new StringBuffer();
-			for(String str : array){
-				sb.append(str);
-				sb.append(",");
-			}
-			LOG.info(sb.toString());
-		}catch(Exception ex){
-			LOG.error("Cannot unmashall an array json file", ex);
-			Assert.fail("Cannot unmashall an array json file arrayJson.txt");
-		}
-	}
-	
-	@Test
-	public void testMapJsonUnmashalling(){
-		try{
-			JsonFactory factory = new JsonFactory(); 
-			ObjectMapper mapper = new ObjectMapper(factory);
-			TypeReference<Map<String, String>> type = new TypeReference<Map<String, String>>() {};
-			Map<String, String> map = mapper.readValue(mapJson, type);
-			StringBuffer sb = new StringBuffer();
-			for(Map.Entry<String, String> entry : map.entrySet()){
-				sb.append(entry.getKey());
-				sb.append(":");
-				sb.append(entry.getValue());
-				sb.append(",");
-			}
-			LOG.info(sb.toString());
-		}catch(Exception ex){
-			LOG.error("Cannot unmashall a map json file", ex);
-			Assert.fail("Cannot unmashall a map json file arrayJson.txt");
-		}
-	}
-	
-	static class Pojo{
-		private String field1;
-		private String field2;
-		public String getField1() {
-			return field1;
-		}
-		public void setField1(String field1) {
-			this.field1 = field1;
-		}
-		public String getField2() {
-			return field2;
-		}
-		public void setField2(String field2) {
-			this.field2 = field2;
-		}
-	}
-	
-	@Test
-	public void testPojoJsonUnmashalling(){
-		try{
-			JsonFactory factory = new JsonFactory(); 
-			ObjectMapper mapper = new ObjectMapper(factory);
-			TypeReference<Pojo> type = new TypeReference<Pojo>() {};
-			Pojo p = mapper.readValue(pojoJson, type);
-			LOG.info(p.getField1() + "," + p.getField2());
-		}catch(Exception ex){
-			LOG.error("Cannot unmashall a map json file", ex);
-			Assert.fail("Cannot unmashall a map json file arrayJson.txt");
-		}
-	}
-	
-	@Test
-	public void testPojoArrayJsonUnmashalling(){
-		try{
-			JsonFactory factory = new JsonFactory(); 
-			ObjectMapper mapper = new ObjectMapper(factory);
-			TypeReference<Pojo[]> type = new TypeReference<Pojo[]>() {};
-			Pojo[] ps = mapper.readValue(pojoArrayJson, type);
-			for(Pojo p : ps){
-				LOG.info(p.getField1() + "," + p.getField2());
-			}
-		}catch(Exception ex){
-			LOG.error("Cannot unmashall a map json file", ex);
-			Assert.fail("Cannot unmashall a map json file arrayJson.txt");
-		}
-	}
-	
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/Base.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/Base.java b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/Base.java
new file mode 100644
index 0000000..1f54f00
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/Base.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.eagle.service.client;
+
+import org.codehaus.jackson.annotate.JsonSubTypes;
+import org.codehaus.jackson.annotate.JsonTypeInfo;
+
+
+//@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
+@JsonTypeInfo(use=JsonTypeInfo.Id.NAME )
+@JsonSubTypes({
+    @JsonSubTypes.Type(value=ClassA.class, name="ClassA"),
+    @JsonSubTypes.Type(value=ClassB.class, name="ClassB")
+})
+public abstract class Base {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/ClassA.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/ClassA.java b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/ClassA.java
new file mode 100644
index 0000000..60158fc
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/ClassA.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.service.client;
+
+import org.codehaus.jackson.annotate.JsonTypeName;
+
+
+@JsonTypeName("ClassA")
+public class ClassA extends Base {
+
+	private int a;
+
+	public int getA() {
+		return a;
+	}
+
+	public void setA(int a) {
+		this.a = a;
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/ClassB.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/ClassB.java b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/ClassB.java
new file mode 100644
index 0000000..faa20ba
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/ClassB.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.eagle.service.client;
+
+import org.codehaus.jackson.annotate.JsonTypeName;
+
+@JsonTypeName("ClassB")
+public class ClassB extends Base {
+
+	private String b;
+
+	public String getB() {
+		return b;
+	}
+
+	public void setB(String b) {
+		this.b = b;
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/ClientTestBase.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/ClientTestBase.java b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/ClientTestBase.java
new file mode 100644
index 0000000..ac16b93
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/ClientTestBase.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.eagle.service.client;
+
+import org.apache.eagle.service.hbase.EmbeddedHbase;
+
+public class ClientTestBase {
+	
+	//protected static EmbeddedServer server;
+	protected static EmbeddedHbase hbase;
+
+	//@BeforeClass
+	public static void startup() throws Exception {
+		//hbase = EmbeddedHbase.getInstance();
+		//String webappDirLocation = "../../../eagle-webservice/target/eagle-service";
+		//server = EmbeddedServer.getInstance(webappDirLocation);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/TestEagleServiceClientImpl.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/TestEagleServiceClientImpl.java b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/TestEagleServiceClientImpl.java
new file mode 100644
index 0000000..0625145
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/TestEagleServiceClientImpl.java
@@ -0,0 +1,339 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.eagle.service.client;
+
+import org.apache.eagle.log.entity.GenericMetricEntity;
+import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
+import org.apache.eagle.log.entity.test.TestTimeSeriesAPIEntity;
+import org.apache.eagle.service.client.impl.EagleServiceClientImpl;
+import org.apache.eagle.service.client.impl.ConcurrentSender;
+import junit.framework.Assert;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+public class TestEagleServiceClientImpl extends ClientTestBase {
+
+    IEagleServiceClient client = new EagleServiceClientImpl("localhost",38080);
+
+    //@Before
+    public void setUp() {
+        hbase.createTable("unittest", "f");
+    }
+
+    //After
+    public void cleanUp() {
+        hbase.deleteTable("unittest");
+    }
+
+    //@Test
+    public void testCreateAndSearch() throws IOException, EagleServiceClientException, IllegalAccessException, InstantiationException {
+        List<TestTimeSeriesAPIEntity> entities = new ArrayList<TestTimeSeriesAPIEntity>();
+
+        for(int i=0;i<100;i++){
+            TestTimeSeriesAPIEntity entity = new TestTimeSeriesAPIEntity();
+            entity.setTimestamp(System.currentTimeMillis());
+            entity.setTags(new HashMap<String, String>() {{
+                put("cluster", "cluster4ut");
+                put("datacenter", "datacenter4ut");
+                put("timestampStr",System.currentTimeMillis()+"");
+            }});
+            entity.setField1(1);
+            entity.setField2(1);
+            entity.setField3(1);
+            entity.setField4(1l);
+            entity.setField5(1l);
+            entity.setField5(1.2);
+            entity.setField6(-1.2);
+            entity.setField7("test unit string attribute");
+            entities.add(entity);
+        }
+
+        GenericServiceAPIResponseEntity response = client.create(entities);
+        assert response.isSuccess();
+        response = client.create(entities,TestTimeSeriesAPIEntity.class);
+        assert response.isSuccess();
+        response = client.create(entities,"TestTimeSeriesAPIEntity");
+        assert response.isSuccess();
+
+        response = client.search("TestTimeSeriesAPIEntity[]{*}")
+                .startTime(0)
+                .endTime(System.currentTimeMillis() + 25 * 3600 * 1000)
+                .pageSize(1000)
+                .send();
+
+        assert  response.isSuccess();
+        assert response.getObj().size() > 0;
+    }
+
+    private TestTimeSeriesAPIEntity newEntity(){
+        TestTimeSeriesAPIEntity entity = new TestTimeSeriesAPIEntity();
+        entity.setTimestamp(System.currentTimeMillis());
+        entity.setTags(new HashMap<String, String>() {{
+            put("cluster", "cluster4ut");
+            put("datacenter", "datacenter4ut");
+        }});
+        entity.setField1(1);
+        entity.setField2(1);
+        entity.setField3(1);
+        entity.setField4(1l);
+        entity.setField5(1l);
+        entity.setField5(1.2);
+        entity.setField6(-1.2);
+        entity.setField7("test unit string attribute");
+        return entity;
+    }
+
+    //@Test
+    public void testUpdate() throws IOException, EagleServiceClientException, IllegalAccessException, InstantiationException {
+        List<TestTimeSeriesAPIEntity> entities = new ArrayList<TestTimeSeriesAPIEntity>();
+        for(int i=0;i<100;i++){
+            TestTimeSeriesAPIEntity entity = new TestTimeSeriesAPIEntity();
+            entity.setTimestamp(System.currentTimeMillis());
+            entity.setTags(new HashMap<String, String>() {{
+                put("cluster", "cluster4ut");
+                put("datacenter", "datacenter4ut");
+            }});
+            entity.setField1(1);
+            entity.setField2(1);
+            entity.setField3(1);
+            entity.setField4(1l);
+            entity.setField5(1l);
+            entity.setField5(1.2);
+            entity.setField6(-1.2);
+            entity.setField7("updated");
+            entities.add(entity);
+        }
+
+        GenericServiceAPIResponseEntity response = client.update(entities);
+        assert response.isSuccess();
+        response = client.update(entities, TestTimeSeriesAPIEntity.class);
+        assert response.isSuccess();
+        response = client.update(entities, "TestTimeSeriesAPIEntity");
+        assert response.isSuccess();
+
+        response = client.search("TestTimeSeriesAPIEntity[]{*}")
+                .startTime(0)
+                .endTime(System.currentTimeMillis() + 25 * 3600 * 1000)
+                .pageSize(1000)
+                .send();
+
+        assert response.isSuccess();
+        assert response.getObj().size() > 0;
+    }
+
+    //@Test
+    public void testDelete() throws IOException, EagleServiceClientException {
+        List<TestTimeSeriesAPIEntity> entities = new ArrayList<TestTimeSeriesAPIEntity>();
+        for(int i=0;i<100;i++){
+            TestTimeSeriesAPIEntity entity = new TestTimeSeriesAPIEntity();
+            entity.setTimestamp(System.currentTimeMillis());
+            entity.setTags(new HashMap<String, String>() {{
+                put("cluster", "cluster4ut");
+                put("datacenter", "datacenter4ut");
+            }});
+
+            entity.setField1(1);
+            entity.setField2(1);
+            entity.setField3(1);
+            entity.setField4(1l);
+            entity.setField5(1l);
+            entity.setField5(1.2);
+            entity.setField6(-1.2);
+            entity.setField7(" unit test oriented string attribute");
+            entities.add(entity);
+        }
+
+        GenericServiceAPIResponseEntity response = client.delete(entities);
+        assert response.isSuccess();
+        response = client.delete(entities, TestTimeSeriesAPIEntity.class);
+        assert response.isSuccess();
+        response = client.delete(entities, "TestTimeSeriesAPIEntity");
+        assert response.isSuccess();
+
+        response = client.delete()
+                .byId(Arrays.asList("30RR1H___rOqxUr5M_sR-g5RxZlmldR_9eQ49A"))
+                .serviceName("TestTimeSeriesAPIEntity")
+                .send();
+
+        assert response.isSuccess();
+
+        response = client.delete()
+                .byQuery("TestTimeSeriesAPIEntity[]{*}")
+                .startTime(0)
+                .endTime(System.currentTimeMillis())
+                .pageSize(1000)
+                .send();
+
+        assert response.isSuccess();
+    }
+
+    //@Test
+    public void testMetricsSender() throws IOException, EagleServiceClientException {
+        List<GenericMetricEntity> entities = new ArrayList<GenericMetricEntity>();
+
+        Map<String,String> tags = new HashMap<String, String>() {{
+            put("cluster", "cluster4ut");
+            put("datacenter", "datacenter4ut");
+        }};
+
+        for(int i=0;i<100;i++){
+            GenericMetricEntity entity = new GenericMetricEntity();
+            entity.setTimestamp(System.currentTimeMillis());
+            entity.setTags(tags);
+            entity.setValue(new double[]{1.234});
+            entity.setPrefix("unit.test.metrics");
+            entities.add(entity);
+        }
+
+        GenericServiceAPIResponseEntity response = client.create(entities);
+        assert response.isSuccess();
+        response = client.create(entities,GenericMetricEntity.class);
+        assert response.isSuccess();
+        response = client.create(entities,GenericMetricEntity.GENERIC_METRIC_SERVICE);
+        assert response.isSuccess();
+
+        client.metric("unit.test.metrics")
+                .batch(5)
+                .tags(tags)
+                .send("unit.test.anothermetrics", System.currentTimeMillis(), tags, 0.1, 0.2, 0.3)
+                .send(System.currentTimeMillis(), 0.1)
+                .send(System.currentTimeMillis(),0.1,0.2)
+                .send(System.currentTimeMillis(),0.1,0.2,0.3)
+                .send(System.currentTimeMillis(),tags,0.1,0.2,0.3)
+                .send("unit.test.anothermetrics",System.currentTimeMillis(),tags,0.1,0.2,0.3)
+                .flush();
+
+        GenericServiceAPIResponseEntity<GenericMetricEntity> metricResponse = client.search("GenericMetricService[@cluster=\"cluster4ut\" AND @datacenter = \"datacenter4ut\"]{*}")
+                .startTime(0)
+                .endTime(System.currentTimeMillis()+24 * 3600 * 1000)
+                .metricName("unit.test.metrics")
+                .pageSize(1000)
+                .send();
+        List<GenericMetricEntity> metricEntities = metricResponse.getObj();
+        assert metricEntities != null;
+        assert metricResponse.isSuccess();
+
+        GenericServiceAPIResponseEntity<Map> metricAggResponse = client.search("GenericMetricService[@cluster=\"cluster4ut\" AND @datacenter = \"datacenter4ut\"]<@cluster>{sum(value)}")
+                .startTime(0)
+                .endTime(System.currentTimeMillis()+24 * 3600 * 1000)
+                .metricName("unit.test.metrics")
+                .pageSize(1000)
+                .send();
+        List<Map> aggResult = metricAggResponse.getObj();
+        assert aggResult != null;
+        assert metricAggResponse.isSuccess();
+
+        client.close();
+    }
+
+    //@Test
+    public void testBatchSender() throws IOException, EagleServiceClientException {
+        client.batch(2)
+                .send(newEntity())
+                .send(newEntity())
+                .send(newEntity());
+        client.close();
+    }
+
+    //@Test
+    public void testAsyncSender() throws IOException, EagleServiceClientException, ExecutionException, InterruptedException {
+        EagleServiceAsyncClient asyncClient = client.async();
+
+        Future<GenericServiceAPIResponseEntity<String>> future1 =
+                asyncClient.create(Arrays.asList(newEntity()));
+
+        GenericServiceAPIResponseEntity<String> response1 = future1.get();
+
+        Assert.assertTrue(response1.isSuccess());
+
+        Future<GenericServiceAPIResponseEntity<String>> future2 =
+                asyncClient.update(Arrays.asList(newEntity()));
+
+        GenericServiceAPIResponseEntity<String> response2 = future2.get();
+
+        Assert.assertTrue(response2.isSuccess());
+
+        Future<GenericServiceAPIResponseEntity<String>> future3 =
+                asyncClient.delete(Arrays.asList(newEntity()));
+
+        GenericServiceAPIResponseEntity<String> response3 = future3.get();
+
+        Assert.assertTrue(response3.isSuccess());
+
+        client.close();
+    }
+
+    //@Test
+    public void testParallelSender() throws IOException, EagleServiceClientException, InterruptedException {
+        // Case #1:
+        ConcurrentSender concurrentSender = client
+                .parallel(10)
+                .batchSize(30)
+                .batchInterval(1000);
+
+        int num = 1000;
+
+        for(int i=0; i< num;i++) {
+            concurrentSender.send(Arrays.asList(newEntity()));
+        }
+
+        // Case #2:
+        ConcurrentSender concurrentSender2 = client
+                .parallel(10)
+                .batchSize(20)
+                .batchInterval(3);
+
+        int num2 = 50;
+
+        for(int i=0; i< num2;i++) {
+            concurrentSender2.send(Arrays.asList(newEntity()));
+            Thread.sleep(1);
+        }
+        client.close();
+    }
+
+    //@Test
+    public void testSearch() throws EagleServiceClientException, IOException {
+        hbase.createTable("eagle_metric", "f");
+
+        GenericServiceAPIResponseEntity<TestTimeSeriesAPIEntity> response =
+                client.search("TestTimeSeriesAPIEntity[]{*}").startTime(0).endTime(System.currentTimeMillis()+1000).pageSize(1000).send();
+
+        Assert.assertTrue(response.isSuccess());
+
+        GenericServiceAPIResponseEntity<Map> response2 =
+                client.search("TestTimeSeriesAPIEntity[]<@cluster>{count}").startTime(0).endTime(System.currentTimeMillis()+1000).pageSize(1000).send();
+
+        Assert.assertTrue(response2.isSuccess());
+
+        GenericServiceAPIResponseEntity<GenericMetricEntity> response3 =
+                client.search("GenericMetricService[@cluster = \"cluster4ut\" AND @datacenter = \"datacenter4ut\"]{*}").metricName("unit.test.metrics").startTime(0).endTime(System.currentTimeMillis()+1000).pageSize(1000).send();
+
+        Assert.assertTrue(response3.isSuccess());
+        hbase.deleteTable("eagle_metric");
+    }
+
+    @Test
+    public void test() {
+
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/TestIEagleServiceClient.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/TestIEagleServiceClient.java b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/TestIEagleServiceClient.java
new file mode 100644
index 0000000..a144118
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/TestIEagleServiceClient.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.service.client;
+
+import org.apache.eagle.common.config.EagleConfigFactory;
+import org.apache.eagle.log.entity.GenericMetricEntity;
+import org.apache.eagle.log.entity.GenericServiceAPIResponseEntity;
+import org.apache.eagle.log.entity.meta.EntityDefinition;
+import org.apache.eagle.log.entity.meta.EntityDefinitionManager;
+import org.apache.eagle.service.client.impl.EagleServiceClientImpl;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class TestIEagleServiceClient extends ClientTestBase {
+    IEagleServiceClient client;
+    //@Before
+    public void setUp(){
+        client = new EagleServiceClientImpl("localhost", EagleConfigFactory.load().getServicePort());
+    }
+
+    /**
+     * Just compiling passed is ok
+     */
+    //@Test
+    @SuppressWarnings("unused")
+    public void testCreate() throws IOException, EagleServiceClientException, IllegalAccessException, InstantiationException {
+        EntityDefinition entityDefinition = EntityDefinitionManager.getEntityDefinitionByEntityClass(GenericMetricEntity.class);
+        hbase.createTable(entityDefinition.getTable(), entityDefinition.getColumnFamily());
+
+        client = new EagleServiceClientImpl("localhost", EagleConfigFactory.load().getServicePort());
+        List<GenericMetricEntity> metricEntityList = new ArrayList<GenericMetricEntity>();
+        GenericServiceAPIResponseEntity<String> unTypedResponse = client.create(metricEntityList);
+        GenericServiceAPIResponseEntity<String> weakTypedResponse = client.create(metricEntityList,GenericMetricEntity.GENERIC_METRIC_SERVICE);
+        GenericServiceAPIResponseEntity<String> strongTypedResponse = client.create(metricEntityList,GenericMetricEntity.class);
+
+        GenericServiceAPIResponseEntity<GenericMetricEntity> weakTypedSearchResponse = client.search("").send();
+        if(weakTypedSearchResponse!=null) {
+            Class<GenericMetricEntity> typedClazz = weakTypedSearchResponse.getType();
+            List<GenericMetricEntity> typedEntities = weakTypedSearchResponse.getObj();
+        }
+    }
+
+    @Test
+    public void test() {
+
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/TestJackson.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/TestJackson.java b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/TestJackson.java
new file mode 100644
index 0000000..73d28be
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/client/TestJackson.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.eagle.service.client;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.codehaus.jackson.JsonGenerationException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.Test;
+
+// http://wiki.fasterxml.com/JacksonPolymorphicDeserialization
+public class TestJackson {
+
+	@Test
+	public void testBase() throws JsonGenerationException, JsonMappingException, IOException {
+		List<Base> objs = new ArrayList<Base>();
+		ClassA a = new ClassA();
+		a.setA(1);
+		ClassB b = new ClassB();
+		b.setB("2");
+		
+		objs.add(a);
+		objs.add(b);
+		
+		ObjectMapper om = new ObjectMapper();
+		om.enableDefaultTyping();
+//		om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+		String value = om.writeValueAsString(objs);
+		
+		System.out.println("value = " + value);
+		
+		@SuppressWarnings("rawtypes")
+		List result = om.readValue(value, ArrayList.class);
+		System.out.println("size = " + result.size());
+		Object obj1 = result.get(0);
+		Object obj2 = result.get(1);
+		
+		Assert.assertEquals("ClassA", obj1.getClass().getSimpleName());
+		Assert.assertEquals(1, ((ClassA)obj1).getA());
+		Assert.assertEquals("ClassB", obj2.getClass().getSimpleName());
+		Assert.assertEquals("2", ((ClassB)obj2).getB());
+		
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/jackson/TestJacksonMarshalling.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/jackson/TestJacksonMarshalling.java b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/jackson/TestJacksonMarshalling.java
new file mode 100644
index 0000000..808ee9a
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/jackson/TestJacksonMarshalling.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.eagle.service.jackson;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.codehaus.jackson.JsonFactory;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestJacksonMarshalling {
+	private static Logger LOG = LoggerFactory.getLogger(TestJacksonMarshalling.class);
+
+	
+	
+	@Test
+	public void testJSonArrayMarshalling(){
+		String[] array = {"cluster", "datacenter", "rack", "hostname"};
+		JsonFactory factory = new JsonFactory(); 
+	    ObjectMapper mapper = new ObjectMapper(factory);
+	    String result = null;
+	    try{
+	    	result = mapper.writeValueAsString(array);
+	    }catch(Exception ex){
+	    	LOG.error("Cannot marshall", ex);
+	    	Assert.fail("cannot marshall an String array");
+	    }
+	    Assert.assertEquals("[\"cluster\",\"datacenter\",\"rack\",\"hostname\"]", result);
+	}
+	
+
+	static class Pojo{
+		private String field1;
+		private String field2;
+		public String getField1() {
+			return field1;
+		}
+		public void setField1(String field1) {
+			this.field1 = field1;
+		}
+		public String getField2() {
+			return field2;
+		}
+		public void setField2(String field2) {
+			this.field2 = field2;
+		}
+	}
+	
+	@Test
+	public void testPojoMarshalling(){
+		Pojo p = new Pojo();
+		p.setField1("field1");
+		p.setField2("field2");
+		
+		JsonFactory factory = new JsonFactory(); 
+	    ObjectMapper mapper = new ObjectMapper(factory);
+	    String result = null;
+	    try{
+	    	result = mapper.writeValueAsString(p);
+	    }catch(Exception ex){
+	    	LOG.error("Cannot marshall", ex);
+	    	Assert.fail("Cannot marshall a Pojo");
+	    }
+	    System.out.println(result);
+	    Assert.assertEquals("{\"field1\":\"field1\",\"field2\":\"field2\"}", result);
+	}
+	
+	@Test
+	public void testPojoArrayMashalling(){
+		Pojo[] ps = new Pojo[2];
+		ps[0] = new Pojo();
+		ps[0].setField1("0_field1");
+		ps[0].setField2("0_field2");
+		ps[1] = new Pojo();
+		ps[1].setField1("1_field1");
+		ps[1].setField2("1_field2");
+		
+		JsonFactory factory = new JsonFactory(); 
+	    ObjectMapper mapper = new ObjectMapper(factory);
+	    String result = null;
+	    try{
+	    	result = mapper.writeValueAsString(ps);
+	    }catch(Exception ex){
+	    	LOG.error("Cannot marshall", ex);
+	    	Assert.fail("Cannot marshall a Pojo array");
+	    }
+	    System.out.println(result);
+	    Assert.assertEquals("[{\"field1\":\"0_field1\",\"field2\":\"0_field2\"},{\"field1\":\"1_field1\",\"field2\":\"1_field2\"}]", result);
+	}
+	
+	@Test
+	public void testComplexMapMarshalling(){
+		Map<List<String>, String> map = new HashMap<List<String>, String>();
+		map.put(Arrays.asList("cluster1","dc1"), "123");
+		map.put(Arrays.asList("cluster1","dc1"), "456");
+		
+		JsonFactory factory = new JsonFactory(); 
+	    ObjectMapper mapper = new ObjectMapper(factory);
+	    String result = null;
+	    try{
+	    	result = mapper.writeValueAsString(map);
+	    }catch(Exception ex){
+	    	LOG.error("Cannot marshall", ex);
+	    	Assert.fail("Cannot marshall a complex map");
+	    }
+	    System.out.println(result);
+	}
+	
+	@Test
+	public void testMapMapMarshalling(){
+		Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>>();
+		Map<String, String> childmap1 = new HashMap<String, String>();
+		childmap1.put("dc1", "123");
+		childmap1.put("dc1", "456");
+		map.put("cluster1", childmap1);
+		
+		JsonFactory factory = new JsonFactory(); 
+	    ObjectMapper mapper = new ObjectMapper(factory);
+	    String result = null;
+	    try{
+	    	result = mapper.writeValueAsString(map);
+	    }catch(Exception ex){
+	    	LOG.error("Cannot marshall", ex);
+	    	Assert.fail("Cannot marshall a complex map");
+	    }
+	    System.out.println(result);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/jackson/TestJacksonUnmashalling.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/jackson/TestJacksonUnmashalling.java b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/jackson/TestJacksonUnmashalling.java
new file mode 100644
index 0000000..09e04ac
--- /dev/null
+++ b/eagle-core/eagle-query/eagle-client-base/src/test/java/org/apache/eagle/service/jackson/TestJacksonUnmashalling.java
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.eagle.service.jackson;
+
+import java.io.File;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.codehaus.jackson.JsonFactory;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.type.TypeReference;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestJacksonUnmashalling {
+	private static Logger LOG = LoggerFactory.getLogger(TestJacksonUnmashalling.class);
+	private static File arrayJson;
+	private static File mapJson;
+	private static File pojoJson;
+	private static File pojoArrayJson;
+	@SuppressWarnings("unused")
+	private static File complexPojoJson;
+	
+	@BeforeClass
+	public static void prepare(){ 
+		try{
+			arrayJson = new File(TestJacksonUnmashalling.class.getResource("/arrayJson.txt").getPath());
+			mapJson = new File(TestJacksonUnmashalling.class.getResource("/mapJson.txt").getPath());
+			pojoJson = new File(TestJacksonUnmashalling.class.getResource("/pojoJson.txt").getPath());
+			pojoArrayJson = new File(TestJacksonUnmashalling.class.getResource("/pojoArrayJson.txt").getPath());
+			complexPojoJson = new File(TestJacksonUnmashalling.class.getResource("/complexPojoJson.txt").getPath());
+		}catch(Exception ex){
+			LOG.error("Cannot read json files", ex);
+			Assert.fail("Cannot read json files");
+		}
+	}
+	
+	@AfterClass
+	public static void end(){
+	}
+	
+	@Test
+	public void testArrayJsonUnmashalling(){
+		try{
+			JsonFactory factory = new JsonFactory(); 
+			ObjectMapper mapper = new ObjectMapper(factory);
+			TypeReference<String[]> type = new TypeReference<String[]>() {};
+			String[] array = mapper.readValue(arrayJson, type);
+			StringBuffer sb = new StringBuffer();
+			for(String str : array){
+				sb.append(str);
+				sb.append(",");
+			}
+			LOG.info(sb.toString());
+		}catch(Exception ex){
+			LOG.error("Cannot unmashall an array json file", ex);
+			Assert.fail("Cannot unmashall an array json file arrayJson.txt");
+		}
+	}
+	
+	@Test
+	public void testMapJsonUnmashalling(){
+		try{
+			JsonFactory factory = new JsonFactory(); 
+			ObjectMapper mapper = new ObjectMapper(factory);
+			TypeReference<Map<String, String>> type = new TypeReference<Map<String, String>>() {};
+			Map<String, String> map = mapper.readValue(mapJson, type);
+			StringBuffer sb = new StringBuffer();
+			for(Map.Entry<String, String> entry : map.entrySet()){
+				sb.append(entry.getKey());
+				sb.append(":");
+				sb.append(entry.getValue());
+				sb.append(",");
+			}
+			LOG.info(sb.toString());
+		}catch(Exception ex){
+			LOG.error("Cannot unmashall a map json file", ex);
+			Assert.fail("Cannot unmashall a map json file arrayJson.txt");
+		}
+	}
+	
+	static class Pojo{
+		private String field1;
+		private String field2;
+		public String getField1() {
+			return field1;
+		}
+		public void setField1(String field1) {
+			this.field1 = field1;
+		}
+		public String getField2() {
+			return field2;
+		}
+		public void setField2(String field2) {
+			this.field2 = field2;
+		}
+	}
+	
+	@Test
+	public void testPojoJsonUnmashalling(){
+		try{
+			JsonFactory factory = new JsonFactory(); 
+			ObjectMapper mapper = new ObjectMapper(factory);
+			TypeReference<Pojo> type = new TypeReference<Pojo>() {};
+			Pojo p = mapper.readValue(pojoJson, type);
+			LOG.info(p.getField1() + "," + p.getField2());
+		}catch(Exception ex){
+			LOG.error("Cannot unmashall a map json file", ex);
+			Assert.fail("Cannot unmashall a map json file arrayJson.txt");
+		}
+	}
+	
+	@Test
+	public void testPojoArrayJsonUnmashalling(){
+		try{
+			JsonFactory factory = new JsonFactory(); 
+			ObjectMapper mapper = new ObjectMapper(factory);
+			TypeReference<Pojo[]> type = new TypeReference<Pojo[]>() {};
+			Pojo[] ps = mapper.readValue(pojoArrayJson, type);
+			for(Pojo p : ps){
+				LOG.info(p.getField1() + "," + p.getField2());
+			}
+		}catch(Exception ex){
+			LOG.error("Cannot unmashall a map json file", ex);
+			Assert.fail("Cannot unmashall a map json file arrayJson.txt");
+		}
+	}
+	
+}
+
+

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/Base64.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/Base64.java b/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/Base64.java
deleted file mode 100644
index d468090..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/Base64.java
+++ /dev/null
@@ -1,44 +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.common;
-
-import java.io.UnsupportedEncodingException;
-
-import javax.xml.bind.DatatypeConverter;
-
-public class Base64 {
-
-	public static String decode(String salted) {
-		try {
-			return new String(DatatypeConverter.parseBase64Binary(salted), "UTF-8");
-		} catch (UnsupportedEncodingException e) {
-			throw new RuntimeException("UTF-8 must be supported", e);
-		}
-	}
-
-	public static String encode(String plain) {
-		try {
-			return DatatypeConverter.printBase64Binary(plain.getBytes("UTF-8"));
-		} catch (UnsupportedEncodingException e) {
-			throw new RuntimeException("UTF-8 must be supported", e);
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/ByteUtil.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/ByteUtil.java b/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/ByteUtil.java
deleted file mode 100644
index b97f316..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/ByteUtil.java
+++ /dev/null
@@ -1,178 +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.common;
-
-public class ByteUtil {
-	
-	public static double bytesToDouble(byte[] bytes, int offset){
-		return Double.longBitsToDouble(bytesToLong(bytes, offset));
-	}
-	
-	public static double bytesToDouble(byte[] bytes){
-		return Double.longBitsToDouble(bytesToLong(bytes));
-	}
-	
-	public static void doubleToBytes(double v, byte[] bytes){
-		doubleToBytes(v, bytes, 0);
-	}
-	
-	public static void doubleToBytes(double v, byte[] bytes, int offset){
-		longToBytes(Double.doubleToLongBits(v), bytes, offset);
-	}
-	
-	public static byte[] doubleToBytes(double v){
-		return longToBytes(Double.doubleToLongBits(v));
-	}
-	
-	public static long bytesToLong(byte[] bytes){
-		return bytesToLong(bytes, 0);
-	}
-	
-	public static long bytesToLong(byte[] bytes, int offset){
-		long value = 0;
-		for(int i=0; i<8; i++){
-			value <<= 8;
-			value |= (bytes[i+offset] & 0xFF);
-		}
-		return value;
-	}
-	
-	public static void longToBytes(long v, byte[] bytes){
-		longToBytes(v, bytes, 0);
-	}
-	
-	public static void longToBytes(long v, byte[] bytes, int offset){
-		long tmp = v;
-		for(int i=0; i<8; i++){
-			bytes[offset + 7 - i] = (byte)(tmp & 0xFF);
-			tmp >>= 8;
-		}
-	}
-	
-	public static byte[] longToBytes(long v){
-		long tmp = v;
-		byte[] b = new byte[8];
-		for(int i=0; i<8; i++){
-			b[7-i] = (byte)(tmp & 0xFF);
-			tmp >>= 8;
-		}
-		return b;
-	}
-	
-	public static int bytesToInt(byte[] bytes){
-		return bytesToInt(bytes, 0);
-	}
-	
-	public static int bytesToInt(byte[] bytes, int offset){
-		int value = 0;
-		for(int i=0; i<4; i++){
-			value <<= 8;
-			value |= (bytes[i+offset] & 0xFF);
-		}
-		return value;
-	}
-	
-	public static void intToBytes(int v, byte[] bytes){
-		intToBytes(v, bytes, 0);
-	}
-	
-	public static void intToBytes(int v, byte[] bytes, int offset){
-		int tmp = v;
-		for(int i=0; i<4; i++){
-			bytes[offset + 3 - i] = (byte)(tmp & 0xFF);
-			tmp >>= 8;
-		}
-	}
-
-	public static byte[] intToBytes(int v){
-		int tmp = v;
-		byte[] b = new byte[4];
-		for(int i=0; i<4; i++){
-			b[3-i] = (byte)(tmp & 0xFF);
-			tmp >>= 8;
-		}
-		return b;
-	}
-
-	//////
-	
-	public static short bytesToShort(byte[] bytes){
-		return bytesToShort(bytes, 0);
-	}
-	
-	public static short bytesToShort(byte[] bytes, int offset){
-		short value = 0;
-		for(int i=0; i < 2; i++){
-			value <<= 8;
-			value |= (bytes[i+offset] & 0xFF);
-		}
-		return value;
-	}
-	
-	public static void shortToBytes(short v, byte[] bytes){
-		shortToBytes(v, bytes, 0);
-	}
-	
-	public static void shortToBytes(short v, byte[] bytes, int offset){
-		int tmp = v;
-		for(int i=0; i < 2; i++){
-			bytes[offset + 1 - i] = (byte)(tmp & 0xFF);
-			tmp >>= 8;
-		}
-	}
-
-	public static byte[] shortToBytes(short v){
-		int tmp = v;
-		byte[] b = new byte[2];
-		for(int i=0; i<2; i++){
-			b[1-i] = (byte)(tmp & 0xFF);
-			tmp >>= 8;
-		}
-		return b;
-	}
-
-	public static byte[] concat(byte[]... arrays) {
-        int length = 0;
-        for (byte[] array : arrays) {
-            length += array.length;
-        }
-        byte[] result = new byte[length];
-        int pos = 0;
-        for (byte[] array : arrays) {
-            System.arraycopy(array, 0, result, pos, array.length);
-            pos += array.length;
-        }
-        return result;
-    }
-	
-//    public static void main(String[] args){ 
-//    	int a = "ThreadName".hashCode();
-//    	byte[] b = intToBytes(a);
-//    	byte[] c = intToBytes(1676687583);
-//    	String s = new String(b);
-//    	System.out.println(s);
-    	
-//    	byte[] d = intToBytes(8652353);
-//    	System.out.println(bytesToInt(d));
-    	
-//    	byte[] e = longToBytes(12131513513l);
-//    	System.out.println(bytesToLong(e));
-//    	if(12131513513l == bytesToLong(e)){
-//    		System.out.println("yes");
-//    	}
-//    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/CircularArrayList.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/CircularArrayList.java b/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/CircularArrayList.java
deleted file mode 100644
index 8fea29c..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/CircularArrayList.java
+++ /dev/null
@@ -1,149 +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.common;
-
-import java.util.AbstractList;
-import java.util.RandomAccess;
-
-/**
- * Circular array implementation
- *
- * @param <E>
- */
-public class CircularArrayList<E> extends AbstractList<E> implements RandomAccess {
-  
-    private final E[] buf; // a List implementing RandomAccess
-    private int head = 0;
-    private int tail = 0;
-    private boolean full = false;
-  
-    public CircularArrayList(E[] array) {
-        buf = array;
-        full = (buf.length == 0);
-    }
-  
-    public int capacity() {
-        return buf.length;
-    }
-    
-    public int head() {
-    	return head;
-    }
-    
-    public int tail() {
-    	return tail;
-    }
-    
-    public boolean isFull() {
-    	return full;
-    }
-    
-    @Override
-    public void clear() {
-        head = 0;
-        tail = 0;
-        full = false;
-        for (int i = 0; i < buf.length; ++i) {
-        	buf[i] = null;
-        }
-    }
-
-    private int wrapIndex(int i) {
-        int m = i % buf.length;
-        if (m < 0) { // java modulus can be negative
-            throw new IndexOutOfBoundsException();
-        }
-        return m;
-    }
-  
-    // This method is O(n) but will never be called if the
-    // CircularArrayList is used in its typical/intended role.
-    private void shiftBlock(int startIndex, int endIndex) {
-        assert (endIndex > startIndex);
-        for (int i = endIndex - 1; i >= startIndex; i--) {
-            set(i + 1, get(i));
-        }
-    }
-    
-    public int find(E e) {
-    	final int size = size();
-    	for (int i = 0; i < size; ++i) {
-    		if (e.equals(get(i))) {
-    			return i;
-    		}
-    	}
-    	return -1;
-    }
-  
-    @Override
-    public int size() {
-    	if (full) {
-    		return buf.length;
-    	}
-        return tail - head + (tail < head ? buf.length : 0);
-    }
-  
-    @Override
-    public E get(int i) {
-        if (i < 0 || i >= size()) {
-            throw new IndexOutOfBoundsException();
-        }
-        return buf[wrapIndex(head + i)];
-    }
-  
-    @Override
-    public E set(int i, E e) {
-        if (i < 0 || i >= size()) {
-            throw new IndexOutOfBoundsException();
-        }
-        return buf[wrapIndex(head + i)] =  e;
-    }
-  
-    @Override
-    public void add(int i, E e) {
-        int s = size();
-        if (s == buf.length) {
-            throw new IllegalStateException("Cannot add element."
-                    + " CircularArrayList is filled to capacity.");
-        }
-        full = (s + 1 == buf.length);
-        if (i < 0 || i > s) {
-            throw new IndexOutOfBoundsException();
-        }
-        tail = wrapIndex(tail + 1);
-        if (i < s) {
-            shiftBlock(i, s);
-        }
-        set(i, e);
-    }
-  
-    @Override
-    public E remove(int i) {
-        int s = size();
-        if (i < 0 || i >= s) {
-            throw new IndexOutOfBoundsException();
-        }
-        final E e = get(i);
-        if (i > 0) {
-            shiftBlock(0, i);
-        }
-    	buf[head] = null;
-        head = wrapIndex(head + 1);
-        full = false;
-        return e;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/CircularArrayListSortedSet.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/CircularArrayListSortedSet.java b/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/CircularArrayListSortedSet.java
deleted file mode 100644
index 18b54c0..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/CircularArrayListSortedSet.java
+++ /dev/null
@@ -1,106 +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.common;
-
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-public class CircularArrayListSortedSet<E> {
-
-	private final CircularArrayList<E> list;
-    private final Comparator<? super E> comparator;
-
-	public CircularArrayListSortedSet(E[] array) {
-		this.list = new CircularArrayList<E>(array);
-		this.comparator = null;
-	}
-	
-	public CircularArrayListSortedSet(E[] array, Comparator<? super E> comparator) {
-		this.list = new CircularArrayList<E>(array);
-		this.comparator = comparator;
-	}
-	
-    public int capacity() {
-        return list.capacity();
-    }
-    
-    public int head() {
-    	return list.head();
-    }
-    
-    public int tail() {
-    	return list.tail();
-    }
-    
-    public boolean isFull() {
-    	return list.isFull();
-    }
-  
-    public void clear() {
-    	list.clear();
-    }
-    
-    public int size() {
-    	return list.size();
-    }
-  
-    public E get(int i) {
-        return list.get(i);
-    }
-    
-    @SuppressWarnings("unchecked")
-	public int binarySearch(E e) {
-    	if (comparator != null) {
-    		return Collections.binarySearch(list, e, comparator);
-    	} else {
-    		return Collections.binarySearch((List<? extends Comparable<? super E>>)list, e);
-    	}
-    }
-    
-    public int replace(E e) {
-    	int index = binarySearch(e);
-    	if (index < 0) {
-    		return -1;
-    	}
-    	list.set(index, e);
-    	return index;
-    }
-  
-    public int insert(E e) {
-    	int index = binarySearch(e);
-    	if (index > 0) {
-    		return -1;
-    	}
-    	index = 0 - index - 1;
-    	list.add(index, e);
-    	return index;
-    }
-  
-    public E remove(int i) {
-    	return list.remove(i);
-    }
-    
-    public int remove(E e) {
-    	final int index = binarySearch(e);
-    	if (index > 0) {
-        	list.remove(index);
-        	return index;
-    	}
-    	return -1;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/DateTimeUtil.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/DateTimeUtil.java b/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/DateTimeUtil.java
deleted file mode 100644
index ed07854..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/DateTimeUtil.java
+++ /dev/null
@@ -1,138 +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.common;
-import eagle.common.config.EagleConfigFactory;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.TimeZone;
-
-/**
- * be aware that SimpleDateFormat instantiation is expensive, so if that's under a tight loop, probably we need
- * a thread local SimpleDateFormat object
- */
-public class DateTimeUtil {
-	public static final long ONESECOND = 1L * 1000L;
-	public static final long ONEMINUTE = 1L * 60L * 1000L;
-	public static final long ONEHOUR = 1L * 60L * 60L * 1000L;
-	public static final long ONEDAY = 24L * 60L * 60L * 1000L;
-    private static TimeZone CURRENT_TIME_ZONE = EagleConfigFactory.load().getTimeZone();
-	
-	public static Date humanDateToDate(String date) throws ParseException{
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		return sdf.parse(date);
-	}
-	
-	public static String secondsToHumanDate(long seconds){
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date t = new Date();
-		t.setTime(seconds*1000);
-		return sdf.format(t);
-	}
-	
-	public static String millisecondsToHumanDateWithMilliseconds(long milliseconds){
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date t = new Date();
-		t.setTime(milliseconds);
-		return sdf.format(t);
-	}
-	
-	public static String millisecondsToHumanDateWithSeconds(long milliseconds){
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date t = new Date();
-		t.setTime(milliseconds);
-		return sdf.format(t);
-	}
-	
-	public static long humanDateToSeconds(String date) throws ParseException{
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date d = sdf.parse(date);
-		return d.getTime()/1000;
-	}
-	
-	public static long humanDateToMilliseconds(String date) throws ParseException{
-		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date d = sdf.parse(date);
-		return d.getTime();
-	}
-	
-	
-	public static long humanDateToMillisecondsWithoutException(String date){
-		try{
-			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,SSS");
-            sdf.setTimeZone(CURRENT_TIME_ZONE);
-			Date d = sdf.parse(date);
-			return d.getTime();
-		}catch(ParseException ex){
-			return 0L;
-		}
-	}
-	
-	public static long humanDateToSecondsWithoutException(String date){
-		try{
-			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            sdf.setTimeZone(CURRENT_TIME_ZONE);
-			Date d = sdf.parse(date);
-			return (d.getTime() / 1000);
-		}catch(ParseException ex){
-			return 0L;
-		}
-	}
-	/**
-	 * this could be accurate only when timezone is UTC
-	 * for the timezones other than UTC, there is possibly issue, for example
-	 * assume timezone is GMT+8 in China
-	 * When user time is "2014-07-15 05:00:00", it will be converted to timestamp first, internally it would be  "2014-07-14 21:00:00" in UTC timezone. When rounded down to day, the internal time would 
-	 * be changed to "2014-07-14 00:00:00", and that means the user time is "2014-07-14 08:00:00". But originally user wants to round it to "2014-07-15 00:00:00"
-	 * 
-	 * @param field
-	 * @param timeInMillis the seconds elapsed since 1970-01-01 00:00:00
-	 * @return
-	 */
-	public static long roundDown(int field, long timeInMillis){
-		switch(field){
-			case Calendar.DAY_OF_MONTH:
-			case Calendar.DAY_OF_WEEK:
-			case Calendar.DAY_OF_YEAR:
-				return (timeInMillis - timeInMillis % (24*60*60*1000));
-			case Calendar.HOUR:
-				return (timeInMillis - timeInMillis % (60*60*1000));
-			case Calendar.MINUTE:
-				return (timeInMillis - timeInMillis % (60*1000));
-			case Calendar.SECOND:
-				return (timeInMillis - timeInMillis % (1000));
-			default:
-				return 0L;
-		}
-	}
-
-	public static String format(long milliseconds, String format) {
-		SimpleDateFormat sdf = new SimpleDateFormat(format);
-        sdf.setTimeZone(CURRENT_TIME_ZONE);
-		Date t = new Date();
-		t.setTime(milliseconds);
-		return sdf.format(t);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/EagleBase64Wrapper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/EagleBase64Wrapper.java b/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/EagleBase64Wrapper.java
deleted file mode 100644
index de92305..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/EagleBase64Wrapper.java
+++ /dev/null
@@ -1,32 +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.common;
-
-import org.apache.commons.net.util.Base64;
-
-/**
- * wrap base64 encoding and decoding, so reduce the confuse of using many Base64 methods. 
- */
-public class EagleBase64Wrapper {
-	public static String encodeByteArray2URLSafeString(byte[] bytes){
-		return Base64.encodeBase64URLSafeString(bytes);
-	}
-	
-	public static byte[] decode(String input){
-		return Base64.decodeBase64(input);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/EagleExceptionWrapper.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/EagleExceptionWrapper.java b/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/EagleExceptionWrapper.java
deleted file mode 100644
index 1f7d040..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/EagleExceptionWrapper.java
+++ /dev/null
@@ -1,42 +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.common;
-
-public class EagleExceptionWrapper {
-	private final static int MAX_DEPTH = 10;
-	
-	public static String wrap(Exception ex){
-		return wrap(ex, EagleExceptionWrapper.MAX_DEPTH);
-	}
-	
-	public static String wrap(Exception ex, int maxdepth){
-		int d = maxdepth;
-		if(d <= 0)
-			d = EagleExceptionWrapper.MAX_DEPTH;
-		int index = 0;
-		StringBuffer sb = new StringBuffer();
-		sb.append(ex);
-		sb.append(System.getProperty("line.separator"));
-		for(StackTraceElement element : ex.getStackTrace()){
-			sb.append(element.toString());
-			sb.append(System.getProperty("line.separator"));
-			if(++index >= d)
-				break;
-		}
-		return sb.toString();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/Environment.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/Environment.java b/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/Environment.java
deleted file mode 100644
index 1c8ff42..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/Environment.java
+++ /dev/null
@@ -1,23 +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.common;
-
-public enum Environment {
-	dev,
-	test,
-	prod,
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/OS.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/OS.java b/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/OS.java
deleted file mode 100644
index b831b97..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/OS.java
+++ /dev/null
@@ -1,41 +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.common;
-
-public class OS {
-
-	private final static String os = System.getProperty("os.name")
-			.toLowerCase();
-
-	public static boolean isWindows() {
-		return (os.indexOf("win") >= 0);
-	}
-
-	public static boolean isMac() {
-		return (os.indexOf("mac") >= 0);
-	}
-
-	public static boolean isUnix() {
-		return (os.indexOf("nix") >= 0 || os.indexOf("nux") >= 0 || os
-				.indexOf("aix") > 0);
-	}
-
-	public static boolean isSolaris() {
-		return (os.indexOf("sunos") >= 0);
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/config/EagleConfig.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/config/EagleConfig.java b/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/config/EagleConfig.java
deleted file mode 100755
index 3be47d9..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/config/EagleConfig.java
+++ /dev/null
@@ -1,55 +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.common.config;
-
-import com.typesafe.config.Config;
-import org.apache.hadoop.hbase.client.HTableInterface;
-
-import java.util.TimeZone;
-import java.util.concurrent.ThreadPoolExecutor;
-
-public interface EagleConfig {
-
-    boolean isCoprocessorEnabled();
-
-	HTableInterface getHTable(String tableName);
-
-    String getStorageType();
-
-    ThreadPoolExecutor getExecutor();
-
-	String getZKQuorum();
-
-	String getZKPort();
-
-	String getServiceHost();
-
-	int getServicePort();
-
-    String getEnv();
-
-    boolean isTableNamePrefixedWithEnvironment();
-	
-    int getHBaseClientScanCacheSize();
-
-    TimeZone getTimeZone();
-
-    /**
-     * @return root config
-     */
-    Config getConfig();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/afe86834/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/config/EagleConfigConstants.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/config/EagleConfigConstants.java b/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/config/EagleConfigConstants.java
deleted file mode 100644
index 589c992..0000000
--- a/eagle-core/eagle-query/eagle-common/src/main/java/eagle/common/config/EagleConfigConstants.java
+++ /dev/null
@@ -1,55 +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.common.config;
-
-public final class EagleConfigConstants {
-    public final static String SERVICE_ENV = "eagle.service.env";
-    public final static String SERVICE_HOST = "eagle.service.host";
-    public final static String SERVICE_PORT = "eagle.service.port";
-    public final static String SERVICE_HBASE_ZOOKEEPER_QUORUM = "eagle.service.hbase-zookeeper-quorum";
-    public final static String SERVICE_HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT = "eagle.service.hbase-zookeeper-property-clientPort";
-    public final static String SERVICE_ZOOKEEPER_ZNODE_PARENT = "eagle.service.zookeeper-znode-parent";
-    public final static String SERVICE_HBASE_CLIENT_IPC_POOL_SIZE = "eagle.service.hbase-client-ipc-pool-size";
-    public final static String SERVICE_STORAGE_TYPE = "eagle.service.storage-type";
-    public final static String SERVICE_COPROCESSOR_ENABLED = "eagle.service.coprocessor-enabled";
-    public final static String SERVICE_TABLE_NAME_PREFIXED_WITH_ENVIRONMENT = "eagle.service.table-name-prefixed-with-environment";
-    public final static String SERVICE_HBASE_CLIENT_SCAN_CACHE_SIZE = "eagle.service.hbase-client-scan-cache-size";
-    public final static String SERVICE_THREADPOOL_CORE_SIZE = "eagle.service.threadpool-core-size";
-    public final static String SERVICE_THREADPOOL_MAX_SIZE = "eagle.service.threadpool-max-size";
-    public final static String SERVICE_THREADPOOL_SHRINK_SIZE = "eagle.service.threadpool-shrink-size";
-
-    public final static String EAGLE_TIME_ZONE = "eagle.timezone";
-    public final static String DEFAULT_EAGLE_TIME_ZONE = "UTC";
-
-    public final static int DEFAULT_THREAD_POOL_CORE_SIZE = 10;
-    public final static int DEFAULT_THREAD_POOL_MAX_SIZE = 20;
-    public final static long DEFAULT_THREAD_POOL_SHRINK_TIME = 60000L;
-    public final static String DEFAULT_SERVICE_HOST = "localhost";
-    public final static String DEFAULT_STORAGE_TYPE = "hbase";
-    public final static int DEFAULT_SERVICE_PORT = 8080;
-    public final static String DEFAULT_ZOOKEEPER_ZNODE_PARENT = "/hbase-unsecure";
-
-    public final static String EAGLE_PROPS="eagleProps";
-    public final static String EAGLE_SERVICE = "eagleService";
-    public final static String HOST = "host";
-    public final static String PORT = "port";
-    public final static String USERNAME = "username";
-    public final static String PASSWORD = "password";
-
-    public final static String SITE = "site";
-    public final static String DATA_SOURCE = "dataSource";
-}
\ No newline at end of file


Mime
View raw message