From fce94347ffe5df3f4b0999dd97b29c56352e1dc3 Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Wed, 19 Jan 2011 03:44:01 +0000 Subject: [PATCH] CSPACE-3061: Enabled UTF-8 create/retrieve and keyword search tests in CollectionObject service. --- .../test/CollectionObjectSearchTest.java | 24 +++++++++---------- .../test/CollectionObjectServiceTest.java | 14 +++++------ 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectSearchTest.java b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectSearchTest.java index acd7b03ee..261a967a0 100644 --- a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectSearchTest.java +++ b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectSearchTest.java @@ -65,15 +65,19 @@ public class CollectionObjectSearchTest extends BaseServiceTest { final static List TWO_MORE_KEYWORDS = Arrays.asList(new String[]{"Karihaya" + IDENTIFIER, "Hlikku" + IDENTIFIER}); final static String NOISE_WORD = "Mihalli + IDENTIFIER"; - // Test Unicode UTF-8 term for keyword searching: the last name of Lech - // Wałęsa, which contains two non-USASCII range Unicode UTF-8 characters. + // Test Unicode UTF-8 term for keyword searching: a random sequence, + // unlikely to be encountered in actual collections data, of two USASCII + // characters followed by four non-USASCII range Unicode UTF-8 characters: // - // For details regarding the łę characters in the last name, see: - // http://en.wikipedia.org/wiki/L_with_stroke - // http://en.wikipedia.org/wiki/%C4%98 - final String UTF8_KEYWORD = "Wa" + '\u0142' + '\u0119' + "sa"; - // Non-existent term, consisting of two back-to-back sets of the first letters - // of each of the words in a short pangram for the English alphabet. + // Δ : Greek capital letter Delta (U+0394) + // Ж : Cyrillic capital letter Zhe with breve (U+04C1) + // Ŵ : Latin capital letter W with circumflex (U+0174) + // Ω : Greek capital letter Omega (U+03A9) + + final String UTF8_KEYWORD = "to" + '\u0394' + '\u04C1' + '\u0174' +'\u03A9'; + // Non-existent term unlikely to be encountered in actual collections + // data, consisting of two back-to-back sets of the first letters of + // each of the words in a short pangram for the English alphabet. final static String NON_EXISTENT_KEYWORD = "jlmbsoqjlmbsoq"; final static String KEYWORD_SEPARATOR = " "; @@ -313,9 +317,6 @@ public class CollectionObjectSearchTest extends BaseServiceTest { // } - // FIXME: Test currently fails with a true UTF-8 String - need to investigate why. - // Will be commented out for now until we get this working ... -/* @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class, groups = {"utf8"}) public void searchWithUTF8Keyword(String testName) { @@ -355,7 +356,6 @@ public class CollectionObjectSearchTest extends BaseServiceTest { long numMatched = getNumMatched(res, NUM_MATCHES_EXPECTED); Assert.assertEquals(numMatched, NUM_MATCHES_EXPECTED); } -*/ // Failure outcomes 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 b886b06c4..d4be6c165 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 @@ -75,7 +75,7 @@ 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 " + private final String UTF8_DATA_SAMPLE = "Audiorecording album cover signed by Lech " + "Wa" + '\u0142' + '\u0119' + "sa"; /* (non-Javadoc) @@ -314,10 +314,9 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { * @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 { + public void createWithUTF8Data(String testName) throws Exception { String testDataDir = System.getProperty("test-data.fileName"); String newId = createFromXmlFile(testName, testDataDir + "/cspace-2779-utf-8-create.xml", false); @@ -326,14 +325,13 @@ public class CollectionObjectServiceTest extends AbstractServiceTestImpl { logger.debug("Attempting to retrieve just-created record ..."); } CollectionobjectsCommon collectionObject = readCollectionObjectCommonPart(newId); - String title = collectionObject.getTitle(); // will need to be changed for multi-valued title + String distinguishingFeatures = collectionObject.getDistinguishingFeatures(); if (logger.isDebugEnabled()) { - logger.debug("Sent title: " + UTF8_TITLE); - logger.debug("Received title: " + title); + logger.debug("Sent distinguishingFeatures: " + UTF8_DATA_SAMPLE); + logger.debug("Received distinguishingFeatures: " + distinguishingFeatures); } - Assert.assertTrue(title.equals(UTF8_TITLE)); + Assert.assertTrue(distinguishingFeatures.equals(UTF8_DATA_SAMPLE)); } - */ /* (non-Javadoc) * @see org.collectionspace.services.client.test.ServiceTest#createList() -- 2.47.3