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

Public Member Functions

void addClientSocketListener (@NotNull final ClientSocketListener clientSocketListener)
 
void addCrossfireMapScrollListener (@NotNull final CrossfireMapScrollListener listener)
 
void addFaceReceivedListener (@NotNull final AskfaceFaceQueueListener listener)
 
void connect (@NotNull final String hostname, final int port)
 
void disconnect (@NotNull final String reason)
 
String getAccountName ()
 
void removeClientSocketListener (@NotNull final ClientSocketListener clientSocketListener)
 
void sendAccountCharacterCreate (@NotNull final String login, @NotNull final String password, @NotNull final Collection< String > attributes)
 
void sendAccountCreate (@NotNull final String login, @NotNull final String password)
 
void sendAccountLink (final int force, @NotNull final String login, @NotNull final String password)
 
void sendAccountLogin (@NotNull final String login, @NotNull final String password)
 
void sendAccountPassword (@NotNull final String currentPassword, @NotNull final String newPassword)
 
void sendAccountPlay (@NotNull final String name)
 
void sendAddme ()
 
void sendApply (final int tag)
 
void sendAskface (final int faceNum)
 
void sendExamine (final int tag)
 
void sendLock (final boolean val, final int tag)
 
void sendLookat (final int dx, final int dy)
 
void sendMark (final int tag)
 
void sendMove (final int to, final int tag, final int nrof)
 
int sendNcom (final int repeat, @NotNull final String command)
 
void sendRawString (@NotNull final String command)
 
void sendReply (@NotNull final String text)
 
void sendRequestinfo (@NotNull final String infoType)
 
void sendSetup (@NotNull final String... options)
 
void sendToggleextendedtext (@NotNull final int... types)
 
void sendVersion (final int csval, final int scval, @NotNull final String vinfo)
 
void setCrossfireUpdateMapListener (@NotNull final CrossfireUpdateMapListener listener)
 
void setPreferredMapSize (final int preferredMapWidth, final int preferredMapHeight)
 
void setPreferredNumLookObjects (final int preferredNumLookObjects)
 
void start ()
 
void stop ()
 
 TestCrossfireServerConnection ()
 
String toString ()
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.server.crossfire.AbstractCrossfireServerConnection
void addCrossfireAccountListener (@NotNull final CrossfireAccountListener listener)
 
void addCrossfireComcListener (@NotNull final CrossfireComcListener listener)
 
void addCrossfireDrawextinfoListener (@NotNull final CrossfireDrawextinfoListener listener)
 
void addCrossfireDrawinfoListener (@NotNull final CrossfireDrawinfoListener listener)
 
void addCrossfireFailureListener (@NotNull final CrossfireFailureListener listener)
 
void addCrossfireMagicmapListener (@NotNull final CrossfireMagicmapListener listener)
 
void addCrossfireMusicListener (@NotNull final CrossfireMusicListener listener)
 
void addCrossfirePickupListener (@NotNull final CrossfirePickupListener listener)
 
void addCrossfireQueryListener (@NotNull final CrossfireQueryListener listener)
 
void addCrossfireSoundListener (@NotNull final CrossfireSoundListener listener)
 
void addCrossfireTickListener (@NotNull final CrossfireTickListener listener)
 
void addCrossfireUpdateItemListener (@NotNull final CrossfireUpdateItemListener crossfireUpdateItemListener)
 
void addPacketWatcherListener (@NotNull final ReceivedPacketListener listener)
 
void addSentPacketListener (@NotNull final SentPacketListener listener)
 
void drawextinfo (final int color, final int type, final int subtype, @NotNull final String message)
 
void drawInfo (@NotNull final String message, final int color)
 
void drawInfoSetDebugMode (final boolean printMessageTypes)
 
void removeCrossfireAccountListener (@NotNull final CrossfireAccountListener listener)
 
void removeCrossfireDrawextinfoListener (@NotNull final CrossfireDrawextinfoListener listener)
 
void removeCrossfireDrawinfoListener (@NotNull final CrossfireDrawinfoListener listener)
 
void removeCrossfireFailureListener (@NotNull final CrossfireFailureListener listener)
 
void removeCrossfireMagicmapListener (@NotNull final CrossfireMagicmapListener listener)
 
void removeCrossfirePickupListener (@NotNull final CrossfirePickupListener listener)
 
void removeCrossfireQueryListener (@NotNull final CrossfireQueryListener listener)
 
void removeCrossfireUpdateItemListener (@NotNull final CrossfireUpdateItemListener crossfireUpdateItemListener)
 
void removePacketWatcherListener (@NotNull final ReceivedPacketListener listener)
 
void removeSentPacketListener (@NotNull final SentPacketListener listener)
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection
void drawextinfo (int color, int type, int subtype, String message)
 

Private Attributes

final StringBuilder sb = new StringBuilder()
 

Additional Inherited Members

- Protected Member Functions inherited from com.realtime.crossfire.jxclient.server.crossfire.AbstractCrossfireServerConnection
 AbstractCrossfireServerConnection (@NotNull final Model model)
 
void clearFailure ()
 
void fireAddAccount (@NotNull final CharacterInformation characterInformation)
 
void fireAddItemReceived (final int location, final int tag, final int flags, final int weight, final int faceNum, final String name, final String namePl, final int anim, final int animSpeed, final int nrof, final int type)
 
void fireCommandComcReceived (final int packetNo, final int time)
 
void fireCommandQueryReceived (@NotNull final String prompt, final int queryType)
 
void fireCommandSound2Received (final int x, final int y, final int dir, final int volume, final int type, @NotNull final String action, @NotNull final String name)
 
void fireCommandSoundReceived (final int x, final int y, final int num, final int type)
 
void fireDelinvReceived (final int tag)
 
void fireDelitemReceived (final int @NotNull[] tags)
 
void fireEndAccountList (final int count)
 
void fireFaceReceived (final int faceNum, final int faceSetNum, final int faceChecksum, @NotNull final String faceName)
 
void fireFailure (@NotNull final String command, @NotNull final String arguments)
 
void fireMagicMap ()
 
void fireManageAccount ()
 
void fireMarkSent (final int tag)
 
void fireMusicReceived (@NotNull final String music)
 
void firePickupChanged (final int pickupOptions)
 
void firePlayerReceived (final int tag, final int weight, final int faceNum, @NotNull final String name)
 
void fireReplySent ()
 
void fireSelectCharacter (@NotNull final String accountName, @NotNull final String characterName)
 
void fireStartAccountList (@NotNull final String accountName)
 
void fireStartPlaying ()
 
void fireTick (final int tickNo)
 
void fireUpditemReceived (final int flags, final int tag, final int valLocation, final int valFlags, final int valWeight, final int valFaceNum, @NotNull final String valName, @NotNull final String valNamePl, final int valAnim, final int valAnimSpeed, final int valNrof)
 
void notifyPacketWatcherListeners (@NotNull final String command, @NotNull final ClientSocketMonitorCommand args)
 
- Static Protected Member Functions inherited from com.realtime.crossfire.jxclient.server.crossfire.AbstractCrossfireServerConnection
static String newString (@NotNull final ByteBuffer byteBuffer, final int start, final int len)
 
- Static Protected Attributes inherited from com.realtime.crossfire.jxclient.server.crossfire.AbstractCrossfireServerConnection
static final Charset UTF8 = StandardCharsets.UTF_8
 

Detailed Description

Implements CrossfireServerConnection for regression tests. All functions do call Assert#fail(). Sub-classes may override some functions.

Author
Andreas Kirschbaum

Definition at line 39 of file TestCrossfireServerConnection.java.

Constructor & Destructor Documentation

◆ TestCrossfireServerConnection()

com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.TestCrossfireServerConnection ( )

Creates a new instance.

Definition at line 50 of file TestCrossfireServerConnection.java.

Member Function Documentation

◆ addClientSocketListener()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.addClientSocketListener ( @NotNull final ClientSocketListener  clientSocketListener)

Adds a ClientSocketListener to notify.

Parameters
clientSocketListenerthe client socket listener to add

Implements com.realtime.crossfire.jxclient.server.server.ServerConnection.

Definition at line 171 of file TestCrossfireServerConnection.java.

◆ addCrossfireMapScrollListener()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.addCrossfireMapScrollListener ( @NotNull final CrossfireMapScrollListener  listener)

Registers a listener to be called whenever the map was scolled.

Parameters
listenerthe listener

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 65 of file TestCrossfireServerConnection.java.

◆ addFaceReceivedListener()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.addFaceReceivedListener ( @NotNull final AskfaceFaceQueueListener  listener)

Registers a listener to be called whenever a face has been received.

Parameters
listenerthe listener

Implements com.realtime.crossfire.jxclient.faces.AskfaceQueue.

Definition at line 89 of file TestCrossfireServerConnection.java.

◆ connect()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.connect ( @NotNull final String  hostname,
final int  port 
)

Attempts to connect the client to a server.

Parameters
hostnamethe hostname to connect to
portthe port to connect to

Implements com.realtime.crossfire.jxclient.server.server.ServerConnection.

Definition at line 180 of file TestCrossfireServerConnection.java.

◆ disconnect()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.disconnect ( @NotNull final String  reason)

Disconnects from the server. Does nothing if not connected.

Parameters
reasonthe reason for the disconnect

Implements com.realtime.crossfire.jxclient.server.server.ServerConnection.

Definition at line 185 of file TestCrossfireServerConnection.java.

◆ getAccountName()

String com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.getAccountName ( )

Returns the current account name.

Returns
the current account name or
null

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 166 of file TestCrossfireServerConnection.java.

◆ removeClientSocketListener()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.removeClientSocketListener ( @NotNull final ClientSocketListener  clientSocketListener)

Removes a ClientSocketListener to notify.

Parameters
clientSocketListenerthe client socket listener to remove

Implements com.realtime.crossfire.jxclient.server.server.ServerConnection.

Definition at line 175 of file TestCrossfireServerConnection.java.

◆ sendAccountCharacterCreate()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendAccountCharacterCreate ( @NotNull final String  login,
@NotNull final String  password,
@NotNull final Collection< String >  attributes 
)

Sends a request to create a new character associated to the account.

Parameters
loginthe character's name
passwordthe character's password
attributesthe character attributes

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 210 of file TestCrossfireServerConnection.java.

◆ sendAccountCreate()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendAccountCreate ( @NotNull final String  login,
@NotNull final String  password 
)

Sends a request to create a new account.

Parameters
loginthe account login
passwordthe account password

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 205 of file TestCrossfireServerConnection.java.

◆ sendAccountLink()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendAccountLink ( final int  force,
@NotNull final String  login,
@NotNull final String  password 
)

Sends a request to add an existing character to an account.

Parameters
force0 to allow failure, 1 to force in certain situations
loginthe character's login
passwordthe character's password

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 200 of file TestCrossfireServerConnection.java.

◆ sendAccountLogin()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendAccountLogin ( @NotNull final String  login,
@NotNull final String  password 
)

Asks for an account login.

Parameters
loginthe account login
passwordthe account password

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 190 of file TestCrossfireServerConnection.java.

◆ sendAccountPassword()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendAccountPassword ( @NotNull final String  currentPassword,
@NotNull final String  newPassword 
)

Sends a request to change the account's password.

Parameters
currentPasswordcurrent account password
newPasswordnew account password

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 215 of file TestCrossfireServerConnection.java.

◆ sendAccountPlay()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendAccountPlay ( @NotNull final String  name)

Sends a request to play a character from an account.

Parameters
namethe character's name to play

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 195 of file TestCrossfireServerConnection.java.

◆ sendAddme()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendAddme ( )

Sends an "addme" command to the server.

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 74 of file TestCrossfireServerConnection.java.

◆ sendApply()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendApply ( final int  tag)

Sends an "apply" command to the server.

Parameters
tagthe item to apply

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 79 of file TestCrossfireServerConnection.java.

References com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sb.

◆ sendAskface()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendAskface ( final int  faceNum)

Sends an "askface" command.

Parameters
faceNumthe face number to request

Implements com.realtime.crossfire.jxclient.faces.AskfaceQueue.

Definition at line 84 of file TestCrossfireServerConnection.java.

◆ sendExamine()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendExamine ( final int  tag)

Sends an "examine" command to the server.

Parameters
tagthe item to examine

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 94 of file TestCrossfireServerConnection.java.

◆ sendLock()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendLock ( final boolean  val,
final int  tag 
)

Sends a "lock" command to the server.

Parameters
valwhether to lock the item
tagthe item to lock

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 99 of file TestCrossfireServerConnection.java.

References com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sb.

◆ sendLookat()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendLookat ( final int  dx,
final int  dy 
)

Sends a "lookat" command to the server.

Parameters
dxthe x-coordinate in tiles, relative to the player
dythe y-coordinate in tiles, relative to the player

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 104 of file TestCrossfireServerConnection.java.

◆ sendMark()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendMark ( final int  tag)

◆ sendMove()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendMove ( final int  to,
final int  tag,
final int  nrof 
)

Sends a "move" command to the server.

Parameters
tothe destination location
tagthe item to move
nrofthe number of items to move

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 114 of file TestCrossfireServerConnection.java.

References com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sb.

◆ sendNcom()

int com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendNcom ( final int  repeat,
@NotNull final String  command 
)

Sends a "ncom" command to the server.

Parameters
repeatthe repeat count
commandthe command
Returns
the packet id

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 119 of file TestCrossfireServerConnection.java.

References com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sb.

◆ sendRawString()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendRawString ( @NotNull final String  command)

Sends an arbitrary string command to the server.

Parameters
commandthe command

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 125 of file TestCrossfireServerConnection.java.

References com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sb.

◆ sendReply()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendReply ( @NotNull final String  text)

Sends a "reply" command to the server.

Parameters
textthe text to reply

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 130 of file TestCrossfireServerConnection.java.

◆ sendRequestinfo()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendRequestinfo ( @NotNull final String  infoType)

Sends a "requestinfo" command to the server.

Parameters
infoTypethe info type to request

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 135 of file TestCrossfireServerConnection.java.

◆ sendSetup()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendSetup ( @NotNull final String...  options)

Sends a "setup" command to the server.

Parameters
optionsthe option/value pairs to send

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 140 of file TestCrossfireServerConnection.java.

◆ sendToggleextendedtext()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendToggleextendedtext ( @NotNull final int...  types)

Sends a "toggleextendedtext" command to the server.

Parameters
typesthe types to request

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 145 of file TestCrossfireServerConnection.java.

◆ sendVersion()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sendVersion ( final int  csval,
final int  scval,
@NotNull final String  vinfo 
)

Sends a "version" command to the server.

Parameters
csvalthe client version number
scvalthe server version number
vinfothe client identification string

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 150 of file TestCrossfireServerConnection.java.

◆ setCrossfireUpdateMapListener()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.setCrossfireUpdateMapListener ( @NotNull final CrossfireUpdateMapListener  listener)

Sets a listener to be notified about map changes. At most one such listener may be set.

Parameters
listenerthe listener

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 69 of file TestCrossfireServerConnection.java.

◆ setPreferredMapSize()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.setPreferredMapSize ( final int  preferredMapWidth,
final int  preferredMapHeight 
)

Sets the preferred map size.

Parameters
preferredMapWidththe preferred map width in tiles; must be odd
preferredMapHeightthe preferred map height in tiles; must be odd

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 155 of file TestCrossfireServerConnection.java.

◆ setPreferredNumLookObjects()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.setPreferredNumLookObjects ( final int  preferredNumLookObjects)

Sets the maximum number of objects in the ground view. Must not be called in connected state.

Parameters
preferredNumLookObjectsthe number of objects
Exceptions
IllegalArgumentExceptionif the number of objects is invalid

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 160 of file TestCrossfireServerConnection.java.

◆ start()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.start ( )

◆ stop()

void com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.stop ( )

Stops operation.

Exceptions
InterruptedExceptionif stopping was interrupted

Implements com.realtime.crossfire.jxclient.server.crossfire.CrossfireServerConnection.

Definition at line 60 of file TestCrossfireServerConnection.java.

◆ toString()

String com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.toString ( )

Member Data Documentation

◆ sb

final StringBuilder com.realtime.crossfire.jxclient.server.crossfire.TestCrossfireServerConnection.sb = new StringBuilder()
private

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