use of org.apache.jmeter.samplers.SampleSaveConfiguration in project jmeter by apache.
the class SampleSaveConfigurationConverter method unmarshal.
/**
* {@inheritDoc}
*/
@Override
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
final Class<SampleSaveConfiguration> thisClass = SampleSaveConfiguration.class;
final Class<?> requiredType = context.getRequiredType();
if (requiredType != thisClass) {
throw new IllegalArgumentException("Unexpected class: " + requiredType.getName());
}
// The default for missing tags is false, so preset all the fields accordingly
SampleSaveConfiguration result = new SampleSaveConfiguration(false);
// Now pick up any tags from the input file
while (reader.hasMoreChildren()) {
reader.moveDown();
String nn = reader.getNodeName();
if (!"formatter".equals(nn)) {
// Skip formatter (if present) bug 42674 $NON-NLS-1$
String fieldName = mapper.realMember(thisClass, nn);
java.lang.reflect.Field field = reflectionProvider.getField(thisClass, fieldName);
Class<?> type = field.getType();
Object value = unmarshallField(context, result, type, field);
reflectionProvider.writeField(result, nn, value, thisClass);
}
reader.moveUp();
}
return result;
}
use of org.apache.jmeter.samplers.SampleSaveConfiguration in project jmeter by apache.
the class HTTPResultConverter method marshal.
/**
* {@inheritDoc}
*/
@Override
public void marshal(Object obj, HierarchicalStreamWriter writer, MarshallingContext context) {
HTTPSampleResult res = (HTTPSampleResult) obj;
SampleSaveConfiguration save = res.getSaveConfig();
setAttributes(writer, context, res, save);
saveAssertions(writer, context, res, save);
saveSubResults(writer, context, res, save);
saveResponseHeaders(writer, context, res, save);
saveRequestHeaders(writer, context, res, save);
saveResponseData(writer, context, res, save);
saveSamplerData(writer, context, res, save);
}
use of org.apache.jmeter.samplers.SampleSaveConfiguration in project jmeter-plugins by undera.
the class CorrectedResultCollector method setupSaving.
private void setupSaving() {
SampleSaveConfiguration conf = getSaveConfig();
// please, save the threads... it's so important, but disabled by default
conf.setThreadCounts(true);
}
use of org.apache.jmeter.samplers.SampleSaveConfiguration in project jmeter-plugins by undera.
the class MergeResultsService method mergeSamples.
public void mergeSamples(CorrectedResultCollector crc, List<SampleResult> samples) {
SampleEvent event;
try {
initializeFileOutput(crc.getFilename(), crc.getSaveConfig());
} catch (IOException e) {
log.warn("Error trying to initialize output file " + e.toString());
}
for (SampleResult result : samples) {
SampleSaveConfiguration config = crc.getSaveConfig();
event = new SampleEvent(result, null);
try {
if (config.saveAsXml()) {
SaveService.saveSampleResult(event, out);
} else {
// !saveAsXml
String savee = CSVSaveService.resultToDelimitedString(event);
out.println(savee);
}
} catch (Exception err) {
log.error("Error trying to record a sample", err);
// should throw exception back to caller
}
}
finalizeFileOutput();
}
use of org.apache.jmeter.samplers.SampleSaveConfiguration in project jmeter-plugins by undera.
the class DbMonCollector method setupSaving.
private void setupSaving(String fileName) {
SampleSaveConfiguration config = getSaveConfig();
JMeterPluginsUtils.doBestCSVSetup(config);
setSaveConfig(config);
setFilename(fileName);
log.info("DbMon metrics will be stored in " + new File(fileName).getAbsolutePath());
}
Aggregations