use of org.apache.jmeter.testelement.property.NullProperty in project jmeter by apache.
the class TestBeanHelper method unwrapProperty.
private static Object unwrapProperty(PropertyDescriptor desc, JMeterProperty jprop, Class<?> type) {
Object value;
if (jprop instanceof TestElementProperty) {
TestElement te = ((TestElementProperty) jprop).getElement();
if (te instanceof TestBean) {
prepare(te);
}
value = te;
} else if (jprop instanceof MultiProperty) {
value = unwrapCollection((MultiProperty) jprop, (String) desc.getValue(TableEditor.CLASSNAME));
} else // value was not provided, and this is allowed
if (jprop instanceof NullProperty && // use negative condition so missing (null) value is treated as FALSE
!Boolean.TRUE.equals(desc.getValue(GenericTestBeanCustomizer.NOT_UNDEFINED))) {
value = null;
} else {
value = Converter.convert(jprop.getStringValue(), type);
}
return value;
}
use of org.apache.jmeter.testelement.property.NullProperty in project jmeter by apache.
the class UrlConfigTest method testOverRide.
@Test
public void testOverRide() {
JMeterProperty jmp = partialConfig.getProperty(HTTPSamplerBase.DOMAIN);
assertTrue(jmp instanceof NullProperty);
assertEquals(jmp, new NullProperty(HTTPSamplerBase.DOMAIN));
partialConfig.addTestElement(defaultConfig);
assertEquals(partialConfig.getPropertyAsString(HTTPSamplerBase.DOMAIN), "www.xerox.com");
assertEquals(partialConfig.getPropertyAsString(HTTPSamplerBase.PATH), "main.jsp");
}
use of org.apache.jmeter.testelement.property.NullProperty in project jmeter by apache.
the class DNSCacheManager method isStaticHost.
private boolean isStaticHost(String host) {
JMeterProperty p = getProperty(HOSTS);
if (p instanceof NullProperty) {
removeProperty(HOSTS);
return false;
}
CollectionProperty property = (CollectionProperty) p;
PropertyIterator iterator = property.iterator();
while (iterator.hasNext()) {
TestElementProperty possibleEntry = (TestElementProperty) iterator.next();
if (log.isDebugEnabled()) {
log.debug("Look for {} at {}: {}", host, possibleEntry.getObjectValue(), possibleEntry.getObjectValue().getClass());
}
StaticHost entry = (StaticHost) possibleEntry.getObjectValue();
if (entry.getName().equalsIgnoreCase(host)) {
if (log.isDebugEnabled()) {
log.debug("Found static host: {} => {}", host, entry.getAddress());
}
return true;
}
}
log.debug("No static host found for {}", host);
return false;
}
use of org.apache.jmeter.testelement.property.NullProperty in project jmeter by apache.
the class DNSCacheManager method fromStaticHost.
private InetAddress[] fromStaticHost(String host) {
JMeterProperty p = getProperty(HOSTS);
if (p instanceof NullProperty) {
removeProperty(HOSTS);
return new InetAddress[0];
}
CollectionProperty property = (CollectionProperty) p;
PropertyIterator iterator = property.iterator();
while (iterator.hasNext()) {
StaticHost entry = (StaticHost) ((TestElementProperty) iterator.next()).getObjectValue();
if (entry.getName().equals(host)) {
List<InetAddress> addresses = new ArrayList<>();
for (String address : Arrays.asList(entry.getAddress().split("\\s*,\\s*"))) {
try {
addresses.addAll(Arrays.asList(requestLookup(address)));
} catch (UnknownHostException e) {
log.warn("Couldn't resolve static address {} for host {}", address, host, e);
}
}
return addresses.toArray(new InetAddress[addresses.size()]);
}
}
return new InetAddress[0];
}
use of org.apache.jmeter.testelement.property.NullProperty in project jmeter-plugins by undera.
the class JMXMonGui method configure.
@Override
public void configure(TestElement te) {
super.configure(te);
JMXMonCollector dmte = (JMXMonCollector) te;
JMeterProperty jmxmonValues = dmte.getSamplerSettings();
if (!(jmxmonValues instanceof NullProperty)) {
JMeterPluginsUtils.collectionPropertyToTableModelRows((CollectionProperty) jmxmonValues, tableModel, columnClasses);
} else {
log.warn("Received null property instead of collection");
}
}
Aggregations