Mercurial > hg > Members > tatsuki > bench > jungle-core
annotate src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/impl/node/DefaultAttributesTest.java @ 88:c5095a354dfc
Delete DefaultAttribute
author | one |
---|---|
date | Thu, 04 Sep 2014 14:50:59 +0900 |
parents | fb1dc448ac8c |
children | 0854f9a9e81d |
rev | line source |
---|---|
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
1 package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.impl.node; |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
2 |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
3 import java.nio.ByteBuffer; |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
4 |
39 | 5 import org.junit.Assert; |
6 | |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
7 import fj.Ord; |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
8 import fj.P2; |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
9 import fj.data.List; |
39 | 10 import fj.data.Option; |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
11 import fj.data.TreeMap; |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.core.AttributesTest; |
81 | 13 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; |
14 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNodeAttributes; | |
75
26dfa90016d1
error delete but 2 test program commentout and not action BulletinBoard
one
parents:
39
diff
changeset
|
15 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTreeNode; |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
16 |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
17 public class DefaultAttributesTest extends AttributesTest |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
18 { |
86 | 19 public TreeNodeAttributes instance() |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
20 { |
81 | 21 List<TreeNode> rawList = List.nil(); |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
22 TreeMap<String,ByteBuffer> rawMap = TreeMap.empty(Ord.stringOrd); |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
23 |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
24 // add attributes |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
25 |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
26 for(P2<String, ByteBuffer> entry : ENTRIES){ |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
27 rawMap = rawMap.set(entry._1(),entry._2()); |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
28 } |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
29 |
81 | 30 TreeNode node = new DefaultTreeNode(rawList,rawMap); |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
31 return node.getAttributes(); |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
32 } |
39 | 33 |
34 public void testGetAttributesAsRawMap() | |
35 { | |
86 | 36 TreeNodeAttributes attrs = instance(); |
39 | 37 TreeMap<String,ByteBuffer> rawMap = attrs.getAttributesAsRawMap(); |
38 | |
39 // testing rawmap is not null. | |
40 Assert.assertNotNull(rawMap); | |
41 | |
42 // testing rawmap has correct key values. | |
43 for(P2<String,ByteBuffer> entry : ENTRIES){ | |
44 String key = entry._1(); | |
45 ByteBuffer value = entry._2(); | |
46 | |
47 Option<ByteBuffer> option = rawMap.get(key); | |
48 if(option.isNone()){ | |
49 Assert.fail(); | |
50 } | |
51 | |
52 ByteBuffer actual = option.some(); | |
53 Assert.assertEquals(0,actual.compareTo(value)); | |
54 } | |
55 } | |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
56 } |