Produced by Araxis Merge on 10/4/2017 8:04:41 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.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | rdk.zip\rdk\product\tests\acceptance-tests\features\steps | announcements_steps.rb | Mon Aug 21 12:51:01 2017 UTC |
| 2 | rdk.zip\rdk\product\tests\acceptance-tests\features\steps | announcements_steps.rb | Tue Oct 3 17:27:11 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 478 |
| Changed | 1 | 2 |
| 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 | ||
| 2 | class Anno uncements | |
| 3 | extend : :RSpec::Ma tchers | |
| 4 | def self .to_boolea n(str) | |
| 5 | return true if s tr.downcas e == "true " | |
| 6 | return false | |
| 7 | end | |
| 8 | ||
| 9 | def self .build_com mmunicatio n_preferen ces_payloa d(table_ha sh) | |
| 10 | comm_p ref = {} | |
| 11 | comm_p ref['categ ory'] = {} | |
| 12 | comm_p ref['categ ory']['cod e'] = tabl e_hash['ca tegory.cod e'] unless table_has h['categor y.code'].n il? | |
| 13 | comm_p ref['categ ory']['sys tem'] = ta ble_hash[' category.s ystem'] un less table _hash['cat egory.syst em'].nil? | |
| 14 | comm_p ref['enabl ed'] = Ann ouncements .to_boolea n(table_ha sh['enable d']) unles s table_ha sh['enable d'].nil? | |
| 15 | comm_p ref['userI d'] = tabl e_hash['us erId'] unl ess table_ hash['user Id'].nil? | |
| 16 | comm_p ref | |
| 17 | end | |
| 18 | ||
| 19 | def self .verify_si ngle_type( path, expe cted_value , response ) | |
| 20 | respon se_body = JSON.parse (response) | |
| 21 | all_va lues = [] | |
| 22 | ||
| 23 | json_v erify = Js onVerifier .new | |
| 24 | json_v erify.save _all_value s_of_path( 0, path.sp lit('.'), response_b ody, "", a ll_values) | |
| 25 | all_va lues_set = Set.new a ll_values | |
| 26 | expect ed_value.e ach do | v alue | | |
| 27 | expe ct(all_val ues_set).t o include( value), "E xpected on ly '#{valu e}' in res ponse, but got #{all _values_se t.to_a}" | |
| 28 | end | |
| 29 | expect (all_value s_set.size ).to eq(ex pected_val ue.length) , "Expecte d only 1 v alue in re sponse, go t #{all_va lues_set.t o_a}" | |
| 30 | end | |
| 31 | ||
| 32 | def self .verify_de scending_o rder(path, response) | |
| 33 | respon se_body = JSON.parse (response) | |
| 34 | all_va lues = [] | |
| 35 | ||
| 36 | json_v erify = Js onVerifier .new | |
| 37 | json_v erify.save _all_value s_of_path( 0, path.sp lit('.'), response_b ody, "", a ll_values) | |
| 38 | expect (all_value s.length). to be > 1, "Need at least 2 va lues to ve rify order , received #{all_val ues.length }" | |
| 39 | expect (Set.new(a ll_values) .size).to be > 1, "N eed at lea st 2 uniqu e values t o verify o rder" | |
| 40 | ||
| 41 | clone_ values = a ll_values. clone.sort .reverse | |
| 42 | expect (clone_val ues).to eq (all_value s) | |
| 43 | end | |
| 44 | ||
| 45 | def self .verify_te rms_return ed(respons e) | |
| 46 | respon se_body = JSON.parse (response. body) | |
| 47 | expect (response_ body['data ']).to_not be_nil | |
| 48 | expect (response_ body['data ']['items' ]).to_not be_nil | |
| 49 | expect (response_ body['data ']['items' ]['communi cation']). to_not be_ nil | |
| 50 | expect (response_ body['data ']['items' ]['communi cation'].l ength).to be > 0 | |
| 51 | end | |
| 52 | ||
| 53 | def self .index_of_ attachment (response) | |
| 54 | respon se_body = JSON.parse (response. body) | |
| 55 | commun ication_ar ray = resp onse_body[ 'data']['i tems']['co mmunicatio n'] | |
| 56 | image_ index = -1 | |
| 57 | commun ication_ar ray.each_w ith_index do | messa ge_block, index | | |
| 58 | expe ct(message _block['pa yload']).t o_not be_n il | |
| 59 | expe ct(message _block['pa yload'][0] ).to_not b e_nil | |
| 60 | expe ct(message _block['pa yload'][0] ['content' ]).to_not be_nil | |
| 61 | expe ct(message _block['pa yload'][0] ['content' ][0]).to_n ot be_nil | |
| 62 | imag e_index = index unle ss message _block['pa yload'][0] ['content' ][0]['cont entAttachm ent'].nil? | |
| 63 | brea k if image _index > - 1 | |
| 64 | end | |
| 65 | expect (image_ind ex).to be > -1 | |
| 66 | image_ index | |
| 67 | end | |
| 68 | ||
| 69 | def self .communica tion_ident ifier(resp onse_body, index) | |
| 70 | expect (response_ body['data ']['items' ]['communi cation'][i ndex]).to_ not be_nil | |
| 71 | expect (response_ body['data ']['items' ]['communi cation'][i ndex]['ide ntifier']) .to_not be _nil | |
| 72 | expect (response_ body['data ']['items' ]['communi cation'][i ndex]['ide ntifier'][ 0]['value' ]).to_not be_nil | |
| 73 | return response_ body['data ']['items' ]['communi cation'][i ndex]['ide ntifier'][ 0]['value' ] | |
| 74 | end | |
| 75 | ||
| 76 | def self .image_ide ntifier(re sponse_bod y, index) | |
| 77 | expect (response_ body['data ']['items' ]['communi cation'][i ndex]).to_ not be_nil | |
| 78 | commun ication_el ement = re sponse_bod y['data'][ 'items'][' communicat ion'][inde x] | |
| 79 | expect (communica tion_eleme nt['payloa d']).to_no t be_nil | |
| 80 | expect (communica tion_eleme nt['payloa d'][0]).to _not be_ni l | |
| 81 | expect (communica tion_eleme nt['payloa d'][0]['co ntent']).t o_not be_n il | |
| 82 | expect (communica tion_eleme nt['payloa d'][0]['co ntent'][0] ).to_not b e_nil | |
| 83 | expect (communica tion_eleme nt['payloa d'][0]['co ntent'][0] ['contentA ttachment' ]).to_not be_nil | |
| 84 | expect (communica tion_eleme nt['payloa d'][0]['co ntent'][0] ['contentA ttachment' ]['content Attachment Identifier ']).to_not be_nil | |
| 85 | return communica tion_eleme nt['payloa d'][0]['co ntent'][0] ['contentA ttachment' ]['content Attachment Identifier '] | |
| 86 | end | |
| 87 | ||
| 88 | def self .attachmen t_link(res ponse_body , index) | |
| 89 | expect (response_ body['data ']['items' ]['communi cation'][i ndex]).to_ not be_nil | |
| 90 | commun ication_el ement = re sponse_bod y['data'][ 'items'][' communicat ion'][inde x] | |
| 91 | expect (communica tion_eleme nt['payloa d']).to_no t be_nil | |
| 92 | expect (communica tion_eleme nt['payloa d'][0]).to _not be_ni l | |
| 93 | expect (communica tion_eleme nt['payloa d'][0]['co ntent']).t o_not be_n il | |
| 94 | expect (communica tion_eleme nt['payloa d'][0]['co ntent'][0] ).to_not b e_nil | |
| 95 | expect (communica tion_eleme nt['payloa d'][0]['co ntent'][0] ['contentA ttachment' ]).to_not be_nil | |
| 96 | expect (communica tion_eleme nt['payloa d'][0]['co ntent'][0] ['contentA ttachment' ]['link']) .to_not be _nil | |
| 97 | return communica tion_eleme nt['payloa d'][0]['co ntent'][0] ['contentA ttachment' ]['link'] | |
| 98 | end | |
| 99 | end | |
| 100 | ||
| 101 | When(/^cli ent reques ts communi cations fo r$/) do |t able| | |
| 102 | request = RDKQuery .new('ehmp -announcem ents') | |
| 103 | table.ro ws.each do | paramet er, value | | |
| 104 | reques t.add_para meter(para meter, val ue) | |
| 105 | end | |
| 106 | ||
| 107 | path = r equest.pat h | |
| 108 | p path | |
| 109 | @respons e = HTTPar tyRDK.get( path) | |
| 110 | end | |
| 111 | ||
| 112 | When(/^the client up dates user preferenc es$/) do | table| | |
| 113 | post_bod y = Announ cements.bu ild_commmu nication_p references _payload(t able.rows_ hash) | |
| 114 | request = RDKQuery .new('ehmp -announcem ents-prefe rences') | |
| 115 | path = " #{request. path}/" | |
| 116 | @respons e = HTTPar tyRDK.post (path, pos t_body.to_ json, Task Helper.hea ders) | |
| 117 | end | |
| 118 | ||
| 119 | When(/^cli ent reques ts prefere nces$/) do |table| | |
| 120 | post_bod y = Announ cements.bu ild_commmu nication_p references _payload(t able.rows_ hash) | |
| 121 | request = RDKQuery .new('ehmp -announcem ents-prefe rences') | |
| 122 | path = " #{request. path}/" | |
| 123 | @respons e = HTTPar tyRDK.post (path, pos t_body.to_ json, Task Helper.hea ders) | |
| 124 | end | |
| 125 | ||
| 126 | Then(/^the response message is 'The requ ired param eter "([^" ]*)" is mi ssing\.'$/ ) do |arg1 | | |
| 127 | message = "The req uired para meter \"#{ arg1}\" is missing." | |
| 128 | p messag e | |
| 129 | response _body = JS ON.parse(@ response.b ody) | |
| 130 | expect(r esponse_bo dy['messag e']).to eq (message) | |
| 131 | end | |
| 132 | ||
| 133 | Then(/^the response only conta ins messag es with a completed status$/) do | |
| 134 | path = ' data.items .communica tion.statu s.code' | |
| 135 | expected _value = ' completed' | |
| 136 | Announce ments.veri fy_single_ type(path, [expected _value], @ response.b ody) | |
| 137 | ||
| 138 | path = ' data.items .communica tion.statu s.system' | |
| 139 | expected _value = ' http://hl7 .org/fhir/ ValueSet/c ommunicati on-status' | |
| 140 | Announce ments.veri fy_single_ type(path, [expected _value], @ response.b ody) | |
| 141 | end | |
| 142 | ||
| 143 | Then(/^the response only conta ins messag es with a delete sta tus$/) do | |
| 144 | path = ' data.items .communica tion.statu s.code' | |
| 145 | expected _value = ' deleted' | |
| 146 | Announce ments.veri fy_single_ type(path, [expected _value], @ response.b ody) | |
| 147 | ||
| 148 | path = ' data.items .communica tion.statu s.system' | |
| 149 | expected_v alue = 'ht tp://ehmp. DNS /messageSt atus' | |
| 150 | Announce ments.veri fy_single_ type(path, [expected _value], @ response.b ody) | |
| 151 | end | |
| 152 | ||
| 153 | Then(/^the response only conta ins messag es of type terms "([ ^"]*)"$/) do |terms| | |
| 154 | path = ' data.items .communica tion.categ ory.code' | |
| 155 | expected _value = t erms | |
| 156 | Announce ments.veri fy_single_ type(path, [expected _value], @ response.b ody) | |
| 157 | end | |
| 158 | ||
| 159 | Then(/^the response only conta ins messag es of requ ested vers ion "([^"] *)"$/) do |version| | |
| 160 | path = ' data.items .communica tion.recip ient.ehmpA ppVersion' | |
| 161 | expected _value = v ersion | |
| 162 | Announce ments.veri fy_single_ type('data .items.com munication .recipient .ehmpAppVe rsion', [e xpected_va lue], @res ponse.body ) | |
| 163 | end | |
| 164 | ||
| 165 | Then(/^the term anno uncements are return ed in desc ending ord er$/) do | |
| 166 | Announce ments.veri fy_descend ing_order( 'data.item s.communic ation.sent ', @respon se.body) | |
| 167 | end | |
| 168 | ||
| 169 | Then(/^the system an nouncement s are retu rned in de scending o rder$/) do | |
| 170 | Announce ments.veri fy_descend ing_order( 'data.item s.communic ation.sent ', @respon se.body) | |
| 171 | end | |
| 172 | ||
| 173 | Then(/^the terms are not retur ned$/) do | |
| 174 | response _body = JS ON.parse(@ response.b ody) | |
| 175 | p respon se_body | |
| 176 | expect(r esponse_bo dy['data'] ).to_not b e_nil | |
| 177 | expect(r esponse_bo dy['data'] ['items']) .to_not be _nil | |
| 178 | expect(r esponse_bo dy['data'] ['items'][ 'communica tion']).to _not be_ni l | |
| 179 | expect(r esponse_bo dy['data'] ['items'][ 'communica tion'].len gth).to eq (0) | |
| 180 | end | |
| 181 | ||
| 182 | Then(/^the terms are returned$ /) do | |
| 183 | Announce ments.veri fy_terms_r eturned @r esponse | |
| 184 | end | |
| 185 | ||
| 186 | When(/^cli ent reques ts attachm ent for in valid iden tifier$/) do | |
| 187 | request = RDKQuery .new('ehmp -announcem ents-attac hment') | |
| 188 | path = r equest.pat h | |
| 189 | path.sub !(':identi fier', 'in valid') | |
| 190 | p path | |
| 191 | @respons e = HTTPar tyRDK.get( path) | |
| 192 | end | |
| 193 | ||
| 194 | Given(/^th e response contains at least ( \d+) term announceme nt with an attachmen t$/) do |a rg1| | |
| 195 | Announce ments.veri fy_terms_r eturned @r esponse | |
| 196 | begin | |
| 197 | Announ cements.in dex_of_att achment @r esponse | |
| 198 | rescue E xception = > e | |
| 199 | p "#{e }" | |
| 200 | raise "Precondit ion not me t: the res ponse did not contai n a messag e with an attachment " | |
| 201 | end | |
| 202 | end | |
| 203 | ||
| 204 | When(/^the client re quests the attachmen t for the first retu rned term using subs titution$/ ) do | |
| 205 | Announce ments.veri fy_terms_r eturned @r esponse | |
| 206 | image_in dex = Anno uncements. index_of_a ttachment @response | |
| 207 | response _body = JS ON.parse(@ response.b ody) | |
| 208 | message_ id = Annou ncements.c ommunicati on_identif ier respon se_body, i mage_index | |
| 209 | image_id = Announc ements.ima ge_identif ier respon se_body, i mage_index | |
| 210 | ||
| 211 | request = RDKQuery .new('ehmp -announcem ents-attac hment') | |
| 212 | path = r equest.pat h | |
| 213 | path.sub !(':identi fier', mes sage_id) | |
| 214 | path.sub !(':idAtta chment', i mage_id) | |
| 215 | p path | |
| 216 | @respons e = HTTPar tyRDK.get( path) | |
| 217 | end | |
| 218 | ||
| 219 | When(/^the client re quests the attachmen t for the first retu rned term using the link$/) do | |
| 220 | Announce ments.veri fy_terms_r eturned @r esponse | |
| 221 | image_in dex = Anno uncements. index_of_a ttachment @response | |
| 222 | response _body = JS ON.parse(@ response.b ody) | |
| 223 | image_li nk = Annou ncements.a ttachment_ link respo nse_body, image_inde x | |
| 224 | ||
| 225 | request = RDKQuery .new('ehmp -announcem ents') | |
| 226 | path = r equest.pat h | |
| 227 | path = p ath.concat (image_lin k) | |
| 228 | p path | |
| 229 | @respons e = HTTPar tyRDK.get( path) | |
| 230 | end | |
| 231 | ||
| 232 | Then(/^the attachmen t response contains populated$ /) do |tab le| | |
| 233 | response _body = JS ON.parse(@ response.b ody) | |
| 234 | expect(r esponse_bo dy['data'] ).to_not b e_nil | |
| 235 | expect(r esponse_bo dy['data'] ['contentT ype']).to_ not be_nil , "Expecte d response body to c ontain key ['data'][ 'contentTy pe']" | |
| 236 | expect(r esponse_bo dy['data'] ['contentT ype'].leng th).to be > 0, "Expe cted ['dat a']['conte ntType'] t o be popul ated" | |
| 237 | ||
| 238 | expect(r esponse_bo dy['data'] ['src']).t o_not be_n il, "Expec ted respon se body to contain k ey ['data' ]['src']" | |
| 239 | expect(r esponse_bo dy['data'] ['src'].le ngth).to b e > 0, "Ex pected ['d ata']['src '] to be p opulated" | |
| 240 | end |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.