Mercurial > hg > Members > tatsuki > bench > jungle-core
annotate src/test/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/impl/node/DefaultAttributesTest.java @ 81:715a9fbf02fc
remove <T> many source
author | one |
---|---|
date | Sun, 31 Aug 2014 07:46:30 +0900 |
parents | 26dfa90016d1 |
children | fb1dc448ac8c |
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; |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
13 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.DefaultAttributes; |
81 | 14 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.impl.TreeNode; |
15 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
|
16 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTreeNode; |
26dfa90016d1
error delete but 2 test program commentout and not action BulletinBoard
one
parents:
39
diff
changeset
|
17 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.transaction.DefaultTreeNodeAttribute; |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
18 |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
19 public class DefaultAttributesTest extends AttributesTest |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
20 { |
81 | 21 public TreeNodeAttributes<TreeNode> instance() |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
22 { |
81 | 23 List<TreeNode> rawList = List.nil(); |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
24 TreeMap<String,ByteBuffer> rawMap = TreeMap.empty(Ord.stringOrd); |
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 // add attributes |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
27 |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
28 for(P2<String, ByteBuffer> entry : ENTRIES){ |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
29 rawMap = rawMap.set(entry._1(),entry._2()); |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
30 } |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
31 |
81 | 32 TreeNode node = new DefaultTreeNode(rawList,rawMap); |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
33 return node.getAttributes(); |
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
34 } |
39 | 35 |
36 public void testGetAttributesAsRawMap() | |
37 { | |
81 | 38 TreeNodeAttributes<TreeNode> attrs = instance(); |
39 | 39 TreeMap<String,ByteBuffer> rawMap = attrs.getAttributesAsRawMap(); |
40 | |
41 // testing rawmap is not null. | |
42 Assert.assertNotNull(rawMap); | |
43 | |
44 // testing rawmap has correct key values. | |
45 for(P2<String,ByteBuffer> entry : ENTRIES){ | |
46 String key = entry._1(); | |
47 ByteBuffer value = entry._2(); | |
48 | |
49 Option<ByteBuffer> option = rawMap.get(key); | |
50 if(option.isNone()){ | |
51 Assert.fail(); | |
52 } | |
53 | |
54 ByteBuffer actual = option.some(); | |
55 Assert.assertEquals(0,actual.compareTo(value)); | |
56 } | |
57 } | |
38
cb9fabaedfd4
added tests and changed testing provider to junit47
Shoshi TAMAKI
parents:
diff
changeset
|
58 } |