import OWS from '../../../../../src/ol/format/OWS.js';
import {parse} from '../../../../../src/ol/xml.js';
describe('ol.format.OWS 1.1', function () {
const parser = new OWS();
it('should read ServiceProvider tag properly', function () {
const doc = parse(
'' +
'' +
'MiraMon' +
'' +
'' +
'Joan Maso Pau' +
'' +
'Senior Software Engineer' +
'' +
'' +
'' +
'+34 93 581 1312' +
'+34 93 581 4151' +
'' +
'' +
'' +
'Fac Ciencies UAB' +
'' +
'Bellaterra' +
'Barcelona' +
'' +
'08193' +
'Spain' +
'joan.maso@uab.es' +
'' +
'' +
'' +
'' +
'' +
''
);
const obj = parser.read(doc);
expect(obj).to.be.ok();
const serviceProvider = obj.ServiceProvider;
expect(serviceProvider).to.be.ok();
expect(serviceProvider.ProviderName).to.eql('MiraMon');
const url = 'http://www.creaf.uab.es/miramon';
expect(serviceProvider.ProviderSite).to.eql(url);
const name = 'Joan Maso Pau';
expect(serviceProvider.ServiceContact.IndividualName).to.eql(name);
const position = 'Senior Software Engineer';
expect(serviceProvider.ServiceContact.PositionName).to.eql(position);
});
it('should read ServiceIdentification tag properly', function () {
const doc = parse(
'' +
'' +
'Web Map Tile Service' +
'Service that contrains the map access interface ' +
'to some TileMatrixSets' +
'' +
'tile' +
'tile matrix set' +
'map' +
'' +
'OGC WMTS' +
'1.0.0' +
'none' +
'none' +
'' +
''
);
const obj = parser.readFromNode(doc.firstChild);
expect(obj).to.be.ok();
const serviceIdentification = obj.ServiceIdentification;
expect(serviceIdentification).to.be.ok();
expect(serviceIdentification.Abstract).to.eql(
'Service that contrains the map access interface to some TileMatrixSets'
);
expect(serviceIdentification.AccessConstraints).to.eql('none');
expect(serviceIdentification.Fees).to.eql('none');
expect(serviceIdentification.Title).to.eql('Web Map Tile Service');
expect(serviceIdentification.ServiceTypeVersion).to.eql('1.0.0');
expect(serviceIdentification.ServiceType).to.eql('OGC WMTS');
});
it('should read OperationsMetadata tag properly', function () {
const doc = parse(
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'KVP' +
'SOAP' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
''
);
const obj = parser.readFromNode(doc.firstChild);
expect(obj).to.be.ok();
const operationsMetadata = obj.OperationsMetadata;
expect(operationsMetadata).to.be.ok();
const getCap = operationsMetadata.GetCapabilities;
let dcp = getCap.DCP;
let url = 'http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?';
expect(dcp.HTTP.Get[0].href).to.eql(url);
expect(dcp.HTTP.Get[0].Constraint[0].name).to.eql('GetEncoding');
expect(dcp.HTTP.Get[0].Constraint[0].AllowedValues.Value[0]).to.eql('KVP');
url = 'http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?';
dcp = operationsMetadata.GetFeatureInfo.DCP;
expect(dcp.HTTP.Get[0].href).to.eql(url);
expect(dcp.HTTP.Get[0].Constraint).to.be(undefined);
url = 'http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?';
dcp = operationsMetadata.GetTile.DCP;
expect(dcp.HTTP.Get[0].href).to.eql(url);
expect(dcp.HTTP.Get[0].Constraint).to.be(undefined);
});
});