From 0d87c2730cbd5ca90b191851de1ea5ebeb1e6a0b Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Wed, 20 Nov 2013 18:08:34 -0800 Subject: [PATCH] CSPACE-6277: On import, allow dollar sign characters to be included in authority item refName display names. --- .../import-locationitem-dollarsign.xml | 16 ++++++ .../test-data/xmlreplay/imports/imports.xml | 49 +++++++++++++++++++ .../import-locationitem-dollarsign.res.xml | 21 ++++++++ .../services/imports/TemplateExpander.java | 3 +- 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/imports/import-locationitem-dollarsign.xml create mode 100644 services/IntegrationTests/src/test/resources/test-data/xmlreplay/imports/res/import-locationitem-dollarsign.res.xml diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/imports/import-locationitem-dollarsign.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/imports/import-locationitem-dollarsign.xml new file mode 100644 index 000000000..1f926ec70 --- /dev/null +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/imports/import-locationitem-dollarsign.xml @@ -0,0 +1,16 @@ + + + + + + + ${termDisplayNameValue} + + + ${shortIdentifierValue} + urn:cspace:core.collectionspace.org:locationauthorities:name(${shortIdentifierValue})'${termDisplayNameValue}' + ${inAuthorityValue} + + + \ No newline at end of file diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/imports/imports.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/imports/imports.xml index d242b11f6..5ecea8223 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/imports/imports.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/imports/imports.xml @@ -328,6 +328,55 @@ /cspace-services/locationauthorities/${importLocationAuthorityWithGeneratedRefName.recordCSID} + + + 200 + POST + /cspace-services/imports + imports/import-locationitem-dollarsign.xml + + ec1b0f42-70ef-4ab3-b81e-d73cadbc25f5 + afistfulofdollars + ${importLocationAuthorityWithVarExpansion.recordCSID} + A Fistful of $$$ Dollars + + + + imports/res/import-locationitem-dollarsign.res.xml + + + + + 200 + GET + /cspace-services/locationauthorities/${importLocationAuthorityWithVarExpansion.recordCSID}/items/${importLocationItemWithDollarSignInRefName.recordCSID} + + imports/res/import-locationitem-dollarsign.res.xml + + + + + + + + + + + ${importLocationItemWithDollarSignInRefName.shortIdentifierValue} + ${importLocationItemWithDollarSignInRefName.inAuthorityValue} + ${importLocationItemWithDollarSignInRefName.termDisplayNameValue} + /locationauthorities/${importLocationAuthorityWithVarExpansion.recordCSID}/items/${importLocationItemWithDollarSignInRefName.recordCSID} + + + + + 200 + DELETE + /cspace-services/locationauthorities/${importLocationAuthorityWithVarExpansion.recordCSID}/items/${importLocationItemWithDollarSignInRefName.recordCSID} + + + 1 + ${uriValue} + urn:cspace:core.collectionspace.org:locationauthorities:name(${shortIdentifierValue})'${termDisplayNameValue}' + + + diff --git a/services/imports/service/src/main/java/org/collectionspace/services/imports/TemplateExpander.java b/services/imports/service/src/main/java/org/collectionspace/services/imports/TemplateExpander.java index c3e340590..223cab207 100644 --- a/services/imports/service/src/main/java/org/collectionspace/services/imports/TemplateExpander.java +++ b/services/imports/service/src/main/java/org/collectionspace/services/imports/TemplateExpander.java @@ -177,8 +177,7 @@ public class TemplateExpander { wrapperTmpl = Tools.searchAndReplace(wrapperTmpl, var("uri"), getDocUri(tenantId, SERVICE_TYPE, docID, partTmpl)); wrapperTmpl = Tools.searchAndReplace(wrapperTmpl, var("refName"), - getRefName(tenantId, SERVICE_TYPE, docID, partTmpl).replace("&", "&")); - + getRefName(tenantId, SERVICE_TYPE, docID, partTmpl).replace("&", "&").replace("$", "$")); String serviceDir = outDir + '/' + docID; FileTools.saveFile(serviceDir, "document.xml", wrapperTmpl, FileTools.FORCE_CREATE_PARENT_DIRS); -- 2.47.3