cz.cuni.amis.pogamut.emohawk.bot
Class EmohawkBotTestController<BOT extends UT2004Bot>

Package class diagram package EmohawkBotTestController
java.lang.Object
  extended by cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController<BOT>
      extended by cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotLogicController<BOT>
          extended by cz.cuni.amis.pogamut.emohawk.bot.impl.EmohawkBotController<BOT>
              extended by cz.cuni.amis.pogamut.emohawk.bot.EmohawkBotTestController<BOT>
All Implemented Interfaces:
IAgentLogic<LogicModule>, IUT2004BotController<BOT>, IUT2004BotLogicController<BOT,LogicModule>
Direct Known Subclasses:
NavigationTestBot, NavigationTestBot2

public class EmohawkBotTestController<BOT extends UT2004Bot>
extends EmohawkBotController<BOT>


Field Summary
 
Fields inherited from class cz.cuni.amis.pogamut.emohawk.bot.impl.EmohawkBotController
act, animations, comm, config, emohawkNavigation, emoticons, fwMap, game, getBackToNavGraph, info, inventory, listenerRegistrator, move, navigation, pathExecutor, pathPlanner, places, players, random, raycasting, runStraight, senses, stats, steering, world
 
Fields inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotLogicController
logicModule
 
Fields inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController
bot, log, USER_LOG_CATEGORY_ID
 
Constructor Summary
EmohawkBotTestController()
           
 
Method Summary
 Throwable getCause()
          The exception that caused the bot to fail...
 cz.cuni.amis.utils.flag.ImmutableFlag<Boolean> getFailureFlag()
          Returns a failure flag, may be used to attach listeners to it.
protected  LogicModule getLogicModule()
           
 String getMessage()
          Message why the bot has succeeded or failed...
 cz.cuni.amis.utils.flag.ImmutableFlag<Boolean> getSuccessFlag()
          Success flag, may be used to attach listeners to it...
 CountDownLatch getTestLatch()
          Returns a latch on which you may CountDownLatch.await() till the test finishes.
 void initializeController(BOT bot)
          Additionally initializes UT2004BotTestController#latch field with new BusAwareCountDownLatch(1, bot.getEventBus())
 boolean isFailure()
          Whether the test has failed (may be called after the latch has been risen).
 boolean isSuccess()
          Whether the test has succeeded (may be called after the latch has been risen).
 void setFailure()
          Declares "failure" - i.e., the test has ended in a wrong way.
 void setFailure(String message)
          Declares "failure" - i.e., the test has ended in a wrong way.
 void setFailure(String message, Throwable cause)
          Declares "failure" - i.e., the test has ended in a wrong way.
 void setFailure(Throwable cause)
          Declares "failure" - i.e., the test has ended in a wrong way.
 void setSuccess()
          Declares "success" - i.e., the test has ended correctly, everything has passed.
 void setSuccess(String message)
          Declares "success" - i.e., the test has ended correctly, everything has passed.
 void setTestLatch(CountDownLatch latch)
          Sets different latch for the bot controller.
 void timeout()
          Called from the outside by the test itself to notify the bot about the timeout.
 
Methods inherited from class cz.cuni.amis.pogamut.emohawk.bot.impl.EmohawkBotController
finishControllerInitialization, getConfig, getFwMap, getGame, getInfo, getMove, getNavigation, getPathExecutor, getPathPlanner, getPlayers, getRandom, getRaycasting, getSenses, getStats, getWorld, initializeListeners, initializeModules, initializePathFinding
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotLogicController
beforeFirstLogic, getLogicInitializeTime, getLogicShutdownTime, initializeLogic, logic, logicInitialize, logicShutdown
 
Methods inherited from class cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotController
botFirstSpawn, botInitialized, botKilled, botShutdown, getAct, getBot, getInitializeCommand, getLog, getPassword, getWorldView, prepareBot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cz.cuni.amis.pogamut.ut2004.bot.IUT2004BotController
botFirstSpawn, botInitialized, botKilled, botShutdown, getAct, getBot, getInitializeCommand, getLog, getPassword, getWorldView, prepareBot
 

Constructor Detail

EmohawkBotTestController

public EmohawkBotTestController()
Method Detail

initializeController

public void initializeController(BOT bot)
Additionally initializes UT2004BotTestController#latch field with new BusAwareCountDownLatch(1, bot.getEventBus())

Specified by:
initializeController in interface IUT2004BotController<BOT extends UT2004Bot>
Overrides:
initializeController in class EmohawkBotController<BOT extends UT2004Bot>

getMessage

public String getMessage()
Message why the bot has succeeded or failed... if provided via UT2004BotTestController#setFailure(String) or UT2004BotTestController#setSuccess(String).

Returns:

getCause

public Throwable getCause()
The exception that caused the bot to fail... if provided via UT2004BotTestController#setFailure(Throwable).

Returns:

setTestLatch

public void setTestLatch(CountDownLatch latch)
Sets different latch for the bot controller.

Parameters:
latch -

setSuccess

public void setSuccess()
Declares "success" - i.e., the test has ended correctly, everything has passed.

Also raises the UT2004BotTestController#latch.


setSuccess

public void setSuccess(String message)
Declares "success" - i.e., the test has ended correctly, everything has passed.

Also raises the UT2004BotTestController#latch.


timeout

public void timeout()
Called from the outside by the test itself to notify the bot about the timeout.

Calls UT2004BotTestController#setFailure(String) + raises the test latch.


setFailure

public void setFailure()
Declares "failure" - i.e., the test has ended in a wrong way.

Also raises the UT2004BotTestController#latch.


setFailure

public void setFailure(String message)
Declares "failure" - i.e., the test has ended in a wrong way.

Also raises the UT2004BotTestController#latch.


setFailure

public void setFailure(Throwable cause)
Declares "failure" - i.e., the test has ended in a wrong way.

Also raises the UT2004BotTestController#latch.


setFailure

public void setFailure(String message,
                       Throwable cause)
Declares "failure" - i.e., the test has ended in a wrong way.

Also raises the UT2004BotTestController#latch.


isFailure

public boolean isFailure()
Whether the test has failed (may be called after the latch has been risen).


getFailureFlag

public cz.cuni.amis.utils.flag.ImmutableFlag<Boolean> getFailureFlag()
Returns a failure flag, may be used to attach listeners to it.

Note that the flag's value semantics is a bit different from UT2004BotTestController#isFailure() as it will switch itself to true only iff the bot reports a failure via UT2004BotTestController#setFailure().

Returns:

isSuccess

public boolean isSuccess()
Whether the test has succeeded (may be called after the latch has been risen).

Returns:

getSuccessFlag

public cz.cuni.amis.utils.flag.ImmutableFlag<Boolean> getSuccessFlag()
Success flag, may be used to attach listeners to it...

Returns:

getTestLatch

public CountDownLatch getTestLatch()
Returns a latch on which you may CountDownLatch.await() till the test finishes.

Returns:

getLogicModule

protected LogicModule getLogicModule()


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.