I am creating custom sampler for JMeter. I am able to import my jar into library, the sampler is visible within the GUI, but the fields are not displayed properly.
Here is my code.
Custom.java
public class Custom extends AbstractSampler implements TestBean {
private String email = "";
public Custom() {
super();
}
public SampleResult sample(Entry entry) {
SampleResult res = new SampleResult();
res.setSampleLabel(getName());
res.setResponseData(("Hello " + getEmail()).getBytes());
res.setSuccessful(Boolean.TRUE);
return res;
}
public void setEmail(String email){ this.email = email; }
public String getEmail(){ return email; }
}
CustomBeanInfo.java
public class CustomBeanInfo extends BeanInfoSupport {
protected CustomBeanInfo() {
super(Custom.class);
createPropertyGroup("contact", new String[]{
"email"
});
PropertyDescriptor p = property("email");
p.setValue(NOT_UNDEFINED, Boolean.TRUE);
p.setValue(DEFAULT, "asd");
}
}
CustomResources.properties
displayName=Custom Sampler
email.displayName=Email Address
email.shortDescription=User Email Address
contact.displayName=Contact
And this is how it looks in JMeter GUI. My guess is that the properties file is not correctly attached to sampler or the constructor is not executed.
EDIT 1: Added pom.xml file content
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.jmeter</groupId>
<artifactId>custom-sampler</artifactId>
<version>0.2.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>2.10</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
EDIT 2: When using sampler (adding it to thread group) following error appears in log
2016/03/25 09:28:23 WARN - jmeter.testbeans.gui.GenericTestBeanCustomizer: org.apache.jmeter.protocol.java.sampler.Custom#email(java.lang.String) does not appear to have been configured

