All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadex.bdi.testcases.misc.CodecTestPlan Maven / Gradle / Ivy

Go to download

The Jadex BDI applications package contain several example applications, benchmarks and testcases using BDI agents.

There is a newer version: 2.4
Show newest version
package jadex.bdi.testcases.misc;

import jadex.base.test.TestReport;
import jadex.bdi.runtime.IMessageEvent;
import jadex.bdi.runtime.Plan;
import jadex.bridge.fipa.SFipa;

/**
 *  Test if custom message codec works. 
 */
public class CodecTestPlan extends Plan
{
	 /**
	  *  The plan body.
	  */
	public void body()
	{
		Object recontent = ((IMessageEvent)getReason()).getParameter(SFipa.CONTENT).getValue();
		TestReport	tr = new TestReport("#1", "Send and receive message with custom codec.");
		//	if(content.equals(recontent))
		if(recontent instanceof Integer && ((Integer)recontent).intValue()==98)
		{
			tr.setSucceeded(true);
		}
		else
		{
			tr.setReason("Received wrong result: "+recontent);
		}
		getBeliefbase().getBeliefSet("testcap.reports").addFact(tr);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy