|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ourgrid.gridmachine.useragent.test.FakeUserAgentServer
public class FakeUserAgentServer
A FakeUserAgentServer for UserAgentClient's unit tests.
Constructor Summary | |
---|---|
FakeUserAgentServer()
|
|
FakeUserAgentServer(GumID gumID,
GumSpec gumSpec)
|
|
FakeUserAgentServer(GumSpec spec)
|
Method Summary | |
---|---|
void |
changeFilePermissions(java.io.File file,
int permissions)
Change the permissions of a file located at the Grid Machine. |
java.lang.String |
createPlaypen(int size)
Creates a playpen in the Grid Machine. |
java.lang.String |
createStorageDirectory()
Creates the storage directory. |
boolean |
fileExists(java.io.File file)
Check if the file denoted by file abstraction exists. |
boolean |
fileNameExists(java.lang.String file)
Returns true if a specified filename was called. |
byte[] |
getFile(java.lang.String filePath,
long filePos,
int size)
Get an array of bytes FROM a file that is located at the Grid Machine. |
protected int |
getFileExistsCalls()
|
protected int |
getGetStorageDirCalls()
|
GumSpec |
getGuMSpec()
|
GumID |
getID()
|
protected int |
getPutFileCalls()
|
java.lang.String |
getRemoteFileDigest(java.io.File remoteFile)
Used to return the digest representation of a file. |
long |
getRemoteFileLastModification(java.io.File remoteFile,
boolean normalized)
Gets the time when the last modification in the specified file has occurred. |
long |
getRemoteFileLength(java.io.File remoteFile)
Determines the remote file size in bytes. |
ExecutorResult |
getResult(ExecutorHandle handle)
Gives access to the result of execution. |
GumStatus |
getStatus()
Gets the status of the grid machine. |
java.lang.String |
getStorageDirectory()
Returns the remote storage directory. |
void |
invalidate()
|
void |
putFile(java.lang.String remoteFile,
byte[] data,
boolean firstSlice)
Put an array of bytes INTO the file specified by removeFile
at the Grid Machine. |
ExecutorHandle |
remoteExecute()
|
ExecutorHandle |
remoteExecute(java.lang.String remoteDir,
java.lang.String command,
java.util.Map envVars)
Executes a remote task command in a specific directory on the grid machine. |
protected void |
setPutFileException(boolean b)
|
protected void |
setStorageDirectory(java.lang.String s)
|
void |
shutDown()
|
void |
startReplica()
Determines a replica start. |
void |
stopReplica()
Tells the user agent to kill any executing tasks and also clean the environment to a next execution. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FakeUserAgentServer() throws java.rmi.RemoteException
java.rmi.RemoteException
public FakeUserAgentServer(GumSpec spec) throws java.rmi.RemoteException
java.rmi.RemoteException
public FakeUserAgentServer(GumID gumID, GumSpec gumSpec) throws java.rmi.RemoteException
java.rmi.RemoteException
Method Detail |
---|
public ExecutorHandle remoteExecute(java.lang.String remoteDir, java.lang.String command, java.util.Map envVars)
Gum
remoteExecute
in interface Gum
remoteDir
- directory where the command will be executed. For
example, in a Unix environment, a cd
to this
directory will be done before running the specified command.command
- the command that will be executed in the specified
directory.envVars
- a Map
containing a set of
environment variable names as the keys and the corresponding
values as the values set. All these variables will be set before
the execution of the command. The keys and values of Map should be
String or, at least, override the Object#toString
method.
Executor
class.public ExecutorHandle remoteExecute()
public void putFile(java.lang.String remoteFile, byte[] data, boolean firstSlice) throws java.rmi.RemoteException, java.io.IOException
Gum
removeFile
at the Grid Machine.
putFile
in interface Gum
remoteFile
- the name of file that where the array of bytes will be
appendeddata
- an array of bytes that must be appended to the file.firstSlice
- Indicates if the array of bytes is the first slice of
the file or not. If true and remoteFile exists,
the file will be overwritten. Otherwise, the array of bytes will
just be appended to the file.
java.rmi.RemoteException
- if some RMI error occurs during the putFile()
method invocation.
java.io.IOException
- if some error occurs during the writing process.public byte[] getFile(java.lang.String filePath, long filePos, int size)
Gum
getFile
in interface Gum
filePath
- the path where the file is located.filePos
- the position into the file from the array will be read.size
- the size of array of bytes that must be read.
public boolean fileExists(java.io.File file)
Gum
fileExists
in interface Gum
file
- the file that will be searched
public boolean fileNameExists(java.lang.String file)
file
- To verify file name
public void changeFilePermissions(java.io.File file, int permissions)
Gum
changeFilePermissions
in interface Gum
file
- the file which permissions will be changed.permissions
- a string specifying the permissions. The string must
be composed of three numbers, like in the UNIX-like systems. For
instance, "rwxrwx---" must be represented by "770".public long getRemoteFileLastModification(java.io.File remoteFile, boolean normalized)
Gum
getRemoteFileLastModification
in interface Gum
remoteFile
- The file located at the Grid Machine which the
modification time will be determined.normalized
- Indicates if the last modification time must be
normalized to the TIMEZONE-0.
public long getRemoteFileLength(java.io.File remoteFile)
Gum
getRemoteFileLength
in interface Gum
remoteFile
- The file located at the Grid Machine which the size
must be determined.
public java.lang.String getRemoteFileDigest(java.io.File remoteFile)
Gum
getRemoteFileDigest
in interface Gum
remoteFile
- if the file used to generate the digest
public java.lang.String createPlaypen(int size)
Gum
createPlaypen
in interface Gum
size
- The number of bytes that must be reserved to the playpen.
public java.lang.String createStorageDirectory()
Gum
createStorageDirectory
in interface Gum
public java.lang.String getStorageDirectory()
Gum
getStorageDirectory
in interface Gum
protected int getPutFileCalls()
protected int getFileExistsCalls()
protected int getGetStorageDirCalls()
protected void setPutFileException(boolean b)
protected void setStorageDirectory(java.lang.String s)
public ExecutorResult getResult(ExecutorHandle handle)
Gum
getResult
in interface Gum
handle
- a handle that identifies the execution of interest
public GumStatus getStatus()
Gum
getStatus
in interface Gum
GumStatus
public GumID getID()
public GumSpec getGuMSpec()
public void invalidate()
public void shutDown()
public void startReplica() throws java.rmi.RemoteException
Gum
startReplica
in interface Gum
java.rmi.RemoteException
- if some RMI error occurs during this method
invocation.public void stopReplica() throws java.rmi.RemoteException
Gum
stopReplica
in interface Gum
java.rmi.RemoteException
- If some RMI error occurs during this method
invocation.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |