org.ourgrid.gridmachine.useragent
Class UserAgentServerImplTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.ourgrid.gridmachine.useragent.UserAgentServerImplTest
All Implemented Interfaces:
junit.framework.Test, GumPreCommitTest, PreCommitTest, SelectiveTest, StressTest

public class UserAgentServerImplTest
extends junit.framework.TestCase
implements GumPreCommitTest


Constructor Summary
UserAgentServerImplTest(java.lang.String name)
          This method constructs a new instance of this TestCase.
 
Method Summary
protected  void setUp()
           
protected  void tearDown()
           
 void testBadExecute()
          This method test the execution of a wrong command.
 void testChangeFilePermissions()
           
 void testCreatePlaypen()
          Test the createPlaypen() method by a UA constructed using the default constructor
 void testCreateStorageTwoUAOnePort()
          Try to create two User Agents using the same port number and perform some operations using one of the UAs created.
 void testDestroyPlaypen()
          Try to destroy a playpen in several situations!
 void testFileExists()
          This method tests the behavior of testing the existence of a remote file using an UA.
 void testGetFile()
          Test the get file method using an UserAgent created by default constructor!
 void testGetFileDoesNotExist()
          Test the get file method using an UserAgent created by default constructor!
 void testGetRemoteFileDigest()
          This method tests the checksum generation is correct
 void testGetRemoteFileLength()
          This test verifies if the remote file length determination works on several situations: - File has size Zero.
 void testGoodExecute()
          This method test the execution of a correct command.
 void testPutFileCommon()
          Test the putFile() method in a common situation.
 void testPutFileDefaultConstructor()
          Test the put file method using an UserAgent created by default constructor!
 void testPutFileOnUnauthorizedArea()
          The the putFile() method when is intended to create a file on unauthorized area
 void testPutNullFile()
          This method tests the Put File Method by trying the extreme situations!
 void testStartAndStopReplica()
          Testing the start and stop replica at a gum.
 void testUaKill()
          Use a inner thread object to test the kill method.
 void testUserAgentAttatchment()
          Test the object creation and its attatchment on a port.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface junit.framework.Test
countTestCases, run
 

Constructor Detail

UserAgentServerImplTest

public UserAgentServerImplTest(java.lang.String name)
This method constructs a new instance of this TestCase.

Parameters:
name - The name of the TestCase class.
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception

tearDown

protected void tearDown()
                 throws java.lang.Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception

testGetRemoteFileLength

public void testGetRemoteFileLength()
This test verifies if the remote file length determination works on several situations: - File has size Zero. - File is so "big"


testUserAgentAttatchment

public void testUserAgentAttatchment()
                              throws java.lang.Exception
Test the object creation and its attatchment on a port.

Throws:
java.lang.Exception

testPutNullFile

public void testPutNullFile()
                     throws java.lang.Exception
This method tests the Put File Method by trying the extreme situations!

Throws:
java.lang.Exception

testPutFileOnUnauthorizedArea

public void testPutFileOnUnauthorizedArea()
The the putFile() method when is intended to create a file on unauthorized area


testPutFileCommon

public void testPutFileCommon()
                       throws java.lang.Exception
Test the putFile() method in a common situation. Store a non-null array of bytes in a file located at an authorized place. The idea is verify if FIRST-SLICE flag is working well. Store a 13-bytes-length array twice (firstly FIRST SLICE flag is TRUE, secondly the FIRST SLICE flag is FALSE) and check the file length. The expected result is the 26-bytes file length.

Throws:
java.lang.Exception

testPutFileDefaultConstructor

public void testPutFileDefaultConstructor()
                                   throws java.lang.Exception
Test the put file method using an UserAgent created by default constructor!

Throws:
java.lang.Exception

testGetFile

public void testGetFile()
                 throws java.lang.Exception
Test the get file method using an UserAgent created by default constructor!

Throws:
java.lang.Exception

testGetFileDoesNotExist

public void testGetFileDoesNotExist()
                             throws java.lang.Exception
Test the get file method using an UserAgent created by default constructor!

Throws:
java.lang.Exception

testCreateStorageTwoUAOnePort

public void testCreateStorageTwoUAOnePort()
                                   throws java.lang.Exception
Try to create two User Agents using the same port number and perform some operations using one of the UAs created.

Throws:
java.lang.Exception

testCreatePlaypen

public void testCreatePlaypen()
                       throws java.lang.Exception
Test the createPlaypen() method by a UA constructed using the default constructor

Throws:
java.lang.Exception - If some error occurs during the test.

testChangeFilePermissions

public void testChangeFilePermissions()
                               throws java.lang.Exception
Throws:
java.lang.Exception

testDestroyPlaypen

public void testDestroyPlaypen()
                        throws java.lang.Exception
Try to destroy a playpen in several situations!

Throws:
java.lang.Exception - if some unexpected error occurs.

testFileExists

public void testFileExists()
                    throws java.lang.Exception
This method tests the behavior of testing the existence of a remote file using an UA.

Throws:
java.lang.Exception - if an unexpected error occurs

testGetRemoteFileDigest

public void testGetRemoteFileDigest()
                             throws java.lang.Exception
This method tests the checksum generation is correct

Throws:
java.lang.Exception

testGoodExecute

public void testGoodExecute()
                     throws java.lang.Exception
This method test the execution of a correct command. The expected result is a correct execution of command.

Throws:
java.lang.Exception

testBadExecute

public void testBadExecute()
                    throws java.lang.Exception
This method test the execution of a wrong command. The expected result is an erroneous execution of command because a permission denied problem.

Throws:
java.lang.Exception

testUaKill

public void testUaKill()
                throws java.lang.Exception
Use a inner thread object to test the kill method.

Throws:
java.lang.Exception

testStartAndStopReplica

public void testStartAndStopReplica()
                             throws java.lang.Exception
Testing the start and stop replica at a gum. Those method should prepare a gum to execution and also clean the gum after any execution. The test will create two playpen and also do two executions. The sleep execution that will be hold until the stop job occurs must be killed and the call to recover the execution must fail.

Throws:
java.lang.Exception - If any exception happen.