Skip to content

Commit 217c0e7

Browse files
authoredOct 10, 2017
Merge pull request #5145 from pblottiere/bugfix_ogc_getcapa_schemalocation
[server][bugfix] Fix OGC test getcapabilities:validate-using-schemaLocation
2 parents e6dcfa4 + 43bb311 commit 217c0e7

File tree

9 files changed

+37
-2
lines changed

9 files changed

+37
-2
lines changed
 

‎python/core/qgsapplication.sip

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@ Returns the path to the donors file.
210210
:rtype: str
211211
%End
212212

213+
static QString serverResourcesPath();
214+
%Docstring
215+
Returns the path to the server resources directory.
216+
:rtype: str
217+
%End
218+
213219
static QString translatorsFilePath();
214220
%Docstring
215221
Returns the path to the sponsors file.

‎resources/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ INSTALL(FILES qgis_global_settings.ini
44
DESTINATION ${QGIS_DATA_DIR})
55
INSTALL(DIRECTORY cpt-city-qgis-min DESTINATION ${QGIS_DATA_DIR}/resources)
66
INSTALL(DIRECTORY themes DESTINATION ${QGIS_DATA_DIR}/resources)
7+
8+
IF (WITH_SERVER)
9+
INSTALL(DIRECTORY server DESTINATION ${QGIS_DATA_DIR}/resources)
10+
ENDIF (WITH_SERVER)
File renamed without changes.

‎src/core/qgsapplication.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,11 @@ QString QgsApplication::defaultThemesFolder()
846846
return ABISYM( mPkgDataPath ) + QStringLiteral( "/resources/themes" );
847847
}
848848

849+
QString QgsApplication::serverResourcesPath()
850+
{
851+
return ABISYM( mPkgDataPath ) + QStringLiteral( "/resources/server/" );
852+
}
853+
849854
QString QgsApplication::libraryPath()
850855
{
851856
return ABISYM( mLibraryPath );

‎src/core/qgsapplication.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ class CORE_EXPORT QgsApplication : public QApplication
231231
//! Returns the path to the donors file.
232232
static QString donorsFilePath();
233233

234+
//! Returns the path to the server resources directory.
235+
static QString serverResourcesPath();
236+
234237
/**
235238
* Returns the path to the sponsors file.
236239
*/

‎src/server/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,5 @@ INSTALL(TARGETS
203203
INSTALL(FILES
204204
admin.sld
205205
wms_metadata.xml
206-
schemaExtension.xsd
207206
DESTINATION ${QGIS_CGIBIN_DIR}
208207
)

‎src/server/services/wms/qgswmsgetschemaextension.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
***************************************************************************/
2121
#include "qgswmsutils.h"
2222
#include "qgswmsgetschemaextension.h"
23+
#include "qgsapplication.h"
2324

25+
#include <QDir>
2426
#include <QFileInfo>
2527

2628
namespace QgsWms
@@ -44,7 +46,9 @@ namespace QgsWms
4446

4547
QDomDocument xsdDoc;
4648

47-
QFileInfo xsdFileInfo( QStringLiteral( "schemaExtension.xsd" ) );
49+
QDir resourcesDir = QFileInfo( QgsApplication::serverResourcesPath() ).absoluteDir();
50+
QFileInfo xsdFileInfo( resourcesDir, QStringLiteral( "schemaExtension.xsd" ) );
51+
4852
if ( !xsdFileInfo.exists() )
4953
{
5054
QgsMessageLog::logMessage( QStringLiteral( "Error, xsd file 'schemaExtension.xsd' does not exist" ),

‎tests/src/python/test_qgsserver_wms.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ def test_project_wms(self):
184184
'&layers=testlayer%20%C3%A8%C3%A9&',
185185
'getstyles')
186186

187+
def test_wms_getschemaextension(self):
188+
self.wms_request_compare('GetSchemaExtension',
189+
'',
190+
'getschemaextension')
191+
187192
def wms_inspire_request_compare(self, request):
188193
"""WMS INSPIRE tests"""
189194
project = self.testdata_path + "test_project_inspire.qgs"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*****
2+
Content-Type: text/xml; charset=utf-8
3+
4+
<?xml version='1.0' encoding='UTF-8'?>
5+
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.qgis.org/wms" elementFormDefault="qualified" version="1.0.0">
6+
<import xmlns="http://www.w3.org/2001/XMLSchema" namespace="http://www.opengis.net/wms" schemaLocation="http://schemas.opengis.net/wms/1.3.0/capabilities_1_3_0.xsd"/>
7+
<element xmlns="http://www.w3.org/2001/XMLSchema" name="GetPrint" substitutionGroup="wms:_ExtendedOperation" type="wms:OperationType"/>
8+
<element xmlns="http://www.w3.org/2001/XMLSchema" name="GetStyles" substitutionGroup="wms:_ExtendedOperation" type="wms:OperationType"/>
9+
</schema>

0 commit comments

Comments
 (0)
Please sign in to comment.