es.upm.dit.gsi.beast.story
Class BeastTestCase

java.lang.Object
  extended by org.jbehave.core.ConfigurableEmbedder
      extended by org.jbehave.core.junit.JUnitStory
          extended by es.upm.dit.gsi.beast.story.BeastTestCase
All Implemented Interfaces:
org.jbehave.core.Embeddable

public abstract class BeastTestCase
extends org.jbehave.core.junit.JUnitStory

Project: beast File: es.upm.dit.gsi.beast.story.BeastTestCase.java Main class to translate plain text into code, following the Given-When-Then language In the GIVEN part it launches the platform In the WHEN part it configures the state of its agents In the THEN part it checks the correct behaviour The main purpose of it consists of knowing agents' state/properties without changing its code. Grupo de Sistemas Inteligentes Departamento de Ingeniería de Sistemas Telemáticos Universidad Politécnica de Madrid (UPM)

Version:
0.1
Author:
Jorge Solitario, alvarocarrera

Field Summary
protected  AgentIntrospector introspector
           
 Logger logger
           
static int SLEEP_TIME
           
 
Constructor Summary
BeastTestCase()
           
 
Method Summary
 List<org.jbehave.core.steps.CandidateSteps> candidateSteps()
           
protected  void checkAgentsBeliefEquealsTo(String agent_name, String belief_name, Object belief_value)
          Checks the value of some agent's belief with the expected value.
 jadex.bdi.runtime.IGoal[] getAgentGoals(String agent_name)
          This method prints goal information of an agent through its external access.
 jadex.bdi.runtime.IPlan[] getAgentPlans(String agent_name)
          This method prints plan information of an agent through its external access.
protected  Object getBeliefValue(String agent_name, String belief_name)
          This method takes the value of an agent's belief through its external access
 Connector getConnector()
           
protected  Object getGoals(String agent_name)
           
protected  Object getPlans(String agent_name)
           
abstract  void launch()
           
 void sendMessageToAgent(String agent_name, String msgtype, Object message_content)
          It sends one message of requested type to an agent
 void sendMessageToAgents(String[] agent_name, String msgtype, Object message_content)
          The same as above, but this method sends the same message to many agents.
 void sendMessageToAgentsWithExtraProperties(String agent_name, String msgtype, Object message_content, ArrayList<Object> properties)
          It sends one message of requested type to an agent, including some extra parameters in the message event, such as ontology or language.
 void sendMessageToAgentWithExtraProperties(String agent_name, String msgtype, Object message_content, ArrayList<Object> properties)
          It sends one message of requested type to an agent, including some extra parameters in the message event, such as ontology or language.
 void setBeliefValue(String agent_name, String belief_name, Object new_value)
          This method changes the value of an agent's belief through its external access
 void setExecutionTime(long millis)
          This method set the execution time of the test.
 void setScenario()
          Once given the scenario, child's setSetup() will be run
abstract  void setup()
           
 void startAgent(String agent_name, String path)
          Creates a real agent in the platform
 void startAgent(String agent_name, String path, String containerName, Object[] arguments)
          Creates a real agent in the platform in a given container
 void startPlatform(String platform, Logger logger)
          Main constructor of the class, launches the platform
abstract  void verify()
           
 
Methods inherited from class org.jbehave.core.junit.JUnitStory
run
 
Methods inherited from class org.jbehave.core.ConfigurableEmbedder
addSteps, addSteps, configuration, configuredEmbedder, stepsFactory, useConfiguration, useEmbedder, useStepsFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SLEEP_TIME

public static final int SLEEP_TIME
See Also:
Constant Field Values

logger

public Logger logger

introspector

protected AgentIntrospector introspector
Constructor Detail

BeastTestCase

public BeastTestCase()
Method Detail

candidateSteps

public List<org.jbehave.core.steps.CandidateSteps> candidateSteps()
Overrides:
candidateSteps in class org.jbehave.core.ConfigurableEmbedder

setup

public abstract void setup()

launch

public abstract void launch()

verify

public abstract void verify()

startPlatform

public void startPlatform(String platform,
                          Logger logger)
Main constructor of the class, launches the platform


getConnector

public Connector getConnector()
Returns:
the platform connector

startAgent

public void startAgent(String agent_name,
                       String path)
Creates a real agent in the platform

Parameters:
agent_name - The name that the agent is gonna have in the platform
path - The path of the description of the agent

startAgent

public void startAgent(String agent_name,
                       String path,
                       String containerName,
                       Object[] arguments)
Creates a real agent in the platform in a given container

Parameters:
agent_name - The name of the agent
path - The path of the Agent
containerName - The name of the container, if it does not exist, beast-tool creates it.
arguments - For the agent

sendMessageToAgent

public void sendMessageToAgent(String agent_name,
                               String msgtype,
                               Object message_content)
It sends one message of requested type to an agent

Parameters:
agent_name - The name of the agent that receives the message
msgtype - The type of the message (SFipa.INFORM - SFipa.REQUEST)
message_content - The content of the message

sendMessageToAgents

public void sendMessageToAgents(String[] agent_name,
                                String msgtype,
                                Object message_content)
The same as above, but this method sends the same message to many agents.

Parameters:
agent_name - The name of the agent that receives the message
msgtype - The type of the message (SFipa.INFORM - SFipa.REQUEST)
message_content - The content of the message

sendMessageToAgentsWithExtraProperties

public void sendMessageToAgentsWithExtraProperties(String agent_name,
                                                   String msgtype,
                                                   Object message_content,
                                                   ArrayList<Object> properties)
It sends one message of requested type to an agent, including some extra parameters in the message event, such as ontology or language.

Parameters:
agent_name - The name of the agent that receives the message
msgtype - The type of the message (SFipa.INFORM - SFipa.REQUEST)
message_content - The content of the message
properties - to add to the message

checkAgentsBeliefEquealsTo

protected void checkAgentsBeliefEquealsTo(String agent_name,
                                          String belief_name,
                                          Object belief_value)
Checks the value of some agent's belief with the expected value. The belief must be initialised. It means, not null value. If a null value is found for a belief_name, this method will be blocked until the value would be not null.

Parameters:
agent_name -
belief_name -
belief_value -

getBeliefValue

protected Object getBeliefValue(String agent_name,
                                String belief_name)
This method takes the value of an agent's belief through its external access

Parameters:
agent_name -
belief_name -
Returns:
the value of the belief

getGoals

protected Object getGoals(String agent_name)

getPlans

protected Object getPlans(String agent_name)

setScenario

public void setScenario()
Once given the scenario, child's setSetup() will be run

Parameters:
scenario -

setBeliefValue

public void setBeliefValue(String agent_name,
                           String belief_name,
                           Object new_value)
This method changes the value of an agent's belief through its external access

Parameters:
agent_name - The name of the agent to change a belief
belief_name - The name of the belief to change
new_value - The new value of the belief to be changed

getAgentPlans

public jadex.bdi.runtime.IPlan[] getAgentPlans(String agent_name)
This method prints plan information of an agent through its external access. It can be used to check the correct behaviour of the agent.

Parameters:
agent_name - The name of the agent
Returns:
IPlan[] so the tester can get the plans information

getAgentGoals

public jadex.bdi.runtime.IGoal[] getAgentGoals(String agent_name)
This method prints goal information of an agent through its external access. It can be used to check the correct behaviour of the agent.

Parameters:
agent_name - The name of the agent
Returns:
IGoal[] so the tester can get the goals information

sendMessageToAgentWithExtraProperties

public void sendMessageToAgentWithExtraProperties(String agent_name,
                                                  String msgtype,
                                                  Object message_content,
                                                  ArrayList<Object> properties)
It sends one message of requested type to an agent, including some extra parameters in the message event, such as ontology or language.

Parameters:
agent_name - The name of the agent
msgtype - The type of the message (SFipa.INFORM - SFipa.REQUEST)
message_content - The content of the message
properties - to add to the message

setExecutionTime

public void setExecutionTime(long millis)
This method set the execution time of the test.

Parameters:
millis - Time in milliseconds


Copyright © 2014 Grupo de Sistemas Inteligentes - Universidad Politécnica de Madrid. All Rights Reserved.