Skip to content
This repository has been archived by the owner on Mar 2, 2019. It is now read-only.

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Tuck authored and Sean Tuck committed Feb 16, 2017
1 parent 1a457c1 commit 17a00ca
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 12 deletions.
5 changes: 2 additions & 3 deletions R/GetBands.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function(Product)
reader <- basicTextGatherer()
header <- basicTextGatherer()

curlPerform(url = paste0(daacmodis, "/cgi-bin/MODIS/GLBVIZ_1_Glb_subset/MODIS_webservice.pl"),
curlPerform(url = paste0(daacmodis, wsdl_loc),
httpheader = header.fields,
postfields = getbands.xml,
writefunction = reader$update,
Expand All @@ -32,8 +32,7 @@ function(Product)
# Check the server is not down by insepcting the XML response for internal server error message.
if(grepl("Internal Server Error", reader$value())){
stop("Web service failure: the ORNL DAAC server seems to be down, please try again later.
The online subsetting tool (https://daac.ornl.gov/cgi-bin/MODIS/GLBVIZ_1_Glb/modis_subset_order_global_col5.pl)
will indicate when the server is up and running again.")
The online subsetting tool may indicate when the server is up and running again.")
}

xmlres <- xmlRoot(xmlTreeParse(reader$value()))
Expand Down
2 changes: 1 addition & 1 deletion R/GetProducts.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function()
reader <- basicTextGatherer()
header <- basicTextGatherer()

curlPerform(url = paste0(daacmodis, "/cgi-bin/MODIS/GLBVIZ_1_Glb_subset/MODIS_webservice.pl"),
curlPerform(url = paste0(daacmodis, wsdl_loc),
httpheader = header.fields,
postfields = getproducts.xml,
writefunction = reader$update,
Expand Down
2 changes: 1 addition & 1 deletion R/GetSubset.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function(Lat, Long, Product, Band, StartDate, EndDate, KmAboveBelow, KmLeftRight
reader <- basicTextGatherer()
header <- basicTextGatherer()

curlPerform(url = paste0(daacmodis, "/cgi-bin/MODIS/GLBVIZ_1_Glb_subset/MODIS_webservice.pl"),
curlPerform(url = paste0(daacmodis, wsdl_loc),
httpheader = header.fields,
postfields = getsubset.xml,
writefunction = reader$update,
Expand Down
1 change: 1 addition & 0 deletions R/daacmodis.R
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
daac <- getOption("MODIStools.daac", default = "https://daac.ornl.gov")
daacmodis <- getOption("MODIStools.daacmodis", default = "https://daacmodis.ornl.gov")
wsdl_loc <- getOption("MODIStools.wsdl_loc", default = "/cgi-bin/MODIS/GLBVIZ_1_Glb_subset/MODIS_webservice.pl")
6 changes: 4 additions & 2 deletions man/daacmodis.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
\alias{daacmodis}
\docType{data}
\title{
Base URLs for MODIS downloads
Base URLs for MODIS downloads and the web service location
}
\description{
These give the base URLs for MODIS downloads. Originally they were \url{http://daac.ornl.gov}
Expand All @@ -16,8 +16,10 @@ will be initialized to values of \code{getOption("MODIStools.daac", default = "h
and \code{getOption("MODIStools.daacmodis", default = "https://daacmodis.ornl.gov")} in case there is
a future change.
}
\usage{daac
\usage{
daac
daacmodis
wsdl_loc
}
\format{
The format is:
Expand Down
4 changes: 2 additions & 2 deletions tests/MODISTools_FullTestingScript.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ header.fields <- c(Accept = "text/xml",
reader <- basicTextGatherer()
header <- basicTextGatherer()

curlPerform(url = paste0(daacmodis, "/cgi-bin/MODIS/GLBVIZ_1_Glb_subset/MODIS_webservice.pl"),
curlPerform(url = paste0(daacmodis, wsdl_doc),
httpheader = header.fields,
postfields = getsubset.xml,
writefunction = reader$update,
Expand Down Expand Up @@ -171,7 +171,7 @@ if(!file.check){
if(class(try(GetProducts(), silent = TRUE)) == "try-error") q()

# Check we can still reach the server for lpdaac modis web service before running functions that request.
if(.Platform$OS.type == "unix" && is.null(nsl("daac.ornl.gov"))) q()
if(.Platform$OS.type == "unix" && is.null(nsl("daacmodis.ornl.gov"))) q()
# Check example of MODISTransects
if(grepl("Server is busy handling other requests",
GetSubset(Lat = SubsetExample$lat, Long = SubsetExample$long, Product = "MOD13Q1", Band = "250m_16_days_EVI",
Expand Down
6 changes: 3 additions & 3 deletions tests/Test.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if(!capabilities("http/ftp")) q()
if(.Platform$OS.type == "unix" && is.null(nsl("cran.r-project.org"))) q()

# Check we can reach the server for lpdaac modis web service.
if(.Platform$OS.type == "unix" && is.null(nsl("daac.ornl.gov"))) q()
if(.Platform$OS.type == "unix" && is.null(nsl("daacmodis.ornl.gov"))) q()

# Check the web service is currently responsive.
if(class(try(GetProducts(), silent = TRUE)) == "try-error") q()
Expand All @@ -29,7 +29,7 @@ if(class(try(GetProducts(), silent = TRUE)) == "try-error") q()
# Check the XML response is as expected.
getsubset.xml <- paste('
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mod="', daac, '/MODIS_webservice">
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mod="', daacmodis, '/MODIS_webservice">
<soapenv:Header/>
<soapenv:Body>
<mod:getsubset soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
Expand All @@ -54,7 +54,7 @@ header.fields <- c(Accept = "text/xml",
reader <- basicTextGatherer()
header <- basicTextGatherer()

curlPerform(url = paste0(daac, "/cgi-bin/MODIS/GLBVIZ_1_Glb_subset/MODIS_webservice.pl"),
curlPerform(url = paste0(daacmodis, wsdl_loc),
httpheader = header.fields,
postfields = getsubset.xml,
writefunction = reader$update,
Expand Down

0 comments on commit 17a00ca

Please sign in to comment.