Skip to content

Commit

Permalink
Wfs 1.0.0 Basic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GarimaNatani committed May 23, 2018
1 parent b0c530d commit 14989c2
Show file tree
Hide file tree
Showing 8 changed files with 330 additions and 44 deletions.
8 changes: 5 additions & 3 deletions karma.conf.js
Expand Up @@ -20,7 +20,8 @@ module.exports = function(config) {
{pattern: 'src/**/*.js', included: false},
{pattern: 'examples/data/KML_Samples.kml', included: false},
{pattern: 'test/formats/geotiff/*.tif', included: false},
{pattern: 'test/ogc/wcs/*.xml', included: false}
{pattern: 'test/ogc/wcs/*.xml', included: false},
{pattern: 'test/ogc/wfs/*.xml', included: false}
],


Expand Down Expand Up @@ -57,11 +58,12 @@ module.exports = function(config) {
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

browserNoActivityTimeout: 300000,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['PhantomJS'],

browsers: ['PhantomJS'],
// browsers: ['Chrome'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
Expand Down
5 changes: 2 additions & 3 deletions src/ogc/ows/OwsWfsOperationsMetadata.js
Expand Up @@ -48,9 +48,8 @@ define([
var child = children[c];

if (child.localName === "Operation") {
this.operation = this.operation || [];
this.operation.push(OwsWfsOperationsMetadata.getOperationMetadataByName(child));
}
this.operation = this.getOperationMetadataByName(child);
}
}
};

Expand Down
67 changes: 33 additions & 34 deletions src/ogc/wfs/WfsCapabilities.js
Expand Up @@ -20,19 +20,16 @@
define([
'../../error/ArgumentError',
'../../util/Logger',
'../../ogc/ows/OwsKeywords',
'../../ogc/ows/OwsOperationsMetadata',
'../../ogc/ows/OwsWfsOperationsMetadata',
'../../ogc/ows/OwsWfsServiceIdentification',
'../../ogc/ows/OwsServiceProvider'
'../../ogc/ows/OwsWfsServiceProvider'
],

function (ArgumentError,
Logger,
OwsFeatureType,
OwsKeywords,
OwsOperationsMetadata,
OwsWfsOperationsMetadata,
OwsWfsServiceIdentification,
OwsServiceProvider) {
OwsWfsServiceProvider) {
"use strict";

/**
Expand Down Expand Up @@ -71,16 +68,19 @@ define([
this.updateSequence = root.getAttribute("updateSequence");

// Wfs 1.0.0 does not utilize OWS Common GetCapabilities service and capability descriptions.
if (this.version === "1.0.0") {
if (this.version === "1.0.0") {
this.assembleDocument100(root);
} else if (this.version === "1.1.0" )
this.assembleDocument110x(root);
else if( this.version === "2.0.0") {
}
/*else if (this.version === "1.1.0" )
this.assembleDocument110x(root);/*
else if( this.version === "2.0.0") {
this.assembleDocument200x(root);
} else {
}
else {
throw new ArgumentError(
Logger.logMessage(Logger.LEVEL_SEVERE, "WfsCapabilities", "assembleDocument", "unsupportedVersion"));
}
}*/
};

// Internal. Intentionally not documented.
Expand Down Expand Up @@ -110,9 +110,9 @@ define([
if (child.localName === "ServiceIdentification") {
this.serviceWfsIdentification = new OwsWfsServiceIdentification(child);
} else if (child.localName === "ServiceProvider") {
this.serviceProvider = new OwsServiceProvider(child);
this.serviceProvider = new OwsWfsServiceProvider(child);
} else if (child.localName === "OperationsMetadata") {
this.operationsMetadata = new OwsOperationsMetadata(child);
this.operationsMetadata = new OwsWfsOperationsMetadata(child);
} else if (child.localName === "FeatureTypeList") {
this.assembleFeatureType100(child);
} else if (child.localName === "Filter_Capabilities") {
Expand All @@ -130,9 +130,9 @@ WfsCapabilities.prototype.assembleDocument200x = function (root) {
if (child.localName === "ServiceIdentification") {
this.serviceWfsIdentification = new OwsWfsServiceIdentification(child);
} else if (child.localName === "ServiceProvider") {
this.serviceProvider = new OwsServiceProvider(child);
this.serviceProvider = new OwsWfsServiceProvider(child);
} else if (child.localName === "OperationsMetadata") {
this.operationsMetadata = new OwsOperationsMetadata(child);
this.operationsMetadata = new OwsWfsOperationsMetadata(child);
} else if (child.localName === "FeatureTypeList") {
this.assembleFeatureType100(child);
} else if (child.localName === "Filter_Capabilities") {
Expand Down Expand Up @@ -197,7 +197,7 @@ WfsCapabilities.prototype.assembleDocument200x = function (root) {
}
else if (child.localName === "fes:GeometryOperands") {
this.Operators(child);

}
else if (child.localName === "fes:SpatialOperators") {
this.Operators(child);
}
Expand Down Expand Up @@ -294,7 +294,7 @@ WfsCapabilities.prototype.assembleDocument200x = function (root) {
} else if (child.localName === "SRS") {
FeatureType.SRS = child.textContent;
} else if (child.localName === "LatLongBoundingBox") {
FeatureType.wgs84BoundingBox = this.assembleLatLonBoundingBox(child);
FeatureType.LatLongBoundingBox = this.assembleLatLonBoundingBox(child);
}
else if (child.localName === "Abstract") {
FeatureType.abstract = child.textContent;
Expand All @@ -310,22 +310,19 @@ WfsCapabilities.prototype.assembleDocument200x = function (root) {
else if (child.localName === "wgs84BoundingBox") {
FeatureType.wgs84BoundingBox = this.assembleBoundingBox(child);
}
else if (child.localName === "LatLongBoundingBox") {
FeatureType.wgs84BoundingBox = this.assembleLatLonBoundingBox(child);
}

}

return FeatureType;
};

WfsCapabilities.assembleLatLonBoundingBox = function (bboxElement) {
WfsCapabilities.prototype.assembleLatLonBoundingBox = function (bboxElement) {
var result = {};

result.minx = WfsCapabilities.getFloatAttribute(bboxElement, "minx");
result.miny = WfsCapabilities.getFloatAttribute(bboxElement, "miny");
result.maxx = WfsCapabilities.getFloatAttribute(bboxElement, "maxx");
result.maxy = WfsCapabilities.getFloatAttribute(bboxElement, "maxy");

result.minx = bboxElement.getAttribute("minx");
result.miny = bboxElement.getAttribute("miny");
result.maxx = bboxElement.getAttribute("maxx");
result.maxy = bboxElement.getAttribute("maxy");
//console.log(result);
return result;
};
// Internal. Intentionally not documented. --Service version 1.0.0 Attribute
Expand Down Expand Up @@ -458,9 +455,11 @@ WfsCapabilities.prototype.assembleDocument200x = function (root) {

// Internal. Intentionally not documented.
WfsCapabilities.prototype.assembleOnlineResource100 = function (element) {
var children = element.children || element.childNodes;

return children.getAttribute("OnlineResource");
var children = element.children || element.childNodes, Attribute;
for (var c = 0; c < children.length; c++) {
var child = children[c];
Attribute = child.getAttribute("OnlineResource");
}

};

Expand Down Expand Up @@ -567,8 +566,8 @@ WfsCapabilities.prototype.Id_Capabilities= function (element) {
var child = children[c];
if (child.localName === "fes:TemporalOperands") {
this.Operators(child);
else
if (child.localName === "fes:TemporalOperators") {
}
else if (child.localName === "fes:TemporalOperators") {
this.Operators(child);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/ogc/wms/WmsCapabilities.js
Expand Up @@ -58,7 +58,7 @@ define([

WmsCapabilities.prototype.accumulateNamedLayers = function (startLayers, namedLayersArray) {
var namedLayers = namedLayersArray || [];

if (!startLayers) {
return namedLayers;
}
Expand All @@ -77,7 +77,7 @@ define([
};

/**
* Searches for a named layer matching the provided name and returns the WmsLayerCapabilities object representing
* Searches for a named layer matching the provided name and returns the WmsLayerCapabilities object representing
* the named layer.
* @param {String} name the layer name to find
* @returns {WmsLayerCapabilities} if a matching named layer is found or null
Expand Down Expand Up @@ -117,8 +117,8 @@ define([
}
}
};
WmsCapabilities.prototype.assembleService = function (element) {

WmsCapabilities.prototype.assembleService = function (element) {
var service = {
capsDoc: this
};
Expand Down
2 changes: 1 addition & 1 deletion test/ogc/wcs/WcsCapabilities.test.js
Expand Up @@ -41,7 +41,7 @@ define([
done();
} else {
done("Test WCS Capabilities Retrieval Error: " + xhr.statusText);
}
}
}
});
xhr.send(null);
Expand Down
7 changes: 7 additions & 0 deletions test/ogc/wfs/wfs100GetCapabilities.xml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions test/ogc/wfs/wfs201GetCapabilities.xml

Large diffs are not rendered by default.

0 comments on commit 14989c2

Please sign in to comment.