AnsweredAssumed Answered

Trying to invoke a class through Custom Test Step Execution Step which will update values into a database from response xml.

Question asked by venkatraj02 on Oct 25, 2017
Latest reply on Oct 26, 2017 by Will_Truong

I have a java class which will read a xml from a defined location and store it into a database.

I have implemented the CustJavaNodeInterface class from lisa core jar.

Please find below my java class:

 

public class ParseXmlResponse implements CustJavaNodeInterface{
final static Logger LOGGER = Logger.getLogger(ParseXmlResponse.class);

@Override
public Object executeNodeLogic(TestExec arg0, @SuppressWarnings("rawtypes") Map params)
throws TestRunException {
String xmlLocation = (String)params.get("XMLLocation");
parseResponse(xmlLocation);
return null;
}
@Override
public ParameterList getParameters() {
ParameterList pl = new ParameterList("XMLLocation=");
return pl;
}
@Override
public void initialize(TestCase arg0, Element arg1) throws TestDefException {
}

public void parseResponse(String filePath){

//read xml and store in database

}

 

I am not sure on what I should return in the executeNodeLogic() method.

I am just returning a null value after the execution. Is there any particular which I have to return in this case?

 

The problem which i am facing here I am able to successfully parse the xml and store into databse only for the first time,for the next consecutive times it is adding entries more then once or repeating the entries.

 

Can someone help out?

Outcomes