
jadex.bdi.testcases.goals.DropGoalPlan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-applications-bdi Show documentation
Show all versions of jadex-applications-bdi Show documentation
The Jadex BDI applications package contain
several example applications, benchmarks and
testcases using BDI agents.
The newest version!
package jadex.bdi.testcases.goals;
import jadex.base.test.TestReport;
import jadex.bdi.runtime.GoalFailureException;
import jadex.bdi.runtime.IGoal;
import jadex.bdi.runtime.Plan;
import jadex.bdi.runtime.TimeoutException;
/**
* Test waiting for a dropped goal.
*/
public class DropGoalPlan extends Plan
{
public void body()
{
// Dispatch goal.
IGoal goal = createGoal("testgoal");
dispatchSubgoal(goal);
// Wait a sec. and then drop the goal.
waitFor(1000);
goal.drop();
// Wait for goal to be finished and check the result.
TestReport report = new TestReport("drop_wait", "Test waiting for a dropped goal.");
try
{
waitForGoal(goal, 1000);
report.setSucceeded(true);
}
catch(GoalFailureException gfee)
{
report.setSucceeded(true);
}
catch(TimeoutException te)
{
report.setFailed("Goal did not finish.");
}
getBeliefbase().getBeliefSet("testcap.reports").addFact(report);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy