Crossfire JXClient, Trunk
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.realtime.crossfire.jxclient.scripts.TestScriptProcess Class Reference
Inheritance diagram for com.realtime.crossfire.jxclient.scripts.TestScriptProcess:
Inheritance graph
Collaboration diagram for com.realtime.crossfire.jxclient.scripts.TestScriptProcess:
Collaboration graph

Public Member Functions

String getAndClearEvents ()
 
void killScript ()
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess
void addScriptProcessListener (@NotNull final ScriptProcessListener scriptProcessListener)
 
void commandSent (@NotNull final String cmd)
 
int compareTo (@NotNull final ScriptProcess o)
 
boolean equals (@Nullable final Object obj)
 
String getFilename ()
 
int getScriptId ()
 
int hashCode ()
 
void run ()
 
String toString ()
 

Static Public Member Functions

static TestScriptProcess newTestScriptProcess (@NotNull final String scriptCommands)
 
static TestScriptProcess newTestScriptProcess (@NotNull final String scriptCommands, @NotNull final CrossfireServerConnection crossfireServerConnection)
 

Protected Member Functions

String readFromScript () throws IOException
 
String waitForTermination ()
 
void writeToScript (@NotNull final String data)
 
- Protected Member Functions inherited from com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess
 AbstractScriptProcess (final int scriptId, @NotNull final String filename, @NotNull final CommandQueue commandQueue, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final Stats stats, @NotNull final FloorView floorView, @NotNull final ItemSet itemSet, @NotNull final SpellsManager spellsManager, @NotNull final MapUpdaterState mapUpdaterState, @NotNull final SkillSet skillSet)
 

Private Member Functions

 TestScriptProcess (final int scriptId, @NotNull final String filename, @NotNull final CommandQueue commandQueue, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final Stats stats, @NotNull final FloorView floorView, @NotNull final ItemSet itemSet, @NotNull final SpellsManager spellsManager, @NotNull final MapUpdaterState mapUpdaterState, @NotNull final SkillSet skillSet, @NotNull final String scriptCommands)
 

Private Attributes

final BufferedReader br
 
final MapUpdaterState mapUpdaterState
 
final StringBuilder sb = new StringBuilder()
 
final Semaphore sem = new Semaphore(0)
 

Static Private Attributes

static final Pattern PATTERN_MAP_SCROLL = Pattern.compile("@map_scroll (-?[0-9]+) (-?[0-9]+)")
 

Detailed Description

A ScriptProcess for regression tests.

In addition to the normal script commands, this class also recognizes the following commands:

Author
Andreas Kirschbaum

Definition at line 65 of file TestScriptProcess.java.

Constructor & Destructor Documentation

◆ TestScriptProcess()

com.realtime.crossfire.jxclient.scripts.TestScriptProcess.TestScriptProcess ( final int  scriptId,
@NotNull final String  filename,
@NotNull final CommandQueue  commandQueue,
@NotNull final CrossfireServerConnection  crossfireServerConnection,
@NotNull final Stats  stats,
@NotNull final FloorView  floorView,
@NotNull final ItemSet  itemSet,
@NotNull final SpellsManager  spellsManager,
@NotNull final MapUpdaterState  mapUpdaterState,
@NotNull final SkillSet  skillSet,
@NotNull final String  scriptCommands 
)
private

Creates a new instance.

Parameters
scriptIdthe script ID identifying the new script
filenamethe command including arguments to execute
commandQueuethe command queue for sending commands
crossfireServerConnectionthe server connection
statsthe stats instance to watch
floorViewthe floor view to use
itemSetthe item set instance to use
spellsManagerthe spells manager instance to use
mapUpdaterStatethe map updater state instance to use
skillSetthe skill set for looking up skill names
scriptCommandsthe script commands to execute

Definition at line 152 of file TestScriptProcess.java.

References com.realtime.crossfire.jxclient.scripts.TestScriptProcess.br, com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.commandQueue, com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.crossfireServerConnection, com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.filename, com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.floorView, com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.itemSet, com.realtime.crossfire.jxclient.scripts.TestScriptProcess.mapUpdaterState, com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.scriptId, com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.skillSet, com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.spellsManager, and com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.stats.

Referenced by com.realtime.crossfire.jxclient.scripts.TestScriptProcess.newTestScriptProcess().

Here is the caller graph for this function:

Member Function Documentation

◆ getAndClearEvents()

String com.realtime.crossfire.jxclient.scripts.TestScriptProcess.getAndClearEvents ( )

◆ killScript()

void com.realtime.crossfire.jxclient.scripts.TestScriptProcess.killScript ( )

◆ newTestScriptProcess() [1/2]

static TestScriptProcess com.realtime.crossfire.jxclient.scripts.TestScriptProcess.newTestScriptProcess ( @NotNull final String  scriptCommands)
static

◆ newTestScriptProcess() [2/2]

static TestScriptProcess com.realtime.crossfire.jxclient.scripts.TestScriptProcess.newTestScriptProcess ( @NotNull final String  scriptCommands,
@NotNull final CrossfireServerConnection  crossfireServerConnection 
)
static

◆ readFromScript()

String com.realtime.crossfire.jxclient.scripts.TestScriptProcess.readFromScript ( ) throws IOException
protected

◆ waitForTermination()

String com.realtime.crossfire.jxclient.scripts.TestScriptProcess.waitForTermination ( )
protected

Waits until the script has terminated.

Returns
the termination reason or
null
if the script exited normally

Reimplemented from com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.

Definition at line 204 of file TestScriptProcess.java.

References com.realtime.crossfire.jxclient.scripts.TestScriptProcess.sem.

◆ writeToScript()

void com.realtime.crossfire.jxclient.scripts.TestScriptProcess.writeToScript ( @NotNull final String  data)
protected

Sends some data to the script process.

Parameters
datathe data
Exceptions
IOExceptionif sending fails

Reimplemented from com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.

Definition at line 214 of file TestScriptProcess.java.

References com.realtime.crossfire.jxclient.scripts.TestScriptProcess.sb.

Member Data Documentation

◆ br

final BufferedReader com.realtime.crossfire.jxclient.scripts.TestScriptProcess.br
private

◆ mapUpdaterState

final MapUpdaterState com.realtime.crossfire.jxclient.scripts.TestScriptProcess.mapUpdaterState
private

◆ PATTERN_MAP_SCROLL

final Pattern com.realtime.crossfire.jxclient.scripts.TestScriptProcess.PATTERN_MAP_SCROLL = Pattern.compile("@map_scroll (-?[0-9]+) (-?[0-9]+)")
staticprivate

Matches the "@map_scroll" command.

Definition at line 71 of file TestScriptProcess.java.

Referenced by com.realtime.crossfire.jxclient.scripts.TestScriptProcess.readFromScript().

◆ sb

final StringBuilder com.realtime.crossfire.jxclient.scripts.TestScriptProcess.sb = new StringBuilder()
private

◆ sem

final Semaphore com.realtime.crossfire.jxclient.scripts.TestScriptProcess.sem = new Semaphore(0)
private

The documentation for this class was generated from the following file: