Skip to content

Commit 0f840d0

Browse files
authored
Merge pull request #18 from rollno748/csv-config-2.1
Updated threads EOF termination policy
2 parents 2d6f379 + 6beb240 commit 0f840d0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/main/java/com/di/jmeter/config/ExtendedCsvDataSetConfig.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.apache.jmeter.threads.JMeterContext;
1414
import org.apache.jmeter.threads.JMeterContextService;
1515
import org.apache.jmeter.threads.JMeterVariables;
16+
import org.apache.jmeter.util.JMeterUtils;
1617
import org.apache.jorphan.util.JMeterStopThreadException;
1718
import org.apache.jorphan.util.JOrphanUtils;
1819
import org.slf4j.Logger;
@@ -23,6 +24,8 @@
2324
public class ExtendedCsvDataSetConfig extends ConfigTestElement implements LoopIterationListener, TestStateListener, NoConfigMerge {
2425
private static final long serialVersionUID = 767792680142202807L;
2526
private static final Logger LOGGER = LoggerFactory.getLogger(ExtendedCsvDataSetConfig.class);
27+
28+
private static final String EOFVALUE = JMeterUtils.getPropDefault("csvdataset.eofstring", "<EOF>");
2629
public static final String FILENAME = "filename";
2730
public static final String FILE_ENCODING = "fileEncoding";
2831
public static final String VARIABLE_NAMES = "variableNames";
@@ -101,14 +104,13 @@ public void iterationStart(LoopIterationEvent iterationEvent) {
101104
// Update Value --> Each Iteration, Once
102105
switch (getPropertyAsString(UPDATE_VALUE).toLowerCase()) {
103106
case "each iteration":
104-
if(lineValues.length > 0){
107+
if (lineValues.length == 0) {
108+
throw new JMeterStopThreadException("End of file:"+ getFilename()+" detected for CSV DataSet:"
109+
+getName()+" configured to Select Row Parameter :" + getUpdateValue());
110+
} else {
105111
for (int a = 0; a < variables.length && a < lineValues.length; a++) {
106112
jMeterVariables.put(variables[a], lineValues[a]);
107113
}
108-
}else {
109-
for (String variable : variables) {
110-
jMeterVariables.put(variable, null);
111-
}
112114
}
113115
break;
114116
case "once":

0 commit comments

Comments
 (0)