From 28053d62bb3bb1451e4c5b5c2a7a100e68dd3e9b Mon Sep 17 00:00:00 2001 From: eblondel Date: Mon, 14 Feb 2022 16:43:13 +0100 Subject: [PATCH] #9 fix serviceVersion-owsVersion mapping --- R/WCSCapabilities.R | 9 +++++++-- tests/testthat/test_WCSClient_v1_1.R | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/R/WCSCapabilities.R b/R/WCSCapabilities.R index 66dd27a..86040e8 100644 --- a/R/WCSCapabilities.R +++ b/R/WCSCapabilities.R @@ -52,13 +52,18 @@ WCSCapabilities <- R6Class("WCSCapabilities", #'@param ... any other parameter to pass to \link{OWSGetCapabilities} service request initialize = function(url, version, client = NULL, logger = NULL, ...) { owsVersion <- switch(version, - "1.0" = "1.1", + "1.0" = "1.1", "1.0.0" = "1.1", + "1.1" = "1.1", "1.1.0" = "1.1", "1.1.1" = "1.1", "2.0.0" = "2.0", - "2.0.1" = "2.0" + "2.0.1" = "2.0", + NULL ) + if(is.null(owsVersion)){ + stop(sprintf("Unknown WCS service version '%s'", version)) + } super$initialize(element = private$xmlElement, namespacePrefix = private$xmlNamespacePrefix, url, service = "WCS", owsVersion = owsVersion, serviceVersion = version, client = client, logger = logger, ...) diff --git a/tests/testthat/test_WCSClient_v1_1.R b/tests/testthat/test_WCSClient_v1_1.R index 61d4e1b..3821578 100644 --- a/tests/testthat/test_WCSClient_v1_1.R +++ b/tests/testthat/test_WCSClient_v1_1.R @@ -50,7 +50,7 @@ test_that("WCS 1.1.1 - GeoServer",{ expect_is(sfdem, "WCSCoverageSummary") sfdem_desc <- sfdem$getDescription() expect_is(sfdem_desc, "WCSCoverageDescription") - domain <- sfdem_desc$getDomain() + expect_is(domain, "WCSCoverageDomain") expect_is(domain$getSpatialDomain(), "WCSCoverageSpatialDomain") })