-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
244 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ Package: geometa | |
Type: Package | ||
Title: Tools for Reading and Writing ISO/OGC Geographic Metadata | ||
Version: 0.3-0 | ||
Date: 2018-01-22 | ||
Date: 2018-01-29 | ||
Author: Emmanuel Blondel <[email protected]> | ||
Maintainer: Emmanuel Blondel <[email protected]> | ||
Description: Provides facilities to handle reading and writing of geographic metadata | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# test_GMLConversion.R | ||
# Author: Emmanuel Blondel <[email protected]> | ||
# | ||
# Description: Unit tests for GMLConversion.R | ||
#======================= | ||
require(geometa, quietly = TRUE) | ||
require(testthat) | ||
require(XML) | ||
|
||
context("GMLConversion") | ||
|
||
test_that("encoding",{ | ||
#encoding | ||
pv1 <- GMLParameterValue$new() | ||
pv1$setValue(1.0, "m") | ||
op <- GMLOperationParameter$new() | ||
op$setDescriptionReference("someref") | ||
op$setIdentifier("identifier", "codespace") | ||
op$addName("name1", "codespace") | ||
op$addName("name2", "codespace") | ||
op$setMinimumOccurs(2L) | ||
pv1$setOperationParameter(op) | ||
|
||
pv2 <- GMLParameterValue$new() | ||
pv2$setValue(2.0, "m") | ||
op2 <- GMLOperationParameter$new() | ||
op2$setDescriptionReference("someref") | ||
op2$setIdentifier("identifier", "codespace") | ||
op2$addName("name1", "codespace") | ||
op2$addName("name2", "codespace") | ||
op2$setMinimumOccurs(2L) | ||
pv2$setOperationParameter(op2) | ||
|
||
pvg <- GMLParameterValueGroup$new() | ||
pvg$addParameterValue(pv1) | ||
pvg$addParameterValue(pv2) | ||
|
||
opg <- GMLOperationParameterGroup$new() | ||
opg$setDescriptionReference("someref") | ||
opg$setIdentifier("identifier", "codespace") | ||
opg$addName("name1", "codespace") | ||
opg$addName("name2", "codespace") | ||
opg$setMinimumOccurs(2L) | ||
opg$setMaximumOccurs(4L) | ||
pvg$setOperationParameterGroup(opg) | ||
|
||
gml <- GMLConversion$new() | ||
gml$addParameterValue(pvg) | ||
|
||
method <- GMLOperationMethod$new() | ||
method$setIdentifier("method","codespace") | ||
method$setSourceDimensions(1) | ||
method$setTargetDimensions(1) | ||
|
||
cit <- ISOCitation$new() | ||
cit$setTitle("sometitle") | ||
d <- ISODate$new() | ||
d$setDate(ISOdate(2015, 1, 1, 1)) | ||
d$setDateType("publication") | ||
cit$addDate(d) | ||
expect_error(cit$addDate("wrong date type")) | ||
cit$setEdition("1.0") | ||
cit$setEditionDate(ISOdate(2015, 1, 1, 1)) | ||
expect_error(cit$setEditionDate("wrong date type")) | ||
cit$setIdentifier(ISOMetaIdentifier$new(code = "identifier")) | ||
expect_error(cit$setIdentifier("wrong identifier type")) | ||
cit$setPresentationForm("mapDigital") | ||
|
||
#adding a cited responsible party | ||
rp <- ISOResponsibleParty$new() | ||
rp$setIndividualName("someone") | ||
rp$setOrganisationName("somewhere") | ||
rp$setPositionName("someposition") | ||
rp$setRole("pointOfContact") | ||
contact <- ISOContact$new() | ||
phone <- ISOTelephone$new() | ||
phone$setVoice("myphonenumber") | ||
phone$setFacsimile("myfacsimile") | ||
contact$setPhone(phone) | ||
address <- ISOAddress$new() | ||
address$setDeliveryPoint("theaddress") | ||
address$setCity("thecity") | ||
address$setPostalCode("111") | ||
address$setCountry("France") | ||
address$setEmail("[email protected]") | ||
contact$setAddress(address) | ||
res <- ISOOnlineResource$new() | ||
res$setLinkage("http://www.somewhereovertheweb.org") | ||
res$setName("somename") | ||
contact$setOnlineResource(res) | ||
rp$setContactInfo(contact) | ||
cit$setCitedResponsibleParty(rp) | ||
method$setFormulaCitation(cit) | ||
|
||
gml$setIdentifier("conversion", "codespace") | ||
extent <- ISOExtent$new() | ||
bbox <- ISOGeographicBoundingBox$new(minx = -180, miny = -90, maxx = 180, maxy = 90) | ||
extent$setGeographicElement(bbox) | ||
gml$setDomainOfValidity(extent) | ||
gml$addScope("scope") | ||
xml <- gml$encode() | ||
expect_is(xml, "XMLInternalNode") | ||
#decoding | ||
gml2 <- GMLConversion$new(xml = xml) | ||
xml2 <- gml2$encode() | ||
#object identity | ||
expect_true(ISOAbstractObject$compare(gml, gml2)) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# test_GMLConversion.R | ||
# Author: Emmanuel Blondel <[email protected]> | ||
# | ||
# Description: Unit tests for GMLConversion.R | ||
#======================= | ||
require(geometa, quietly = TRUE) | ||
require(testthat) | ||
require(XML) | ||
|
||
context("GMLConversion") | ||
|
||
test_that("encoding",{ | ||
#encoding | ||
gml <- GMLOperationMethod$new() | ||
gml$setIdentifier("method","codespace") | ||
gml$setSourceDimensions(1) | ||
gml$setTargetDimensions(1) | ||
|
||
cit <- ISOCitation$new() | ||
cit$setTitle("sometitle") | ||
d <- ISODate$new() | ||
d$setDate(ISOdate(2015, 1, 1, 1)) | ||
d$setDateType("publication") | ||
cit$addDate(d) | ||
expect_error(cit$addDate("wrong date type")) | ||
cit$setEdition("1.0") | ||
cit$setEditionDate(ISOdate(2015, 1, 1, 1)) | ||
expect_error(cit$setEditionDate("wrong date type")) | ||
cit$setIdentifier(ISOMetaIdentifier$new(code = "identifier")) | ||
expect_error(cit$setIdentifier("wrong identifier type")) | ||
cit$setPresentationForm("mapDigital") | ||
|
||
#adding a cited responsible party | ||
rp <- ISOResponsibleParty$new() | ||
rp$setIndividualName("someone") | ||
rp$setOrganisationName("somewhere") | ||
rp$setPositionName("someposition") | ||
rp$setRole("pointOfContact") | ||
contact <- ISOContact$new() | ||
phone <- ISOTelephone$new() | ||
phone$setVoice("myphonenumber") | ||
phone$setFacsimile("myfacsimile") | ||
contact$setPhone(phone) | ||
address <- ISOAddress$new() | ||
address$setDeliveryPoint("theaddress") | ||
address$setCity("thecity") | ||
address$setPostalCode("111") | ||
address$setCountry("France") | ||
address$setEmail("[email protected]") | ||
contact$setAddress(address) | ||
res <- ISOOnlineResource$new() | ||
res$setLinkage("http://www.somewhereovertheweb.org") | ||
res$setName("somename") | ||
contact$setOnlineResource(res) | ||
rp$setContactInfo(contact) | ||
cit$setCitedResponsibleParty(rp) | ||
gml$setFormulaCitation(cit) | ||
|
||
xml <- gml$encode() | ||
expect_is(xml, "XMLInternalNode") | ||
#decoding | ||
gml2 <- GMLOperationMethod$new(xml = xml) | ||
xml2 <- gml2$encode() | ||
#object identity | ||
expect_true(ISOAbstractObject$compare(gml, gml2)) | ||
}) |