Produced by Araxis Merge on 10/5/2018 9:05:46 PM 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | MHEDP3_VAOS_VATS_SM_Sept2018.zip\SM 2.4.0\scheduling-manager-web-2.4.0.zip\scheduling-manager\test\watir-ruby\module\database | MongoUtility.rb | Thu Jul 19 16:14:00 2018 UTC |
| 2 | MHEDP3_VAOS_VATS_SM_Sept2018.zip\SM 2.4.0\scheduling-manager-web-2.4.0.zip\scheduling-manager\test\watir-ruby\module\database | MongoUtility.rb | Fri Oct 5 16:56:05 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 4 | 390 |
| Changed | 3 | 6 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 |
No regular expressions were active.
| 1 | require 'm ongo' | |
| 2 | require 'b son' | |
| 3 | require 'a ctive_supp ort/time' | |
| 4 | include Mo ngo | |
| 5 | ||
| 6 | module Mon goUtility | |
| 7 | MONGO_CE RT_PATH = File.dirna me(__FILE_ _) + '/mon godb-cert. crt' | |
| 8 | ||
| 9 | def conn ectToMongo DB_No_SSL( dbName) | |
| 10 | db = Mongo ::Client.n ew('mongod b:// IP /' + dbNam e + '?ssl= false&conn ectTimeout MS=20000') | |
| 11 | return db | |
| 12 | end | |
| 13 | ||
| 14 | ||
| 15 | def conn ectToMongo _SSL(dbNam e) | |
| 16 | uri = "mon godb:// IP 7/" + dbNa me + "?ssl =true&conn ectTimeout MS=20000" | |
| 17 | db = M ongo::Clie nt.new(uri , :ssl_ver ify => tru e, :ssl_ca _cert => ' module/dat abase/mong odb-cert.c rt' ) | |
| 18 | return db | |
| 19 | end | |
| 20 | ||
| 21 | def conn ectToVARUt ility | |
| 22 | var_uti_ur i = "mongo db://var-u tility:var -utility@ IP 7/var-util ity?ssl=tr ue&connect TimeoutMS= 20000&auth Mechanism= SCRAM-SHA- 1&" | |
| 23 | db = M ongo::Clie nt.new(var _uti_uri, :ssl_verif y => true, :ssl_ca_c ert => MON GO_CERT_PA TH ) | |
| 24 | return db | |
| 25 | end | |
| 26 | ||
| 27 | ||
| 28 | def remo veCollecti on(collect ionName,db ) | |
| 29 | collec tion = db[ collection Name] | |
| 30 | collec tion.drop | |
| 31 | end | |
| 32 | ||
| 33 | def upda teDocument (collectio nName, obj Id, column Name, valu e, db) | |
| 34 | collec tion = db[ collection Name] | |
| 35 | collec tion.updat e({:_id => objId}, { "$set" => {columnNam e => value }}) | |
| 36 | ||
| 37 | end | |
| 38 | ||
| 39 | def remo veDocument (collectio nName, obj Id, db) | |
| 40 | collec tion = db[ collection Name] | |
| 41 | collec tion.delet e_one({:_i d => objId }) | |
| 42 | ||
| 43 | end | |
| 44 | ||
| 45 | def rest oreCollect ion(collec tionName, dbName, fi leName, db ) | |
| 46 | remove Collection (collectio nName, db) | |
| 47 | ||
| 48 | begin | |
| 49 | coll = db[coll ectionName ] | |
| 50 | coll .insert_ma ny(JSON.pa rse(File.r ead("modul e/database /snapshots /" + fileN ame))) | |
| 51 | ||
| 52 | rescue Exception =>e | |
| 53 | puts "[Excepti on insertC ollection] " + e.to_s | |
| 54 | end | |
| 55 | ||
| 56 | end | |
| 57 | ||
| 58 | def inse rtDocument (collectio nName, doc ument, db) | |
| 59 | collec tion = db[ collection Name] | |
| 60 | result = collect ion.insert _one(docum ent) | |
| 61 | #resul t.n => ret urns 1, be cause 1 do cument was inserted. | |
| 62 | return result.n | |
| 63 | end | |
| 64 | ||
| 65 | def inse rtManyDocu ments(coll ectionName , document s, db) | |
| 66 | collec tion = db[ collection Name] | |
| 67 | ||
| 68 | =begin | |
| 69 | #docum ents sampl e | |
| 70 | docume nts = [ | |
| 71 | { :name => ' Flying Lot us' }, | |
| 72 | { :name => ' Aphex Twin ' } | |
| 73 | ] | |
| 74 | =end | |
| 75 | result = collect ion.insert _many(docu ments) | |
| 76 | ||
| 77 | ||
| 78 | #resul t.n #=> re turns 2, i f 2 docume nts were i nserted. | |
| 79 | return result.n | |
| 80 | ||
| 81 | end | |
| 82 | ||
| 83 | def getF ieldByObjI d(collecti onName, ob jId, colum nName, db) | |
| 84 | db[col lectionNam e].find({: _id => obj Id}).each do |docume nt| | |
| 85 | #=> Yields a B SON::Docum ent. | |
| 86 | #put s "getFiel dByObjId: " + docum ent.to_s | |
| 87 | retu rn documen t[columnNa me] | |
| 88 | end | |
| 89 | end | |
| 90 | ||
| 91 | def getN thCoreSett ings(colle ctionName, objId, nt h, db) | |
| 92 | db[col lectionNam e].find({: _id => obj Id}).each do |docume nt| | |
| 93 | core Settings = document[ 'coreSetti ngs'] | |
| 94 | retu rn coreSet tings[nth] | |
| 95 | end | |
| 96 | end | |
| 97 | ||
| 98 | def getN thRequestS ettings(co llectionNa me, objId, nth, db) | |
| 99 | db[col lectionNam e].find({: _id => obj Id}).each do |docume nt| | |
| 100 | core Settings = document[ 'requestSe ttings'] | |
| 101 | retu rn coreSet tings[nth] | |
| 102 | end | |
| 103 | end | |
| 104 | ||
| 105 | def getD ocumentByO bjId(colle ctionName, objId, co lumnName, db) | |
| 106 | db[col lectionNam e].find({: _id => obj Id}, :fiel ds => [col umnName]). each do |d ocument| | |
| 107 | ||
| 108 | retu rn documen t['coreSet tings'] | |
| 109 | end | |
| 110 | end | |
| 111 | ||
| 112 | def getD ocumentByO bjId(colle ctionName, objId, co lumnName, db) | |
| 113 | db[col lectionNam e].find({: _id => obj Id}, :fiel ds => [col umnName]). each do |d ocument| | |
| 114 | ||
| 115 | retu rn documen t['request Settings'] | |
| 116 | end | |
| 117 | end | |
| 118 | ||
| 119 | def veri fyNotifica tionDelete d(collecti onName, ob jId, colum nName, db) | |
| 120 | docume nt = getDo cumentByOb jId(collec tionName, objId, col umnName, d b) | |
| 121 | isDele ted = true | |
| 122 | ||
| 123 | for re cord in do cument | |
| 124 | if r ecord[colu mnName] == false | |
| 125 | is Deleted = false | |
| 126 | br eak | |
| 127 | end | |
| 128 | end | |
| 129 | #puts "[verifyNo tification Deleted ] objId: " + objId + " - columnN ame: " + c olumnName + " IsDele ted: " + i sDeleted.t o_s | |
| 130 | return isDeleted | |
| 131 | ||
| 132 | end | |
| 133 | ||
| 134 | def veri fyDocument sDeleted(c ollectionN ame, objId , columnNa me, db) | |
| 135 | docume nt = getD ocumentByO bjId(colle ctionName, objId, co lumnName, db) | |
| 136 | isDele ted = true | |
| 137 | ||
| 138 | for re cord in do cument | |
| 139 | #put s "record[ columnName ] = " + re cord[colum nName].to_ s | |
| 140 | ||
| 141 | if r ecord[colu mnName] == false | |
| 142 | is Deleted = false | |
| 143 | br eak | |
| 144 | end | |
| 145 | end | |
| 146 | ||
| 147 | return isDeleted | |
| 148 | ||
| 149 | end | |
| 150 | ||
| 151 | def retr ieveThisFi eldInDocum entWithMul tiRows(col lectionNam e, objId, columnNam e, db) | |
| 152 | docume nt = getDo cumentByOb jId(collec tionName, objId, col umnName, d b) | |
| 153 | outPut = "" | |
| 154 | docume nt.each { |record| | |
| 155 | #put s record[c olumnName] | |
| 156 | if r ecord[colu mnName] != nil then | |
| 157 | ou tPut = rec ord[column Name] + ', ' + outPut .to_s | |
| 158 | else | |
| 159 | ou tput = "" + "," + ou tput.to_s | |
| 160 | end | |
| 161 | } | |
| 162 | #puts "outPut=" + outPut.t o_s | |
| 163 | return outPut | |
| 164 | ||
| 165 | end | |
| 166 | ||
| 167 | def retr ieveThisFi eldInDocum entWithMul tiRowsAsAr ray(collec tionName, objId, co lumnName, db) | |
| 168 | docume nt = getDo cumentByOb jId(collec tionName, objId, col umnName, d b) | |
| 169 | outPut = Array.n ew | |
| 170 | docume nt.each { |record| | |
| 171 | if r ecord[colu mnName] != nil then | |
| 172 | ou tPut.push( record[col umnName]) | |
| 173 | end | |
| 174 | } | |
| 175 | return outPut | |
| 176 | end | |
| 177 | ||
| 178 | def retr ieveThisFi eldInDocum ent(collec tionName, objId, co lumnName, db) | |
| 179 | docume nt = getDo cumentByOb jId(collec tionName, objId, col umnName, d b) | |
| 180 | ||
| 181 | for re cord in do cument | |
| 182 | puts "record[c olumnName] =" + recor d[columnNa me].to_s | |
| 183 | retu rn record[ columnName ] | |
| 184 | end | |
| 185 | end | |
| 186 | ||
| 187 | def retr eiveAllDoc umentsInCo llection(c ollectionN ame, db) | |
| 188 | docume ntArray = [] | |
| 189 | ||
| 190 | db[col lectionNam e].find(). each do |d ocument| | |
| 191 | docu mentArray << documen t | |
| 192 | end | |
| 193 | ||
| 194 | puts d ocumentArr ay.to_s | |
| 195 | ||
| 196 | return documentA rray | |
| 197 | end | |
| 198 | end |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.