Skip to content

Commit

Permalink
Fix can not delete geonode instance from browser.
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsunni authored and nyalldawson committed Sep 12, 2017
1 parent 3016158 commit cad8fa8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
5 changes: 1 addition & 4 deletions src/core/geonode/qgsgeonoderequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ QgsGeoNodeStyle QgsGeoNodeRequest::getStyle( QString styleID )
void QgsGeoNodeRequest::replyProgress( qint64 bytesReceived, qint64 bytesTotal )
{
QString msg = tr( "%1 of %2 bytes of request downloaded." ).arg( bytesReceived ).arg( bytesTotal < 0 ? QStringLiteral( "unknown number of" ) : QString::number( bytesTotal ) );
QgsDebugMsg( msg );
QgsMessageLog::logMessage( QStringLiteral( "Reply in progress" ), tr( "GeoNode" ) );
QgsMessageLog::logMessage( msg, tr( "GeoNode" ) );
emit statusChanged( msg );
}
Expand Down Expand Up @@ -484,10 +482,9 @@ bool QgsGeoNodeRequest::request( QString endPoint )
{
abort();
mIsAborted = false;
QgsMessageLog::logMessage( mBaseUrl, tr( "GeoNode" ) );
// Handle case where the endpoint is full url
QString url = endPoint.startsWith( mBaseUrl ) ? endPoint : mBaseUrl + endPoint;
QgsMessageLog::logMessage( url, tr( "GeoNode" ) );
QgsMessageLog::logMessage( "Requesting to " + url, tr( "GeoNode" ) );
setProtocol( url.split( "://" )[0] );
QUrl layerUrl( url );
layerUrl.setScheme( getProtocol() );
Expand Down
6 changes: 2 additions & 4 deletions src/gui/geonode/qgsgeonodesourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ void QgsGeoNodeSourceSelect::connectToGeonodeConnection()

if ( !layers.empty() )
{
QgsMessageLog::logMessage( QStringLiteral( "Success" ), tr( "GeoNode" ) );
QgsMessageLog::logMessage( QStringLiteral( "Success, non empty layers %1" ).arg( layers.count( ) ), tr( "GeoNode" ) );
}
else
{
QgsMessageLog::logMessage( QStringLiteral( "Failed" ), tr( "GeoNode" ) );
QgsMessageLog::logMessage( QStringLiteral( "Failed, empty layers" ), tr( "GeoNode" ) );
}

if ( mModel )
Expand All @@ -217,8 +217,6 @@ void QgsGeoNodeSourceSelect::connectToGeonodeConnection()
{
QUuid uuid = layer.uuid;

QString layerName = layer.name;

QString wmsURL = layer.wmsURL;
QString wfsURL = layer.wfsURL;
QString xyzURL = layer.xyzURL;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/ows/qgsgeonodedataitems.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class QgsGeoNodeConnectionItem : public QgsDataCollectionItem
void editConnection();
void deleteConnection()
{
QgsGeoNodeConnection::deleteConnection( mParent->name() );
QgsGeoNodeConnection::deleteConnection( name() );
mParent->refresh();
};

Expand Down
23 changes: 21 additions & 2 deletions tests/src/core/testqgsgeonodeconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgssettings.h"
#include "qgsgeonoderequest.h"
#include "qgslogger.h"
#include "qgsmessagelog.h"

/** \ingroup UnitTests
* This is a unit test for the QgsGeoConnection class.
Expand Down Expand Up @@ -46,7 +47,10 @@ class TestQgsGeoNodeConnection: public QObject
// Check if we can create geonode connection from database.
void testCreation();

// Test API
// Test Layer API
void testLayerAPI();

// Test Style API
void testStyleAPI();

private:
Expand Down Expand Up @@ -122,9 +126,24 @@ void TestQgsGeoNodeConnection::testCreation()
}

// Test Layer API
void TestQgsGeoNodeConnection::testLayerAPI()
{
if ( mSkipRemoteTest )
{
QSKIP( "Skip remote test for faster testing" );
}

QgsGeoNodeRequest geonodeRequest( mKartozaGeoNodeQGISServerURL, true );
QList<QgsServiceLayerDetail> layers = geonodeRequest.getLayers();
QString msg = QStringLiteral( "Number of layers: %1" ).arg( layers.count() );
QgsDebugMsg( msg );
QVERIFY( layers.count() > 0 );
}

// Test Style API
void TestQgsGeoNodeConnection::testStyleAPI()
{
if ( !mSkipRemoteTest )
if ( mSkipRemoteTest )
{
QSKIP( "Skip remote test for faster testing" );
}
Expand Down

0 comments on commit cad8fa8

Please sign in to comment.