Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lukas Niegsch
erp5
Commits
c60f541d
Commit
c60f541d
authored
Jul 30, 2015
by
Vivek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renderjs_interfaces: syntax update.
parent
01d900a2
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
515 additions
and
148 deletions
+515
-148
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_demo_interface1_html.xml
...teItem/web_page_module/interface_demo_interface1_html.xml
+4
-4
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_demo_interface2_html.xml
...teItem/web_page_module/interface_demo_interface2_html.xml
+4
-4
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_demo_interface_invalid1_html.xml
...eb_page_module/interface_demo_interface_invalid1_html.xml
+4
-4
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_demo_interface_invalid2_html.xml
...eb_page_module/interface_demo_interface_invalid2_html.xml
+3
-3
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_demo_interface_invalid3_html.xml
...eb_page_module/interface_demo_interface_invalid3_html.xml
+4
-4
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_gadget_interfacedemo_html.xml
...m/web_page_module/interface_gadget_interfacedemo_html.xml
+2
-5
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_gadget_interfacedemo_js.xml
...tem/web_page_module/interface_gadget_interfacedemo_js.xml
+3
-3
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_gadget_interfaces_js.xml
...teItem/web_page_module/interface_gadget_interfaces_js.xml
+49
-39
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_demo_interface1_html.xml
...teItem/web_page_module/interface_demo_interface1_html.xml
+4
-4
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_demo_interface2_html.xml
...teItem/web_page_module/interface_demo_interface2_html.xml
+4
-4
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_demo_interface_invalid1_html.xml
...eb_page_module/interface_demo_interface_invalid1_html.xml
+4
-4
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_demo_interface_invalid2_html.xml
...eb_page_module/interface_demo_interface_invalid2_html.xml
+3
-3
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_demo_interface_invalid3_html.xml
...eb_page_module/interface_demo_interface_invalid3_html.xml
+4
-4
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_gadget_interfaces_js.xml
...teItem/web_page_module/interface_gadget_interfaces_js.xml
+49
-39
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_test_gadget.xml
...athTemplateItem/web_page_module/interface_test_gadget.xml
+358
-0
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_test_gadget_js.xml
...TemplateItem/web_page_module/interface_test_gadget_js.xml
+10
-18
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_test_mismatched_argument_gadget_js.xml
...e_module/interface_test_mismatched_argument_gadget_js.xml
+3
-3
bt5/erp5_web_interface_test/PathTemplateItem/web_site_module/interface_test.xml
..._test/PathTemplateItem/web_site_module/interface_test.xml
+3
-3
No files found.
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_demo_interface1_html.xml
View file @
c60f541d
...
...
@@ -130,8 +130,8 @@
</dd>
\n
<dt>
method3
</dt>
\n
<dd>
description of method3
</dd>
\n
<dl></dl>
\n
</dl>
\n
<dl></dl>
\n
</dl>
\n
</body>
\n
</html>
...
...
@@ -270,7 +270,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.
23279.6717.16810
</string>
</value>
<value>
<string>
944.
38727.13625.36864
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -288,7 +288,7 @@
</tuple>
<state>
<tuple>
<float>
143
7729072.46
</float>
<float>
143
8006894.41
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_demo_interface2_html.xml
View file @
c60f541d
...
...
@@ -115,7 +115,7 @@
<dl>
\n
<dt>
testmethod1
</dt>
\n
<dd>
description of testmethod1
</dd>
\n
<dl></dl>
\n
<dl></dl>
\n
<dt>
testmethod2
</dt>
\n
<dd>
description of testmethod2
</dd>
\n
<dl>
\n
...
...
@@ -131,7 +131,7 @@
<dt
data-parameter-required=
"optional"
>
param2
</dt>
\n
<dd>
description of param2
</dd>
\n
</dl>
\n
</dl>
\n
</dl>
\n
</body>
\n
</html>
...
...
@@ -270,7 +270,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.
22909.64597.48196
</string>
</value>
<value>
<string>
944.
38727.37060.50432
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -288,7 +288,7 @@
</tuple>
<state>
<tuple>
<float>
143
7729093.91
</float>
<float>
143
8006945.77
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_demo_interface_invalid1_html.xml
View file @
c60f541d
...
...
@@ -132,8 +132,8 @@
</dd>
\n
<dt>
method3
</dt>
\n
<dd>
description of method3
</dd>
\n
<dl></dl>
\n
</dl>
\n
<dl></dl>
\n
</dl>
\n
</body>
\n
</html>
...
...
@@ -272,7 +272,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.387
47.4525.18602
</string>
</value>
<value>
<string>
944.387
63.51422.46455
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -290,7 +290,7 @@
</tuple>
<state>
<tuple>
<float>
143
7730636.54
</float>
<float>
143
8007018.31
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_demo_interface_invalid2_html.xml
View file @
c60f541d
...
...
@@ -133,7 +133,7 @@
\n
<!--Missing <dl></dl> tag for arguments-->
\n
\n
</dl>
\n
</dl>
\n
</body>
\n
</html>
...
...
@@ -272,7 +272,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.387
51.9712.8123
</string>
</value>
<value>
<string>
944.387
63.45191.41369
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -290,7 +290,7 @@
</tuple>
<state>
<tuple>
<float>
143
7730590.39
</float>
<float>
143
8007084.42
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_demo_interface_invalid3_html.xml
View file @
c60f541d
...
...
@@ -132,8 +132,8 @@
</dd>
\n
<dt>
method3
</dt>
\n
<dd>
description of method3
</dd>
\n
<dl></dl>
\n
</dl>
\n
<dl></dl>
\n
</dl>
\n
</body>
\n
</html>
...
...
@@ -272,7 +272,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.387
54.38729.2158
9
</string>
</value>
<value>
<string>
944.387
63.48521.4363
9
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -290,7 +290,7 @@
</tuple>
<state>
<tuple>
<float>
143
7730820.31
</float>
<float>
143
8007104.6
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_gadget_interfacedemo_html.xml
View file @
c60f541d
...
...
@@ -112,9 +112,6 @@
<title>
I-Demo
</title>
\n
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
\n
<link
rel=
"stylesheet"
href=
"jquerymobile.css"
>
\n
\n
<link
rel=
"http://www.renderjs.org/rel/interface"
href=
"demo_interface1.html"
>
\n
<link
rel=
"http://www.renderjs.org/rel/interface"
href=
"demo_interface2.html"
>
\n
\n
<!-- renderjs -->
\n
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
\n
...
...
@@ -323,7 +320,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.43
289.51727.28569
</string>
</value>
<value>
<string>
944.43
346.53030.10871
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -341,7 +338,7 @@
</tuple>
<state>
<tuple>
<float>
14380
06248.54
</float>
<float>
14380
73929.05
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_gadget_interfacedemo_js.xml
View file @
c60f541d
...
...
@@ -106,7 +106,7 @@
\n
var INTERFACE_GADGET_URL = "./gadget_interfaces.html",\n
INTERFACE_GADGET_SCOPE = "interface";\n
\n
\n
rJS(window)\n
.ready(function (g) {\n
g.props = {};\n
...
...
@@ -326,7 +326,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.4306
1.11797.41233
</string>
</value>
<value>
<string>
944.4306
2.44277.6144
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -344,7 +344,7 @@
</tuple>
<state>
<tuple>
<float>
143
7989200.5
3
</float>
<float>
143
8007247.0
3
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_demo/PathTemplateItem/web_page_module/interface_gadget_interfaces_js.xml
View file @
c60f541d
...
...
@@ -155,7 +155,7 @@
var VERIFY_GADGET_SCOPE = "verify_gadget";\n
\n
function getVerifyGadget(gadget_url, interface_gadget) {\n
//to declare and get the gadget to be verified.\n
//to declare and get the gadget to be verified.\n
return new RSVP.Queue()\n
.push(function () {\n
return interface_gadget.declareGadget(gadget_url, {\n
...
...
@@ -169,7 +169,7 @@
}\n
\n
function verifyInterfaceDefinition(interface_url) {\n
//to verify if interface definition follows the correct template.\n
//to verify if interface definition follows the correct template.\n
return RSVP.Queue()\n
.push(function () {\n
return jQuery.get(interface_url);\n
...
...
@@ -179,12 +179,13 @@
dl_list = doc.getElementsByTagName(\'dl\'),\n
next_element = dl_list[0].firstElementChild,\n
method_len = dl_list.length - 1,\n
defer = RSVP.defer();\n
defer = RSVP.defer(),\n
i;\n
if (dl_list[0].childElementCount !== 3*method_len) {\n
throw new Error("Interface Definition Incorrect.");\n
}
\n
}\n
try {\n
for (
var i=0; i<method_len; i+=
1) {\n
for (
i = 0; i < method_len; i +=
1) {\n
if ((!next_element || next_element.localName.toLowerCase() !== \'dt\') ||\n
(!(next_element = next_element.nextElementSibling) || next_element.localName.toLowerCase() !== \'dd\') ||\n
(!(next_element = next_element.nextElementSibling) || next_element.localName.toLowerCase() !== \'dl\')) {\n
...
...
@@ -194,8 +195,9 @@
throw new Error("Interface Definition Incorrect.");\n
}\n
var argument_len = next_element.getElementsByTagName(\'dt\').length,\n
next_child_element = next_element.firstElementChild;\n
for (var j=0; j<argument_len; j+=1) {\n
next_child_element = next_element.firstElementChild,\n
j;\n
for (j = 0; j < argument_len; j += 1) {\n
if ((!next_child_element || next_child_element.localName.toLowerCase() !== \'dt\') ||\n
(!(next_child_element = next_child_element.nextElementSibling) || next_child_element.localName.toLowerCase() !== \'dd\')) {\n
throw new Error("Interface Definition Incorrect.");\n
...
...
@@ -207,13 +209,13 @@
defer.resolve("Success");\n
} catch(error) {\n
defer.reject(error);\n
}
\n
}\n
return defer.promise;\n
});\n
}\n
\n
function verifyInterfaceDeclaration(interface_url, declared_interface_list) {\n
//to verify if gadget declares the interface.\n
//to verify if gadget declares the interface.\n
var defer = RSVP.defer();\n
try {\n
if (declared_interface_list.indexOf(interface_url) >
-1) {\n
...
...
@@ -228,7 +230,7 @@
}\n
\n
function verifyAllMethod(interface_method_list, gadget_method_list) {\n
//to verify all methods of gadget and interface.\n
//to verify all methods of gadget and interface.\n
var defer = RSVP.defer();\n
return RSVP.Queue()\n
.push(function() {\n
...
...
@@ -247,15 +249,16 @@
}\n
\n
function verifyAllMethodDeclared(interface_method_list, gadget_method_list) {\n
//to verify if all the interface methods are declared by the gadget.\n
//to verify if all the interface methods are declared by the gadget.\n
var defer = RSVP.defer(),\n
gadget_method_name_list = gadget_method_list,\n
interface_method_name_list = [];\n
for (var i=0; i
<interface_method_list.length
;
i+=1)
{\n
interface_method_name_list = [],\n
i, j;\n
for (i = 0; i
< interface_method_list.length
;
i
+=
1)
{\n
interface_method_name_list.push(interface_method_list[i].name);\n
}\n
try
{\n
for
(
var
j=
0;
j<interface_method_name_list.length;
j+=
1)
{\n
for
(
j =
0;
j
<
interface_method_name_list.length;
j
+=
1)
{\n
if(gadget_method_name_list.indexOf(interface_method_name_list[j])
<
0)
{\n
throw
new
Error("All
methods
are
not
declared.");\n
}\n
...
...
@@ -268,19 +271,21 @@
}\n
\n
function
verifyAllMethodSignature(interface_method_list,
gadget_method_list)
{\n
//to
verify
if
all
the
declared
methods
match
the
signature
of
the
interface
methods.\n
//to
verify
if
all
the
declared
methods
match
the
signature
of
the
interface
methods.\n
var
defer =
RSVP.defer(),\n
interface_method_dict =
{},\n
gadget_method_name_list =
[],\n
index;\n
for(var
i=
0;
i<interface_method_list.length;
i+=1)
{\n
index,\n
item,\n
i,
j;\n
for(
i =
0;
i
<
interface_method_list.length;
i
+=
1)
{\n
interface_method_dict[interface_method_list[i].name]
=
interface_method_list[i];\n
}\n
for(
var
j=
0;
j<gadget_method_list.length;
j+=
1)
{\n
for(
j =
0;
j
<
gadget_method_list.length;
j
+=
1)
{\n
gadget_method_name_list.push(gadget_method_list[j].name);\n
}\n
try
{\n
for(
var
item
in
interface_method_dict)
{\n
for(item
in
interface_method_dict)
{\n
index =
gadget_method_name_list.lastIndexOf(item);\n
if(!verifyMethodSignature(interface_method_dict[item],
gadget_method_list[index]))
{\n
throw
new
Error("All
methods
signature
do
not
match.");\n
...
...
@@ -294,12 +299,13 @@
}\n
\n
function
verifyMethodSignature(interface_method,
gadget_method)
{\n
//to
verify
if
two
methods
have
the
same
signature\n
//to
verify
if
two
methods
have
the
same
signature\n
var
max_arg_len =
interface_method.argument_list.length,\n
min_arg_len =
0;\n
min_arg_len =
0,\n
i;\n
if
(max_arg_len)
{\n
var
argument_list =
interface_method.argument_list;\n
for
(
var
i=
0;
i<argument_list.length;
i+=
1)
{\n
for
(
i =
0;
i
<
argument_list.length;
i
+=
1)
{\n
if
(argument_list[i].required)
{\n
min_arg_len
+=
1;\n
}\n
...
...
@@ -350,25 +356,27 @@
dt_list = doc.getElementsByTagName(\'dt\'),\n
dd_list = doc.getElementsByTagName(\'dd\'),\n
method_len = dl_list.length - 1,\n
dt_count = 0, \n
dl_count = 1;\n
dt_count = 0,\n
dl_count = 1,\n
i;\n
interface_data.name = doc.getElementsByTagName(\'h1\')[0].innerText;\n
interface_data.description = doc.getElementsByTagName(\'h3\')[0].innerText;\n
for (
var i=0; i
<method_len
;
i+=
1)
{\n
for (
i = 0; i
< method_len
;
i
+=
1)
{\n
var
method =
{\n
name:
dt_list[dt_count].innerText,\n
description:
dd_list[dt_count].innerText,\n
argument_list:
[]\n
name:
dt_list[dt_count].innerText,\n
description:
dd_list[dt_count].innerText,\n
argument_list:
[]\n
},\n
argument_len =
dl_list[dl_count].getElementsByTagName(\'dt\').length;\n
argument_len =
dl_list[dl_count].getElementsByTagName(\'dt\').length,\n
j;\n
dt_count
+=
1;\n
dl_count
+=
1;\n
for
(
var
j=
0;
j<argument_len;
j+=
1)
{\n
for
(
j =
0;
j
<
argument_len;
j
+=
1)
{\n
var
argument_item =
{\n
name:
dt_list[dt_count].innerText,\n
description:
dd_list[dt_count].innerText,\n
required:
dt_list[dt_count].getAttribute("data-parameter-required")
===
"optional"
?
false:true,\n
type:
dt_list[dt_count].getAttribute("data-parameter-type")\n
name:
dt_list[dt_count].innerText,\n
description:
dd_list[dt_count].innerText,\n
required:
dt_list[dt_count].getAttribute("data-parameter-required")
===
"optional"
?
false:true,\n
type:
dt_list[dt_count].getAttribute("data-parameter-type")\n
};\n
dt_count
+=
1;\n
method.argument_list.push(argument_item);\n
...
...
@@ -438,15 +446,17 @@
})\n
.push(function
(declared_interface_list)
{\n
var
interface_url,\n
result_list =
[];\n
for
(var
item
in
declared_interface_list)
{\n
result_list =
[],\n
item;\n
for
(item
in
declared_interface_list)
{\n
interface_url =
declared_interface_list[item];\n
result_list.push(interface_gadget.verifyGadgetInterfaceImplementation(gadget_url,
interface_url));\n
}\n
return
RSVP.all(result_list);\n
})\n
.push(function(result_list)
{\n
for(var
item
in
result_list)
{\n
var
item;\n
for(item
in
result_list)
{\n
if
(!result_list[item])
{\n
throw
new
Error("Interface
Implementation
Failure.");\n
}\n
...
...
@@ -596,7 +606,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.4
3313.24628.20019
</string>
</value>
<value>
<string>
944.4
6238.52656.22988
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -614,7 +624,7 @@
</tuple>
<state>
<tuple>
<float>
1438
006033.5
</float>
<float>
1438
180072.6
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_demo_interface1_html.xml
View file @
c60f541d
...
...
@@ -130,8 +130,8 @@
</dd>
\n
<dt>
method3
</dt>
\n
<dd>
description of method3
</dd>
\n
<dl></dl>
\n
</dl>
\n
<dl></dl>
\n
</dl>
\n
</body>
\n
</html>
...
...
@@ -270,7 +270,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.
23279.6717.16810
</string>
</value>
<value>
<string>
944.
38727.13625.36864
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -288,7 +288,7 @@
</tuple>
<state>
<tuple>
<float>
143
7729072.46
</float>
<float>
143
8006894.41
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_demo_interface2_html.xml
View file @
c60f541d
...
...
@@ -115,7 +115,7 @@
<dl>
\n
<dt>
testmethod1
</dt>
\n
<dd>
description of testmethod1
</dd>
\n
<dl></dl>
\n
<dl></dl>
\n
<dt>
testmethod2
</dt>
\n
<dd>
description of testmethod2
</dd>
\n
<dl>
\n
...
...
@@ -131,7 +131,7 @@
<dt
data-parameter-required=
"optional"
>
param2
</dt>
\n
<dd>
description of param2
</dd>
\n
</dl>
\n
</dl>
\n
</dl>
\n
</body>
\n
</html>
...
...
@@ -270,7 +270,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.
22909.64597.48196
</string>
</value>
<value>
<string>
944.
38727.37060.50432
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -288,7 +288,7 @@
</tuple>
<state>
<tuple>
<float>
143
7729093.91
</float>
<float>
143
8006945.77
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_demo_interface_invalid1_html.xml
View file @
c60f541d
...
...
@@ -132,8 +132,8 @@
</dd>
\n
<dt>
method3
</dt>
\n
<dd>
description of method3
</dd>
\n
<dl></dl>
\n
</dl>
\n
<dl></dl>
\n
</dl>
\n
</body>
\n
</html>
...
...
@@ -272,7 +272,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.387
47.4525.18602
</string>
</value>
<value>
<string>
944.387
63.51422.46455
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -290,7 +290,7 @@
</tuple>
<state>
<tuple>
<float>
143
7730636.54
</float>
<float>
143
8007018.31
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_demo_interface_invalid2_html.xml
View file @
c60f541d
...
...
@@ -133,7 +133,7 @@
\n
<!--Missing <dl></dl> tag for arguments-->
\n
\n
</dl>
\n
</dl>
\n
</body>
\n
</html>
...
...
@@ -272,7 +272,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.387
51.9712.8123
</string>
</value>
<value>
<string>
944.387
63.45191.41369
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -290,7 +290,7 @@
</tuple>
<state>
<tuple>
<float>
143
7730590.39
</float>
<float>
143
8007084.42
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_demo_interface_invalid3_html.xml
View file @
c60f541d
...
...
@@ -132,8 +132,8 @@
</dd>
\n
<dt>
method3
</dt>
\n
<dd>
description of method3
</dd>
\n
<dl></dl>
\n
</dl>
\n
<dl></dl>
\n
</dl>
\n
</body>
\n
</html>
...
...
@@ -272,7 +272,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.387
54.38729.2158
9
</string>
</value>
<value>
<string>
944.387
63.48521.4363
9
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -290,7 +290,7 @@
</tuple>
<state>
<tuple>
<float>
143
7730820.31
</float>
<float>
143
8007104.6
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_gadget_interfaces_js.xml
View file @
c60f541d
...
...
@@ -155,7 +155,7 @@
var VERIFY_GADGET_SCOPE = "verify_gadget";\n
\n
function getVerifyGadget(gadget_url, interface_gadget) {\n
//to declare and get the gadget to be verified.\n
//to declare and get the gadget to be verified.\n
return new RSVP.Queue()\n
.push(function () {\n
return interface_gadget.declareGadget(gadget_url, {\n
...
...
@@ -169,7 +169,7 @@
}\n
\n
function verifyInterfaceDefinition(interface_url) {\n
//to verify if interface definition follows the correct template.\n
//to verify if interface definition follows the correct template.\n
return RSVP.Queue()\n
.push(function () {\n
return jQuery.get(interface_url);\n
...
...
@@ -179,12 +179,13 @@
dl_list = doc.getElementsByTagName(\'dl\'),\n
next_element = dl_list[0].firstElementChild,\n
method_len = dl_list.length - 1,\n
defer = RSVP.defer();\n
defer = RSVP.defer(),\n
i;\n
if (dl_list[0].childElementCount !== 3*method_len) {\n
throw new Error("Interface Definition Incorrect.");\n
}
\n
}\n
try {\n
for (
var i=0; i<method_len; i+=
1) {\n
for (
i = 0; i < method_len; i +=
1) {\n
if ((!next_element || next_element.localName.toLowerCase() !== \'dt\') ||\n
(!(next_element = next_element.nextElementSibling) || next_element.localName.toLowerCase() !== \'dd\') ||\n
(!(next_element = next_element.nextElementSibling) || next_element.localName.toLowerCase() !== \'dl\')) {\n
...
...
@@ -194,8 +195,9 @@
throw new Error("Interface Definition Incorrect.");\n
}\n
var argument_len = next_element.getElementsByTagName(\'dt\').length,\n
next_child_element = next_element.firstElementChild;\n
for (var j=0; j<argument_len; j+=1) {\n
next_child_element = next_element.firstElementChild,\n
j;\n
for (j = 0; j < argument_len; j += 1) {\n
if ((!next_child_element || next_child_element.localName.toLowerCase() !== \'dt\') ||\n
(!(next_child_element = next_child_element.nextElementSibling) || next_child_element.localName.toLowerCase() !== \'dd\')) {\n
throw new Error("Interface Definition Incorrect.");\n
...
...
@@ -207,13 +209,13 @@
defer.resolve("Success");\n
} catch(error) {\n
defer.reject(error);\n
}
\n
}\n
return defer.promise;\n
});\n
}\n
\n
function verifyInterfaceDeclaration(interface_url, declared_interface_list) {\n
//to verify if gadget declares the interface.\n
//to verify if gadget declares the interface.\n
var defer = RSVP.defer();\n
try {\n
if (declared_interface_list.indexOf(interface_url) >
-1) {\n
...
...
@@ -228,7 +230,7 @@
}\n
\n
function verifyAllMethod(interface_method_list, gadget_method_list) {\n
//to verify all methods of gadget and interface.\n
//to verify all methods of gadget and interface.\n
var defer = RSVP.defer();\n
return RSVP.Queue()\n
.push(function() {\n
...
...
@@ -247,15 +249,16 @@
}\n
\n
function verifyAllMethodDeclared(interface_method_list, gadget_method_list) {\n
//to verify if all the interface methods are declared by the gadget.\n
//to verify if all the interface methods are declared by the gadget.\n
var defer = RSVP.defer(),\n
gadget_method_name_list = gadget_method_list,\n
interface_method_name_list = [];\n
for (var i=0; i
<interface_method_list.length
;
i+=1)
{\n
interface_method_name_list = [],\n
i, j;\n
for (i = 0; i
< interface_method_list.length
;
i
+=
1)
{\n
interface_method_name_list.push(interface_method_list[i].name);\n
}\n
try
{\n
for
(
var
j=
0;
j<interface_method_name_list.length;
j+=
1)
{\n
for
(
j =
0;
j
<
interface_method_name_list.length;
j
+=
1)
{\n
if(gadget_method_name_list.indexOf(interface_method_name_list[j])
<
0)
{\n
throw
new
Error("All
methods
are
not
declared.");\n
}\n
...
...
@@ -268,19 +271,21 @@
}\n
\n
function
verifyAllMethodSignature(interface_method_list,
gadget_method_list)
{\n
//to
verify
if
all
the
declared
methods
match
the
signature
of
the
interface
methods.\n
//to
verify
if
all
the
declared
methods
match
the
signature
of
the
interface
methods.\n
var
defer =
RSVP.defer(),\n
interface_method_dict =
{},\n
gadget_method_name_list =
[],\n
index;\n
for(var
i=
0;
i<interface_method_list.length;
i+=1)
{\n
index,\n
item,\n
i,
j;\n
for(
i =
0;
i
<
interface_method_list.length;
i
+=
1)
{\n
interface_method_dict[interface_method_list[i].name]
=
interface_method_list[i];\n
}\n
for(
var
j=
0;
j<gadget_method_list.length;
j+=
1)
{\n
for(
j =
0;
j
<
gadget_method_list.length;
j
+=
1)
{\n
gadget_method_name_list.push(gadget_method_list[j].name);\n
}\n
try
{\n
for(
var
item
in
interface_method_dict)
{\n
for(item
in
interface_method_dict)
{\n
index =
gadget_method_name_list.lastIndexOf(item);\n
if(!verifyMethodSignature(interface_method_dict[item],
gadget_method_list[index]))
{\n
throw
new
Error("All
methods
signature
do
not
match.");\n
...
...
@@ -294,12 +299,13 @@
}\n
\n
function
verifyMethodSignature(interface_method,
gadget_method)
{\n
//to
verify
if
two
methods
have
the
same
signature\n
//to
verify
if
two
methods
have
the
same
signature\n
var
max_arg_len =
interface_method.argument_list.length,\n
min_arg_len =
0;\n
min_arg_len =
0,\n
i;\n
if
(max_arg_len)
{\n
var
argument_list =
interface_method.argument_list;\n
for
(
var
i=
0;
i<argument_list.length;
i+=
1)
{\n
for
(
i =
0;
i
<
argument_list.length;
i
+=
1)
{\n
if
(argument_list[i].required)
{\n
min_arg_len
+=
1;\n
}\n
...
...
@@ -350,25 +356,27 @@
dt_list = doc.getElementsByTagName(\'dt\'),\n
dd_list = doc.getElementsByTagName(\'dd\'),\n
method_len = dl_list.length - 1,\n
dt_count = 0, \n
dl_count = 1;\n
dt_count = 0,\n
dl_count = 1,\n
i;\n
interface_data.name = doc.getElementsByTagName(\'h1\')[0].innerText;\n
interface_data.description = doc.getElementsByTagName(\'h3\')[0].innerText;\n
for (
var i=0; i
<method_len
;
i+=
1)
{\n
for (
i = 0; i
< method_len
;
i
+=
1)
{\n
var
method =
{\n
name:
dt_list[dt_count].innerText,\n
description:
dd_list[dt_count].innerText,\n
argument_list:
[]\n
name:
dt_list[dt_count].innerText,\n
description:
dd_list[dt_count].innerText,\n
argument_list:
[]\n
},\n
argument_len =
dl_list[dl_count].getElementsByTagName(\'dt\').length;\n
argument_len =
dl_list[dl_count].getElementsByTagName(\'dt\').length,\n
j;\n
dt_count
+=
1;\n
dl_count
+=
1;\n
for
(
var
j=
0;
j<argument_len;
j+=
1)
{\n
for
(
j =
0;
j
<
argument_len;
j
+=
1)
{\n
var
argument_item =
{\n
name:
dt_list[dt_count].innerText,\n
description:
dd_list[dt_count].innerText,\n
required:
dt_list[dt_count].getAttribute("data-parameter-required")
===
"optional"
?
false:true,\n
type:
dt_list[dt_count].getAttribute("data-parameter-type")\n
name:
dt_list[dt_count].innerText,\n
description:
dd_list[dt_count].innerText,\n
required:
dt_list[dt_count].getAttribute("data-parameter-required")
===
"optional"
?
false:true,\n
type:
dt_list[dt_count].getAttribute("data-parameter-type")\n
};\n
dt_count
+=
1;\n
method.argument_list.push(argument_item);\n
...
...
@@ -438,15 +446,17 @@
})\n
.push(function
(declared_interface_list)
{\n
var
interface_url,\n
result_list =
[];\n
for
(var
item
in
declared_interface_list)
{\n
result_list =
[],\n
item;\n
for
(item
in
declared_interface_list)
{\n
interface_url =
declared_interface_list[item];\n
result_list.push(interface_gadget.verifyGadgetInterfaceImplementation(gadget_url,
interface_url));\n
}\n
return
RSVP.all(result_list);\n
})\n
.push(function(result_list)
{\n
for(var
item
in
result_list)
{\n
var
item;\n
for(item
in
result_list)
{\n
if
(!result_list[item])
{\n
throw
new
Error("Interface
Implementation
Failure.");\n
}\n
...
...
@@ -596,7 +606,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.4
3313.24628.20019
</string>
</value>
<value>
<string>
944.4
6238.52656.22988
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -614,7 +624,7 @@
</tuple>
<state>
<tuple>
<float>
1438
006033.5
</float>
<float>
1438
180072.6
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_test_gadget.xml
0 → 100644
View file @
c60f541d
This diff is collapsed.
Click to expand it.
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_test_gadget_js.xml
View file @
c60f541d
...
...
@@ -138,11 +138,10 @@
.push(function(result) {\n
equal(result, true, "verify correctly implemented gadget test - expected true - success");\n
});\n
\n
});\n
\n
module("RJSMissingInterfaceDeclarationTest");\n
\n
\n
test("verify missing interface declaration gadget test", function() {\n
var gadget_url = "./interface_test_missing_interface_declaration_gadget.html",\n
interface_url = "https://softinst60317.host.vifib.net/erp5/web_site_module/interface_test/demo_interface1.html";\n
...
...
@@ -156,11 +155,10 @@
.push(function(result) {\n
equal(result, false, "verify missing interface declaration gadget test - expected false - success");\n
});\n
\n
});\n
\n
module("RJSMissingMethodDeclarationTest");\n
\n
\n
test("verify missing method declaration gadget test", function() {\n
var gadget_url = "./interface_test_missing_method_declaration_gadget.html",\n
interface_url = "https://softinst60317.host.vifib.net/erp5/web_site_module/interface_test/demo_interface1.html";\n
...
...
@@ -174,11 +172,10 @@
.push(function(result) {\n
equal(result, false, "verify missing method declaration gadget test - expected false - success");\n
});\n
\n
});\n
\n
module("RJSMismatchedMethodArgumentTest");\n
\n
\n
test("verify mismatched method argument gadget test", function() {\n
var gadget_url = "./interface_test_mismatched_argument_gadget.html",\n
interface_url = "https://softinst60317.host.vifib.net/erp5/web_site_module/interface_test/demo_interface1.html";\n
...
...
@@ -192,11 +189,10 @@
.push(function(result) {\n
equal(result, false, "verify mismatched method argument gadget test - expected false - success");\n
});\n
\n
});\n
\n
module("RJSMultipleInterfaceCorrectImplementationTest");\n
\n
\n
test("verify multiple interface correct gadget test", function() {\n
var gadget_url = "./interface_test_multiple_interface_correct_gadget.html";\n
return new RSVP.Queue()\n
...
...
@@ -209,11 +205,10 @@
.push(function(result) {\n
equal(result, true, "verify multiple interface correct gadget test - expected true - success");\n
});\n
\n
});\n
\n
module("RJSMultipleInterfaceMissingMethodDeclarationTest");\n
\n
\n
test("verify multiple interface missing method declaration gadget test", function() {\n
var gadget_url = "./interface_test_multiple_interface_missing_method_declaration_gadget.html";\n
return new RSVP.Queue()\n
...
...
@@ -226,11 +221,10 @@
.push(function(result) {\n
equal(result, false, "verify multiple interface missing method declaration gadget test - expected false - success");\n
});\n
\n
});\n
\n
module("RJSMultipleInterfaceMismatchedArgumentTest");\n
\n
\n
test("verify multiple interface mismatched argument gadget test", function() {\n
var gadget_url = "./interface_test_multiple_interface_mismached_argument_gadget.html";\n
return new RSVP.Queue()\n
...
...
@@ -243,11 +237,10 @@
.push(function(result) {\n
equal(result, false, "verify multiple interface mismatched argument gadget test - expected false - success");\n
});\n
\n
});\n
\n
module("RJSInvalidInterfaceDefinitionTest");\n
\n
\n
test("verify invalid interface definition gadget test", function() {\n
var gadget_url = "./interface_test_missing_interface_declaration_gadget.html",\n
interface_url1 = "https://softinst60317.host.vifib.net/erp5/web_site_module/interface_test/demo_interface_invalid1.html",\n
...
...
@@ -269,9 +262,8 @@
equal(result[1], false, "verify invalid interface definition - missing param list tag - gadget test - expected false - success");\n
equal(result[2], false, "verify invalid interface definition - missing param description tag - gadget test - expected false - success");\n
});\n
\n
});\n
\n
\n
}(document, renderJS, QUnit, sinon, URI));\n
</string>
</value>
</item>
...
...
@@ -408,7 +400,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.
38901.1195.26897
</string>
</value>
<value>
<string>
944.
43375.6436.61201
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -426,7 +418,7 @@
</tuple>
<state>
<tuple>
<float>
143
7747711.99
</float>
<float>
143
8008031.04
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_test/PathTemplateItem/web_page_module/interface_test_mismatched_argument_gadget_js.xml
View file @
c60f541d
...
...
@@ -112,7 +112,7 @@
.declareMethod("method1", function (param1, param2) {\n
return;\n
})\n
// method2 - argument mismatched - expects param1.
\n
// method2 - argument mismatched - expects param1.\n
.declareMethod("method2", function () {\n
return;\n
})\n
...
...
@@ -258,7 +258,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.375
39.18747.48452
</string>
</value>
<value>
<string>
944.375
43.12889.41096
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -276,7 +276,7 @@
</tuple>
<state>
<tuple>
<float>
143
7657935.47
</float>
<float>
143
8008051.98
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_interface_test/PathTemplateItem/web_site_module/interface_test.xml
View file @
c60f541d
...
...
@@ -167,7 +167,7 @@
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
aggregate/web_page_module/
gadget_rjs_itest_index_html
</string>
<string>
aggregate/web_page_module/
interface_test_gadget
</string>
</tuple>
</value>
</item>
...
...
@@ -388,7 +388,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
944.3898
7.49759.34713
</string>
</value>
<value>
<string>
944.3898
8.2596.37649
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -406,7 +406,7 @@
</tuple>
<state>
<tuple>
<float>
143
7744722.3
7
</float>
<float>
143
8007850.4
7
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment