Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Test Servlet Using Cactus

Status
Not open for further replies.

princeOfMountain

Programmer
Nov 29, 2011
1
0
0
Hi I have the following servlet method which I want to test using Cactus
I am a newbie so I will really appreciate any helpful tips:

public DSResponse executeFetch(DSRequest req) throws Exception {
DSResponse resp = new DSResponse();
String maID = (String) req.getCriteria().get("memberActivityID");
MemberActivityImpl memberImpl = new MemberActivityImpl();
MemberActivity memberAct = new MemberActivity();
if (req.getDataSourceName().equals("memberActivity")) {
if (maID != null) {
// Fetch the MemberActivity based on the memberActivityID criteria
memberAct = memberImpl.getMemberActivity(maID);
List<Map> resultList = new LinkedList<Map>();

if( memberAct != null && memberAct.getMemberID() != null )
{
// Pass the memberAct to the client
Map<String, Object> result = new HashMap<String, Object>();
result.put("name", memberAct.getName());
result.put("type", memberAct.getType());
result.put("memberID", memberAct.getMemberID());
if (memberAct.getGoal() != null) {
result.put("goal", memberAct.getGoal());
}
resultList.add(result);}
resp.setData(resultList);
} else {
resp.setFailure();}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top