add test case for this programe

This commit is contained in:
coderfengyun 2014-03-20 09:16:25 +08:00
parent 0bf9cf3dc0
commit 0f116bb29b
2 changed files with 15 additions and 10 deletions

View File

@ -4,11 +4,9 @@ import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.CharBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.ArrayBlockingQueue;
@ -147,8 +145,8 @@ public class Para_Table {
TableRow tempTableRow = new TableRow();
try {
for (int i = 0; i < cacheSize;) {
int tt = bfr.read();
char readBuff = (char)tt;
int tt = bfr.read();
char readBuff = (char) tt;
if (tt == -1) {
createBFR();
break;
@ -222,8 +220,9 @@ public class Para_Table {
// java.util.HashMap, java.lang.String, java.lang.String, java.lang.String,
// java.lang.String, java.lang.String, java.lang.String, java.lang.String)
public String getTableColumnValue(UUID id, HashMap<String, Object> objCache,
String source, String sourceValue, String firstRow, String nextRow,
public String getTableColumnValue(UUID id,
HashMap<String, Object> objCache, String source,
String sourceValue, String firstRow, String nextRow,
String splitChar, String lineChar, String column) {
int fRow = Integer.parseInt(firstRow);
char sChar = splitChar.charAt(0);
@ -258,8 +257,7 @@ public class Para_Table {
return resultRow.cells.get(col);
}
public void unreg(UUID id) {
}
}

View File

@ -19,12 +19,19 @@ public class TEST_UserName {
"ScenarioParameters\\param1.txt", "0", "sequence", ";", "~",
"2");
System.out.println(ret);
InstanceControler ic = new InstanceControler();
String passwordName = ic
.getParam("<parameters class=\"Para_Table\" type=\"crossThread\" method=\"getTableColumnValue\" args=\"file,ScenarioParameters\\param1.txt,0,sequence,;,~,2\" />");
.getParam("<parameters name=\"useNamePassword\" class=\"Para_Table\" type=\"crossThread\" method=\"getTableColumnValue\" args=\"file,ScenarioParameters\\param1.txt,0,sequence,;,~,2\" />");
System.out.println(passwordName);
assertNotNull(passwordName);
InstanceControler instanceControler = new InstanceControler();
String password2 = instanceControler
.getParam("<parameters name=\"useNamePassword\" class=\"Para_Table\" type=\"crossThread\" method=\"getTableColumnValue\" args=\"file,ScenarioParameters\\param1.txt,0,sequence,;,~,2\" />");
System.out.println(password2);
assertNotNull(password2);
assertEquals(Integer.parseInt(passwordName) + 10,
Integer.parseInt(password2));
TestHelper.invokePrivate(ic, "releaseAll", null, null);
}
}