Mercurial > hg > Database > jungle-network
diff src/test/alice/jungle/PersistenJournalTest.java @ 87:f142dd4abc74
Implemented getTreeName and uuid method in some classes
author | one |
---|---|
date | Tue, 05 Nov 2013 08:41:12 +0900 |
parents | bcaf28f8244d |
children | f3f89613c7e3 |
line wrap: on
line diff
--- a/src/test/alice/jungle/PersistenJournalTest.java Tue Oct 29 16:52:12 2013 +0900 +++ b/src/test/alice/jungle/PersistenJournalTest.java Tue Nov 05 08:41:12 2013 +0900 @@ -8,6 +8,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTreeEditor; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.Node; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeList; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeListReader; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; @@ -43,7 +44,6 @@ } editor = either.b(); either = editor.putAttribute(path, key, value); - JungleTreeEditor e = either.b(); e.success(); journal.close(); @@ -68,36 +68,7 @@ } editor2 = either2.b(); editor2.success(); - - for (TreeOperation op : chList) { - NodePath p = op.getNodePath(); - NodeOperation nodeOp = op.getNodeOperation(); - Command c = nodeOp.getCommand(); - String str = ""; - switch (c) { - case PUT_ATTRIBUTE: - String opKey = nodeOp.getKey(); - ByteBuffer opValue = nodeOp.getValue(); - if (value.limit() < 100) { - str = String.format("key:%s,value:%s", opKey, - new String(opValue.array())); - } else { - str = String.format("key:%s,value:%d", opKey, - opValue.limit()); - } - break; - case DELETE_ATTRIBUTE: - str = String.format("key:%s", nodeOp.getKey()); - break; - case APPEND_CHILD: - str = String.format("pos:%d", nodeOp.getPosition()); - break; - case DELETE_CHILD: - str = String.format("pos:%d", nodeOp.getPosition()); - break; - } - System.out.println(String.format("[%s:%s:%s]", c, p, str)); - } + printChangeList(chList); System.out.println(); } JungleTree tree2 = jungle2.getTreeByName("hoge"); @@ -108,4 +79,37 @@ } + public static void printChangeList(ChangeList chList) { + for (TreeOperation op : chList) { + NodePath p = op.getNodePath(); + NodeOperation nodeOp = op.getNodeOperation(); + Command c = nodeOp.getCommand(); + String str = ""; + switch (c) { + case PUT_ATTRIBUTE: + String opKey = nodeOp.getKey(); + ByteBuffer opValue = nodeOp.getValue(); + if (opValue.limit() < 100) { + str = String.format("key:%s,value:%s", opKey, + new String(opValue.array())); + } else { + str = String.format("key:%s,value:%d", opKey, + opValue.limit()); + } + break; + case DELETE_ATTRIBUTE: + str = String.format("key:%s", nodeOp.getKey()); + break; + case APPEND_CHILD: + str = String.format("pos:%d", nodeOp.getPosition()); + break; + case DELETE_CHILD: + str = String.format("pos:%d", nodeOp.getPosition()); + break; + } + System.out.println(String.format("[%s:%s:%s]", c, p, str)); + } + + } + }