view src/jungle/test/codesegment/practice/StartJungleCodeSegment.java @ 17:c767e7af4d88

add TestPutAttributeCodeSegmnet and StartJungleCodeSegment
author one
date Fri, 28 Jun 2013 12:36:07 +0900
parents d2436fd71c61
children 2f1132767af2
line wrap: on
line source

package jungle.test.codesegment.practice;

import java.io.IOException;
import java.nio.ByteBuffer;

import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.JungleTree;
import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultNodePath;
import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.DefaultTreeOperation;
import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation;
import jungle.test.datasegment.store.operations.DefaultTreeOperationContainer;
import alice.codesegment.CodeSegment;

public class StartJungleCodeSegment {
	
	public static void main(String[] args) {
		JungleManager jm = new JungleManager();
		JungleTree tree = jm.createTree("tree");
		
		/* Create TreeOperation */
		String key = "hoge";
		ByteBuffer b = ByteBuffer.wrap("messagepack value".getBytes());
		PutAttributeOperation op = new PutAttributeOperation(key, b);
		DefaultNodePath p = new DefaultNodePath();
		p = p.add(1);
		DefaultTreeOperation treeOp = new DefaultTreeOperation(p, op);

		DefaultTreeOperationContainer treeOperationContainer = new DefaultTreeOperationContainer();
		try {
			treeOperationContainer.unconvert(treeOp);
		} catch (IOException e) {
			e.printStackTrace();
		}

		 TestPutAttributeCodeSegment cs = new TestPutAttributeCodeSegment();
		cs.ods.update("local", "log", treeOperationContainer);
		
		
	}

}