org.nees.data.test
Class NFMSProtocolTest

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.nees.data.test.NFMSTestMetaClass
              extended byorg.nees.data.test.NFMSSessionTest
                  extended byorg.nees.data.test.NFMSProtocolTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
NFMSFTPTest, NFMSGridFTPTest, NFMSLocalFileTests

public abstract class NFMSProtocolTest
extends NFMSSessionTest

Author:
USER

Field Summary
 
Fields inherited from class org.nees.data.test.NFMSTestMetaClass
APPEND_FILE_COUNT_KEY, BACKEND_TESTS_ENABLED_KEY, DOWNLOADOPTIONS_COUNT, FAILED, FILE_SIZE_KEY, FTP_PASSWORD_KEY, FTP_TESTS_ENABLED_KEY, FTP_USERNAME_KEY, GENERAL_TESTS_ENABLED_KEY, GRID_FTP_TESTS_ENABLED_KEY, GRID_USER_CREDENTIAL_FILE_KEY, LOCAL_DEBUG_MODE_KEY, LOCAL_DEBUG_SESSION_USER_KEY, LOCAL_DEBUG_USER_HOME_KEY, LOCAL_FILE_TESTS_ENABLED_KEY, NFMS_FACADE_TESTS_ENABLED_KEY, NFMS_PROPERTIES_FILE_KEY, NFMS_SERVICE_URI_KEY, OK, SCRATCH_DIRECTORY_KEY, TEST_LOGICAL_NAME_KEY, TEST_NAMESPACE_KEY, TEST_PROPERTIES_FILE_KEY, UPLOADOPTIONS_COUNT_KEY, VERSION_FILE_COUNT_KEY
 
Constructor Summary
NFMSProtocolTest()
          Creates a new instance of NFMSProtocolTest
NFMSProtocolTest(java.lang.String x)
           
 
Method Summary
protected  void downloadFile(java.io.File dFile, LogicalName logicalName, int version)
           
abstract  java.lang.String getProtocol()
           
protected  TransferReturnBean startDownload(java.io.File dFile, LogicalName logicalName, int version)
          Starts a download.
protected  TransferReturnBean startUpload(java.io.File tempFile, LogicalName ln, boolean isNewFile, boolean isAppend, boolean isNewVersion)
          Starts an upload.
 void testBadVersion()
          Test that putting a file then trying to get the wrong version throws and exception.
 void testDownloadWithOptions()
           
 void testFileAppend()
          This will append multiple files to a single file.
 void testFileVersionAndAppend()
          This tests that putting a file, then uploading another file with the append and version flags set performs correctly.
 void testFileVersioning()
          This tests that a file may be put into nfms, versioned and then the most recent version can be retrieved.
 void testNoPre_ExistingFile()
           
 void testPre_ExistingNewFileFailure()
          This checks that when an entry exists any attempt to do an operation involving the new file flag being true fails.
 void testProtocolRequest()
          Checks that the server recognizes this protocol.
 void testUploadWithOptions()
          Upload with options test.
abstract  void transferFile(java.net.URI localURI, java.net.URI remoteURI, boolean putFile)
           
protected  void uploadFile(java.io.File tempFile, LogicalName ln, boolean isNewFile, boolean isAppend, boolean isNewVersion)
           
protected  LogicalName uploadLocalFile(java.io.File tempFile, boolean isNewFile, boolean isAppend, boolean isNewVersion)
          This uploads a file, creates the logical name and returns the logical name.
 
Methods inherited from class org.nees.data.test.NFMSSessionTest
downloadLocalFile, getNFMS, localFileTransfer, startLocalFileDownload, startLocalFileUpload, uploadLocalFile
 
Methods inherited from class org.nees.data.test.NFMSTestMetaClass
getAssumedAuthenticIdentity, getBackend, getBootstrapper, getFTU, getGridID, getLocalNFMS, getNFMSProperties, getRepoRootDirURI, getScratchDir, getTestProperties, getUserDirURI, makeLogicalName, report, report
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, 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
 

Constructor Detail

NFMSProtocolTest

public NFMSProtocolTest()
Creates a new instance of NFMSProtocolTest


NFMSProtocolTest

public NFMSProtocolTest(java.lang.String x)
Method Detail

getProtocol

public abstract java.lang.String getProtocol()

transferFile

public abstract void transferFile(java.net.URI localURI,
                                  java.net.URI remoteURI,
                                  boolean putFile)
                           throws java.lang.Exception
Throws:
java.lang.Exception

testProtocolRequest

public void testProtocolRequest()
Checks that the server recognizes this protocol.

Expected behavior - NFMS allows request and abort.


testNoPre_ExistingFile

public void testNoPre_ExistingFile()

testFileVersioning

public void testFileVersioning()
This tests that a file may be put into nfms, versioned and then the most recent version can be retrieved. It will then get the previous version and check that that is indeed correctly returned.

Expected behavior - NFMS accepts all the files. Each version checks and the request for the latest version checks too.


testPre_ExistingNewFileFailure

public void testPre_ExistingNewFileFailure()
This checks that when an entry exists any attempt to do an operation involving the new file flag being true fails.


testFileAppend

public void testFileAppend()
This will append multiple files to a single file.

Expected behavior - NFMS concatenates all of the files and the request for the latest version equals (byte-wise) all the preceeding files.


testFileVersionAndAppend

public void testFileVersionAndAppend()
This tests that putting a file, then uploading another file with the append and version flags set performs correctly.


testBadVersion

public void testBadVersion()
Test that putting a file then trying to get the wrong version throws and exception.

Expected behaior - Putting a single file to NFMS then requesting a non-existent version throws an exception.


testUploadWithOptions

public void testUploadWithOptions()
Upload with options test. Shows that the server can identify this protocol as a valid when a batch of transfer options is given.


testDownloadWithOptions

public void testDownloadWithOptions()

startUpload

protected TransferReturnBean startUpload(java.io.File tempFile,
                                         LogicalName ln,
                                         boolean isNewFile,
                                         boolean isAppend,
                                         boolean isNewVersion)
                                  throws java.lang.Exception
Starts an upload. This is to allow for aborting the upload, for instance.

Throws:
java.lang.Exception

uploadFile

protected void uploadFile(java.io.File tempFile,
                          LogicalName ln,
                          boolean isNewFile,
                          boolean isAppend,
                          boolean isNewVersion)
                   throws java.lang.Exception
Throws:
java.lang.Exception

uploadLocalFile

protected LogicalName uploadLocalFile(java.io.File tempFile,
                                      boolean isNewFile,
                                      boolean isAppend,
                                      boolean isNewVersion)
                               throws java.lang.Exception
This uploads a file, creates the logical name and returns the logical name.

Overrides:
uploadLocalFile in class NFMSSessionTest
Throws:
java.lang.Exception

startDownload

protected TransferReturnBean startDownload(java.io.File dFile,
                                           LogicalName logicalName,
                                           int version)
                                    throws java.lang.Exception
Starts a download. This is to allow for aborting the download, for instance.

Throws:
java.lang.Exception

downloadFile

protected void downloadFile(java.io.File dFile,
                            LogicalName logicalName,
                            int version)
                     throws java.lang.Exception
Throws:
java.lang.Exception