Commit 0fcefd6b authored by Romain Courteaud's avatar Romain Courteaud

erp5_gadget_interface_validator: stop relying on appcache

Use the precache script to get the list of gadgets.
Ensure to also check the launcher gadget.

Report subgadget service error.
parent fcae1e17
......@@ -257,8 +257,7 @@
// XXX Load in an iframe
return context.declareGadget('gadget_interface_loader.html', {
scope: gadget_to_check_url,
element: element,
sandbox: 'iframe'
element: element
});
})
.push(function (result) {
......@@ -356,13 +355,21 @@
return this.changeState(options);
})
.onStateChange(function () {
.onStateChange(function (modification_dict) {
var context = this,
required_interface_list = [],
gadget_method_list = [],
error_list = [];
if (modification_dict.hasOwnProperty('gadget_to_check_url')) {
return getOrDeclareGadget(context, context.state.gadget_to_check_url)
/*
.push(undefined, function (error) {
console.warn('oups', error);
context.element.innerHTML = '';
return;
});
*/
.push(function (gadget_to_check) {
// Get the list of interfaces/methods
......@@ -402,7 +409,8 @@
for (i = 0; i < method_table.length; i += 1) {
for (j = 0; j < method_table[i].length; j += 1) {
// Check method declared twice
if (interface_method_list.indexOf(method_table[i][j].name) >= 0) {
if (interface_method_list.indexOf(method_table[i][j].name) >=
0) {
error_list.push({
details: "Method documented in multiple interface\n" +
method_table[i][j].name
......@@ -465,9 +473,21 @@
.push(undefined, function (error) {
console.warn(error);
context.element.firstElementChild.textContent =
"Unexpected error";
"Unexpected error: " + error;
});
}
if (modification_dict.hasOwnProperty('error')) {
console.warn(context.state.error);
context.element.firstElementChild.textContent =
"Unexpected error: " + context.state.error;
}
})
.allowPublicAcquisition('reportServiceError', function (param_list) {
// Subgadget services failed.
// Report it as an error instead of crashing the page
return this.changeState({error: param_list[0]});
});
}(window, rJS, RSVP, DOMParser, jIO, console, document));
\ No newline at end of file
......@@ -150,11 +150,13 @@
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -198,16 +200,20 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -230,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.15264.49528.31470</string> </value>
<value> <string>981.53320.7091.32256</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1544521627.98</float>
<float>1581589017.29</float>
<string>UTC</string>
</tuple>
</state>
......@@ -257,16 +263,20 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -316,7 +326,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*jslint nomen: true, indent: 2, maxerr: 3, maxlen: 80 */
/*global rJS, window*/
(function (window, rJS) {
/*global rJS, window, document*/
(function (window, rJS, document) {
"use strict";
rJS(window)
.declareMethod("declareGadgetToCheck", function (url) {
return this.declareGadget(url, {
scope: 'gadget_to_check'
var div = document.createElement('div'),
gadget = this;
this.element.innerHTML = '';
this.element.appendChild(div);
return gadget.declareGadget(url, {
scope: 'gadget_to_check',
sandbox: 'iframe',
element: div
})
.push(function () {
// Do not return the loaded gadget.
......@@ -29,4 +35,4 @@
});
});
}(window, rJS));
\ No newline at end of file
}(window, rJS, document));
\ No newline at end of file
......@@ -148,11 +148,13 @@
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -196,16 +198,20 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -228,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>970.15515.25000.46984</string> </value>
<value> <string>981.53324.16635.57019</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1536845809.9</float>
<float>1581589224.71</float>
<string>UTC</string>
</tuple>
</state>
......@@ -255,16 +261,20 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -312,7 +322,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -100,79 +100,10 @@
<item>
<key> <string>text_content</string> </key>
<value> <string>CACHE MANIFEST\n
# generated on Thu, 14 Aug 2018 15:31:33 +0000\n
CACHE:\n
favicon.ico\n
font-awesome/font-awesome-webfont.eot\n
font-awesome/font-awesome-webfont.woff\n
font-awesome/font-awesome-webfont.woff2\n
font-awesome/font-awesome-webfont.ttf\n
font-awesome/font-awesome-webfont.svg#fontawesomeregular\n
erp5_launcher_nojqm.js\n
gadget_erp5_nojqm.css\n
gadget_erp5_configure_editor.html\n
gadget_erp5_configure_editor.js\n
gadget_erp5_editor_panel.html\n
gadget_erp5_editor_panel.js\n
gadget_erp5_field_gadget.html\n
gadget_erp5_field_gadget.js\n
gadget_erp5_field_listbox.html\n
gadget_erp5_field_listbox.js\n
gadget_erp5_field_readonly.html\n
gadget_erp5_field_readonly.js\n
gadget_erp5_field_string.html\n
gadget_erp5_field_string.js\n
gadget_erp5_form.html\n
gadget_erp5_form.js\n
gadget_erp5_header.html\n
gadget_erp5_header.js\n
gadget_erp5_label_field.html\n
gadget_erp5_label_field.js\n
gadget_erp5_notification.html\n
gadget_erp5_notification.js\n
gadget_erp5_pt_form_list.html\n
gadget_erp5_pt_form_list.js\n
gadget_erp5_pt_form_view.html\n
gadget_erp5_pt_form_view.js\n
gadget_erp5_router.html\n
gadget_erp5_router.js\n
gadget_erp5_search_editor.html\n
gadget_erp5_search_editor.js\n
gadget_erp5_searchfield.html\n
gadget_erp5_searchfield.js\n
gadget_erp5_sort_editor.html\n
gadget_erp5_sort_editor.js\n
gadget_global.js\n
gadget_html5_element.html\n
gadget_html5_element.js\n
gadget_html5_input.html\n
gadget_html5_input.js\n
gadget_html5_textarea.html\n
gadget_html5_textarea.js\n
gadget_erp5_global.js\n
gadget_jio.html\n
gadget_jio.js\n
gadget_translation.html\n
gadget_translation.js\n
gadget_translation_data.js\n
handlebars.js\n
jiodev.js\n
renderjs.js\n
rsvp.js\n
gadget_erp5_page_validator_report.html\n
gadget_erp5_page_validator_report.js\n
gadget_erp5_page_validator_result_list.html\n
gadget_erp5_page_validator_result_list.js\n
gadget_interface_validator_panel.html\n
gadget_interface_validator_panel.js\n
gadget_interface_validator_jio.html\n
gadget_interface_validator_jio.js\n
gadget_interface.html\n
gadget_interface.js\n
gadget_interface_loader.html\n
gadget_interface_loader.js\n
NETWORK:\n
*</string> </value>
*\n
</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -227,11 +158,13 @@ NETWORK:\n
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -275,16 +208,20 @@ NETWORK:\n
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -307,7 +244,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>970.14054.33498.24268</string> </value>
<value> <string>981.60890.14483.27238</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -325,7 +262,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1536845892.77</float>
<float>1582883829.81</float>
<string>UTC</string>
</tuple>
</state>
......@@ -334,16 +271,20 @@ NETWORK:\n
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -391,7 +332,9 @@ NETWORK:\n
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*global window, rJS, RSVP, jIO, QueryFactory, SimpleQuery */
/*global window, rJS, RSVP, jIO, QueryFactory, SimpleQuery, URL */
/*jslint indent: 2, maxerr: 3, nomen: true */
(function (window, rJS, RSVP, jIO, QueryFactory, SimpleQuery) {
(function (window, rJS, RSVP, jIO, QueryFactory, SimpleQuery, URL) {
"use strict";
//////////////////////////////////////////////
......@@ -12,16 +12,25 @@
return (new RegExp(suffix + '$', 'i')).test(str);
}
function fetchAppcacheData(appcache_url) {
function fetchPrecacheData(precache_url) {
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
url: appcache_url,
dataType: 'text'
url: precache_url,
dataType: 'json'
});
})
.push(function (evt) {
return evt.target.responseText.split('\n');
var key,
precache_dict = evt.target.response,
result_list = [],
precache_absolute_url = (new URL(precache_url, window.location)).href;
for (key in precache_dict) {
if (precache_dict.hasOwnProperty(key)) {
result_list.push((new URL(key, precache_absolute_url)).href);
}
}
return result_list;
});
}
......@@ -32,8 +41,8 @@
var gadget_list = [],
i;
for (i = 0; i < filename_list.length; i += 1) {
if (endsWith(filename_list[i], '.html') &&
(filename_list[i][0] !== '#')) {
if (endsWith(filename_list[i], '.html') ||
endsWith(filename_list[i], '/')) {
gadget_list.push(filename_list[i]);
}
}
......@@ -66,11 +75,11 @@
InterfaceValidatorStorage.prototype.buildQuery = function (options) {
// XXX HARDCODED
var query = QueryFactory.create(options.query || '');
if (!((query instanceof SimpleQuery) && (query.key === 'appcache_url'))) {
if (!((query instanceof SimpleQuery) && (query.key === 'precache_url'))) {
// Only accept simple query with an appcache_url
return [];
}
return fetchAppcacheData(query.value)
return fetchPrecacheData(query.value)
// return fetchAppcacheData('gadget_interface_validator_test.appcache')
.push(function (filename_list) {
return filterGadgetList(filename_list);
......@@ -123,4 +132,4 @@
return wrapJioCall(this, 'get', arguments);
});
}(window, rJS, RSVP, jIO, QueryFactory, SimpleQuery));
\ No newline at end of file
}(window, rJS, RSVP, jIO, QueryFactory, SimpleQuery, URL));
\ No newline at end of file
......@@ -148,11 +148,13 @@
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -196,16 +198,20 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -228,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>968.34342.13291.34082</string> </value>
<value> <string>981.51931.38103.24746</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1530196276.82</float>
<float>1581590120.37</float>
<string>UTC</string>
</tuple>
</state>
......@@ -255,16 +261,20 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -312,7 +322,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -93,7 +93,7 @@
"list_method": "portal_catalog",
"query": "urn:jio:allDocs",
"portal_type": [],
"search_column_list": [['appcache_url', 'Appcache']],
"search_column_list": [['precache_url', 'Precache']],
"sort_column_list": [],
"sort": [],
"title": "Gadgets",
......
......@@ -148,11 +148,13 @@
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -196,16 +198,20 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -228,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.15241.36748.63146</string> </value>
<value> <string>977.38881.34981.23125</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1544537143.01</float>
<float>1581503610.2</float>
<string>UTC</string>
</tuple>
</state>
......@@ -255,16 +261,20 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -312,7 +322,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -289,6 +289,26 @@
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_precache_manifest_url_list</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>configuration_service_worker_url</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
......@@ -355,18 +375,28 @@
</item>
<item>
<key> <string>configuration_manifest_url</string> </key>
<value> <string>gadget_interface_validator.appcache</string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>configuration_panel_gadget_url</string> </key>
<value> <string>gadget_interface_validator_panel.html</string> </value>
</item>
<item>
<key> <string>configuration_precache_manifest_url_list</string> </key>
<value> <string>WebSection_getInterfaceValidatorPrecacheManifest</string> </value>
</item>
<item>
<key> <string>configuration_router_gadget_url</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>configuration_service_worker_url</string> </key>
<value> <string>gadget_erp5_serviceworker.js</string> </value>
</item>
<item>
<key> <string>configuration_stylesheet_url</string> </key>
<value>
......@@ -540,11 +570,13 @@
</record>
<record id="9" aka="AAAAAAAAAAk=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -588,16 +620,20 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="10" aka="AAAAAAAAAAo=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -620,7 +656,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>968.34333.9892.31675</string> </value>
<value> <string>982.9379.31736.51558</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -638,7 +674,7 @@
</tuple>
<state>
<tuple>
<float>1530201187.52</float>
<float>1582884975.52</float>
<string>UTC</string>
</tuple>
</state>
......@@ -647,7 +683,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_gadget_interface_validator</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# Add all ERP5JS gadget
url_list = [
'gadget_erp5_page_validator_report.html',
'gadget_erp5_page_validator_report.js',
'gadget_erp5_page_validator_result_list.html',
'gadget_erp5_page_validator_result_list.js',
'gadget_interface_validator_panel.html',
'gadget_interface_validator_panel.js',
'gadget_interface_validator_jio.html',
'gadget_interface_validator_jio.js',
'gadget_interface.html',
'gadget_interface.js',
'gadget_interface_loader.html',
'gadget_interface_loader.js',
]
if REQUEST is not None:
import json
REQUEST.RESPONSE.setHeader('Content-Type', 'application/json')
return json.dumps(dict.fromkeys(url_list), indent=2)
return url_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_getInterfaceValidatorPrecacheManifest</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_gadget_interface_validator
erp5_web_renderjs_ui_unsafe
\ No newline at end of file
......@@ -10,8 +10,8 @@
<tr><td rowspan="1" colspan="3">Test Gadget Interface Validation UI</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<tal:block tal:define="check_configuration python: {'app_cache_reference': 'gadget_interface_validator_test.appcache',
'gadget_count': 8}">
<tal:block tal:define="check_configuration python: {'precache_reference': './WebSection_getInterfaceValidatorTestPrecacheManifest',
'gadget_count': 9}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUiInterface/macros/run_app_interface_check" />
</tal:block>
......@@ -21,7 +21,7 @@
<tr>
<td>assertText</td>
<td>//tbody/tr/td</td>
<td>gadget_interface_validator_test_correct_implemented_gadget.html</td>
<td>*/gadget_interface_validator_test_correct_implemented_gadget.html</td>
</tr>
<tr>
<td>assertText</td>
......@@ -30,26 +30,26 @@
</tr>
<tr>
<td colspan="3"><b>Check interface with invalid syntax</b></td>
<td colspan="3"><b>Check failing service</b></td>
</tr>
<tr>
<td>assertText</td>
<td>//tbody/tr[2]/td</td>
<td>gadget_interface_validator_test_invalid_interface_gadget.html</td>
<td>*/gadget_interface_validator_test_failing_service_gadget.html</td>
</tr>
<tr>
<td>assertText</td>
<td>//tbody/tr[2]/td[2]</td>
<td>Failure</td>
<td>Unexpected error*</td>
</tr>
<tr>
<td colspan="3"><b>Check missing interface</b></td>
<td colspan="3"><b>Check interface with invalid syntax</b></td>
</tr>
<tr>
<td>assertText</td>
<td>//tbody/tr[3]/td</td>
<td>gadget_interface_validator_test_missing_interface_declaration_gadget.html</td>
<td>*/gadget_interface_validator_test_invalid_interface_gadget.html</td>
</tr>
<tr>
<td>assertText</td>
......@@ -58,12 +58,12 @@
</tr>
<tr>
<td colspan="3"><b>Check missing method declaration</b></td>
<td colspan="3"><b>Check missing interface</b></td>
</tr>
<tr>
<td>assertText</td>
<td>//tbody/tr[4]/td</td>
<td>gadget_interface_validator_test_missing_method_declaration_gadget.html</td>
<td>*/gadget_interface_validator_test_missing_interface_declaration_gadget.html</td>
</tr>
<tr>
<td>assertText</td>
......@@ -72,40 +72,40 @@
</tr>
<tr>
<td colspan="3"><b>Check correct use case for multiple interface</b></td>
<td colspan="3"><b>Check missing method declaration</b></td>
</tr>
<tr>
<td>assertText</td>
<td>//tbody/tr[5]/td</td>
<td>gadget_interface_validator_test_multiple_interface_correct_implemented_gadget.html</td>
<td>*/gadget_interface_validator_test_missing_method_declaration_gadget.html</td>
</tr>
<tr>
<td>assertText</td>
<td>//tbody/tr[5]/td[2]</td>
<td>Success</td>
<td>Failure</td>
</tr>
<tr>
<td colspan="3"><b>Check duplicated method name declaration</b></td>
<td colspan="3"><b>Check correct use case for multiple interface</b></td>
</tr>
<tr>
<td>assertText</td>
<td>//tbody/tr[6]/td</td>
<td>gadget_interface_validator_test_multiple_interface_duplicated_method_name.html</td>
<td>*/gadget_interface_validator_test_multiple_interface_correct_implemented_gadget.html</td>
</tr>
<tr>
<td>assertText</td>
<td>//tbody/tr[6]/td[2]</td>
<td>Failure</td>
<td>Success</td>
</tr>
<tr>
<td colspan="3"><b>Check not existent gadget</b></td>
<td colspan="3"><b>Check duplicated method name declaration</b></td>
</tr>
<tr>
<td>assertText</td>
<td>//tbody/tr[7]/td</td>
<td>gadget_interface_validator_test_nonexistent_gadget.html</td>
<td>*/gadget_interface_validator_test_multiple_interface_duplicated_method_name.html</td>
</tr>
<tr>
<td>assertText</td>
......@@ -114,12 +114,12 @@
</tr>
<tr>
<td colspan="3"><b>Check unknown method declaration</b></td>
<td colspan="3"><b>Check not existent gadget</b></td>
</tr>
<tr>
<td>assertText</td>
<td>//tbody/tr[8]/td</td>
<td>gadget_interface_validator_test_unknown_method_declaration_gadget.html</td>
<td>*/gadget_interface_validator_test_nonexistent_gadget.html</td>
</tr>
<tr>
<td>assertText</td>
......@@ -127,6 +127,20 @@
<td>Failure</td>
</tr>
<tr>
<td colspan="3"><b>Check unknown method declaration</b></td>
</tr>
<tr>
<td>assertText</td>
<td>//tbody/tr[9]/td</td>
<td>*/gadget_interface_validator_test_unknown_method_declaration_gadget.html</td>
</tr>
<tr>
<td>assertText</td>
<td>//tbody/tr[9]/td[2]</td>
<td>Failure</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Unknown method declaration Test Gadget</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="http://www.renderjs.org/rel/interface" href="gadget_interface_validator_test_dummy_interface1.html">
<!-- renderjs -->
<script src="rsvp.js" type="text/javascript"></script>
<script src="renderjs.js" type="text/javascript"></script>
<!-- custom script -->
<script src="gadget_interface_validator_test_failing_service_gadget.js" type="text/javascript"></script>
</head>
<body> </body>
</html>
\ No newline at end of file
......@@ -2,7 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Web Manifest" module="erp5.portal_type"/>
<global name="Web Page" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
......@@ -16,7 +16,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -59,7 +58,6 @@
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
......@@ -69,9 +67,13 @@
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>gadget_interface_validator_test.appcache</string> </value>
<value> <string>gadget_interface_validator_test_failing_service_gadget.html</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -81,7 +83,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>gadget_test_interface_validator_appcache</string> </value>
<value> <string>gadget_test_interface_validator_failing_service_declaration_gadget_html</string> </value>
</item>
<item>
<key> <string>language</string> </key>
......@@ -89,7 +91,7 @@
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Web Manifest</string> </value>
<value> <string>Web Page</string> </value>
</item>
<item>
<key> <string>short_title</string> </key>
......@@ -97,42 +99,9 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>CACHE MANIFEST\n
# generated on Fri, 14 Jun 2018 15:31:33 +0000\n
# XXX + fonts\n
# images/ajax-loader.gif\n
CACHE:\n
URI.js\n
gadget_interface_validator_test_correct_implemented_gadget.html\n
gadget_interface_validator_test_correct_implemented_gadget.js\n
gadget_interface_validator_test_nonexistent_gadget.html\n
gadget_interface_validator_test_nonexistent_gadget.js\n
gadget_interface_validator_test_invalid_interface_gadget.html\n
gadget_interface_validator_test_invalid_interface_gadget.js\n
gadget_interface_validator_test_missing_interface_declaration_gadget.html\n
gadget_interface_validator_test_missing_interface_declaration_gadget.js\n
gadget_interface_validator_test_missing_method_declaration_gadget.html\n
gadget_interface_validator_test_missing_method_declaration_gadget.js\n
gadget_interface_validator_test_multiple_interface_correct_implemented_gadget.html\n
gadget_interface_validator_test_multiple_interface_correct_implemented_gadget.js\n
gadget_interface_validator_test_multiple_interface_duplicated_method_name.html\n
gadget_interface_validator_test_multiple_interface_duplicated_method_name.js\n
gadget_interface_validator_test_unknown_method_declaration_gadget.html\n
gadget_interface_validator_test_unknown_method_declaration_gadget.js\n
i18next.js\n
jquery.js\n
jquerymobile.css\n
jquerymobile.js\n
renderjs.js\n
rsvp.js\n
NETWORK:\n
*</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Gadget Interface Validator AppCache</string> </value>
<value> <string>Failing Service Test Gadget</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -183,11 +152,13 @@ NETWORK:\n
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -218,7 +189,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1444205829.99</float>
<float>1582887029.56</float>
<string>UTC</string>
</tuple>
</state>
......@@ -231,16 +202,20 @@ NETWORK:\n
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -263,7 +238,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>970.12316.58397.42922</string> </value>
<value> <string>982.9424.56173.15360</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -281,7 +256,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1536652656.93</float>
<float>1582887418.26</float>
<string>UTC</string>
</tuple>
</state>
......@@ -290,16 +265,20 @@ NETWORK:\n
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -338,7 +317,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1444205653.55</float>
<float>1582886865.59</float>
<string>UTC</string>
</tuple>
</state>
......@@ -347,7 +326,9 @@ NETWORK:\n
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
/*global window, rJS , RSVP*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
(function (window, rJS) {
"use strict";
rJS(window)
.ready(function (g) {
g.props = {};
})
.declareMethod("method1", function (param1, param2) {
return;
})
.declareMethod("method2", function (param1) {
return;
})
.declareMethod("method3", function () {
return;
})
.declareMethod("method4", function () {
return;
})
.declareService(function () {
throw new Error('boom');
});
}(window, rJS));
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_gadget_interface_validator_ui_test</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# Add all ERP5JS gadget
url_list = [
'gadget_interface_validator_test_correct_implemented_gadget.html',
'gadget_interface_validator_test_correct_implemented_gadget.js',
'gadget_interface_validator_test_nonexistent_gadget.html',
'gadget_interface_validator_test_nonexistent_gadget.js',
'gadget_interface_validator_test_invalid_interface_gadget.html',
'gadget_interface_validator_test_invalid_interface_gadget.js',
'gadget_interface_validator_test_missing_interface_declaration_gadget.html',
'gadget_interface_validator_test_missing_interface_declaration_gadget.js',
'gadget_interface_validator_test_missing_method_declaration_gadget.html',
'gadget_interface_validator_test_missing_method_declaration_gadget.js',
'gadget_interface_validator_test_multiple_interface_correct_implemented_gadget.html',
'gadget_interface_validator_test_multiple_interface_correct_implemented_gadget.js',
'gadget_interface_validator_test_multiple_interface_duplicated_method_name.html',
'gadget_interface_validator_test_multiple_interface_duplicated_method_name.js',
'gadget_interface_validator_test_unknown_method_declaration_gadget.html',
'gadget_interface_validator_test_unknown_method_declaration_gadget.js',
'gadget_interface_validator_test_failing_service_gadget.html',
'gadget_interface_validator_test_failing_service_gadget.js'
]
if REQUEST is not None:
import json
REQUEST.RESPONSE.setHeader('Content-Type', 'application/json')
return json.dumps(dict.fromkeys(url_list), indent=2)
return url_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_getInterfaceValidatorTestPrecacheManifest</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
erp5_gadget_interface_validator_ui_test
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment