25. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 4/18/2019 5:55:17 PM Eastern 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.

25.1 Files compared

# Location File Last Modified
1 MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_API_Core\src\test\fsc-837\backup092818 queue-integration.js Wed Apr 3 02:27:36 2019 UTC
2 MCCF_EDI_TAS_TASCore v2.0_Build_10.zip\MCCF_EDI_TAS_API_Core\src\test\fsc-837\backup092818 queue-integration.js Tue Apr 16 16:31:16 2019 UTC

25.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 5 398
Changed 4 8
Inserted 0 0
Removed 0 0

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

25.4 Active regular expressions

No regular expressions were active.

25.5 Comparison detail

  1   "use stric t"
  2  
  3  
  4   /**
  5    * DEBUG=*  TAS_QUEUE _ADDRESS=" amqps:// DNS . URL : PORT " TAS_QUEU E_CERTIFIC ATE_PATH=` pwd`/test/ fsc-837/va cacert.pem  node_modu les/mocha/ bin/mocha  test/fsc-8 37/queue-i ntegration .js    --exit
  6    * 
  7    */
  8  
  9   const cryp to = requi re('crypto ')
  10   const amqp lib = requ ire('amqpl ib')
  11   const fs =  require(' fs')
  12   const expe ct = requi re('chai') .expect
  13  
  14   const mock _claim = r equire('./ mock-claim ')
  15  
  16   const conn ect = asyn c address  => await a mqplib.con nect(addre ss)
  17   const toBu ffer = mes sage => ne w Buffer(J SON.string ify(messag e))
  18  
  19   /*
  20     const op ts = {
  21       key: f s.readFile Sync('../. ./tas/test /https-cer ts/kvtest- server.key '),
  22       cert:  fs.readFil eSync('../ ../tas/tes t/https-ce rts/kvtest -server.cr t'),
  23       ca: fs .readFileS ync('../.. /tas/test/ https-cert s/kvtest-c a-client.c rt'),
  24       reques tCert: tru e,
  25       reject Unauthoriz ed: false
  26   }
  27   */
  28  
  29   const send  = async ( queue_name , content)  => {
  30       try {
  31       const  connection  = await a mqplib.con nect(proce ss.env.TAS _QUEUE_ADD RESS)
  32       
  33           //  ,function (err, 
  34           //  conn) {
  35           //      debug ("Enter in  callback" ,conn)
  36           //      if (e rr) {
  37           //        con sole.error ("[AMQP]",  err.messa ge)
  38           //        ret urn err
  39           //      }
  40           //      conn. on("error" , function (err) {
  41           //        if  (err.messa ge !== "Co nnection c losing") {
  42           //          c onsole.err or("[AMQP]  conn erro r", err.me ssage)
  43           //        }
  44           //      })
  45           //      conn. on("close" , function () {
  46           //        con sole.error ("[AMQP] r econnectin g")
  47           //        ret urn
  48           //      })
  49           
  50           //      debug ("[AMQP] c onnected")
  51           //      amqpC onn = conn
  52           //      callb ack(null," Success")
  53           //    })
  54  
  55  
  56  
  57       const  channel =  await conn ection.cre ateChannel ()
  58       await  channel.as sertQueue( queue_name )
  59       await  channel.se ndToQueue( queue_name , toBuffer (content),  { persist ent: true  })
  60       } catc h (excepti on) {
  61           de bug(except ion)
  62       }
  63   }
  64  
  65   const list en = async  (queue_na me, handle r, options ) => {
  66       const  connection  = await c onnect(pro cess.env.T AS_QUEUE_A DDRESS)
  67       const  channel =  await conn ection.cre ateChannel ()
  68  
  69       channe l.assertQu eue(queue_ name)
  70           .t hen(ok =>  {
  71                channel. consume(qu eue_name,  async mess age => {
  72                    cons t body = J SON.parse( message.co ntent.toSt ring())
  73                    awai t handler( body)
  74                }, optio ns)
  75           })
  76   }
  77  
  78   const gene rate = (se ed = '') = > {
  79       const  hash = cry pto.create Hash('sha1 ')
  80       hash.u pdate(seed  + (new Da te()).toIS OString())
  81       return  hash.dige st('hex')
  82   }
  83  
  84   describe(" queueing",  () => {
  85       it("li stens / ad ds to queu e", functi on (done)  {
  86           co nst queue_ name = gen erate(this .title)
  87           co nst obj =  { a: 1, b:  2 }
  88           se nd(queue_n ame, obj)
  89                .then(()  => {
  90                    list en(queue_n ame, (cont ent) => {
  91                         expect(con tent).to.e ql(obj)
  92                         done()
  93                    }).t hen(() =>  {
  94                         setTimeout (() => {
  95                             //+ de lay
  96                         }, 1000)
  97                    })
  98                })
  99       })
  100  
  101       it("Te st Pushing  a Transac tion to Qu eue using  AMQP Libra ry Direct" , async ()  => {
  102           //  Setup var iables to  pass to re quest
  103           le t user_id  = 'MOCK-SE CID-000001 1111'
  104  
  105           //  If using  a client c ertificate  then you  will need  to add the  first two  lines
  106           //  See https ://www.squ aremobius. net/amqp.n ode/ssl.ht ml
  107             // pfx: fs .readFileS ync('C:\\U sers\\ DNS \\Document s\\2018\\f pctas800.p 12'),
  108           va r opts = {
  109               ca: [fs.r eadFileSyn c(process. env.TAS_QU EUE_CERTIF ICATE_PATH )]
  110               //ca: [fs .readFileS ync("./vac acert.pem" )]
  111           }
  112  
  113             let TAS_QU EUE_ADDRES S = "amqps :// DNS . URL : PORT /fsc-queue s-dev?hear tbeat=60"
  114           // let TAS_QU EUE_ADDRES S = "amqps ://testdev :testdev@l ocalhost:5 671/fsc-qu eues-dev"
  115  
  116           le t q = 'fsc -test-queu e'
  117           le t payload  = mock_cla im.MOCK_FS C_837_FOR_ MOCHA
  118           // payload =  "{'test':  'This is a  test'}"
  119           le t roughObj Size = JSO N.stringif y(payload) .length
  120           de bug(roughO bjSize)
  121  
  122           le t connecti on = null
  123           le t queue_re sponse = n ull
  124           le t content  = null
  125           tr y {
  126                content  =  { name:  'claim_fh ir', paylo ad}
  127                if (type of content  !== 'unde fined') {
  128                    cont ent = Obje ct.assign( {}, conten t, { $secu rityContex t: user_id  })
  129                } else {
  130                    cont ent = user _id
  131                }
  132                connecti on = await  connect(T AS_QUEUE_A DDRESS, op ts)
  133                const ch annel = aw ait connec tion.creat eChannel()
  134  
  135                await ch annel.asse rtQueue(q,  {durable:  true})
  136                let msg  = toBuffer (content)
  137                queue_re sponse = a wait chann el.sendToQ ueue(q, ms g, {
  138                    cont entType: " applicatio n/json",
  139                    time stamp: Dat e.now(),
  140                    pers istent: tr ue
  141                })
  142                //debug( " [x] Sent  '%s'", ms g)
  143  
  144                await ch annel.clos e()
  145  
  146           }  catch (err ) {
  147                debug(er r)
  148           }
  149           //  Call the  retRespons e async ca ll to show  that it c an load da ta to the  queue
  150           ex pect(queue _response) .to.equal( true)
  151  
  152       })
  153  
  154       it("Ex change", a sync () =>  {
  155           //  Setup var iables to  pass to re quest
  156           le t user_id  = 'MOCK-SE CID-000001 1111'
  157  
  158           va r opts = {
  159               ca: [fs.r eadFileSyn c(process. env.TAS_QU EUE_CERTIF ICATE_PATH )]
  160               //ca: [fs .readFileS ync("./vac acert.pem" )]
  161           }
  162  
  163             let TAS_QU EUE_ADDRES S = "amqps :// DNS . URL : PORT /fsc-queue s-dev?hear tbeat=60"
  164           // let TAS_QU EUE_ADDRES S = "amqps ://testdev :testdev@l ocalhost:5 671/fsc-qu eues-dev"
  165  
  166           le t q = 'fsc -test-queu e'
  167           le t payload  = mock_cla im.MOCK_FS C_837_FOR_ MOCHA
  168           // payload =  "{'test':  'This is a  test'}"
  169           le t roughObj Size = JSO N.stringif y(payload) .length
  170           de bug(roughO bjSize)
  171  
  172           le t connecti on = null
  173           le t queue_re sponse = n ull
  174           le t content  = null
  175           tr y {
  176                content  =  { name:  'claim_fh ir', paylo ad}
  177                if (type of content  !== 'unde fined') {
  178                    cont ent = Obje ct.assign( {}, conten t, { $secu rityContex t: user_id  })
  179                } else {
  180                    cont ent = user _id
  181                }
  182                connecti on = await  connect(T AS_QUEUE_A DDRESS, op ts)
  183                const ch annel = aw ait connec tion.creat eChannel()
  184  
  185                var ex =  'djh-ex'
  186                var msg  = 'hello d jh' // pro cess.argv. slice(2).j oin(' ') | | 'Hello W orld!'
  187           
  188                channel. assertExch ange(ex, ' fanout', { durable: f alse})
  189                channel. publish(ex , '', new  Buffer(msg ))
  190                debug("  [x] Sent % s", msg)
  191  
  192                // await  channel.a ssertQueue (q, {durab le: true})
  193                // await  channel.c lose()
  194  
  195           }  catch (err ) {
  196                debug(er r)
  197           }
  198           //  Call the  retRespons e async ca ll to show  that it c an load da ta to the  queue
  199           ex pect(queue _response) .to.equal( true)
  200  
  201       })
  202  
  203   })