Skip to content

Commit

Permalink
- Update travis dist to '20.04 focal'
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Nov 1, 2020
1 parent 63739f6 commit 70ad77b
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 71 deletions.
29 changes: 19 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
language: python
python:
- 3.7
- 3.8

git:
depth: 3

cache:
bundler: true
yarn: true
pip: true
directories:
- node_modules
- $HOME/buildout-cache

before_cache:
- rm -f $HOME/.cache/pip/log/debug.log

dist: bionic
dist: focal

services:
- docker
- postgresql

addons:
hosts:
- geonode
postgresql: 9.6
chrome: stable
firefox: "latest-esr"
postgresql: "12"
apt:
packages:
- postgresql-9.6-postgis-2.4
- postgresql-12
- postgresql-client-12
- postgresql-server-dev-12
- postgresql-12-postgis-3
- nginx
sources:
- sourceline: 'ppa:ubuntugis/ppa'
firefox: "latest-esr"

branches:
only:
Expand Down Expand Up @@ -285,6 +292,9 @@ jobs:
- name: "Selenium Tests SPCGeoNode"

before_install:
- sudo sed -i 's/port = 5433/port = 5432/' /etc/postgresql/12/main/postgresql.conf
- sudo sed -i 's/peer/trust/' /etc/postgresql/12/main/pg_hba.conf
- sudo pg_ctlcluster 12 main restart
- if [ "$TEST_RUN_SELENIUM" = "True" ]; then
git clone --depth 1 https://github.com/GeoNode/geonode-selenium.git;
export GEONODE_REPOSITORY=$(pwd);
Expand Down Expand Up @@ -323,8 +333,7 @@ install:
export PATH=$PATH:$PWD/bin;
else
sudo apt -qq -y update;
sudo apt install -y libgdal20 gdal-bin gettext libxml2 libxml2-dev libxslt1-dev zlib1g-dev libjpeg-dev libpq-dev libgdal-dev;
sudo apt install -y sqlite3 spatialite-bin libsqlite3-mod-spatialite;
sudo apt install -y build-essential gdal-bin python3.8-dev python3.8-venv virtualenvwrapper libxml2 libxml2-dev gettext libxslt1-dev libjpeg-dev libpng-dev libpq-dev libgdal-dev software-properties-common build-essential git unzip gcc zlib1g-dev libgeos-dev libproj-dev sqlite3 spatialite-bin libsqlite3-mod-spatialite libsqlite3-dev;
sudo apt install -y openjdk-8-jre openjdk-8-jdk;
sudo update-java-alternatives --set java-1.8.0-openjdk-amd64;
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::");
Expand Down
46 changes: 25 additions & 21 deletions geonode/geoserver/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1124,29 +1124,33 @@ def set_styles(layer, gs_catalog):

# Legend links
logger.debug(" -- Resource Links[Legend link]...")
from geonode.base.models import Link
layer_legends = Link.objects.filter(resource=layer.resourcebase_ptr, name='Legend')
for style in set(list(layer.styles.all()) + [layer.default_style, ]):
style_name = os.path.basename(
urlparse(style.sld_url).path).split('.')[0]
legend_url = ogc_server_settings.PUBLIC_LOCATION + \
'ows?service=WMS&request=GetLegendGraphic&format=image/png&WIDTH=20&HEIGHT=20&LAYER=' + \
layer.alternate + '&STYLE=' + style_name + \
'&legend_options=fontAntiAliasing:true;fontSize:12;forceLabels:on'

if layer_legends.filter(url=legend_url).count() == 0:
Link.objects.update_or_create(
resource=layer.resourcebase_ptr,
name='Legend',
url=legend_url,
defaults=dict(
extension='png',
try:
from geonode.base.models import Link
layer_legends = Link.objects.filter(resource=layer.resourcebase_ptr, name='Legend')
for style in set(list(layer.styles.all()) + [layer.default_style, ]):
if style:
style_name = os.path.basename(
urlparse(style.sld_url).path).split('.')[0]
legend_url = ogc_server_settings.PUBLIC_LOCATION + \
'ows?service=WMS&request=GetLegendGraphic&format=image/png&WIDTH=20&HEIGHT=20&LAYER=' + \
layer.alternate + '&STYLE=' + style_name + \
'&legend_options=fontAntiAliasing:true;fontSize:12;forceLabels:on'

if layer_legends.filter(url=legend_url).count() == 0:
Link.objects.update_or_create(
resource=layer.resourcebase_ptr,
name='Legend',
url=legend_url,
mime='image/png',
link_type='image',
defaults=dict(
extension='png',
url=legend_url,
mime='image/png',
link_type='image',
)
)
)
logger.debug(" -- Resource Links[Legend link]...done!")
logger.debug(" -- Resource Links[Legend link]...done!")
except Exception as e:
logger.debug(f" -- Resource Links[Legend link]...error: {e}")

try:
set_geowebcache_invalidate_cache(layer.alternate or layer.typename)
Expand Down
2 changes: 1 addition & 1 deletion geonode/layers/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def decimal_encode(bbox):
20037397.02329845, 74299743.40061197]
logger.debug(projected_bbox)
for coord, check in zip(projected_bbox, solution):
self.assertAlmostEqual(coord, check)
self.assertAlmostEqual(coord, check, places=3)

def test_layer_attributes_feature_catalogue(self):
""" Test layer feature catalogue functionality
Expand Down
24 changes: 12 additions & 12 deletions geonode/tests/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,29 +281,29 @@ def test_layer_upload_bbox(self):
bbox_y1 = Decimal('-5.303545551999900')
srid = 'EPSG:4326'

self.assertAlmostEqual(bbox_x0, Decimal(uploaded.bbox_x0))
self.assertAlmostEqual(bbox_x1, Decimal(uploaded.bbox_x1))
self.assertAlmostEqual(bbox_y0, Decimal(uploaded.bbox_y0))
self.assertAlmostEqual(bbox_y1, Decimal(uploaded.bbox_y1))
self.assertAlmostEqual(bbox_x0, Decimal(uploaded.bbox_x0), places=3)
self.assertAlmostEqual(bbox_x1, Decimal(uploaded.bbox_x1), places=3)
self.assertAlmostEqual(bbox_y0, Decimal(uploaded.bbox_y0), places=3)
self.assertAlmostEqual(bbox_y1, Decimal(uploaded.bbox_y1), places=3)
self.assertTrue(uploaded.srid in srid)

# bbox format: [xmin,xmax,ymin,ymax]
uploaded_bbox_x0, uploaded_bbox_x1, \
uploaded_bbox_y0, uploaded_bbox_y1 = \
map(Decimal, uploaded.bbox[:4])
self.assertAlmostEqual(bbox_x0, uploaded_bbox_x0)
self.assertAlmostEqual(bbox_x1, uploaded_bbox_x1)
self.assertAlmostEqual(bbox_y0, uploaded_bbox_y0)
self.assertAlmostEqual(bbox_y1, uploaded_bbox_y1)
self.assertAlmostEqual(bbox_x0, uploaded_bbox_x0, places=3)
self.assertAlmostEqual(bbox_x1, uploaded_bbox_x1, places=3)
self.assertAlmostEqual(bbox_y0, uploaded_bbox_y0, places=3)
self.assertAlmostEqual(bbox_y1, uploaded_bbox_y1, places=3)

# bbox format: [xmin,ymin,xmax,ymax]
uploaded_bbox_string_x0, uploaded_bbox_string_y0, \
uploaded_bbox_string_x1, uploaded_bbox_string_y1 = \
map(Decimal, uploaded.bbox_string.split(','))
self.assertAlmostEqual(bbox_x0, uploaded_bbox_string_x0)
self.assertAlmostEqual(bbox_x1, uploaded_bbox_string_x1)
self.assertAlmostEqual(bbox_y0, uploaded_bbox_string_y0)
self.assertAlmostEqual(bbox_y1, uploaded_bbox_string_y1)
self.assertAlmostEqual(bbox_x0, uploaded_bbox_string_x0, places=3)
self.assertAlmostEqual(bbox_x1, uploaded_bbox_string_x1, places=3)
self.assertAlmostEqual(bbox_y0, uploaded_bbox_string_y0, places=3)
self.assertAlmostEqual(bbox_y1, uploaded_bbox_string_y1, places=3)
finally:
# Clean up and completely delete the layer
uploaded.delete()
Expand Down
17 changes: 11 additions & 6 deletions geonode/tests/smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,37 +236,42 @@ def test_inverse_mercator(self):
self.assertAlmostEqual(
arctic[0],
0.0,
places=3,
msg="Arctic longitude is correct")
self.assertAlmostEqual(
arctic[1],
85.0,
places=3,
msg="Arctic latitude is correct")

self.assertAlmostEqual(
antarctic[0],
0.0,
places=3,
msg="Antarctic longitude is correct")
self.assertAlmostEqual(
antarctic[1], -85.0, msg="Antarctic latitude is correct")
antarctic[1], -85.0, places=3, msg="Antarctic latitude is correct")

self.assertAlmostEqual(
hawaii[0], -180.0, msg="Hawaiian lon is correct")
self.assertAlmostEqual(hawaii[1], 0.0, msg="Hawaiian lat is correct")
self.assertAlmostEqual(hawaii[1], 0.0, places=3, msg="Hawaiian lat is correct")

self.assertAlmostEqual(
phillipines[0],
180.0,
places=3,
msg="Phillipines lon is correct")
self.assertAlmostEqual(
phillipines[1],
0.0,
places=3,
msg="Phillipines lat is correct")

self.assertAlmostEqual(ne[0], 180.0, msg="NE lon is correct")
self.assertAlmostEqual(ne[1], 90.0, msg="NE lat is correct")
self.assertAlmostEqual(ne[0], 180.0, places=3, msg="NE lon is correct")
self.assertAlmostEqual(ne[1], 90.0, places=3, msg="NE lat is correct")

self.assertAlmostEqual(sw[0], -180.0, msg="SW lon is correct")
self.assertAlmostEqual(sw[1], -90.0, msg="SW lat is correct")
self.assertAlmostEqual(sw[0], -180.0, places=3, msg="SW lon is correct")
self.assertAlmostEqual(sw[1], -90.0, places=3, msg="SW lat is correct")

def test_split_query(self):
query = 'alpha "beta gamma" delta '
Expand Down
46 changes: 25 additions & 21 deletions geonode/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1785,27 +1785,31 @@ def set_resource_default_links(instance, layer, prune=False, **kwargs):

# Legend link
logger.debug(" -- Resource Links[Legend link]...")
for style in instance.styles.all():
style_name = os.path.basename(
urlparse(style.sld_url).path).split('.')[0]
legend_url = ogc_server_settings.PUBLIC_LOCATION + \
'ows?service=WMS&request=GetLegendGraphic&format=image/png&WIDTH=20&HEIGHT=20&LAYER=' + \
instance.alternate + '&STYLE=' + style_name + \
'&legend_options=fontAntiAliasing:true;fontSize:12;forceLabels:on'

if Link.objects.filter(resource=instance.resourcebase_ptr, url=legend_url).count() < 2:
Link.objects.update_or_create(
resource=instance.resourcebase_ptr,
name='Legend',
url=legend_url,
defaults=dict(
extension='png',
url=legend_url,
mime='image/png',
link_type='image',
)
)
logger.debug(" -- Resource Links[Legend link]...done!")
try:
for style in set(list(instance.styles.all()) + [instance.default_style, ]):
if style:
style_name = os.path.basename(
urlparse(style.sld_url).path).split('.')[0]
legend_url = ogc_server_settings.PUBLIC_LOCATION + \
'ows?service=WMS&request=GetLegendGraphic&format=image/png&WIDTH=20&HEIGHT=20&LAYER=' + \
instance.alternate + '&STYLE=' + style_name + \
'&legend_options=fontAntiAliasing:true;fontSize:12;forceLabels:on'

if Link.objects.filter(resource=instance.resourcebase_ptr, url=legend_url).count() < 2:
Link.objects.update_or_create(
resource=instance.resourcebase_ptr,
name='Legend',
url=legend_url,
defaults=dict(
extension='png',
url=legend_url,
mime='image/png',
link_type='image',
)
)
logger.debug(" -- Resource Links[Legend link]...done!")
except Exception as e:
logger.debug(f" -- Resource Links[Legend link]...error: {e}")

# Thumbnail link
logger.debug(" -- Resource Links[Thumbnail link]...")
Expand Down

0 comments on commit 70ad77b

Please sign in to comment.