Files
openlayers/tests/WPSClient.html
2012-08-11 19:32:17 +02:00

66 lines
1.6 KiB
HTML

<html>
<head>
<script src="OLLoader.js"></script>
<script type="text/javascript">
var client;
function test_initialize(t) {
t.plan(2);
client = new OpenLayers.WPSClient({
servers: {
local: "/geoserver/wps"
}
});
t.ok(client instanceof OpenLayers.WPSClient, 'creates an instance');
t.eq(client.servers.local.url, '/geoserver/wps', 'servers stored on instance');
}
function test_getProcess(t) {
t.plan(4);
client = new OpenLayers.WPSClient({
servers: {
local: "/geoserver/wps"
},
lazy: true
});
var process = client.getProcess('local', 'gs:splitPolygon');
t.ok(process instanceof OpenLayers.WPSProcess, 'creates a process');
t.ok(process.client === client, 'process knows about client');
t.eq(process.server, 'local', 'process created with correct server');
t.eq(process.identifier, 'gs:splitPolygon', 'process created with correct identifier');
}
function test_execute(t) {
t.plan(1);
client = new OpenLayers.WPSClient({
servers: {
local: "/geoserver/wps"
},
lazy: true
});
var log = [];
client.getProcess = function() {
return {
execute: function(options) {
log.push(options);
}
}
}
client.execute({inputs: 'a', success: 'b', scope: 'c'});
t.eq(log[0], {inputs: 'a', success: 'b', scope: 'c'}, "process executed with correct options");
}
</script>
</head>
<body>
</body>
</html>