51. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 10/4/2017 8:04:34 AM Central Daylight 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.

51.1 Files compared

# Location File Last Modified
1 rdk.zip\rdk\product\production\rdk\src\resources\cds-schedule cds-execute-resource-spec.js Fri Aug 25 15:36:55 2017 UTC
2 rdk.zip\rdk\product\production\rdk\src\resources\cds-schedule cds-execute-resource-spec.js Tue Oct 3 17:16:32 2017 UTC

51.2 Comparison summary

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

51.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

51.4 Active regular expressions

No regular expressions were active.

51.5 Comparison detail

  1   'use stric t';
  2  
  3   var cdsexe cuteResour ce = requi re('./cds- execute-re source');
  4   var execut e = requir e('./cds-e xecute');
  5  
  6   var rdk =  require('. ./../core/ rdk');
  7   var MongoC lient = re quire('mon godb').Mon goClient;
  8  
  9   var cdsSpe cUtil = re quire('../ cds-spec-u til/cds-sp ec-util');
  10   var mockRe qResUtil =  cdsSpecUt il.mockReq ResUtil;
  11   var appRef erence = c dsSpecUtil .createApp Reference;
  12  
  13   function c reateTestJ son(name,  scope) {
  14       // nam e HTNList
  15       var te stJson = {
  16           'e xecution':  {
  17                'jobId':  null,
  18                'baseCon text': {
  19                    'spe cialty': {
  20                         'entityTyp e': 'Speci alty',
  21                         'codeSyste m': null,
  22                         'name': nu ll,
  23                         'id': null ,
  24                         'type': nu ll
  25                    },
  26                    'use r': {
  27                         'entityTyp e': 'User' ,
  28                         'codeSyste m': 'VA:DU Z',
  29                         'name': 'U SER PANORA MA',
  30                          'id': ' PW           ',
  31                         'type': 'p rovider'
  32                    },
  33                    'loc ation': {
  34                         'entityTyp e': 'Locat ion',
  35                         'codeSyste m': null,
  36                         'name': nu ll,
  37                         'id': null ,
  38                         'type': nu ll
  39                    },
  40                    'sub ject': {
  41                         'entityTyp e': 'Subje ct',
  42                         'codeSyste m': null,
  43                         'name': nu ll,
  44                         'id': null ,
  45                         'type': nu ll
  46                    }
  47                },
  48                'subject ListRefere nces': ['T imeout'],
  49                'subject Ids': null ,
  50                'target' : {
  51                    'int entsSet':  [
  52                         'providerB atchAdvice '
  53                    ],
  54                    'sup plementalM appings':  null,
  55                    'per ceivedExec utionTime' : null,
  56                    'typ e': 'Backg round',
  57                    'mod e': 'Norma l'
  58                }
  59           },
  60           'l astRun': 1 4291349783 13,
  61           'n ame': '',
  62           'o wner': {
  63                'entityT ype': 'Use r',
  64                'codeSys tem': 'VA: DUZ',
  65                'name':  'USER PANO RAMA',
  66                'id': '9 E7A:100000 00230',
  67                'type':  'provider'
  68           },
  69           'd escription ': 'A Test  job from  the unit t ests',
  70           'd isabled':  false
  71       };
  72       //maki ng these o ptional fo r required  parameter  testing.. .
  73       if (na me) {
  74           te stJson.nam e = name;
  75       }
  76       return  testJson;
  77   }
  78  
  79   describe(' CDS Execut e Resource ', functio n() {
  80       descri be('Test c onfigurati on', funct ion() {
  81           va r resource s = cdsexe cuteResour ce.getReso urceConfig (appRefere nce());
  82           va r intercep tors = {
  83                audit: t rue,
  84                metrics:  true,
  85                authenti cation: tr ue,
  86                operatio nalDataChe ck: false,
  87                synchron ize: false
  88           };
  89  
  90           it ('has 4 en dpoints co nfigured',  function( ) {
  91                expect(r esources.l ength).to. equal(4);
  92           }) ;
  93  
  94           it ('has corr ect config uration fo r CDS Exec ute get ',  function( ) {
  95                var r =  resources[ 0];
  96                expect(r .name).to. equal('cds -execute-c ds-execute -get');
  97                expect(r .path).to. equal('/re quest');
  98                expect(r .get).not. to.be.unde fined();
  99                expect(r .intercept ors).to.eq l(intercep tors);
  100           }) ;
  101           it ('has corr ect config uration fo r CDS Exec ute post ' , function () {
  102                var r =  resources[ 1];
  103                expect(r .name).to. equal('cds -execute-c ds-execute -post');
  104                expect(r .path).to. equal('/re quest');
  105                expect(r .post).not .to.be.und efined();
  106                expect(r .intercept ors).to.eq l(intercep tors);
  107           }) ;
  108           it ('has corr ect config uration fo r CDS Exec ute put ',  function( ) {
  109                var r =  resources[ 2];
  110                expect(r .name).to. equal('cds -execute-c ds-execute -put');
  111                expect(r .path).to. equal('/re quest');
  112                expect(r .put).not. to.be.unde fined();
  113                expect(r .intercept ors).to.eq l(intercep tors);
  114           }) ;
  115           it ('has corr ect config uration fo r CDS Exec ute delete ', functio n() {
  116                var r =  resources[ 3];
  117                expect(r .name).to. equal('cds -execute-c ds-execute -delete');
  118                expect(r .path).to. equal('/re quest');
  119                expect(r .delete).n ot.to.be.u ndefined() ;
  120                expect(r .intercept ors).to.eq l(intercep tors);
  121           }) ;
  122       });
  123  
  124       descri be('Execut e endpoint  HTTP resp onse codes ', functio n() {
  125           // Create the  mocked Mo ngoDB func tions that  are used  by the cod e that we' re testing ...
  126           va r db = cds SpecUtil.c reateMockD b({
  127                find: fu nction(cal lback) {
  128                    retu rn {
  129                         toArray: f unction(ca llback) {
  130                             callba ck(null, [ ]);
  131                         }
  132                    };
  133                },
  134                insert:  function(t estJson, c allback) {
  135                    var  echo = [];
  136                    test Json._id =  'mongodb1 2345678';
  137                    echo .push(test Json);
  138                    call back(null,  echo); //  can mock  a response  here...
  139                },
  140                ensureIn dex: funct ion() {
  141                    retu rn;
  142                },
  143                remove:  function()  {
  144                    retu rn;
  145                }
  146           }) ;
  147  
  148           fu nction bui ldRes(expe ctedStatus ) {
  149                return {
  150                    stat us: functi on(statusC ode) {
  151                         expect(sta tusCode == = expected Status).to .be.true() ;
  152                         return thi s;
  153                    },
  154                    rdkS end: funct ion() {
  155                         return thi s;
  156                    },
  157                    send : function () {
  158                         return thi s;
  159                    },
  160                    end:  function( ) {
  161                         return thi s;
  162                    }
  163                };
  164           }
  165  
  166           be foreEach(f unction()  {
  167                sinon.st ub(MongoCl ient, 'con nect').cal lsFake(fun ction(stri ng, option s, callbac k) {
  168                    call back(null,  db);
  169                });
  170           }) ;
  171  
  172           it ('GET resp onds HTTP  Not Found' , function () {
  173                execute. getExecute (mockReqRe sUtil.crea teRequestW ithParam(n ull, null) , buildRes (rdk.https tatus.not_ found));
  174           }) ;
  175  
  176           it ('POST res ponds HTTP  Bad Reque st when re quired par ameter mis sing', fun ction() {
  177                var test Json = cre ateTestJso n();
  178                execute. postExecut e(mockReqR esUtil.cre ateRequest WithParam( null, test Json), bui ldRes(rdk. httpstatus .bad_reque st));
  179           }) ;
  180  
  181           it ('POST res ponds HTTP  Created',  function( ) {
  182                var test Json = cre ateTestJso n('execute 1');
  183                execute. postExecut e(mockReqR esUtil.cre ateRequest WithParam( null, test Json), bui ldRes(rdk. httpstatus .created)) ;
  184           }) ;
  185  
  186           it ('POST res ponds HTTP  Bad Reque st when pa yload has  an _id att ribute', f unction()  {
  187                var test Json = cre ateTestJso n('execute 1');
  188                testJson ._id = 'fo o';
  189                execute. postExecut e(mockReqR esUtil.cre ateRequest WithParam( null, test Json), bui ldRes(rdk. httpstatus .bad_reque st));
  190           }) ;
  191  
  192           it ('PUT resp onds HTTP  Bad Reques t when req uired para meter miss ing', func tion() {
  193                var test Json = cre ateTestJso n();
  194                execute. putExecute (mockReqRe sUtil.crea teRequestW ithParam(n ull, testJ son), buil dRes(rdk.h ttpstatus. bad_reques t));
  195           }) ;
  196  
  197           it ('Delete r esponds HT TP Bad Req uest when  required p arameter m issing', f unction()  {
  198                var test Json = cre ateTestJso n();
  199                execute. deleteExec ute(mockRe qResUtil.c reateReque stWithPara m(null, te stJson), b uildRes(rd k.httpstat us.bad_req uest));
  200           }) ;
  201       });
  202   });