Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F886267
rpc.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Subscribers
None
rpc.js
View Options
if
(
!
dojo
.
_hasResource
[
"tests.rpc"
]){
//_hasResource checks added by build. Do not use _hasResource directly in your code.
dojo
.
_hasResource
[
"tests.rpc"
]
=
true
;
dojo
.
provide
(
"tests.rpc"
);
dojo
.
require
(
"dojo.rpc.RpcService"
);
dojo
.
require
(
"dojo.rpc.JsonService"
);
dojo
.
require
(
"dojo.rpc.JsonpService"
);
doh
.
register
(
"tests.rpc"
,
[
{
name
:
"JsonRPC-EchoTest"
,
timeout
:
2000
,
setUp
:
function
(){
var
testSmd
=
{
serviceURL
:
"../../dojo/tests/resources/test_JsonRPCMediator.php"
,
methods
:
[
{
name
:
"myecho"
,
parameters
:
[
{
name
:
"somestring"
,
type
:
"STRING"
}
]
}
]
}
this
.
svc
=
new
dojo
.
rpc
.
JsonService
(
testSmd
);
},
runTest
:
function
(){
var
d
=
new
doh
.
Deferred
();
var
td
=
this
.
svc
.
myecho
(
"RPC TEST"
);
if
(
window
.
location
.
protocol
==
"file:"
)
{
var
err
=
new
Error
(
"This Test requires a webserver and PHP and will fail intentionally if loaded from file://"
);
d
.
errback
(
err
);
return
d
;
}
td
.
addCallbacks
(
function
(
result
)
{
if
(
result
==
"<P>RPC TEST</P>"
){
return
true
;
}
else
{
return
new
Error
(
"JsonRpc-EchoTest test failed, resultant content didn't match"
);
}
},
function
(
result
){
return
new
Error
(
result
);
});
td
.
addBoth
(
d
,
"callback"
);
return
d
;
}
},
{
name
:
"JsonRPC-EmptyParamTest"
,
timeout
:
2000
,
setUp
:
function
(){
var
testSmd
=
{
serviceURL
:
"../../dojo/tests/resources/test_JsonRPCMediator.php"
,
methods
:
[
{
name
:
"contentB"
}
]
}
this
.
svc
=
new
dojo
.
rpc
.
JsonService
(
testSmd
);
},
runTest
:
function
(){
var
d
=
new
doh
.
Deferred
();
var
td
=
this
.
svc
.
contentB
();
if
(
window
.
location
.
protocol
==
"file:"
)
{
var
err
=
new
Error
(
"This Test requires a webserver and PHP and will fail intentionally if loaded from file://"
);
d
.
errback
(
err
);
return
d
;
}
td
.
addCallbacks
(
function
(
result
){
if
(
result
==
"<P>Content B</P>"
){
return
true
;
}
else
{
return
new
Error
(
"JsonRpc-EmpytParamTest test failed, resultant content didn't match"
);
}
},
function
(
result
){
return
new
Error
(
result
);
});
td
.
addBoth
(
d
,
"callback"
);
return
d
;
}
},
{
name
:
"JsonRPC_SMD_Loading_test"
,
setUp
:
function
(){
this
.
svc
=
new
dojo
.
rpc
.
JsonService
(
"../../dojo/tests/resources/testClass.smd"
);
},
runTest
:
function
(){
if
(
this
.
svc
.
objectName
=
"testClass"
)
{
return
true
;
}
else
{
return
new
Error
(
"Error loading and/or parsing an smd file"
);
}
}
},
{
name
:
"JsonP_test"
,
timeout
:
10000
,
setUp
:
function
(){
this
.
svc
=
new
dojo
.
rpc
.
JsonpService
(
dojo
.
moduleUrl
(
"dojox.rpc"
,
"yahoo.smd"
),
{
appid
:
"foo"
});
},
runTest
:
function
(){
var
d
=
new
doh
.
Deferred
();
if
(
window
.
location
.
protocol
==
"file:"
)
{
var
err
=
new
Error
(
"This Test requires a webserver and will fail intentionally if loaded from file://"
);
d
.
errback
(
err
);
return
d
;
}
var
td
=
this
.
svc
.
webSearch
({
query
:
"dojotoolkit"
});
td
.
addCallbacks
(
function
(
result
){
return
true
;
if
(
result
[
"ResultSet"
][
"Result"
][
0
][
"DisplayUrl"
]
==
"dojotoolkit.org/"
)
{
return
true
;
}
else
{
return
new
Error
(
"JsonRpc_SMD_Loading_Test failed, resultant content didn't match"
);
}
},
function
(
result
){
return
new
Error
(
result
);
});
td
.
addBoth
(
d
,
"callback"
);
return
d
;
}
}
]
);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Apr 7, 00:10 (2 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24667
Default Alt Text
rpc.js (3 KB)
Attached To
rZED Zed
Event Timeline
Log In to Comment