Skip to content

Commit

Permalink
Merge pull request #18 from rollno748/csv-config-2.1
Browse files Browse the repository at this point in the history
Updated threads EOF termination policy
  • Loading branch information
rollno748 authored Jan 14, 2024
2 parents 2d6f379 + 6beb240 commit 0f840d0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/java/com/di/jmeter/config/ExtendedCsvDataSetConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.apache.jmeter.threads.JMeterContext;
import org.apache.jmeter.threads.JMeterContextService;
import org.apache.jmeter.threads.JMeterVariables;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.util.JMeterStopThreadException;
import org.apache.jorphan.util.JOrphanUtils;
import org.slf4j.Logger;
Expand All @@ -23,6 +24,8 @@
public class ExtendedCsvDataSetConfig extends ConfigTestElement implements LoopIterationListener, TestStateListener, NoConfigMerge {
private static final long serialVersionUID = 767792680142202807L;
private static final Logger LOGGER = LoggerFactory.getLogger(ExtendedCsvDataSetConfig.class);

private static final String EOFVALUE = JMeterUtils.getPropDefault("csvdataset.eofstring", "<EOF>");
public static final String FILENAME = "filename";
public static final String FILE_ENCODING = "fileEncoding";
public static final String VARIABLE_NAMES = "variableNames";
Expand Down Expand Up @@ -101,14 +104,13 @@ public void iterationStart(LoopIterationEvent iterationEvent) {
// Update Value --> Each Iteration, Once
switch (getPropertyAsString(UPDATE_VALUE).toLowerCase()) {
case "each iteration":
if(lineValues.length > 0){
if (lineValues.length == 0) {
throw new JMeterStopThreadException("End of file:"+ getFilename()+" detected for CSV DataSet:"
+getName()+" configured to Select Row Parameter :" + getUpdateValue());
} else {
for (int a = 0; a < variables.length && a < lineValues.length; a++) {
jMeterVariables.put(variables[a], lineValues[a]);
}
}else {
for (String variable : variables) {
jMeterVariables.put(variable, null);
}
}
break;
case "once":
Expand Down

0 comments on commit 0f840d0

Please sign in to comment.