package tw.kewang.hbase;

import java.util.Map.Entry;

import junit.framework.TestCase;
import tw.kewang.hbase.dao.HBaseSettings;
import tw.kewang.hbase.domain.AbstractDomain.Value;

public class DaoTest extends TestCase {
	@Override
	protected void setUp() throws Exception {
		HBaseSettings.setZooKeeperQuorum("localhost");
	}

	public void testUser1GetByRowkey() {
		UserDao uDao = new UserDao();

		User1 u1 = (User1) uDao.getByRowkey("xyz_abc");

		assertEquals("xyz", u1.getUserId());
		assertEquals("abc", u1.getAccessToken());
	}

	public void testUser1GetByRowkeyNotFound() {
		UserDao uDao = new UserDao();

		User1 u1 = (User1) uDao.getByRowkey("xyz_a");

		assertNull(u1);
	}

	public void testUser1AndUser2GetByRowkey() {
		UserDao uDao = new UserDao();

		User1 u1 = (User1) uDao.getByRowkey("xyz_abc");
		User2 u2 = (User2) uDao.getByRowkey("xyz_abc_kewang");

		assertNotNull(u1);
		assertNotNull(u2);
		assertEquals("kewang", u2.getId());
	}

	public void testUser1GetRawValues() {
		UserDao uDao = new UserDao();

		User1 u1 = (User1) uDao.getByRowkey("xyz_abc");

		assertNotNull(u1.getRawValues());

		for (Entry<String, Value> entry : u1.getRawValues().entrySet()) {
			System.out.println(entry.getValue());
		}

		assertEquals("kewang", u1.getNickname().getValue());
	}
}
@@ -48,16 +48,74 @@
 Entry;%0A%0A
+import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A
 import j
@@ -274,16 +274,92 @@
 tCase %7B%0A
+%09private static final Logger LOG = LoggerFactory.getLogger(DaoTest.class);%0A%0A
 %09@Overri
@@ -1322,26 +1322,17 @@
 %0A%09%09%09
-System.out.println
+LOG.debug
 (ent
@@ -1340,24 +1340,35 @@
 y.getValue()
+.toString()
 );%0A%09%09%7D%0A%0A%09%09as

Add more log