From 0e0e903b61c72d163333c58c410d609163f6bd3a Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Fri, 11 Mar 2016 17:27:03 +0000 Subject: [PATCH] Merged 5.1.N (5.1.1) to HEAD (5.1) 117597 adavis: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1) 117582 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3) (PARTIAL MERGE) 116652 amorarasu: MNT-14983: CMIS: Euro character not encoded correctly Merged V4.2.4 (4.2.4.19) to V4.2-BUG-FIX (4.2.6) 115140 115998 116396 amorarasu: MNT-15044: CLONE - CMIS: Euro character not encoded correctly - Removed the unicode interval that was used to escape characters from the categories: currency, general punctuation, subscripts and superscripts (2000-20FF). - Changed the way the control characters are filtered + adapted tests. - Removed unnecessary j_string use from the ftl and added proper xml encoding. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@123586 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/rest/api/tests/TestCMIS.java | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/source/test-java/org/alfresco/rest/api/tests/TestCMIS.java b/source/test-java/org/alfresco/rest/api/tests/TestCMIS.java index cf557af17c..e998503a68 100644 --- a/source/test-java/org/alfresco/rest/api/tests/TestCMIS.java +++ b/source/test-java/org/alfresco/rest/api/tests/TestCMIS.java @@ -1635,7 +1635,7 @@ public class TestCMIS extends EnterpriseTestApi SiteInformation siteInfo = new SiteInformation(siteName, siteName, siteName, SiteVisibility.PUBLIC); final TestSite site = network1.createSite(siteInfo); - NodeRef resNode = repoService.createDocument(site.getContainerNodeRef("documentLibrary"), "testdoc.txt", "Test Doc1 Title", "d\u0010", "Test Content"); + NodeRef resNode = repoService.createDocument(site.getContainerNodeRef("documentLibrary"), "testdoc \u0010.txt", "Test Doc1 Title \u0010", "d\u0010", "Test Content"); return resNode; } }, person1Id, network1.getId()); @@ -1657,6 +1657,55 @@ public class TestCMIS extends EnterpriseTestApi // Therefore we can check end tag of root element assertTrue("No end tag was found", xml.endsWith("")); } + + /** + * 1) Creating a file with currency symbols in the name, title and description (MNT-15044) + * 2) Get the document with correct chars in the properties. + * @throws Exception + */ + @Test + public void testGetXmlWithCorrectCurrencySymbols() throws Exception + { + final TestNetwork network1 = getTestFixture().getRandomNetwork(); + + String username = "user" + System.currentTimeMillis(); + PersonInfo personInfo = new PersonInfo(username, username, username, "password", null, null, null, null, null, null, null); + TestPerson person1 = network1.createUser(personInfo); + String person1Id = person1.getId(); + + final String siteName = "site" + System.currentTimeMillis(); + + NodeRef fileNode = TenantUtil.runAsUserTenant(new TenantRunAsWork() + { + @Override + public NodeRef doWork() throws Exception + { + SiteInformation siteInfo = new SiteInformation(siteName, siteName, siteName, SiteVisibility.PUBLIC); + final TestSite site = network1.createSite(siteInfo); + + NodeRef resNode = repoService.createDocument(site.getContainerNodeRef("documentLibrary"), + "Euro \u20AC Pound \u00A3 Franc \u20A3.txt", + "Euro \u20AC Pound \u00A3 Franc \u20A3 File", + "\u20A3 \u00A3 \u20A3", + "\u20A3 \u00A3 \u20A3"); + return resNode; + } + }, person1Id, network1.getId()); + + publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id)); + CmisSession atomCmisSession10 = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_10, AlfrescoObjectFactoryImpl.class.getName()); + + String objectId = fileNode.getId(); + Document doc = (Document)atomCmisSession10.getObject(objectId); + + String name = (String)doc.getProperty(PropertyIds.NAME).getFirstValue(); + String title = (String)doc.getProperty("cm:title").getFirstValue(); + String description = (String)doc.getProperty("cm:description").getFirstValue(); + + assertEquals("Euro \u20AC Pound \u00A3 Franc \u20A3.txt", name); + assertEquals("Euro \u20AC Pound \u00A3 Franc \u20A3 File", title); + assertEquals("\u20A3 \u00A3 \u20A3", description); + } /* * Test that creating a document with a number of initial aspects does not create lots of initial versions