add formats for CSW GetRecords and GetDomain requests, p=bbinet, r=me (closes #2132)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9699 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
56
tests/Format/CSWGetDomain/v2_0_2.html
Normal file
56
tests/Format/CSWGetDomain/v2_0_2.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../../../lib/OpenLayers.js"></script>
|
||||
<script src="v2_0_2.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var format = new OpenLayers.Format.CSWGetDomain();
|
||||
|
||||
function test_write(t) {
|
||||
|
||||
t.plan(1);
|
||||
|
||||
var options = {
|
||||
PropertyName: "type"
|
||||
};
|
||||
|
||||
var result = format.write(options);
|
||||
|
||||
t.eq(result, csw_request, "check value returned by format " +
|
||||
"CSWGetDomain: write method");
|
||||
|
||||
}
|
||||
|
||||
|
||||
function test_read(t) {
|
||||
|
||||
t.plan(9);
|
||||
|
||||
var obj = format.read(csw_response);
|
||||
|
||||
var domainValues = obj.DomainValues;
|
||||
// test getRecordsResponse object
|
||||
t.ok(domainValues, "object contains DomainValues property");
|
||||
|
||||
// test DomainValues
|
||||
t.eq(domainValues.length, 1, "object contains 1 object in DomainValues");
|
||||
var domainValue = domainValues[0];
|
||||
t.eq(domainValue.type, "csw:Record", "check value for attribute type");
|
||||
t.eq(domainValue.PropertyName, "type", "check value for element PropertyName");
|
||||
t.ok(domainValue.ListOfValues, "object contains ListOfValues property");
|
||||
|
||||
// test ListOfValues
|
||||
t.eq(domainValue.ListOfValues.length, 2, "object contains 2 objects " +
|
||||
"in ListOfValues");
|
||||
var val = domainValue.ListOfValues[0];
|
||||
t.ok(val.Value, "object contains Value property");
|
||||
t.eq(val.Value.my_attr, "my_value", "check value for attribute my_attr");
|
||||
t.eq(val.Value.value, "dataset", "check value for element Value");
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user