Produced by Araxis Merge on 5/29/2018 12:14:32 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 | mobile-kidney-web-2.0.0.zip\mobile-kidney-web\acceptance_test\watir\lib\module | MongoOperationsModule.rb | Wed Apr 4 20:16:46 2018 UTC |
2 | mobile-kidney-web-2.0.0.zip\mobile-kidney-web\acceptance_test\watir\lib\module | MongoOperationsModule.rb | Tue May 29 15:34:33 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 228 |
Changed | 1 | 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 'm ongo-impor t' | |
3 | require 'b son' | |
4 | require 'a ctive_supp ort/time' | |
5 | include Mo ngo | |
6 | include Mo ngoImport | |
7 | ||
8 | require 'd ate' | |
9 | ||
10 | module Mon goOperatio nsModule | |
11 | HOST = " IP " | |
12 | PORT = PORT | |
13 | HOSTANDPOR T = " IP : PORT " | |
14 | ||
15 | def remo veCollecti on(collect ionName, d bName) | |
16 | @db = Mongo::Cli ent.new([ HOSTANDPOR T ], :data base => db Name, :con nect_timeo ut => 20, :max_pool_ size => 10 0) | |
17 | @db[co llectionNa me].drop | |
18 | @db.da tabase.col lection(co llectionNa me).drop | |
19 | puts " [removeCol lection] r emoved All documents for " + c ollectionN ame | |
20 | end | |
21 | ||
22 | def inse rtCollecti on(collect ionName, d bName, fil ePath) | |
23 | comman d = "mongo restore -h #{HOST}:# {PORT} --c ollection " + collec tionName + ' --db ' + dbName + ' ' + fil ePath | |
24 | puts c ommand | |
25 | puts ` #{command} ` | |
26 | puts " [insertCol lection] i mported Co llection " + collect ionName | |
27 | end | |
28 | ||
29 | def inse rtDocument (collectio nName, dbN ame, docum ent) | |
30 | @db = Mongo::Cli ent.new([ HOSTANDPOR T ], :data base => db Name, :con nect_timeo ut => 20, :max_pool_ size => 10 0) | |
31 | collec tion = @db [collectio nName] | |
32 | collec tion.inser t_one(docu ment) | |
33 | end | |
34 | ||
35 | def rese tCollectio n(collecti onName, db Name, file Name) | |
36 | remove Collection (collectio nName, dbN ame) | |
37 | insert Collection (collectio nName, dbN ame, fileN ame) | |
38 | puts " [resetColl ection] re set Collec tion " + c ollectionN ame | |
39 | end | |
40 | ||
41 | def retr eiveAllDoc umentsInCo llection(c ollectionN ame, dbNam e) | |
42 | docume ntArray = [] | |
43 | @db = Mongo::Cli ent.new([ HOSTANDPOR T ], :data base => db Name, :con nect_timeo ut => 20, :max_pool_ size => 10 0) | |
44 | docume nts = @db[ collection Name].find () | |
45 | docume nts.each d o | docume nt | | |
46 | docu mentArray << documen t | |
47 | end | |
48 | return documentA rray | |
49 | end | |
50 | ||
51 | def getD ocumentByF ields(dbNa me, collec tion, fiel dHash) | |
52 | @db = Mongo::Cli ent.new([ HOSTANDPOR T ], :data base => db Name, :con nect_timeo ut => 20, :max_pool_ size => 10 0) | |
53 | docume nt = @db[c ollection] .find(fiel dHash) | |
54 | docs = [] | |
55 | docume nt.each { |doc| | |
56 | docs << doc | |
57 | } | |
58 | ||
59 | return docs | |
60 | end | |
61 | ||
62 | def getD ocumentByT itle(colle ctionName, dbName, t itleName, columnName ) | |
63 | @db = Mongo::Cli ent.new([ HOSTANDPOR T ], :data base => db Name, :con nect_timeo ut => 20, :max_pool_ size => 10 0) | |
64 | docume nt = @db[c ollectionN ame].find( {"title" = > titleNam e}, :field s => [colu mnName]) | |
65 | ||
66 | return document | |
67 | end | |
68 | ||
69 | def retr ieveThisFi eldInDocum entByTitle (collectio nName, dbN ame, title Name, colu mnName) | |
70 | docume nt = getDo cumentByTi tle(collec tionName, dbName, ti tleName, c olumnName) | |
71 | ||
72 | for re cord in do cument | |
73 | puts "record[c olumnName] =" + recor d[columnNa me].to_s | |
74 | retu rn record[ columnName ] | |
75 | end | |
76 | end | |
77 | ||
78 | def getD ocumentByP atientIden tifier(col lectionNam e, dbName, assigning AuthorityV alue, uniq ueIdValue, columnNam e) | |
79 | @db = Mongo::Cli ent.new([ HOSTANDPOR T ], :data base => db Name, :con nect_timeo ut => 20, :max_pool_ size => 10 0) | |
80 | docume nt = @db[c ollectionN ame].find( {"patientI dentifier. uniqueId" => uniqueI dValue, "p atientIden tifier.ass igningAuth ority"=> a ssigningAu thorityVal ue}, :fiel ds => [col umnName]) | |
81 | return document | |
82 | end | |
83 | ||
84 | def retr ieveThisFi eldInDocum ent(collec tionName, dbName, as signingAut horityValu e, uniqueI dValue, co lumnName) | |
85 | docume nt = getDo cumentByPa tientIdent ifier(coll ectionName , dbName, assigningA uthorityVa lue, uniqu eIdValue, columnName ) | |
86 | ||
87 | for re cord in do cument | |
88 | retu rn record[ columnName ] | |
89 | end | |
90 | end | |
91 | ||
92 | def setD efaultPref erencesFor Patient(un iqueId) | |
93 | @db = Mongo::Cli ent.new([ HOSTANDPOR T ], :data base => "n otificatio nsdb", :co nnect_time out => 20, :max_pool _size => 1 00) | |
94 | docume nts = @db[ "preferenc es"] | |
95 | docume nt = getDo cumentByPa tientIdent ifier("pre ferences", "notifica tionsdb", "EDIPI", u niqueId, " timeZone") | |
96 | docume ntEnum = d ocument.ea ch | |
97 | ||
98 | begin | |
99 | docu mentEnum.n ext() | |
100 | rescue StopItera tion | |
101 | docu ments.inse rt_one({"p atientIden tifier" => { "unique Id" => uni queId, "as signingAut hority"=> "EDIPI" }, "timeZone " => "(-05 :00) Ameri ca/New_Yor k (Eastern )", "email Address" = > "test@te st.com"}) | |
102 | end | |
103 | end | |
104 | ||
105 | def setD efaultNoti ficationPr eferencesF orPatient( uniqueId, firstName, lastName) | |
106 | @db = Mongo::Cli ent.new([ HOSTANDPOR T ], :data base => "n otificatio nsdb", :co nnect_time out => 20, :max_pool _size => 1 00) | |
107 | docume nts = @db[ "notificat ionPrefere nces"] | |
108 | docume nt = getDo cumentByPa tientIdent ifier("not ificationP references ", "notifi cationsdb" , "EDIPI", uniqueId, "optInSel ected") | |
109 | docum entEnum = document.e ach | |
110 | begin | |
111 | docu mentEnum.n ext() | |
112 | rescue StopItera tion | |
113 | docu ments.inse rt_one({"p atientIden tifier" => { "unique Id" => uni queId, "as signingAut hority"=> "EDIPI" }, "firstNam e" => firs tName, "la stName" => lastName, "optInSel ected" => true, "dat eOfBirth" => {"forma t" => "MMM dd, yyyy" , "value" => "Jan 19 , 1900", " valid" => true}}) | |
114 | end | |
115 | end | |
116 | ||
117 | end |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.