use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter by apache.
the class HeaderManager method clear.
/**
* {@inheritDoc}
*/
@Override
public void clear() {
super.clear();
setProperty(new CollectionProperty(HEADERS, new ArrayList<>()));
}
use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter by apache.
the class HeaderManager method save.
/**
* Save the header data to a file.
*
* @param headFile
* name of the file to store headers into. If name is relative
* the system property <code>user.dir</code> will be prepended
* @throws IOException
* if writing the headers fails
*/
public void save(String headFile) throws IOException {
File file = new File(headFile);
if (!file.isAbsolute()) {
file = new File(// $NON-NLS-1$
System.getProperty("user.dir") + File.separator + headFile);
}
try (BufferedWriter fw = Files.newBufferedWriter(file.toPath());
PrintWriter writer = new PrintWriter(fw)) {
// TODO Charset ?
// $NON-NLS-1$
writer.println("# JMeter generated Header file");
final CollectionProperty hdrs = getHeaders();
for (int i = 0; i < hdrs.size(); i++) {
final JMeterProperty hdr = hdrs.get(i);
Header head = (Header) hdr.getObjectValue();
writer.println(head.toString());
}
}
}
use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter by apache.
the class HeaderManager method getFirstHeaderNamed.
/**
* Get the first header from Headers by the header name, or {@code null} if not found.
* @param name header name
* @return the first header from Headers by the header name, or {@code null} if not found
*/
public Header getFirstHeaderNamed(final String name) {
final CollectionProperty headers = getHeaders();
final int size = headers.size();
for (int i = 0; i < size; i++) {
Header header = (Header) headers.get(i).getObjectValue();
if (header == null) {
continue;
}
if (header.getName().equalsIgnoreCase(name)) {
return header;
}
}
return null;
}
use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter by apache.
the class Arguments method clear.
/**
* Clear the arguments.
*/
@Override
public void clear() {
super.clear();
setProperty(new CollectionProperty(ARGUMENTS, new ArrayList<Argument>()));
}
use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.
the class JMXMonCollectorTest method testSetData.
/**
* Test of setData method, of class JMXMonCollector.
*/
@Test
public void testSetData() {
System.out.println("setData");
CollectionProperty rows = new CollectionProperty();
JMXMonCollector instance = new JMXMonCollector();
instance.setData(rows);
}
Aggregations