After consulting with our support tem, it seems Scripted DataSet mostly works. The reader needs to be stored in the Shared Model Map (I was mistakenly putting in testExec). If you do that, the dataset will correctly step through each line in the file.
However, here's the catch: it only resets itself after completely stepping through the entire file. If you only get part way through the datasets (say, you've read lines 1, 2, and 3) and then start the test case over, it picks up where it left off (line 4). The solution to this is to create a step at the beginning of your test case to ensure the reader has been removed from the Shared Model Map.
Here's the script I used:
import java.io.*;
import java.util.*;
import com.itko.lisa.vse.*;
Map data = null;
// check to see if we've already opened a reader
BufferedReader reader = (BufferedReader) SharedModelMap.getObject("MyNamespace", "ds_reader");
// if not found, open it
if (reader == null)
{
FileInputStream fis = new FileInputStream(LISA_PROJ_ROOT+ "/Data/MyData.csv");
reader = new BufferedReader(new InputStreamReader(fis));
SharedModelMap.putObject("MyNamespace", "ds_reader", reader);
}
// see if there's more data
String row = reader.readLine();
if (row == null)
{
// nope. close stream and remove from state
reader.close();
SharedModelMap.remove("MyNamespace", "ds_reader");
}
else
{
// put this row of data into a map
String[] cols = row.split(",");
data = new HashMap();
data.put( "ds_color", cols[0] );
data.put( "ds_letter", cols[1] );
data.put( "ds_number", cols[2] );
}
return data;