Replaced jasmine testing framework by mocha, expect.js and sinon
as discussed in #319
This commit is contained in:
@@ -1,31 +1,31 @@
|
||||
goog.provide('ol.test.parser.ogc.ExceptionReport');
|
||||
|
||||
|
||||
describe('ol.parser.ogc.exceptionreport', function() {
|
||||
|
||||
var parser = new ol.parser.ogc.ExceptionReport();
|
||||
|
||||
describe('test read exception', function() {
|
||||
it('OCG WMS 1.3.0 exceptions', function() {
|
||||
it('OCG WMS 1.3.0 exceptions', function(done) {
|
||||
var result, exceptions;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/exceptionreport/wms1_3_0.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
result = parser.read(xhr.getResponseXml());
|
||||
exceptions = result.exceptionReport.exceptions;
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/exceptionreport/wms1_3_0.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
result = parser.read(xhr.getResponseXml());
|
||||
exceptions = result.exceptionReport.exceptions;
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (result !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(exceptions.length).toBe(4);
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(exceptions.length).to.be(4);
|
||||
var str = 'Plain text message about an error.';
|
||||
expect(goog.string.trim(exceptions[0].text)).toBe(str);
|
||||
expect(exceptions[1].code).toBe('InvalidUpdateSequence');
|
||||
expect(goog.string.trim(exceptions[0].text)).to.be(str);
|
||||
expect(exceptions[1].code).to.be('InvalidUpdateSequence');
|
||||
str = ' Another error message, this one with a service exception ' +
|
||||
'code supplied. ';
|
||||
expect(exceptions[1].text).toBe(str);
|
||||
expect(exceptions[1].text).to.be(str);
|
||||
str = 'Error in module <foo.c>, line 42A message that includes angle ' +
|
||||
'brackets in text must be enclosed in a Character Data Section as' +
|
||||
' in this example. All XML-like markup is ignored except for this' +
|
||||
@@ -37,55 +37,56 @@ describe('ol.parser.ogc.exceptionreport', function() {
|
||||
'application-specific software may choose to process it.' +
|
||||
'</Explanation>';
|
||||
expect(goog.string.trim(exceptions[3].text), str);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('test read exception OWSCommon 1.0.0', function() {
|
||||
it('test read exception OWSCommon 1.0.0', function(done) {
|
||||
var result, report, exception;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/exceptionreport/ows1_0_0.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
result = parser.read(xhr.getResponseXml());
|
||||
report = result.exceptionReport;
|
||||
exception = report.exceptions[0];
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/exceptionreport/ows1_0_0.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
result = parser.read(xhr.getResponseXml());
|
||||
report = result.exceptionReport;
|
||||
exception = report.exceptions[0];
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (result !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(report.version).toEqual('1.0.0');
|
||||
expect(report.language).toEqual('en');
|
||||
expect(exception.code).toEqual('InvalidParameterValue');
|
||||
expect(exception.locator).toEqual('foo');
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(report.version).to.eql('1.0.0');
|
||||
expect(report.language).to.eql('en');
|
||||
expect(exception.code).to.eql('InvalidParameterValue');
|
||||
expect(exception.locator).to.eql('foo');
|
||||
var msg = 'Update error: Error occured updating features';
|
||||
expect(exception.texts[0]).toEqual(msg);
|
||||
expect(exception.texts[0]).to.eql(msg);
|
||||
msg = 'Second exception line';
|
||||
expect(exception.texts[1]).toEqual(msg);
|
||||
expect(exception.texts[1]).to.eql(msg);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('test read exception OWSCommon 1.1.0', function() {
|
||||
it('test read exception OWSCommon 1.1.0', function(done) {
|
||||
var result, report, exception;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/exceptionreport/ows1_1_0.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
result = parser.read(xhr.getResponseXml());
|
||||
report = result.exceptionReport;
|
||||
exception = report.exceptions[0];
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/exceptionreport/ows1_1_0.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
result = parser.read(xhr.getResponseXml());
|
||||
report = result.exceptionReport;
|
||||
exception = report.exceptions[0];
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (result !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(report.version).toEqual('1.1.0');
|
||||
expect(report.language).toEqual('en');
|
||||
expect(exception.code).toEqual('InvalidParameterValue');
|
||||
expect(exception.locator).toEqual('foo');
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(report.version).to.eql('1.1.0');
|
||||
expect(report.language).to.eql('en');
|
||||
expect(exception.code).to.eql('InvalidParameterValue');
|
||||
expect(exception.locator).to.eql('foo');
|
||||
var msg = 'Update error: Error occured updating features';
|
||||
expect(exception.texts[0]).toEqual(msg);
|
||||
expect(exception.texts[1]).toEqual('Second exception line');
|
||||
expect(exception.texts[0]).to.eql(msg);
|
||||
expect(exception.texts[1]).to.eql('Second exception line');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,19 +8,19 @@ describe('ol.parser.ogc.versioned', function() {
|
||||
describe('test constructor', function() {
|
||||
var parser = new ol.parser.ogc.Versioned({version: '1.0.0'});
|
||||
it('new OpenLayers.Format.XML.VersionedOGC returns object', function() {
|
||||
expect(parser instanceof ol.parser.ogc.Versioned).toBeTruthy();
|
||||
expect(parser instanceof ol.parser.ogc.Versioned).to.be.ok();
|
||||
});
|
||||
it('constructor sets version correctly', function() {
|
||||
expect(parser.version).toEqual('1.0.0');
|
||||
expect(parser.version).to.eql('1.0.0');
|
||||
});
|
||||
it('defaultVersion should be null if not specified', function() {
|
||||
expect(parser.defaultVersion).toBeNull();
|
||||
expect(parser.defaultVersion).to.be(null);
|
||||
});
|
||||
it('format has a read function', function() {
|
||||
expect(typeof(parser.read)).toEqual('function');
|
||||
expect(typeof(parser.read)).to.eql('function');
|
||||
});
|
||||
it('format has a write function', function() {
|
||||
expect(typeof(parser.write)).toEqual('function');
|
||||
expect(typeof(parser.write)).to.eql('function');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,34 +10,34 @@ describe('test WMSCapabilities', function() {
|
||||
it('Version taken from document', function() {
|
||||
var parser = new ol.parser.ogc.WMSCapabilities();
|
||||
var data = parser.read(snippet);
|
||||
expect(data.version).toEqual('1.3.0');
|
||||
expect(data.version).to.eql('1.3.0');
|
||||
});
|
||||
it('Version taken from parser takes preference', function() {
|
||||
var parser = new ol.parser.ogc.WMSCapabilities({version: '1.1.0'});
|
||||
var data = parser.read(snippet);
|
||||
expect(data.version).toEqual('1.1.0');
|
||||
expect(data.version).to.eql('1.1.0');
|
||||
});
|
||||
it('If nothing else is set, defaultVersion should be returned', function() {
|
||||
var parser = new ol.parser.ogc.WMSCapabilities({defaultVersion: '1.1.1'});
|
||||
var data = parser.read(snippet2);
|
||||
expect(data.version).toEqual('1.1.1');
|
||||
expect(data.version).to.eql('1.1.1');
|
||||
});
|
||||
var parser = new ol.parser.ogc.WMSCapabilities({defaultVersion: '1.1.1'});
|
||||
it('Version from options returned', function() {
|
||||
var version = parser.getVersion(null, {version: '1.3.0'});
|
||||
expect(version).toEqual('1.3.0');
|
||||
expect(version).to.eql('1.3.0');
|
||||
});
|
||||
var msg = 'defaultVersion returned if no version specified in options ' +
|
||||
'and no version on the format';
|
||||
it(msg, function() {
|
||||
var version = parser.getVersion(null);
|
||||
expect(version).toEqual('1.1.1');
|
||||
expect(version).to.eql('1.1.1');
|
||||
});
|
||||
msg = 'version returned of the Format if no version specified in options';
|
||||
it(msg, function() {
|
||||
parser.version = '1.1.0';
|
||||
var version = parser.getVersion(null);
|
||||
expect(version).toEqual('1.1.0');
|
||||
expect(version).to.eql('1.1.0');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,30 +11,30 @@ describe('ol.parser.ogc.wmscapabilities_v1_0_0', function() {
|
||||
var parser = new ol.parser.ogc.WMSCapabilities();
|
||||
|
||||
describe('test read', function() {
|
||||
it('Test read', function() {
|
||||
it('Test read', function(done) {
|
||||
var obj;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_0_0.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_0_0.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(obj.service.keywords.length).toEqual(2);
|
||||
expect(obj.service.keywords[0]['value']).toEqual('BGDI');
|
||||
expect(obj.service.href).toEqual('https://wms.geo.admin.ch/?');
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(obj.service.keywords.length).to.eql(2);
|
||||
expect(obj.service.keywords[0]['value']).to.eql('BGDI');
|
||||
expect(obj.service.href).to.eql('https://wms.geo.admin.ch/?');
|
||||
var url = 'https://wms.geo.admin.ch/?';
|
||||
var getmap = obj.capability.request.getmap;
|
||||
expect(getmap.get.href).toEqual(url);
|
||||
expect(getmap.post.href).toEqual(url);
|
||||
expect(getmap.formats.length).toEqual(4);
|
||||
expect(getmap.formats[0]).toEqual('GIF');
|
||||
expect(obj.capability.layers[64].keywords.length).toEqual(2);
|
||||
expect(obj.capability.layers[64].keywords[0].value).toEqual('Geometer');
|
||||
expect(getmap.get.href).to.eql(url);
|
||||
expect(getmap.post.href).to.eql(url);
|
||||
expect(getmap.formats.length).to.eql(4);
|
||||
expect(getmap.formats[0]).to.eql('GIF');
|
||||
expect(obj.capability.layers[64].keywords.length).to.eql(2);
|
||||
expect(obj.capability.layers[64].keywords[0].value).to.eql('Geometer');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,306 +5,306 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1', function() {
|
||||
var parser = new ol.parser.ogc.WMSCapabilities();
|
||||
|
||||
describe('test read exception', function() {
|
||||
it('Error reported correctly', function() {
|
||||
it('Error reported correctly', function(done) {
|
||||
var obj;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/' +
|
||||
'exceptionsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/' +
|
||||
'exceptionsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(!!obj.error).toBeTruthy();
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(!!obj.error).to.be.ok();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('test read', function() {
|
||||
it('Test read', function() {
|
||||
it('Test read', function(done) {
|
||||
var obj, capability, getmap, describelayer, getfeatureinfo, layer;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/gssample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
capability = obj.capability;
|
||||
getmap = capability.request.getmap;
|
||||
describelayer = capability.request.describelayer;
|
||||
getfeatureinfo = capability.request.getfeatureinfo;
|
||||
layer = capability.layers[2];
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/gssample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
capability = obj.capability;
|
||||
getmap = capability.request.getmap;
|
||||
describelayer = capability.request.describelayer;
|
||||
getfeatureinfo = capability.request.getfeatureinfo;
|
||||
layer = capability.layers[2];
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(capability).toBeTruthy();
|
||||
expect(getmap.formats.length).toEqual(28);
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(capability).to.be.ok();
|
||||
expect(getmap.formats.length).to.eql(28);
|
||||
var get = 'http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&';
|
||||
expect(getmap.get.href).toEqual(get);
|
||||
expect(getmap.post).toBeUndefined();
|
||||
expect(getmap.get.href).to.eql(get);
|
||||
expect(getmap.post).to.be(undefined);
|
||||
get = 'http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&';
|
||||
expect(describelayer.get.href).toEqual(get);
|
||||
expect(describelayer.post).toBeUndefined();
|
||||
expect(describelayer.get.href).to.eql(get);
|
||||
expect(describelayer.post).to.be(undefined);
|
||||
get = 'http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&';
|
||||
expect(getfeatureinfo.get.href).toEqual(get);
|
||||
expect(getfeatureinfo.get.href).to.eql(get);
|
||||
var post = 'http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&';
|
||||
expect(getfeatureinfo.post.href).toEqual(post);
|
||||
expect(capability.layers).toBeTruthy();
|
||||
expect(capability.layers.length).toEqual(22);
|
||||
expect(getfeatureinfo.post.href).to.eql(post);
|
||||
expect(capability.layers).to.be.ok();
|
||||
expect(capability.layers.length).to.eql(22);
|
||||
var infoFormats =
|
||||
['text/plain', 'text/html', 'application/vnd.ogc.gml'];
|
||||
expect(layer.infoFormats).toEqual(infoFormats);
|
||||
expect(layer.name).toEqual('tiger:tiger_roads');
|
||||
expect(layer.prefix).toEqual('tiger');
|
||||
expect(layer.title).toEqual('Manhattan (NY) roads');
|
||||
expect(layer.infoFormats).to.eql(infoFormats);
|
||||
expect(layer.name).to.eql('tiger:tiger_roads');
|
||||
expect(layer.prefix).to.eql('tiger');
|
||||
expect(layer.title).to.eql('Manhattan (NY) roads');
|
||||
var abstr = 'Highly simplified road layout of Manhattan in New York..';
|
||||
expect(layer['abstract']).toEqual(abstr);
|
||||
expect(layer['abstract']).to.eql(abstr);
|
||||
var bbox = [-74.08769307536667, 40.660618924633326,
|
||||
-73.84653192463333, 40.90178007536667];
|
||||
expect(layer.llbbox).toEqual(bbox);
|
||||
expect(layer.styles.length).toEqual(1);
|
||||
expect(layer.styles[0].name).toEqual('tiger_roads');
|
||||
expect(layer.llbbox).to.eql(bbox);
|
||||
expect(layer.styles.length).to.eql(1);
|
||||
expect(layer.styles[0].name).to.eql('tiger_roads');
|
||||
var legend = 'http://publicus.opengeo.org:80/geoserver/wms/' +
|
||||
'GetLegendGraphic?VERSION=1.0.0&FORMAT=image/png&WIDTH=20&' +
|
||||
'HEIGHT=20&LAYER=tiger:tiger_roads';
|
||||
expect(layer.styles[0].legend.href).toEqual(legend);
|
||||
expect(layer.styles[0].legend.format).toEqual('image/png');
|
||||
expect(layer.queryable).toBeTruthy();
|
||||
expect(layer.styles[0].legend.href).to.eql(legend);
|
||||
expect(layer.styles[0].legend.format).to.eql('image/png');
|
||||
expect(layer.queryable).to.be.ok();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('test layers', function() {
|
||||
it('Test layers', function() {
|
||||
it('Test layers', function(done) {
|
||||
var obj, capability, layers = {}, rootlayer, identifiers, authorities;
|
||||
var featurelist;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
capability = obj.capability;
|
||||
for (var i = 0, len = capability.layers.length; i < len; i++) {
|
||||
if ('name' in capability.layers[i]) {
|
||||
layers[capability.layers[i].name] = capability.layers[i];
|
||||
}
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
capability = obj.capability;
|
||||
for (var i = 0, len = capability.layers.length; i < len; i++) {
|
||||
if ('name' in capability.layers[i]) {
|
||||
layers[capability.layers[i].name] = capability.layers[i];
|
||||
}
|
||||
rootlayer = capability.layers[capability.layers.length - 1];
|
||||
identifiers = layers['ROADS_RIVERS'].identifiers;
|
||||
authorities = layers['ROADS_RIVERS'].authorityURLs;
|
||||
featurelist = layers['ROADS_RIVERS'].featureListURL;
|
||||
});
|
||||
}
|
||||
rootlayer = capability.layers[capability.layers.length - 1];
|
||||
identifiers = layers['ROADS_RIVERS'].identifiers;
|
||||
authorities = layers['ROADS_RIVERS'].authorityURLs;
|
||||
featurelist = layers['ROADS_RIVERS'].featureListURL;
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(rootlayer.srs).toEqual({'EPSG:4326': true});
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(rootlayer.srs).to.eql({'EPSG:4326': true});
|
||||
var srs = {'EPSG:4326': true, 'EPSG:26986': true};
|
||||
expect(layers['ROADS_RIVERS'].srs).toEqual(srs);
|
||||
expect(layers['Temperature'].srs).toEqual({'EPSG:4326': true});
|
||||
expect(layers['ROADS_RIVERS'].srs).to.eql(srs);
|
||||
expect(layers['Temperature'].srs).to.eql({'EPSG:4326': true});
|
||||
var bbox = layers['ROADS_RIVERS'].bbox['EPSG:26986'];
|
||||
expect(bbox.bbox).toEqual([189000, 834000, 285000, 962000]);
|
||||
expect(bbox.res).toEqual({x: 1, y: 1});
|
||||
expect(bbox.bbox).to.eql([189000, 834000, 285000, 962000]);
|
||||
expect(bbox.res).to.eql({x: 1, y: 1});
|
||||
bbox = layers['ROADS_RIVERS'].bbox['EPSG:4326'];
|
||||
expect(bbox.bbox).toEqual([-71.63, 41.75, -70.78, 42.90]);
|
||||
expect(bbox.res).toEqual({x: 0.01, y: 0.01});
|
||||
expect(bbox.bbox).to.eql([-71.63, 41.75, -70.78, 42.90]);
|
||||
expect(bbox.res).to.eql({x: 0.01, y: 0.01});
|
||||
bbox = layers['ROADS_1M'].bbox['EPSG:26986'];
|
||||
expect(bbox.bbox).toEqual([189000, 834000, 285000, 962000]);
|
||||
expect(bbox.res).toEqual({x: 1, y: 1});
|
||||
expect(identifiers).toBeTruthy();
|
||||
expect('DIF_ID' in identifiers).toBeTruthy();
|
||||
expect(identifiers['DIF_ID']).toEqual('123456');
|
||||
expect('DIF_ID' in authorities).toBeTruthy();
|
||||
expect(bbox.bbox).to.eql([189000, 834000, 285000, 962000]);
|
||||
expect(bbox.res).to.eql({x: 1, y: 1});
|
||||
expect(identifiers).to.be.ok();
|
||||
expect('DIF_ID' in identifiers).to.be.ok();
|
||||
expect(identifiers['DIF_ID']).to.eql('123456');
|
||||
expect('DIF_ID' in authorities).to.be.ok();
|
||||
var url = 'http://gcmd.gsfc.nasa.gov/difguide/whatisadif.html';
|
||||
expect(authorities['DIF_ID']).toEqual(url);
|
||||
expect(featurelist).toBeTruthy();
|
||||
expect(featurelist.format).toEqual('application/vnd.ogc.se_xml');
|
||||
expect(authorities['DIF_ID']).to.eql(url);
|
||||
expect(featurelist).to.be.ok();
|
||||
expect(featurelist.format).to.eql('application/vnd.ogc.se_xml');
|
||||
url = 'http://www.university.edu/data/roads_rivers.gml';
|
||||
expect(featurelist.href).toEqual(url);
|
||||
expect(layers['Pressure'].queryable).toBeTruthy();
|
||||
expect(layers['ozone_image'].queryable).toBeFalsy();
|
||||
expect(layers['population'].cascaded).toEqual(1);
|
||||
expect(layers['ozone_image'].fixedWidth).toEqual(512);
|
||||
expect(layers['ozone_image'].fixedHeight).toEqual(256);
|
||||
expect(layers['ozone_image'].opaque).toBeTruthy();
|
||||
expect(layers['ozone_image'].noSubsets).toBeTruthy();
|
||||
expect(featurelist.href).to.eql(url);
|
||||
expect(layers['Pressure'].queryable).to.be.ok();
|
||||
expect(layers['ozone_image'].queryable).to.not.be();
|
||||
expect(layers['population'].cascaded).to.eql(1);
|
||||
expect(layers['ozone_image'].fixedWidth).to.eql(512);
|
||||
expect(layers['ozone_image'].fixedHeight).to.eql(256);
|
||||
expect(layers['ozone_image'].opaque).to.be.ok();
|
||||
expect(layers['ozone_image'].noSubsets).to.be.ok();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('test dimensions', function() {
|
||||
it('Test dimensions', function() {
|
||||
it('Test dimensions', function(done) {
|
||||
var obj, capability, layers = {}, time, elevation;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
capability = obj.capability;
|
||||
for (var i = 0, len = capability.layers.length; i < len; i++) {
|
||||
if ('name' in capability.layers[i]) {
|
||||
layers[capability.layers[i].name] = capability.layers[i];
|
||||
}
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
capability = obj.capability;
|
||||
for (var i = 0, len = capability.layers.length; i < len; i++) {
|
||||
if ('name' in capability.layers[i]) {
|
||||
layers[capability.layers[i].name] = capability.layers[i];
|
||||
}
|
||||
time = layers['Clouds'].dimensions.time;
|
||||
elevation = layers['Pressure'].dimensions.elevation;
|
||||
});
|
||||
}
|
||||
time = layers['Clouds'].dimensions.time;
|
||||
elevation = layers['Pressure'].dimensions.elevation;
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(time['default']).toEqual('2000-08-22');
|
||||
expect(time.values.length).toEqual(1);
|
||||
expect(time.values[0]).toEqual('1999-01-01/2000-08-22/P1D');
|
||||
expect(elevation.units).toEqual('EPSG:5030');
|
||||
expect(elevation['default']).toEqual('0');
|
||||
expect(elevation.nearestVal).toBeTruthy();
|
||||
expect(elevation.multipleVal).toBeFalsy();
|
||||
expect(elevation.values).toEqual(
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(time['default']).to.eql('2000-08-22');
|
||||
expect(time.values.length).to.eql(1);
|
||||
expect(time.values[0]).to.eql('1999-01-01/2000-08-22/P1D');
|
||||
expect(elevation.units).to.eql('EPSG:5030');
|
||||
expect(elevation['default']).to.eql('0');
|
||||
expect(elevation.nearestVal).to.be.ok();
|
||||
expect(elevation.multipleVal).to.not.be();
|
||||
expect(elevation.values).to.eql(
|
||||
['0', '1000', '3000', '5000', '10000']);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('test contact info', function() {
|
||||
it('Test contact info', function() {
|
||||
it('Test contact info', function(done) {
|
||||
var obj, service, contactinfo, personPrimary, addr;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
service = obj.service;
|
||||
contactinfo = service.contactInformation;
|
||||
personPrimary = contactinfo.personPrimary;
|
||||
addr = contactinfo.contactAddress;
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
service = obj.service;
|
||||
contactinfo = service.contactInformation;
|
||||
personPrimary = contactinfo.personPrimary;
|
||||
addr = contactinfo.contactAddress;
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(contactinfo).toBeTruthy();
|
||||
expect(personPrimary).toBeTruthy();
|
||||
expect(personPrimary.person).toEqual('Jeff deLaBeaujardiere');
|
||||
expect(personPrimary.organization).toEqual('NASA');
|
||||
expect(contactinfo.position).toEqual('Computer Scientist');
|
||||
expect(addr).toBeTruthy();
|
||||
expect(addr.type).toEqual('postal');
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(contactinfo).to.be.ok();
|
||||
expect(personPrimary).to.be.ok();
|
||||
expect(personPrimary.person).to.eql('Jeff deLaBeaujardiere');
|
||||
expect(personPrimary.organization).to.eql('NASA');
|
||||
expect(contactinfo.position).to.eql('Computer Scientist');
|
||||
expect(addr).to.be.ok();
|
||||
expect(addr.type).to.eql('postal');
|
||||
var address = 'NASA Goddard Space Flight Center, Code 933';
|
||||
expect(addr.address).toEqual(address);
|
||||
expect(addr.city).toEqual('Greenbelt');
|
||||
expect(addr.stateOrProvince).toEqual('MD');
|
||||
expect(addr.postcode).toEqual('20771');
|
||||
expect(addr.country).toEqual('USA');
|
||||
expect(contactinfo.phone).toEqual('+1 301 286-1569');
|
||||
expect(contactinfo.fax).toEqual('+1 301 286-1777');
|
||||
expect(contactinfo.email).toEqual('delabeau@iniki.gsfc.nasa.gov');
|
||||
expect(addr.address).to.eql(address);
|
||||
expect(addr.city).to.eql('Greenbelt');
|
||||
expect(addr.stateOrProvince).to.eql('MD');
|
||||
expect(addr.postcode).to.eql('20771');
|
||||
expect(addr.country).to.eql('USA');
|
||||
expect(contactinfo.phone).to.eql('+1 301 286-1569');
|
||||
expect(contactinfo.fax).to.eql('+1 301 286-1777');
|
||||
expect(contactinfo.email).to.eql('delabeau@iniki.gsfc.nasa.gov');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test fees and constraints', function() {
|
||||
it('Test fees and constraints', function() {
|
||||
it('Test fees and constraints', function(done) {
|
||||
var obj, service;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/gssample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
service = obj.service;
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/gssample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
service = obj.service;
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect('fees' in service).toBeFalsy();
|
||||
expect('accessConstraints' in service).toBeFalsy();
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect('fees' in service).to.not.be();
|
||||
expect('accessConstraints' in service).to.not.be();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Test requests', function() {
|
||||
it('Test requests', function() {
|
||||
it('Test requests', function(done) {
|
||||
var obj, request, exception, userSymbols;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/gssample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
request = obj.capability.request;
|
||||
exception = obj.capability.exception;
|
||||
userSymbols = obj.capability.userSymbols;
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/gssample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
request = obj.capability.request;
|
||||
exception = obj.capability.exception;
|
||||
userSymbols = obj.capability.userSymbols;
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(request).toBeTruthy();
|
||||
expect('getmap' in request).toBeTruthy();
|
||||
expect('getfeatureinfo' in request).toBeTruthy();
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(request).to.be.ok();
|
||||
expect('getmap' in request).to.be.ok();
|
||||
expect('getfeatureinfo' in request).to.be.ok();
|
||||
var formats = ['text/plain', 'text/html', 'application/vnd.ogc.gml'];
|
||||
expect(request.getfeatureinfo.formats).toEqual(formats);
|
||||
expect('describelayer' in request).toBeTruthy();
|
||||
expect('getlegendgraphic' in request).toBeTruthy();
|
||||
expect(exception).toBeTruthy();
|
||||
expect(exception.formats).toEqual(['application/vnd.ogc.se_xml']);
|
||||
expect(userSymbols).toBeTruthy();
|
||||
expect(userSymbols.supportSLD).toBeTruthy();
|
||||
expect(userSymbols.userLayer).toBeTruthy();
|
||||
expect(userSymbols.userStyle).toBeTruthy();
|
||||
expect(userSymbols.remoteWFS).toBeTruthy();
|
||||
expect(request.getfeatureinfo.formats).to.eql(formats);
|
||||
expect('describelayer' in request).to.be.ok();
|
||||
expect('getlegendgraphic' in request).to.be.ok();
|
||||
expect(exception).to.be.ok();
|
||||
expect(exception.formats).to.eql(['application/vnd.ogc.se_xml']);
|
||||
expect(userSymbols).to.be.ok();
|
||||
expect(userSymbols.supportSLD).to.be.ok();
|
||||
expect(userSymbols.userLayer).to.be.ok();
|
||||
expect(userSymbols.userStyle).to.be.ok();
|
||||
expect(userSymbols.remoteWFS).to.be.ok();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('test ogc', function() {
|
||||
it('Test ogc', function() {
|
||||
it('Test ogc', function(done) {
|
||||
var obj, capability, attribution, keywords, metadataURLs;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
capability = obj.capability;
|
||||
attribution = capability.layers[2].attribution;
|
||||
keywords = capability.layers[0].keywords;
|
||||
metadataURLs = capability.layers[0].metadataURLs;
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1/ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
capability = obj.capability;
|
||||
attribution = capability.layers[2].attribution;
|
||||
keywords = capability.layers[0].keywords;
|
||||
metadataURLs = capability.layers[0].metadataURLs;
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(attribution.title).toEqual('State College University');
|
||||
expect(attribution.href).toEqual('http://www.university.edu/');
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(attribution.title).to.eql('State College University');
|
||||
expect(attribution.href).to.eql('http://www.university.edu/');
|
||||
var url = 'http://www.university.edu/icons/logo.gif';
|
||||
expect(attribution.logo.href).toEqual(url);
|
||||
expect(attribution.logo.format).toEqual('image/gif');
|
||||
expect(attribution.logo.width).toEqual('100');
|
||||
expect(attribution.logo.height).toEqual('100');
|
||||
expect(keywords.length).toEqual(3);
|
||||
expect(keywords[0].value).toEqual('road');
|
||||
expect(metadataURLs.length).toEqual(2);
|
||||
expect(metadataURLs[0].type).toEqual('FGDC');
|
||||
expect(metadataURLs[0].format).toEqual('text/plain');
|
||||
expect(attribution.logo.href).to.eql(url);
|
||||
expect(attribution.logo.format).to.eql('image/gif');
|
||||
expect(attribution.logo.width).to.eql('100');
|
||||
expect(attribution.logo.height).to.eql('100');
|
||||
expect(keywords.length).to.eql(3);
|
||||
expect(keywords[0].value).to.eql('road');
|
||||
expect(metadataURLs.length).to.eql(2);
|
||||
expect(metadataURLs[0].type).to.eql('FGDC');
|
||||
expect(metadataURLs[0].format).to.eql('text/plain');
|
||||
var href = 'http://www.university.edu/metadata/roads.txt';
|
||||
expect(metadataURLs[0].href).toEqual(href);
|
||||
expect(Math.round(capability.layers[0].minScale)).toEqual(250000);
|
||||
expect(Math.round(capability.layers[0].maxScale)).toEqual(1000);
|
||||
expect(capability.layers[1].minScale).toBeUndefined();
|
||||
expect(capability.layers[1].maxScale).toBeUndefined();
|
||||
expect(metadataURLs[0].href).to.eql(href);
|
||||
expect(Math.round(capability.layers[0].minScale)).to.eql(250000);
|
||||
expect(Math.round(capability.layers[0].maxScale)).to.eql(1000);
|
||||
expect(capability.layers[1].minScale).to.be(undefined);
|
||||
expect(capability.layers[1].maxScale).to.be(undefined);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -8,30 +8,29 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1_wmsc', function() {
|
||||
});
|
||||
|
||||
describe('test read', function() {
|
||||
it('Test read', function() {
|
||||
it('Test read', function(done) {
|
||||
var obj, tilesets, tileset;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1_WMSC/wmsc.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
tilesets = obj.capability.vendorSpecific.tileSets;
|
||||
tileset = tilesets[0];
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1_WMSC/wmsc.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
tilesets = obj.capability.vendorSpecific.tileSets;
|
||||
tileset = tilesets[0];
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(tilesets.length).toEqual(2);
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(tilesets.length).to.eql(2);
|
||||
var bbox = [-13697515.466796875, 5165920.118906248,
|
||||
-13619243.94984375, 5244191.635859374];
|
||||
expect(tileset.bbox['EPSG:900913'].bbox).toEqual(bbox);
|
||||
expect(tileset.format).toEqual('image/png');
|
||||
expect(tileset.height).toEqual(256);
|
||||
expect(tileset.width).toEqual(256);
|
||||
expect(tileset.layers).toEqual('medford:hydro');
|
||||
expect(tileset.srs['EPSG:900913']).toBeTruthy();
|
||||
expect(tileset.bbox['EPSG:900913'].bbox).to.eql(bbox);
|
||||
expect(tileset.format).to.eql('image/png');
|
||||
expect(tileset.height).to.eql(256);
|
||||
expect(tileset.width).to.eql(256);
|
||||
expect(tileset.layers).to.eql('medford:hydro');
|
||||
expect(tileset.srs['EPSG:900913']).to.be.ok();
|
||||
var resolutions = [156543.03390625, 78271.516953125, 39135.7584765625,
|
||||
19567.87923828125, 9783.939619140625, 4891.9698095703125,
|
||||
2445.9849047851562, 1222.9924523925781, 611.4962261962891,
|
||||
@@ -41,28 +40,29 @@ describe('ol.parser.ogc.wmscapabilities_v1_1_1_wmsc', function() {
|
||||
0.5971642833948135, 0.29858214169740677, 0.14929107084870338,
|
||||
0.07464553542435169, 0.037322767712175846, 0.018661383856087923,
|
||||
0.009330691928043961, 0.004665345964021981];
|
||||
expect(tileset.resolutions).toEqual(resolutions);
|
||||
expect(tileset.styles).toEqual('');
|
||||
expect(tileset.resolutions).to.eql(resolutions);
|
||||
expect(tileset.styles).to.eql('');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('test fallback', function() {
|
||||
it('Test fallback', function() {
|
||||
it('Test fallback', function(done) {
|
||||
var obj;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1_WMSC/' +
|
||||
'fallback.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_1_1_WMSC/' +
|
||||
'fallback.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(obj.capability.layers.length).toEqual(2);
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(obj.capability.layers.length).to.eql(2);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,148 +5,148 @@ describe('ol.parser.ogc.wmscapabilities_v1_3_0', function() {
|
||||
var parser = new ol.parser.ogc.WMSCapabilities();
|
||||
|
||||
describe('test read exception', function() {
|
||||
it('Error reported correctly', function() {
|
||||
it('Error reported correctly', function(done) {
|
||||
var result;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_3_0/' +
|
||||
'exceptionsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
result = parser.read(xhr.getResponseXml());
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_3_0/' +
|
||||
'exceptionsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
result = parser.read(xhr.getResponseXml());
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (result !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(!!result.error).toBe(true);
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(!!result.error).to.be(true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('test read', function() {
|
||||
it('Test read', function() {
|
||||
it('Test read', function(done) {
|
||||
var obj, capability, layers = {}, rootlayer, identifiers, authorities;
|
||||
var featurelist, time, elevation, service, contactinfo, personPrimary,
|
||||
addr, request, exception, attribution, keywords, metadataURLs;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_3_0/ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
capability = obj.capability;
|
||||
for (var i = 0, len = capability.layers.length; i < len; i++) {
|
||||
if ('name' in capability.layers[i]) {
|
||||
layers[capability.layers[i].name] = capability.layers[i];
|
||||
}
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmscapabilities_v1_3_0/ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
capability = obj.capability;
|
||||
for (var i = 0, len = capability.layers.length; i < len; i++) {
|
||||
if ('name' in capability.layers[i]) {
|
||||
layers[capability.layers[i].name] = capability.layers[i];
|
||||
}
|
||||
rootlayer = capability.layers[capability.layers.length - 1];
|
||||
identifiers = layers['ROADS_RIVERS'].identifiers;
|
||||
authorities = layers['ROADS_RIVERS'].authorityURLs;
|
||||
featurelist = layers['ROADS_RIVERS'].featureListURL;
|
||||
time = layers['Clouds'].dimensions.time;
|
||||
elevation = layers['Pressure'].dimensions.elevation;
|
||||
service = obj.service;
|
||||
contactinfo = service.contactInformation;
|
||||
personPrimary = contactinfo.personPrimary;
|
||||
addr = contactinfo.contactAddress;
|
||||
request = obj.capability.request;
|
||||
exception = obj.capability.exception;
|
||||
attribution = capability.layers[2].attribution;
|
||||
keywords = capability.layers[0].keywords;
|
||||
metadataURLs = capability.layers[0].metadataURLs;
|
||||
});
|
||||
}
|
||||
rootlayer = capability.layers[capability.layers.length - 1];
|
||||
identifiers = layers['ROADS_RIVERS'].identifiers;
|
||||
authorities = layers['ROADS_RIVERS'].authorityURLs;
|
||||
featurelist = layers['ROADS_RIVERS'].featureListURL;
|
||||
time = layers['Clouds'].dimensions.time;
|
||||
elevation = layers['Pressure'].dimensions.elevation;
|
||||
service = obj.service;
|
||||
contactinfo = service.contactInformation;
|
||||
personPrimary = contactinfo.personPrimary;
|
||||
addr = contactinfo.contactAddress;
|
||||
request = obj.capability.request;
|
||||
exception = obj.capability.exception;
|
||||
attribution = capability.layers[2].attribution;
|
||||
keywords = capability.layers[0].keywords;
|
||||
metadataURLs = capability.layers[0].metadataURLs;
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(rootlayer.srs).toEqual({'CRS:84': true});
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(rootlayer.srs).to.eql({'CRS:84': true});
|
||||
var srs = {'CRS:84': true, 'EPSG:26986': true};
|
||||
expect(layers['ROADS_RIVERS'].srs).toEqual(srs);
|
||||
expect(layers['Temperature'].srs).toEqual({'CRS:84': true});
|
||||
expect(layers['ROADS_RIVERS'].srs).to.eql(srs);
|
||||
expect(layers['Temperature'].srs).to.eql({'CRS:84': true});
|
||||
var infoFormats = ['text/xml', 'text/plain', 'text/html'];
|
||||
expect(layers['Temperature'].infoFormats).toEqual(infoFormats);
|
||||
expect(layers['Temperature'].infoFormats).to.eql(infoFormats);
|
||||
var bbox = layers['ROADS_RIVERS'].bbox['EPSG:26986'];
|
||||
expect(bbox.bbox).toEqual([189000, 834000, 285000, 962000]);
|
||||
expect(bbox.res).toEqual({x: 1, y: 1});
|
||||
expect(bbox.bbox).to.eql([189000, 834000, 285000, 962000]);
|
||||
expect(bbox.res).to.eql({x: 1, y: 1});
|
||||
bbox = layers['ROADS_RIVERS'].bbox['CRS:84'];
|
||||
expect(bbox.bbox).toEqual([-71.63, 41.75, -70.78, 42.90]);
|
||||
expect(bbox.res).toEqual({x: 0.01, y: 0.01});
|
||||
expect(bbox.bbox).to.eql([-71.63, 41.75, -70.78, 42.90]);
|
||||
expect(bbox.res).to.eql({x: 0.01, y: 0.01});
|
||||
bbox = layers['ROADS_1M'].bbox['EPSG:26986'];
|
||||
expect(bbox.bbox).toEqual([189000, 834000, 285000, 962000]);
|
||||
expect(bbox.res).toEqual({x: 1, y: 1});
|
||||
expect(identifiers).toBeTruthy();
|
||||
expect('DIF_ID' in identifiers).toBeTruthy();
|
||||
expect(identifiers['DIF_ID']).toEqual('123456');
|
||||
expect('DIF_ID' in authorities).toBeTruthy();
|
||||
expect(bbox.bbox).to.eql([189000, 834000, 285000, 962000]);
|
||||
expect(bbox.res).to.eql({x: 1, y: 1});
|
||||
expect(identifiers).to.be.ok();
|
||||
expect('DIF_ID' in identifiers).to.be.ok();
|
||||
expect(identifiers['DIF_ID']).to.eql('123456');
|
||||
expect('DIF_ID' in authorities).to.be.ok();
|
||||
var url = 'http://gcmd.gsfc.nasa.gov/difguide/whatisadif.html';
|
||||
expect(authorities['DIF_ID']).toEqual(url);
|
||||
expect(featurelist).toBeTruthy();
|
||||
expect(featurelist.format).toEqual('XML');
|
||||
expect(authorities['DIF_ID']).to.eql(url);
|
||||
expect(featurelist).to.be.ok();
|
||||
expect(featurelist.format).to.eql('XML');
|
||||
url = 'http://www.university.edu/data/roads_rivers.gml';
|
||||
expect(featurelist.href).toEqual(url);
|
||||
expect(layers['Pressure'].queryable).toBeTruthy();
|
||||
expect(layers['ozone_image'].queryable).toBeFalsy();
|
||||
expect(layers['population'].cascaded).toEqual(1);
|
||||
expect(layers['ozone_image'].fixedWidth).toEqual(512);
|
||||
expect(layers['ozone_image'].fixedHeight).toEqual(256);
|
||||
expect(layers['ozone_image'].opaque).toBeTruthy();
|
||||
expect(layers['ozone_image'].noSubsets).toBeTruthy();
|
||||
expect(time['default']).toEqual('2000-08-22');
|
||||
expect(time.values.length).toEqual(1);
|
||||
expect(time.values[0]).toEqual('1999-01-01/2000-08-22/P1D');
|
||||
expect(elevation.units).toEqual('CRS:88');
|
||||
expect(elevation['default']).toEqual('0');
|
||||
expect(elevation.nearestVal).toBeTruthy();
|
||||
expect(elevation.multipleVal).toBeFalsy();
|
||||
expect(elevation.values).toEqual(
|
||||
expect(featurelist.href).to.eql(url);
|
||||
expect(layers['Pressure'].queryable).to.be.ok();
|
||||
expect(layers['ozone_image'].queryable).to.not.be();
|
||||
expect(layers['population'].cascaded).to.eql(1);
|
||||
expect(layers['ozone_image'].fixedWidth).to.eql(512);
|
||||
expect(layers['ozone_image'].fixedHeight).to.eql(256);
|
||||
expect(layers['ozone_image'].opaque).to.be.ok();
|
||||
expect(layers['ozone_image'].noSubsets).to.be.ok();
|
||||
expect(time['default']).to.eql('2000-08-22');
|
||||
expect(time.values.length).to.eql(1);
|
||||
expect(time.values[0]).to.eql('1999-01-01/2000-08-22/P1D');
|
||||
expect(elevation.units).to.eql('CRS:88');
|
||||
expect(elevation['default']).to.eql('0');
|
||||
expect(elevation.nearestVal).to.be.ok();
|
||||
expect(elevation.multipleVal).to.not.be();
|
||||
expect(elevation.values).to.eql(
|
||||
['0', '1000', '3000', '5000', '10000']);
|
||||
expect(contactinfo).toBeTruthy();
|
||||
expect(personPrimary).toBeTruthy();
|
||||
expect(personPrimary.person).toEqual('Jeff Smith');
|
||||
expect(personPrimary.organization).toEqual('NASA');
|
||||
expect(contactinfo.position).toEqual('Computer Scientist');
|
||||
expect(addr).toBeTruthy();
|
||||
expect(addr.type).toEqual('postal');
|
||||
expect(addr.address).toEqual('NASA Goddard Space Flight Center');
|
||||
expect(addr.city).toEqual('Greenbelt');
|
||||
expect(addr.stateOrProvince).toEqual('MD');
|
||||
expect(addr.postcode).toEqual('20771');
|
||||
expect(addr.country).toEqual('USA');
|
||||
expect(contactinfo.phone).toEqual('+1 301 555-1212');
|
||||
expect(contactinfo.email).toEqual('user@host.com');
|
||||
expect('fees' in service).toBeFalsy();
|
||||
expect('accessConstraints' in service).toBeFalsy();
|
||||
expect(request).toBeTruthy();
|
||||
expect('getmap' in request).toBeTruthy();
|
||||
expect('getfeatureinfo' in request).toBeTruthy();
|
||||
expect(contactinfo).to.be.ok();
|
||||
expect(personPrimary).to.be.ok();
|
||||
expect(personPrimary.person).to.eql('Jeff Smith');
|
||||
expect(personPrimary.organization).to.eql('NASA');
|
||||
expect(contactinfo.position).to.eql('Computer Scientist');
|
||||
expect(addr).to.be.ok();
|
||||
expect(addr.type).to.eql('postal');
|
||||
expect(addr.address).to.eql('NASA Goddard Space Flight Center');
|
||||
expect(addr.city).to.eql('Greenbelt');
|
||||
expect(addr.stateOrProvince).to.eql('MD');
|
||||
expect(addr.postcode).to.eql('20771');
|
||||
expect(addr.country).to.eql('USA');
|
||||
expect(contactinfo.phone).to.eql('+1 301 555-1212');
|
||||
expect(contactinfo.email).to.eql('user@host.com');
|
||||
expect('fees' in service).to.not.be();
|
||||
expect('accessConstraints' in service).to.not.be();
|
||||
expect(request).to.be.ok();
|
||||
expect('getmap' in request).to.be.ok();
|
||||
expect('getfeatureinfo' in request).to.be.ok();
|
||||
var formats = ['text/xml', 'text/plain', 'text/html'];
|
||||
expect(request.getfeatureinfo.formats).toEqual(formats);
|
||||
expect(exception).toBeTruthy();
|
||||
expect(request.getfeatureinfo.formats).to.eql(formats);
|
||||
expect(exception).to.be.ok();
|
||||
formats = ['XML', 'INIMAGE', 'BLANK'];
|
||||
expect(exception.formats).toEqual(formats);
|
||||
expect(attribution.title).toEqual('State College University');
|
||||
expect(attribution.href).toEqual('http://www.university.edu/');
|
||||
expect(exception.formats).to.eql(formats);
|
||||
expect(attribution.title).to.eql('State College University');
|
||||
expect(attribution.href).to.eql('http://www.university.edu/');
|
||||
url = 'http://www.university.edu/icons/logo.gif';
|
||||
expect(attribution.logo.href).toEqual(url);
|
||||
expect(attribution.logo.format).toEqual('image/gif');
|
||||
expect(attribution.logo.width).toEqual('100');
|
||||
expect(attribution.logo.height).toEqual('100');
|
||||
expect(keywords.length).toEqual(3);
|
||||
expect(keywords[0].value).toEqual('road');
|
||||
expect(metadataURLs.length).toEqual(2);
|
||||
expect(metadataURLs[0].type).toEqual('FGDC:1998');
|
||||
expect(metadataURLs[0].format).toEqual('text/plain');
|
||||
expect(attribution.logo.href).to.eql(url);
|
||||
expect(attribution.logo.format).to.eql('image/gif');
|
||||
expect(attribution.logo.width).to.eql('100');
|
||||
expect(attribution.logo.height).to.eql('100');
|
||||
expect(keywords.length).to.eql(3);
|
||||
expect(keywords[0].value).to.eql('road');
|
||||
expect(metadataURLs.length).to.eql(2);
|
||||
expect(metadataURLs[0].type).to.eql('FGDC:1998');
|
||||
expect(metadataURLs[0].format).to.eql('text/plain');
|
||||
url = 'http://www.university.edu/metadata/roads.txt';
|
||||
expect(metadataURLs[0].href).toEqual(url);
|
||||
expect(metadataURLs[0].href).to.eql(url);
|
||||
var minScale = 250000;
|
||||
expect(capability.layers[0].minScale).toEqual(minScale.toPrecision(16));
|
||||
expect(capability.layers[0].minScale).to.eql(minScale.toPrecision(16));
|
||||
var maxScale = 1000;
|
||||
expect(capability.layers[0].maxScale).toEqual(maxScale.toPrecision(16));
|
||||
expect(obj.service.layerLimit).toEqual(16);
|
||||
expect(obj.service.maxHeight).toEqual(2048);
|
||||
expect(obj.service.maxWidth).toEqual(2048);
|
||||
expect(capability.layers[0].maxScale).to.eql(maxScale.toPrecision(16));
|
||||
expect(obj.service.layerLimit).to.eql(16);
|
||||
expect(obj.service.maxHeight).to.eql(2048);
|
||||
expect(obj.service.maxWidth).to.eql(2048);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,173 +5,173 @@ describe('ol.parser.ogc.wmtscapabilities_v1_0_0', function() {
|
||||
var parser = new ol.parser.ogc.WMTSCapabilities();
|
||||
|
||||
describe('test ows', function() {
|
||||
it('Test ows', function() {
|
||||
it('Test ows', function(done) {
|
||||
var obj, serviceIdentification, serviceProvider, operationsMetadata,
|
||||
contactInfo;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmtscapabilities_v1_0_0/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
serviceIdentification = obj.serviceIdentification;
|
||||
serviceProvider = obj.serviceProvider;
|
||||
operationsMetadata = obj.operationsMetadata;
|
||||
contactInfo = serviceProvider.serviceContact.contactInfo;
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmtscapabilities_v1_0_0/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
serviceIdentification = obj.serviceIdentification;
|
||||
serviceProvider = obj.serviceProvider;
|
||||
operationsMetadata = obj.operationsMetadata;
|
||||
contactInfo = serviceProvider.serviceContact.contactInfo;
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(serviceIdentification.title).toEqual('Web Map Tile Service');
|
||||
expect(serviceIdentification.serviceTypeVersion).toEqual('1.0.0');
|
||||
expect(serviceIdentification.serviceType.value).toEqual('OGC WMTS');
|
||||
expect(serviceProvider.providerName).toEqual('MiraMon');
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(serviceIdentification.title).to.eql('Web Map Tile Service');
|
||||
expect(serviceIdentification.serviceTypeVersion).to.eql('1.0.0');
|
||||
expect(serviceIdentification.serviceType.value).to.eql('OGC WMTS');
|
||||
expect(serviceProvider.providerName).to.eql('MiraMon');
|
||||
var url = 'http://www.creaf.uab.es/miramon';
|
||||
expect(serviceProvider.providerSite).toEqual(url);
|
||||
expect(serviceProvider.providerSite).to.eql(url);
|
||||
var name = 'Joan Maso Pau';
|
||||
expect(serviceProvider.serviceContact.individualName).toEqual(name);
|
||||
expect(serviceProvider.serviceContact.individualName).to.eql(name);
|
||||
var position = 'Senior Software Engineer';
|
||||
expect(serviceProvider.serviceContact.positionName).toEqual(position);
|
||||
expect(contactInfo.address.administrativeArea).toEqual('Barcelona');
|
||||
expect(contactInfo.address.city).toEqual('Bellaterra');
|
||||
expect(contactInfo.address.country).toEqual('Spain');
|
||||
expect(contactInfo.address.deliveryPoint).toEqual('Fac Ciencies UAB');
|
||||
expect(serviceProvider.serviceContact.positionName).to.eql(position);
|
||||
expect(contactInfo.address.administrativeArea).to.eql('Barcelona');
|
||||
expect(contactInfo.address.city).to.eql('Bellaterra');
|
||||
expect(contactInfo.address.country).to.eql('Spain');
|
||||
expect(contactInfo.address.deliveryPoint).to.eql('Fac Ciencies UAB');
|
||||
var email = 'joan.maso@uab.es';
|
||||
expect(contactInfo.address.electronicMailAddress).toEqual(email);
|
||||
expect(contactInfo.address.postalCode).toEqual('08193');
|
||||
expect(contactInfo.phone.voice).toEqual('+34 93 581 1312');
|
||||
expect(contactInfo.address.electronicMailAddress).to.eql(email);
|
||||
expect(contactInfo.address.postalCode).to.eql('08193');
|
||||
expect(contactInfo.phone.voice).to.eql('+34 93 581 1312');
|
||||
var dcp = operationsMetadata.GetCapabilities.dcp;
|
||||
url = 'http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?';
|
||||
expect(dcp.http.get[0].url).toEqual(url);
|
||||
expect(dcp.http.get[0].url).to.eql(url);
|
||||
dcp = operationsMetadata.GetCapabilities.dcp;
|
||||
expect(dcp.http.get[0].constraints.GetEncoding.allowedValues).toEqual(
|
||||
expect(dcp.http.get[0].constraints.GetEncoding.allowedValues).to.eql(
|
||||
{'KVP': true});
|
||||
url = 'http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?';
|
||||
dcp = operationsMetadata.GetFeatureInfo.dcp;
|
||||
expect(dcp.http.get[0].url).toEqual(url);
|
||||
expect(dcp.http.get[0].url).to.eql(url);
|
||||
dcp = operationsMetadata.GetFeatureInfo.dcp;
|
||||
expect(dcp.http.get[0].constraints).toBeUndefined();
|
||||
expect(dcp.http.get[0].constraints).to.be(undefined);
|
||||
url = 'http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?';
|
||||
expect(operationsMetadata.GetTile.dcp.http.get[0].url).toEqual(url);
|
||||
expect(operationsMetadata.GetTile.dcp.http.get[0].url).to.eql(url);
|
||||
dcp = operationsMetadata.GetTile.dcp;
|
||||
expect(dcp.http.get[0].constraints).toBeUndefined();
|
||||
expect(dcp.http.get[0].constraints).to.be(undefined);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('test layers', function() {
|
||||
it('Test layers', function() {
|
||||
it('Test layers', function(done) {
|
||||
var obj, contents, layer, wgs84Bbox, dimensions;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmtscapabilities_v1_0_0/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
contents = obj.contents;
|
||||
layer = contents.layers[0];
|
||||
wgs84Bbox = layer.bounds;
|
||||
dimensions = layer.dimensions;
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmtscapabilities_v1_0_0/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
contents = obj.contents;
|
||||
layer = contents.layers[0];
|
||||
wgs84Bbox = layer.bounds;
|
||||
dimensions = layer.dimensions;
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(contents.layers.length).toEqual(1);
|
||||
expect(layer['abstract']).toEqual('Coastline/shorelines (BA010)');
|
||||
expect(layer.identifier).toEqual('coastlines');
|
||||
expect(layer.title).toEqual('Coastlines');
|
||||
expect(layer.formats.length).toEqual(2);
|
||||
expect(layer.formats[0]).toEqual('image/png');
|
||||
expect(layer.formats[1]).toEqual('image/gif');
|
||||
expect(layer.styles.length).toEqual(2);
|
||||
expect(layer.styles[0].identifier).toEqual('DarkBlue');
|
||||
expect(layer.styles[0].isDefault).toBeTruthy();
|
||||
expect(layer.styles[0].title).toEqual('Dark Blue');
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(contents.layers.length).to.eql(1);
|
||||
expect(layer['abstract']).to.eql('Coastline/shorelines (BA010)');
|
||||
expect(layer.identifier).to.eql('coastlines');
|
||||
expect(layer.title).to.eql('Coastlines');
|
||||
expect(layer.formats.length).to.eql(2);
|
||||
expect(layer.formats[0]).to.eql('image/png');
|
||||
expect(layer.formats[1]).to.eql('image/gif');
|
||||
expect(layer.styles.length).to.eql(2);
|
||||
expect(layer.styles[0].identifier).to.eql('DarkBlue');
|
||||
expect(layer.styles[0].isDefault).to.be.ok();
|
||||
expect(layer.styles[0].title).to.eql('Dark Blue');
|
||||
var url = 'http://www.miramon.uab.es/wmts/Coastlines/' +
|
||||
'coastlines_darkBlue.png';
|
||||
expect(layer.styles[0].legend.href).toEqual(url);
|
||||
expect(layer.styles[0].legend.format).toEqual('image/png');
|
||||
expect(layer.styles[1].identifier).toEqual('thickAndRed');
|
||||
expect(!layer.styles[1].isDefault).toBeTruthy();
|
||||
expect(layer.styles[1].title).toEqual('Thick And Red');
|
||||
expect(layer.styles[1].legend).toBeUndefined();
|
||||
expect(layer.tileMatrixSetLinks.length).toEqual(1);
|
||||
expect(layer.tileMatrixSetLinks[0].tileMatrixSet).toEqual('BigWorld');
|
||||
expect(wgs84Bbox instanceof ol.Extent).toBeTruthy();
|
||||
expect(wgs84Bbox.minX).toEqual(-180.0);
|
||||
expect(wgs84Bbox.maxX).toEqual(180.0);
|
||||
expect(wgs84Bbox.minY).toEqual(-90.0);
|
||||
expect(wgs84Bbox.maxY).toEqual(90.0);
|
||||
expect(layer.resourceUrls.hasOwnProperty('tile')).toBeTruthy();
|
||||
expect(layer.styles[0].legend.href).to.eql(url);
|
||||
expect(layer.styles[0].legend.format).to.eql('image/png');
|
||||
expect(layer.styles[1].identifier).to.eql('thickAndRed');
|
||||
expect(!layer.styles[1].isDefault).to.be.ok();
|
||||
expect(layer.styles[1].title).to.eql('Thick And Red');
|
||||
expect(layer.styles[1].legend).to.be(undefined);
|
||||
expect(layer.tileMatrixSetLinks.length).to.eql(1);
|
||||
expect(layer.tileMatrixSetLinks[0].tileMatrixSet).to.eql('BigWorld');
|
||||
expect(wgs84Bbox instanceof ol.Extent).to.be.ok();
|
||||
expect(wgs84Bbox.minX).to.eql(-180.0);
|
||||
expect(wgs84Bbox.maxX).to.eql(180.0);
|
||||
expect(wgs84Bbox.minY).to.eql(-90.0);
|
||||
expect(wgs84Bbox.maxY).to.eql(90.0);
|
||||
expect(layer.resourceUrls.hasOwnProperty('tile')).to.be.ok();
|
||||
var format = 'image/png';
|
||||
expect(layer.resourceUrls.tile.hasOwnProperty(format)).toBeTruthy();
|
||||
expect(layer.resourceUrls.tile[format].length).toEqual(2);
|
||||
expect(layer.resourceUrls.tile.hasOwnProperty(format)).to.be.ok();
|
||||
expect(layer.resourceUrls.tile[format].length).to.eql(2);
|
||||
var tpl = 'http://a.example.com/wmts/coastlines/{TileMatrix}/' +
|
||||
'{TileRow}/{TileCol}.png';
|
||||
expect(layer.resourceUrls.tile[format][0]).toEqual(tpl);
|
||||
expect(layer.resourceUrls.tile[format][0]).to.eql(tpl);
|
||||
tpl = 'http://b.example.com/wmts/coastlines/{TileMatrix}/' +
|
||||
'{TileRow}/{TileCol}.png';
|
||||
expect(layer.resourceUrls.tile[format][1]).toEqual(tpl);
|
||||
expect(layer.resourceUrls.hasOwnProperty('FeatureInfo')).toBeTruthy();
|
||||
expect(layer.resourceUrls.tile[format][1]).to.eql(tpl);
|
||||
expect(layer.resourceUrls.hasOwnProperty('FeatureInfo')).to.be.ok();
|
||||
format = 'application/gml+xml; version=3.1';
|
||||
expect(layer.resourceUrls.FeatureInfo.hasOwnProperty(format))
|
||||
.toBeTruthy();
|
||||
expect(layer.resourceUrls.FeatureInfo[format].length).toEqual(1);
|
||||
.to.be.ok();
|
||||
expect(layer.resourceUrls.FeatureInfo[format].length).to.eql(1);
|
||||
tpl = 'http://www.example.com/wmts/coastlines/{TileMatrixSet}/' +
|
||||
'{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml';
|
||||
expect(layer.resourceUrls.FeatureInfo[format][0]).toEqual(tpl);
|
||||
expect(dimensions.length).toEqual(1);
|
||||
expect(dimensions[0].title).toEqual('Time');
|
||||
expect(dimensions[0]['abstract']).toEqual('Monthly datasets');
|
||||
expect(dimensions[0].identifier).toEqual('TIME');
|
||||
expect(dimensions[0]['default']).toEqual('default');
|
||||
expect(dimensions[0].values.length).toEqual(3);
|
||||
expect(dimensions[0].values[0]).toEqual('2007-05');
|
||||
expect(dimensions[0].values[1]).toEqual('2007-06');
|
||||
expect(dimensions[0].values[1]).toEqual('2007-06');
|
||||
expect(dimensions[0].values[2]).toEqual('2007-07');
|
||||
expect(layer.resourceUrls.FeatureInfo[format][0]).to.eql(tpl);
|
||||
expect(dimensions.length).to.eql(1);
|
||||
expect(dimensions[0].title).to.eql('Time');
|
||||
expect(dimensions[0]['abstract']).to.eql('Monthly datasets');
|
||||
expect(dimensions[0].identifier).to.eql('TIME');
|
||||
expect(dimensions[0]['default']).to.eql('default');
|
||||
expect(dimensions[0].values.length).to.eql(3);
|
||||
expect(dimensions[0].values[0]).to.eql('2007-05');
|
||||
expect(dimensions[0].values[1]).to.eql('2007-06');
|
||||
expect(dimensions[0].values[1]).to.eql('2007-06');
|
||||
expect(dimensions[0].values[2]).to.eql('2007-07');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('test tileMatrixSets', function() {
|
||||
it('Test tileMatrixSets', function() {
|
||||
it('Test tileMatrixSets', function(done) {
|
||||
var obj, tileMatrixSets, bigWorld;
|
||||
runs(function() {
|
||||
var url = 'spec/ol/parser/ogc/xml/wmtscapabilities_v1_0_0/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
tileMatrixSets = obj.contents.tileMatrixSets;
|
||||
bigWorld = tileMatrixSets['BigWorld'];
|
||||
});
|
||||
|
||||
var url = 'spec/ol/parser/ogc/xml/wmtscapabilities_v1_0_0/' +
|
||||
'ogcsample.xml';
|
||||
goog.net.XhrIo.send(url, function(e) {
|
||||
var xhr = e.target;
|
||||
obj = parser.read(xhr.getResponseXml());
|
||||
tileMatrixSets = obj.contents.tileMatrixSets;
|
||||
bigWorld = tileMatrixSets['BigWorld'];
|
||||
});
|
||||
|
||||
waitsFor(function() {
|
||||
return (obj !== undefined);
|
||||
}, 'XHR timeout', 1000);
|
||||
runs(function() {
|
||||
expect(bigWorld).toBeDefined();
|
||||
expect(bigWorld.identifier).toEqual('BigWorld');
|
||||
expect(bigWorld.matrixIds.length).toEqual(2);
|
||||
expect(bigWorld.matrixIds[0].identifier).toEqual('1e6');
|
||||
expect(bigWorld.matrixIds[0].matrixHeight).toEqual(50000);
|
||||
expect(bigWorld.matrixIds[0].matrixWidth).toEqual(60000);
|
||||
expect(bigWorld.matrixIds[0].scaleDenominator).toEqual(1000000);
|
||||
expect(bigWorld.matrixIds[0].tileWidth).toEqual(256);
|
||||
expect(bigWorld.matrixIds[0].tileHeight).toEqual(256);
|
||||
expect(bigWorld.matrixIds[0].topLeftCorner.x).toEqual(-180);
|
||||
expect(bigWorld.matrixIds[0].topLeftCorner.y).toEqual(84);
|
||||
expect(bigWorld.matrixIds[1].identifier).toEqual('2.5e6');
|
||||
expect(bigWorld.matrixIds[1].matrixHeight).toEqual(7000);
|
||||
expect(bigWorld.matrixIds[1].matrixWidth).toEqual(9000);
|
||||
expect(bigWorld.matrixIds[1].scaleDenominator).toEqual(2500000);
|
||||
expect(bigWorld.matrixIds[1].tileWidth).toEqual(256);
|
||||
expect(bigWorld.matrixIds[1].tileHeight).toEqual(256);
|
||||
expect(bigWorld.matrixIds[1].topLeftCorner.x).toEqual(-180);
|
||||
expect(bigWorld.matrixIds[1].topLeftCorner.y).toEqual(84);
|
||||
}, 'XHR timeout', 1000, function() {
|
||||
expect(bigWorld).to.not.be(undefined);
|
||||
expect(bigWorld.identifier).to.eql('BigWorld');
|
||||
expect(bigWorld.matrixIds.length).to.eql(2);
|
||||
expect(bigWorld.matrixIds[0].identifier).to.eql('1e6');
|
||||
expect(bigWorld.matrixIds[0].matrixHeight).to.eql(50000);
|
||||
expect(bigWorld.matrixIds[0].matrixWidth).to.eql(60000);
|
||||
expect(bigWorld.matrixIds[0].scaleDenominator).to.eql(1000000);
|
||||
expect(bigWorld.matrixIds[0].tileWidth).to.eql(256);
|
||||
expect(bigWorld.matrixIds[0].tileHeight).to.eql(256);
|
||||
expect(bigWorld.matrixIds[0].topLeftCorner.x).to.eql(-180);
|
||||
expect(bigWorld.matrixIds[0].topLeftCorner.y).to.eql(84);
|
||||
expect(bigWorld.matrixIds[1].identifier).to.eql('2.5e6');
|
||||
expect(bigWorld.matrixIds[1].matrixHeight).to.eql(7000);
|
||||
expect(bigWorld.matrixIds[1].matrixWidth).to.eql(9000);
|
||||
expect(bigWorld.matrixIds[1].scaleDenominator).to.eql(2500000);
|
||||
expect(bigWorld.matrixIds[1].tileWidth).to.eql(256);
|
||||
expect(bigWorld.matrixIds[1].tileHeight).to.eql(256);
|
||||
expect(bigWorld.matrixIds[1].topLeftCorner.x).to.eql(-180);
|
||||
expect(bigWorld.matrixIds[1].topLeftCorner.y).to.eql(84);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user