From 398ee79c90e279596ab64d95a940d6dee8ef7fa3 Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Tue, 12 Oct 2010 00:46:13 +0000 Subject: [PATCH] CSPACE-2779: Added test to create a CollectionObject, one of whose fields contains non-Latin1 Unicode UTF-8 characters. Test is initially commented out so as not to fail on systems where the underlying database system is not configured to use the UTF-8 character set. --- .../test/CollectionObjectServiceTest.java | 32 ++++++++++++++++++- .../test-data/cspace-2779-utf-8-create.xml | 16 ++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 services/collectionobject/client/src/test/resources/test-data/cspace-2779-utf-8-create.xml diff --git a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java index 544bdbc41..3de64ba69 100644 --- a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java +++ b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectServiceTest.java @@ -73,6 +73,8 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { private final String OBJECT_NAME_VALUE = "an object name"; private final String UPDATED_MEASURED_PART_VALUE = "updated measured part value"; + private final String UTF8_TITLE = "Audiorecording album cover signed by Lech " + + "Wa" + '\u0142' + '\u0119' + "sa"; /* (non-Javadoc) * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent() @@ -302,7 +304,35 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { } testSubmitRequest(newId); } - + + /** + * Creates a CollectionObject resource, one of whose fields contains + * non-Latin 1 Unicode UTF-8 characters. + * + * @param testName the test name + * @throws Exception the exception + */ + /* + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + dependsOnMethods = {"create", "testSubmitRequest"}, groups={"utf8-create"}) + public void createWithUTF8Title(String testName) throws Exception { + String testDataDir = System.getProperty("test-data.fileName"); + String newId = + createFromXmlFile(testName, testDataDir + "/cspace-2779-utf-8-create.xml", false); + if (logger.isDebugEnabled()) { + logger.debug("Created record with UTF-8 chars in payload."); + logger.debug("Attempting to retrieve just-created record ..."); + } + CollectionobjectsCommon collectionObject = readCollectionObjectCommonPart(newId); + String title = collectionObject.getTitle(); + if (logger.isDebugEnabled()) { + logger.debug("Sent title: " + UTF8_TITLE); + logger.debug("Received title: " + title); + } + Assert.assertTrue(title.equals(UTF8_TITLE)); + } + */ + /* (non-Javadoc) * @see org.collectionspace.services.client.test.ServiceTest#createList() */ diff --git a/services/collectionobject/client/src/test/resources/test-data/cspace-2779-utf-8-create.xml b/services/collectionobject/client/src/test/resources/test-data/cspace-2779-utf-8-create.xml new file mode 100644 index 000000000..0f7ede491 --- /dev/null +++ b/services/collectionobject/client/src/test/resources/test-data/cspace-2779-utf-8-create.xml @@ -0,0 +1,16 @@ + + + + + 2 + Katowice Spodek Live '94 by the band Perfect + Audiorecording album cover signed by Lech Wałęsa + -- 2.47.3