Changeset 3340
- Timestamp:
- 08/09/13 09:57:57 (11 years ago)
- Location:
- DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mockjax-xml.html
r3325 r3340 16 16 <!-- Libraries --> 17 17 <!-- <script src="../lib/jquery-1.10.2.min.js"></script> --> 18 19 <!-- Observe: jquery 1.8.3 version required in order to have proxy approach work with mockjax! --> 18 20 <script src="../../lib/jquery-1.8.3.min.js"></script> 19 21 -
DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mockjax-xml.js
r3329 r3340 7 7 var url = '/api/annotations?link="http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"'; 8 8 9 // Mock for Responding GET api/annotations?link="URI" 9 10 $.mockjax({ 10 11 /* url: A string or regular expression specifying the url of the request that the data should be mocked for. */ 11 12 // url: '/api/annotations?link="http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"&access=read', 12 13 url: url, 14 // url: '/api/annotations?link="http://en.wikipedia.org/wiki/Sagrada_Fam%C3%ADlia"', 13 15 /* type: Specify what HTTP method to match, usually GET or POST. Case-insensitive, so get and post also work. */ 14 16 type: 'GET', … … 18 20 responseTime: 750, 19 21 /* proxy: A string specifying a path to a file, from which the contents will be returned for the request. */ 20 proxy: 'mocks/annotations-sagrada-GET.xml' 22 proxy: 'mocks/annotations-sagrada-GET.xml', 23 }); 24 25 // Mock for Responding GET api/annotations/AID20130808114716 (annot-0001-GET.xml) 26 $.mockjax({ 27 url: '/api/annotations/AID20130808114716', 28 type: 'GET', 29 dataType: 'xml', 30 responseTime: 750, 31 proxy: 'mocks/annot-0001-GET.xml', 32 }); 33 34 // Mock for Responding GET api/annotations/AID20130808124131 (annot-0002-GET.xml) 35 $.mockjax({ 36 url: '/api/annotations/AID20130808124131', 37 type: 'GET', 38 dataType: 'xml', 39 responseTime: 750, 40 proxy: 'mocks/annot-0002-GET.xml', 21 41 }); 22 42 … … 29 49 type: 'GET', 30 50 success: function(xml, textStatus, jqXHR) { 31 // success: function(xml) {32 // can be used if parameters textStatus and jqXHR are not required within the following code block33 51 // success: function(xml) { 52 // can be used if parameters textStatus and jqXHR are not required within the following code block 53 34 54 $xml = $(xml); 35 55 … … 45 65 aidArr.push($(this).attr('ref').substr(29)); // http://dasish.eu/annotations/ is erased 46 66 }); 47 67 48 68 console.log(aidArr); 49 50 for (var i in aidArr) {69 70 for (var i in aidArr) { 51 71 aid_string += '<br />' + aidArr[i]; 52 72 $('#xmlContents').html('<h4 style="margin-bottom: 0;">List of AIDs returned from REST service address<br />GET api/annotations?link="URI":</h4>' + aid_string); 73 url = ""; 74 url = '/api/annotations/' + aidArr[i]; 75 76 $.ajax({ 77 url: url, 78 dataType: 'xml', 79 type: 'GET', 80 success: function(xml) { 81 82 $xml = $(xml); 83 84 var body = ""; 85 $xml.find('annotation').each(function() { 86 body = $(this).find('body').text(); 87 88 $('#xmlContents').append("<br /><br /><strong>Body content of " + aidArr[i] + ":</strong><br /><em>" + body + "</em>"); 89 90 }); 91 92 } 93 }); 94 53 95 } 54 96 55 97 } 98 56 99 }); 57 100 } -
DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service/test/mockjax/mocks/annotations-sagrada-GET.xml
r3332 r3340 18 18 </targetSources> 19 19 </annotation> 20 <!-- 20 21 <annotation ref="http://dasish.eu/annotations/AIDzyy"> 21 22 <owner ref="http://dasish.eu/users/UIDefef"/> … … 25 26 </targetSources> 26 27 </annotation> 28 --> 27 29 </annotations>
Note: See TracChangeset
for help on using the changeset viewer.