|
8 | 8 | import java.io.IOException;
|
9 | 9 | import java.io.OutputStream;
|
10 | 10 | import java.time.LocalDateTime;
|
11 |
| -import java.util.Calendar; |
12 |
| -import java.util.GregorianCalendar; |
13 |
| -import java.util.ResourceBundle; |
| 11 | +import java.util.*; |
14 | 12 |
|
15 | 13 | import static org.junit.Assert.*;
|
16 | 14 |
|
@@ -77,6 +75,41 @@ public void test_BasicDictionary_getString_DT_ANY() throws IOException {
|
77 | 75 | bd.put(new BasicInt(1),new BasicAnyVector(arr,true));
|
78 | 76 | assertEquals("1->(0,1,2,3,4,5,6,7,8,9)\n",bd.getString());
|
79 | 77 | }
|
| 78 | + @Test |
| 79 | + public void test_BasicDictionary_upload() throws IOException { |
| 80 | + DBConnection conn = new DBConnection(); |
| 81 | + conn.connect(HOST,PORT); |
| 82 | + BasicDictionary bd = new BasicDictionary(Entity.DATA_TYPE.DT_INT, Entity.DATA_TYPE.DT_ANY); |
| 83 | + Map<String,Entity> data = new HashMap<>(); |
| 84 | + data.put("bd",bd); |
| 85 | + conn.upload(data); |
| 86 | + Dictionary re= (Dictionary) conn.run("bd"); |
| 87 | + System.out.println(re.getString()); |
| 88 | + assertEquals("", re.getString()); |
| 89 | + Entity[] arr = new Entity[10]; |
| 90 | + for (int i = 0; i < 10; i++) { |
| 91 | + arr[i] = conn.run(""+i); |
| 92 | + } |
| 93 | + |
| 94 | + bd.put(new BasicInt(1),new BasicAnyVector(arr,true)); |
| 95 | + data.put("bd",bd); |
| 96 | + conn.upload(data); |
| 97 | + Dictionary re1= (Dictionary) conn.run("bd"); |
| 98 | + System.out.println(re1.getString()); |
| 99 | + assertEquals("1->(0,1,2,3,4,5,6,7,8,9)", re1.getString()); |
| 100 | + } |
| 101 | + @Test |
| 102 | + public void test_BasicDictionary_valueType_DT_ANY() throws IOException { |
| 103 | + BasicDictionary bd = new BasicDictionary(Entity.DATA_TYPE.DT_INT, Entity.DATA_TYPE.DT_ANY,1); |
| 104 | + conn = new DBConnection(); |
| 105 | + conn.connect(HOST,PORT); |
| 106 | + bd.put(new BasicInt(1),new BasicInt(1)); |
| 107 | + assertEquals("1->1\n",bd.getString()); |
| 108 | + bd.put(new BasicInt(1),new BasicString("1121!@#$%^&*()_+-=`~{}[]|\":;',.ldfdf中文")); |
| 109 | + assertEquals("1->1121!@#$%^&*()_+-=`~{}[]|\":;',.ldfdf中文\n",bd.getString()); |
| 110 | + bd.put(new BasicInt(1),new BasicDouble(1.666)); |
| 111 | + assertEquals("1->1.666\n",bd.getString()); |
| 112 | + } |
80 | 113 |
|
81 | 114 | @Test(expected = IOException.class)
|
82 | 115 | public void test_BasicDictionary_Exception() throws IOException {
|
|
0 commit comments