Mercurial > hg > Members > nobuyasu > jungle-network
changeset 19:08e283ede7c9
fix TestPutAttributeCodeSegment
author | one |
---|---|
date | Fri, 28 Jun 2013 19:44:05 +0900 |
parents | 2f1132767af2 |
children | 506388c02b4b |
files | src/jungle/test/codesegment/persistence/TestJungle.java src/jungle/test/codesegment/practice/StartJungleCodeSegment.java src/jungle/test/codesegment/practice/TestPutAttributeCodeSegment.java |
diffstat | 3 files changed, 20 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jungle/test/codesegment/persistence/TestJungle.java Fri Jun 28 19:32:52 2013 +0900 +++ b/src/jungle/test/codesegment/persistence/TestJungle.java Fri Jun 28 19:44:05 2013 +0900 @@ -11,7 +11,7 @@ public static void main(String[] args) { JungleManager jm = new JungleManager(); - JungleTree tree = jm.createTree("tree1"); + JungleTree tree = jm.createNewTree("tree1"); JungleTreeEditor editor = tree.getTreeEditor(); new TestPutAttributeCodeSegment().execute();
--- a/src/jungle/test/codesegment/practice/StartJungleCodeSegment.java Fri Jun 28 19:32:52 2013 +0900 +++ b/src/jungle/test/codesegment/practice/StartJungleCodeSegment.java Fri Jun 28 19:44:05 2013 +0900 @@ -17,12 +17,8 @@ JungleManager jm = new JungleManager(); JungleTree tree = jm.createNewTree("tree"); - - TestPutAttributeCodeSegment cs = new TestPutAttributeCodeSegment(); - DefaultTreeOperation treeOp = cs.getSampleOperation(); - - + DefaultTreeOperation treeOp = cs.getSampleOperation("message0"); DefaultTreeOperationContainer treeOperationContainer = new DefaultTreeOperationContainer(); try { treeOperationContainer.unconvert(treeOp); @@ -30,8 +26,6 @@ e.printStackTrace(); } cs.ods.update("local", "log", treeOperationContainer); - - } }
--- a/src/jungle/test/codesegment/practice/TestPutAttributeCodeSegment.java Fri Jun 28 19:32:52 2013 +0900 +++ b/src/jungle/test/codesegment/practice/TestPutAttributeCodeSegment.java Fri Jun 28 19:44:05 2013 +0900 @@ -37,12 +37,15 @@ public void run() { - - + System.out.println("--TestPutAttributeCodeSegment--"); System.out.println("type = " + arg1.type); System.out.println("index = " + arg1.index); System.out.println("data = " + arg1.getVal()); System.out.println(((Value)arg1.getVal()).getType()); + + if (arg1.index >= 10) { + System.exit(0); + } DefaultTreeOperationContainer convertedOpContainer = arg1.asClass(DefaultTreeOperationContainer.class); TreeOperation convertedOp = null; @@ -51,23 +54,31 @@ } catch (IOException e) { e.printStackTrace(); } - Jungle jungle = new JungleManager().getJungle(); JungleTree tree = jungle.getTreeByName("tree"); NetworkDefaultJungleTreeEditor editor = (NetworkDefaultJungleTreeEditor) tree.getTreeEditor(); edit(editor, convertedOp); editor.success(); - + TestPutAttributeCodeSegment cs = new TestPutAttributeCodeSegment(); + DefaultTreeOperation treeOp = cs.getSampleOperation("message"+arg1.index); + DefaultTreeOperationContainer treeOperationContainer = new DefaultTreeOperationContainer(); + try { + treeOperationContainer.unconvert(treeOp); + } catch (IOException e) { + e.printStackTrace(); + } + cs.ods.update("local", "log", treeOperationContainer); + } - public DefaultTreeOperation getSampleOperation() { + public DefaultTreeOperation getSampleOperation(String message) { /* Create TreeOperation */ String key = "hoge"; - ByteBuffer b = ByteBuffer.wrap("messagepack value".getBytes()); + ByteBuffer b = ByteBuffer.wrap(message.getBytes()); PutAttributeOperation op = new PutAttributeOperation(key, b); DefaultNodePath p = new DefaultNodePath(); - p = p.add(1); + p = p.add(0); DefaultTreeOperation treeOp = new DefaultTreeOperation(p, op); return treeOp; }