97. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 2/7/2017 12:14:09 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

97.1 Files compared

# Location File Last Modified
1 cpss.zip\cpss\src\test\java\gov\va\cpss\job\fps ProcessFPSDataJobBatchFtpIT.java Wed Feb 1 21:07:32 2017 UTC
2 cpss.zip\cpss\src\test\java\gov\va\cpss\job\fps ProcessFPSDataJobBatchFtpIT.java Mon Feb 6 16:32:18 2017 UTC

97.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 1596
Changed 1 2
Inserted 0 0
Removed 0 0

97.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

97.4 Active regular expressions

No regular expressions were active.

97.5 Comparison detail

  1   package go v.va.cpss. job.fps;
  2  
  3   import org .junit.Bef ore;
  4   import sta tic org.ju nit.Assume .assumeTru e;
  5   import sta tic org.ju nit.Assert .assertEqu als;
  6   import sta tic org.ju nit.Assert .assertFal se;
  7   import sta tic org.ju nit.Assert .assertNul l;
  8   import sta tic org.ju nit.Assert .assertTru e;
  9  
  10   import jav a.io.File;
  11  
  12   import org .junit.Tes t;
  13   import org .junit.run ner.RunWit h;
  14   import org .springfra mework.bea ns.factory .annotatio n.Autowire d;
  15   import org .springfra mework.bea ns.factory .annotatio n.Value;
  16   import org .springfra mework.tes t.context. ContextCon figuration ;
  17   import org .springfra mework.tes t.context. junit4.Spr ingJUnit4C lassRunner ;
  18  
  19   import gov .va.cpss.s ervice.Sft pService;
  20  
  21   /**
  22    * Integra tion Unit  Tests to t est succes s and fail ure cases  of Process  FPS Data
  23    * batch p rocessing  using the  ftp interf ace. NOTE:  These tes ts use the  ftp
  24    * server.  Various t est files  are refere nced in sr c/test/res ources/fps
  25    * directo ry.
  26    * 
  27    * @author   DN S      D N S
  28    */
  29   @RunWith(S pringJUnit 4ClassRunn er.class)
  30   @ContextCo nfiguratio n(location s = { "/te st-context .xml", "/c pss-contex t.xml", "/ cpss-batch .xml",
  31                    "/pr ocess-fps- data-job-f tp-test-co ntext.xml" , "/cpss-e mail.xml"  })
  32   public cla ss Process FPSDataJob BatchFtpIT  {
  33  
  34           @V alue("${ru n.integrat ion.test:f alse}")
  35           pr ivate Bool ean runInt egrationTe st;
  36           
  37           @A utowired
  38           pr ivate Proc essFPSData JobTest pr ocessFPSDa taJobTest;
  39  
  40           @A utowired
  41           pr ivate Sftp Service sf tpService;
  42           
  43           @A utowired
  44           pr ivate Stri ng process FPSServerT argetDirec tory;
  45           @A utowired
  46           pr ivate Stri ng process FPSServerA rchiveTarg etDirector y;
  47           
  48           @A utowired
  49           pr ivate Stri ng process FPSServerE rrorTarget Directory;
  50           /* *
  51            *  Only run  these test s if prope rty is set  to run in tegration  test.
  52            * /
  53           @B efore
  54       public  final voi d beforeTe st() {
  55           as sumeTrue(r unIntegrat ionTest);
  56       }
  57           
  58           @T est
  59           pu blic final  void test InvalidZer oNumberPat ientsJob()  {
  60  
  61                    fina l String f ilename =  "CPSS-to-C CPC_PS_inv alid_zero_ number_pat ients.txt" ;
  62                    fina l String f ilepath =  "fps/" + f ilename;
  63  
  64                    // E nsure test  server is  in expect ed initial  state.
  65                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  66                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  67                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  68  
  69                    // F TP test fi le to serv er.
  70                    asse rtTrue(ftp FileToServ er(filepat h));
  71  
  72                    // R un the job .
  73                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  74  
  75                    // V erify the  job was un successful .
  76                    asse rtFalse(ru nSuccess);
  77                    asse rtEquals(
  78                                      "\n\nErr or Message :\n" + (ne w File(fil ename)).ge tName() +  ": "
  79                                                       +  "Attempted  to proces s PS with  invalid to tal statem ent count  (0)",
  80                                      processF PSDataJobT est.getErr orMessage( ));
  81  
  82                    // V erify file  is not in  the data  directory.
  83                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  84  
  85                    // V erify file  is not in  the archi ve directo ry.
  86                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  87  
  88                    // V erify file  is in the  error dir ectory.
  89                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  90  
  91                    // C leanup.
  92                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  93           }
  94           
  95           @T est
  96           pu blic final  void test InvalidZer oNumberDet ailsJob()  {
  97  
  98                    fina l String f ilename =  "CPSS-to-C CPC_PH_inv alid_zero_ number_det ails.txt";
  99                    fina l String f ilepath =  "fps/" + f ilename;
  100  
  101                    // E nsure test  server is  in expect ed initial  state.
  102                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  103                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  104                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  105  
  106                    // F TP test fi le to serv er.
  107                    asse rtTrue(ftp FileToServ er(filepat h));
  108  
  109                    // R un the job .
  110                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  111  
  112                    // V erify the  job was un successful .
  113                    asse rtFalse(ru nSuccess);
  114                    asse rtEquals(
  115                                      "\n\nErr or Message :\n" + (ne w File(fil ename)).ge tName() +  ": "
  116                                                       +  "Attempted  to proces s PH with  invalid to tal detail s count (0 )",
  117                                      processF PSDataJobT est.getErr orMessage( ));
  118  
  119                    // V erify file  is not in  the data  directory.
  120                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  121  
  122                    // V erify file  is not in  the archi ve directo ry.
  123                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  124  
  125                    // V erify file  is in the  error dir ectory.
  126                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  127  
  128                    // C leanup.
  129                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  130           }
  131  
  132           @T est
  133           pu blic final  void test Successful Job() {
  134  
  135                    fina l String f ilename =  "CPSS-to-C CPC_succes sful.txt";
  136                    fina l String f ilepath =  "fps/" + f ilename;
  137  
  138                    // E nsure test  server is  in expect ed initial  state.
  139                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  140                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  141                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  142  
  143                    // F TP test fi le to serv er.
  144                    asse rtTrue(ftp FileToServ er(filepat h));
  145  
  146                    // R un the job .
  147                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  148  
  149                    // V erify the  job was su ccessful.
  150                    asse rtTrue(run Success);
  151  
  152                    // C heck exit  status
  153                    asse rtNull(pro cessFPSDat aJobTest.g etErrorMes sage());
  154  
  155                    // V erify file  is not in  the data  directory.
  156                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  157  
  158                    // V erify file  is in the  archive d irectory.
  159                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getArc hiveDirect ory()));
  160  
  161                    // V erify file  is not in  the error  directory .
  162                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  163  
  164                    // C leanup.
  165                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getA rchiveDire ctory()));
  166           }
  167  
  168           @T est
  169           pu blic final  void test InvalidSeq uenceNumbe rJob() {
  170  
  171                    fina l String f ilename =  "CPSS-to-C CPC_PS_inv alid_seque nce_number .txt";
  172                    fina l String f ilepath =  "fps/" + f ilename;
  173  
  174                    // E nsure test  server is  in expect ed initial  state.
  175                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  176                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  177                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  178  
  179                    // F TP test fi le to serv er.
  180                    asse rtTrue(ftp FileToServ er(filepat h));
  181  
  182                    // R un the job .
  183                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  184  
  185                    // V erify the  job was un successful .
  186                    asse rtFalse(ru nSuccess);
  187                    asse rtEquals(
  188                                      "\n\nErr or Message :\n" + (ne w File(fil ename)).ge tName() +  ": "
  189                                                       +  "Attempted  to proces s PS with  invalid se q num (5)  but expect ed (1)",
  190                                      processF PSDataJobT est.getErr orMessage( ));
  191  
  192                    // V erify file  is not in  the data  directory.
  193                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  194  
  195                    // V erify file  is not in  the archi ve directo ry.
  196                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  197  
  198                    // V erify file  is in the  error dir ectory.
  199                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  200  
  201                    // C leanup.
  202                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  203           }
  204  
  205           @T est
  206           pu blic final  void test Incomplete FilePSJob( ) {
  207  
  208                    fina l String f ilename =  "CPSS-to-C CPC_PS_inv alid_end_o f_file.txt ";
  209                    fina l String f ilepath =  "fps/" + f ilename;
  210  
  211                    // E nsure test  server is  in expect ed initial  state.
  212                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  213                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  214                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  215  
  216                    // F TP test fi le to serv er.
  217                    asse rtTrue(ftp FileToServ er(filepat h));
  218  
  219                    // R un the job .
  220                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  221  
  222                    // V erify the  job was un successful .
  223                    asse rtFalse(ru nSuccess);
  224                    asse rtEquals(" \n\nError  Message:\n " + (new F ile(filena me)).getNa me() + ":  "
  225                                      + "PS co unt (1) of  (2) indic ates incom plete sequ ence", pro cessFPSDat aJobTest.g etErrorMes sage());
  226  
  227                    // V erify file  is not in  the data  directory.
  228                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  229  
  230                    // V erify file  is not in  the archi ve directo ry.
  231                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  232  
  233                    // V erify file  is in the  error dir ectory.
  234                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  235  
  236                    // C leanup.
  237                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  238           }
  239  
  240           @T est
  241           pu blic final  void test Incomplete FilePHJob( ) {
  242  
  243                    fina l String f ilename =  "CPSS-to-C CPC_PH_inv alid_end_o f_file.txt ";
  244                    fina l String f ilepath =  "fps/" + f ilename;
  245  
  246                    // E nsure test  server is  in expect ed initial  state.
  247                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  248                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  249                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  250  
  251                    // F TP test fi le to serv er.
  252                    asse rtTrue(ftp FileToServ er(filepat h));
  253  
  254                    // R un the job .
  255                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  256  
  257                    // V erify the  job was un successful .
  258                    asse rtFalse(ru nSuccess);
  259                    asse rtEquals(
  260                                      "\n\nErr or Message :\n" + (ne w File(fil ename)).ge tName() +  ": "
  261                                                       +  "PH count  (3) of (4)  indicates  incomplet e statemen t",
  262                                      processF PSDataJobT est.getErr orMessage( ));
  263  
  264                    // V erify file  is not in  the data  directory.
  265                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  266  
  267                    // V erify file  is not in  the archi ve directo ry.
  268                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  269  
  270                    // V erify file  is in the  error dir ectory.
  271                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  272  
  273                    // C leanup.
  274                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  275           }
  276  
  277           @T est
  278           pu blic final  void test Incomplete FilePDJob( ) {
  279  
  280                    fina l String f ilename =  "CPSS-to-C CPC_PD_inv alid_end_o f_file.txt ";
  281                    fina l String f ilepath =  "fps/" + f ilename;
  282  
  283                    // E nsure test  server is  in expect ed initial  state.
  284                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  285                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  286                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  287  
  288                    // F TP test fi le to serv er.
  289                    asse rtTrue(ftp FileToServ er(filepat h));
  290  
  291                    // R un the job .
  292                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  293  
  294                    // V erify the  job was un successful .
  295                    asse rtFalse(ru nSuccess);
  296                    asse rtEquals(" \n\nError  Message:\n " + (new F ile(filena me)).getNa me() + ":  "
  297                                      + "PD co unt (1) of  (2) indic ates incom plete deta ils", proc essFPSData JobTest.ge tErrorMess age());
  298  
  299                    // V erify file  is not in  the data  directory.
  300                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  301  
  302                    // V erify file  is not in  the archi ve directo ry.
  303                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  304  
  305                    // V erify file  is in the  error dir ectory.
  306                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  307  
  308                    // C leanup.
  309                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  310           }
  311  
  312           @T est
  313           pu blic final  void test InvalidSta tementCoun tLowJob()  {
  314  
  315                    fina l String f ilename =  "CPSS-to-C CPC_PS_inv alid_state ment_count _low.txt";
  316                    fina l String f ilepath =  "fps/" + f ilename;
  317  
  318                    // E nsure test  server is  in expect ed initial  state.
  319                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  320                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  321                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  322  
  323                    // F TP test fi le to serv er.
  324                    asse rtTrue(ftp FileToServ er(filepat h));
  325  
  326                    // R un the job .
  327                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  328  
  329                    // V erify the  job was un successful .
  330                    asse rtFalse(ru nSuccess);
  331                    asse rtEquals(
  332                                      "\n\nErr or Message :\n" + (ne w File(fil ename)).ge tName() +  ": "
  333                                                       +  "PH count  (3) of (4)  indicates  incomplet e statemen t",
  334                                      processF PSDataJobT est.getErr orMessage( ));
  335  
  336                    // V erify file  is not in  the data  directory.
  337                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  338  
  339                    // V erify file  is not in  the archi ve directo ry.
  340                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  341  
  342                    // V erify file  is in the  error dir ectory.
  343                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  344  
  345                    // C leanup.
  346                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  347           }
  348  
  349           @T est
  350           pu blic final  void test InvalidSta tementCoun tHighJob()  {
  351  
  352                    fina l String f ilename =  "CPSS-to-C CPC_PS_inv alid_state ment_count _high.txt" ;
  353                    fina l String f ilepath =  "fps/" + f ilename;
  354  
  355                    // E nsure test  server is  in expect ed initial  state.
  356                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  357                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  358                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  359  
  360                    // F TP test fi le to serv er.
  361                    asse rtTrue(ftp FileToServ er(filepat h));
  362  
  363                    // R un the job .
  364                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  365  
  366                    // V erify the  job was un successful .
  367                    asse rtFalse(ru nSuccess);
  368                    asse rtEquals(
  369                                      "\n\nErr or Message :\n" + (ne w File(fil ename)).ge tName() +  ": "
  370                                                       +  "Attempted  to proces s PH with  unexpected  count (3)  but expec ted (1)",
  371                                      processF PSDataJobT est.getErr orMessage( ));
  372  
  373                    // V erify file  is not in  the data  directory.
  374                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  375  
  376                    // V erify file  is not in  the archi ve directo ry.
  377                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  378  
  379                    // V erify file  is in the  error dir ectory.
  380                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  381  
  382                    // C leanup.
  383                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  384           }
  385  
  386           @T est
  387           pu blic final  void test InvalidDet ailsCountL owJob() {
  388  
  389                    fina l String f ilename =  "CPSS-to-C CPC_PH_inv alid_detai ls_count_l ow.txt";
  390                    fina l String f ilepath =  "fps/" + f ilename;
  391  
  392                    // E nsure test  server is  in expect ed initial  state.
  393                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  394                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  395                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  396  
  397                    // F TP test fi le to serv er.
  398                    asse rtTrue(ftp FileToServ er(filepat h));
  399  
  400                    // R un the job .
  401                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  402  
  403                    // V erify the  job was un successful .
  404                    asse rtFalse(ru nSuccess);
  405                    asse rtEquals(" \n\nError  Message:\n " + (new F ile(filena me)).getNa me() + ":  "
  406                                      + "PD co unt (2) of  (3) indic ates incom plete deta ils", proc essFPSData JobTest.ge tErrorMess age());
  407  
  408                    // V erify file  is not in  the data  directory.
  409                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  410  
  411                    // V erify file  is not in  the archi ve directo ry.
  412                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  413  
  414                    // V erify file  is in the  error dir ectory.
  415                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  416  
  417                    // C leanup.
  418                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  419           }
  420  
  421           @T est
  422           pu blic final  void test InvalidDet ailsCountH ighJob() {
  423  
  424                    fina l String f ilename =  "CPSS-to-C CPC_PH_inv alid_detai ls_count_h igh.txt";
  425                    fina l String f ilepath =  "fps/" + f ilename;
  426  
  427                    // E nsure test  server is  in expect ed initial  state.
  428                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  429                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  430                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  431  
  432                    // F TP test fi le to serv er.
  433                    asse rtTrue(ftp FileToServ er(filepat h));
  434  
  435                    // R un the job .
  436                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  437  
  438                    // V erify the  job was un successful .
  439                    asse rtFalse(ru nSuccess);
  440                    asse rtEquals(
  441                                      "\n\nErr or Message :\n" + (ne w File(fil ename)).ge tName() +  ": "
  442                                                       +  "Attempted  to proces s PD with  unexpected  count (2)  but expec ted (1)",
  443                                      processF PSDataJobT est.getErr orMessage( ));
  444  
  445                    // V erify file  is not in  the data  directory.
  446                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  447  
  448                    // V erify file  is not in  the archi ve directo ry.
  449                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  450  
  451                    // V erify file  is in the  error dir ectory.
  452                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  453  
  454                    // C leanup.
  455                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  456           }
  457  
  458           @T est
  459           pu blic final  void test InvalidTyp e() {
  460  
  461                    fina l String f ilename =  "CCPC-to-C PSS_invali d_type.txt ";
  462                    fina l String f ilepath =  "fps/" + f ilename;
  463  
  464                    // E nsure test  server is  in expect ed initial  state.
  465                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  466                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  467                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  468  
  469                    // F TP test fi le to serv er.
  470                    asse rtTrue(ftp FileToServ er(filepat h));
  471  
  472                    // R un the job .
  473                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  474  
  475                    // V erify the  job was un successful .
  476                    asse rtFalse(ru nSuccess);
  477                    asse rtTrue(
  478                                      processF PSDataJobT est.getErr orMessage( ).contains ("Cause: C ould not f ind a matc hing patte rn for key "));
  479  
  480                    // V erify file  is not in  the data  directory.
  481                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  482  
  483                    // V erify file  is not in  the archi ve directo ry.
  484                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  485  
  486                    // V erify file  is in the  error dir ectory.
  487                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  488  
  489                    // C leanup.
  490                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  491           }
  492  
  493           @T est
  494           pu blic final  void test NoFiles()  {
  495  
  496                    // R un the job .
  497                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  498  
  499                    // V erify the  job was un successful .
  500                    asse rtFalse(ru nSuccess);
  501                    asse rtEquals(" \n\nError  Message:\n " + "No fi les found  on ftp ser ver to pro cess",
  502                                      processF PSDataJobT est.getErr orMessage( ));
  503           }
  504  
  505           @T est
  506           pu blic final  void test EmptyFileP ath() {
  507  
  508                    // N ote that e mpty file  causes IOE xception w hen readin g via ftp.
  509  
  510                    fina l String f ilename =  "CCPC-to-C PSS_empty. txt";
  511                    fina l String f ilepath =  "fps/" + f ilename;
  512  
  513                    // E nsure test  server is  in expect ed initial  state.
  514                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  515                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  516                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  517  
  518                    // F TP test fi le to serv er.
  519                    asse rtTrue(ftp FileToServ er(filepat h));
  520  
  521                    // R un the job .
  522                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  523  
  524                    // V erify the  job was un successful .
  525                    asse rtFalse(ru nSuccess);
  526                    asse rtTrue(pro cessFPSDat aJobTest.g etErrorMes sage().con tains("Inp ut file is  empty"));
  527  
  528                    // V erify file  is not in  the data  directory.
  529                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  530  
  531                    // V erify file  is not in  the archi ve directo ry.
  532                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  533  
  534                    // V erify file  is in the  error dir ectory.
  535                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  536  
  537                    // C leanup.
  538                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  539           }
  540  
  541           @T est
  542           pu blic final  void test BadAddress FlagReadFo rmat() {
  543  
  544                    fina l String f ilename =  "CCPC-to-C PSS_PH_bad _address_f lag.txt";
  545                    fina l String f ilepath =  "fps/" + f ilename;
  546  
  547                    // E nsure test  server is  in expect ed initial  state.
  548                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  549                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  550                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  551  
  552                    // F TP test fi le to serv er.
  553                    asse rtTrue(ftp FileToServ er(filepat h));
  554  
  555                    // R un the job .
  556                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  557  
  558                    // V erify the  job was un successful .
  559                    asse rtFalse(ru nSuccess);
  560                    asse rtTrue(pro cessFPSDat aJobTest.g etErrorMes sage()
  561                                      .contain s("Field e rror in ob ject 'targ et' on fie ld 'addres sFlag': re jected val ue [R]"));
  562  
  563                    // V erify file  is not in  the data  directory.
  564                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  565  
  566                    // V erify file  is not in  the archi ve directo ry.
  567                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  568  
  569                    // V erify file  is in the  error dir ectory.
  570                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  571  
  572                    // C leanup.
  573                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  574           }
  575  
  576           @T est
  577           pu blic final  void test BadAddress FlagReadFo rmat2() {
  578  
  579                    fina l String f ilename =  "CCPC-to-C PSS_PH_bad _address_f lag_empty. txt";
  580                    fina l String f ilepath =  "fps/" + f ilename;
  581  
  582                    // E nsure test  server is  in expect ed initial  state.
  583                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  584                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  585                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  586  
  587                    // F TP test fi le to serv er.
  588                    asse rtTrue(ftp FileToServ er(filepat h));
  589  
  590                    // R un the job .
  591                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  592  
  593                    // V erify the  job was un successful .
  594                    asse rtFalse(ru nSuccess);
  595                    asse rtTrue(pro cessFPSDat aJobTest.g etErrorMes sage()
  596                                      .contain s("Field e rror in ob ject 'targ et' on fie ld 'addres sFlag': re jected val ue []"));
  597  
  598                    // V erify file  is not in  the data  directory.
  599                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  600  
  601                    // V erify file  is not in  the archi ve directo ry.
  602                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  603  
  604                    // V erify file  is in the  error dir ectory.
  605                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  606  
  607                    // C leanup.
  608                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  609           }
  610  
  611           @T est
  612           pu blic final  void test BadCobolFo rmat() {
  613  
  614                    fina l String f ilename =  "CCPC-to-C PSS_PS_inv alid_state ment_val.t xt";
  615                    fina l String f ilepath =  "fps/" + f ilename;
  616  
  617                    // E nsure test  server is  in expect ed initial  state.
  618                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  619                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  620                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getEr rorDirecto ry()));
  621  
  622                    // F TP test fi le to serv er.
  623                    asse rtTrue(ftp FileToServ er(filepat h));
  624  
  625                    // R un the job .
  626                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  627  
  628                    // V erify the  job was un successful .
  629                    asse rtFalse(ru nSuccess);
  630                    asse rtTrue(pro cessFPSDat aJobTest.g etErrorMes sage()
  631                                      .contain s("Field e rror in ob ject 'targ et' on fie ld 'statem entVal': r ejected va lue [00000 55442Z]")) ;
  632  
  633                    // V erify file  is not in  the data  directory.
  634                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, proce ssFPSServe rTargetDir ectory));
  635  
  636                    // V erify file  is not in  the archi ve directo ry.
  637                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame, getAr chiveDirec tory()));
  638  
  639                    // V erify file  is in the  error dir ectory.
  640                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me, getErr orDirector y()));
  641  
  642                    // C leanup.
  643                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name, getE rrorDirect ory()));
  644           }
  645  
  646           @T est
  647           pu blic final  void test BadFilePat h() {
  648  
  649                    // R un the job .
  650                    fina l boolean  runSuccess  = process FPSDataJob Test.testE rrorFtpJob ();
  651  
  652                    // V erify the  job was un successful .
  653                    asse rtFalse(ru nSuccess);
  654                    asse rtTrue(pro cessFPSDat aJobTest.g etErrorMes sage().con tains("Una ble to ope n ftp conn ection bec ause faile d file siz e request" ));
  655           }
  656  
  657           @T est
  658           pu blic final  void test MultiSucce ssJob() {
  659  
  660                    fina l String f ilename1 =  "CPSS-to- CCPC_succe ssful.txt" ;
  661                    fina l String f ilename2 =  "CPSS-to- CCPC-doubl e.txt";
  662  
  663                    fina l String f ilepath1 =  "fps/" +  filename1;
  664                    fina l String f ilepath2 =  "cbs/" +  filename2;
  665  
  666                    // E nsure test  server is  in expect ed initial  state.
  667                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame1, proc essFPSServ erTargetDi rectory));
  668                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame1, getA rchiveDire ctory()));
  669                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame1, getE rrorDirect ory()));
  670                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame2, proc essFPSServ erTargetDi rectory));
  671                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame2, getA rchiveDire ctory()));
  672                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame2, getE rrorDirect ory()));
  673  
  674                    // F TP test fi les to ser ver.
  675                    asse rtTrue(ftp FileToServ er(filepat h1));
  676                    asse rtTrue(ftp FileToServ er(filepat h2));
  677  
  678                    // R un the job .
  679                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  680  
  681                    // V erify the  job was su ccessful.
  682                    asse rtTrue(run Success);
  683  
  684                    // C heck exit  status
  685                    asse rtNull(pro cessFPSDat aJobTest.g etErrorMes sage());
  686  
  687                    // V erify file s are not  in the dat a director y.
  688                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame1, proc essFPSServ erTargetDi rectory));
  689                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame2, proc essFPSServ erTargetDi rectory));
  690  
  691                    // V erify file s are in t he archive  directory .
  692                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me1, getAr chiveDirec tory()));
  693                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me2, getAr chiveDirec tory()));
  694  
  695                    // V erify file s are not  in the err or directo ry.
  696                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame1, getE rrorDirect ory()));
  697                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame2, getE rrorDirect ory()));
  698  
  699                    // C leanup.
  700                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name1, get ArchiveDir ectory())) ;
  701                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name2, get ArchiveDir ectory())) ;
  702           }
  703  
  704           @T est
  705           pu blic final  void test MultiError Job() {
  706  
  707                    fina l String f ilename1 =  "CPSS-to- CCPC_succe ssful.txt" ;
  708                    fina l String f ilename2 =  "CPSS-to- CCPC_PS_in valid_sequ ence_numbe r.txt";
  709                    fina l String f ilename3 =  "CPSS-to- CCPC_PS_in valid_end_ of_file.tx t";
  710  
  711                    fina l String f ilepath1 =  "fps/" +  filename1;
  712                    fina l String f ilepath2 =  "fps/" +  filename2;
  713                    fina l String f ilepath3 =  "fps/" +  filename3;
  714  
  715                    // E nsure test  server is  in expect ed initial  state.
  716                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame1, proc essFPSServ erTargetDi rectory));
  717                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame1, getA rchiveDire ctory()));
  718                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame1, getE rrorDirect ory()));
  719                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame2, proc essFPSServ erTargetDi rectory));
  720                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame2, getA rchiveDire ctory()));
  721                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame2, getE rrorDirect ory()));
  722                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame3, proc essFPSServ erTargetDi rectory));
  723                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame3, getA rchiveDire ctory()));
  724                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame3, getE rrorDirect ory()));
  725  
  726                    // F TP test fi les to ser ver.
  727                    asse rtTrue(ftp FileToServ er(filepat h1));
  728                    asse rtTrue(ftp FileToServ er(filepat h2));
  729                    asse rtTrue(ftp FileToServ er(filepat h3));
  730  
  731                    // R un the job .
  732                    fina l boolean  runSuccess  = process FPSDataJob Test.testF tpJob();
  733  
  734                    // V erify the  job was un successful .
  735                    asse rtFalse(ru nSuccess);
  736  
  737                    // V erify 2 er rors can b e found in  the error  message.
  738                    // N ote the or der of pro cessed fil e is not g uaranteed.
  739                    asse rtTrue(pro cessFPSDat aJobTest.g etErrorMes sage()
  740                                      .equals( "\n\nError  Message:\ n" + (new  File(filen ame2)).get Name() + " : "
  741                                                       +  "Attempted  to proces s PS with  invalid se q num (5)  but expect ed (1)\n"
  742                                                       +  (new File( filename3) ).getName( ) + ": " +  "PS count  (1) of (2 ) indicate s incomple te sequenc e")
  743                                      || proce ssFPSDataJ obTest.get ErrorMessa ge()
  744                                                       .e quals("\n\ nError Mes sage:\n" +  (new File (filename3 )).getName () + ": "
  745                                                                         + "PS  count (1)  of (2) ind icates inc omplete se quence\n"
  746                                                                         + (new  File(file name2)).ge tName() +  ": "
  747                                                                         + "Att empted to  process PS  with inva lid seq nu m (5) but  expected ( 1)"));
  748  
  749                    // V erify file s are not  in the dat a director y.
  750                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame1, proc essFPSServ erTargetDi rectory));
  751                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame2, proc essFPSServ erTargetDi rectory));
  752                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame3, proc essFPSServ erTargetDi rectory));
  753  
  754                    // V erify succ essful fil e is in th e archive  directory.
  755                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me1, getAr chiveDirec tory()));
  756  
  757                    // V erify erro neous file s are not  in the arc hive direc tory.
  758                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame2, getA rchiveDire ctory()));
  759                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame3, getA rchiveDire ctory()));
  760  
  761                    // V erify succ essful fil e is not i n the erro r director y.
  762                    asse rtFalse(sf tpService. ftpFileExi stsInDirec tory(filen ame1, getE rrorDirect ory()));
  763  
  764                    // V erify erro neous file s are in t he error d irectory.
  765                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me2, getEr rorDirecto ry()));
  766                    asse rtTrue(sft pService.f tpFileExis tsInDirect ory(filena me3, getEr rorDirecto ry()));
  767  
  768                    // C leanup.
  769                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name1, get ArchiveDir ectory())) ;
  770                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name2, get ErrorDirec tory()));
  771                    asse rtTrue(sft pService.f tpRemoveFi leFromDire ctory(file name3, get ErrorDirec tory()));
  772           }
  773           
  774           pr ivate Stri ng getArch iveDirecto ry() {
  775                    retu rn process FPSServerT argetDirec tory + "/"  + process FPSServerA rchiveTarg etDirector y ;
  776           }
  777  
  778           pr ivate Stri ng getErro rDirectory () {
  779                    retu rn process FPSServerT argetDirec tory + "/"  + process FPSServerE rrorTarget Directory;
  780           }
  781           
  782           pr ivate bool ean ftpFil eToServer( final Stri ng filepat h) {
  783                    // T ransfer da ta file.
  784                    fina l boolean  dataFileRe sult = sft pService.f tpFileToSe rver(new F ile(this.g etClass(). getClassLo ader().get Resource(f ilepath).g etFile()). getAbsolut ePath(), p rocessFPSS erverTarge tDirectory );
  785                    
  786                    // T ransfer do n file.
  787                    fina l String e mptyFilena me = "CCPC -to-CPSS_e mpty.txt";
  788                    fina l String e mptyFilepa th = new F ile(
  789                                      this.get Class().ge tClassLoad er().getRe source("fp s/" + empt yFilename) .getFile() ).getAbsol utePath();
  790                    
  791                    fina l String d ataFilenam e = new Fi le(this.ge tClass().g etClassLoa der().getR esource(fi lepath).ge tFile()).g etName();
  792                    fina l String i ndicatorFi lename = d ataFilenam e.substrin g(0, dataF ilename.la stIndexOf( ".txt")) +  ".don";
  793                    
  794                    fina l boolean  indicatorF ileResult  = sftpServ ice.ftpFil eToServerW ithName(em ptyFilepat h, indicat orFilename , processF PSServerTa rgetDirect ory);
  795                    
  796                    retu rn (dataFi leResult & & indicato rFileResul t);
  797           }
  798  
  799   }