From: <die...@us...> - 2010-03-05 13:00:31
|
Revision: 2095 http://openutils.svn.sourceforge.net/openutils/?rev=2095&view=rev Author: diego_schivo Date: 2010-03-05 13:00:25 +0000 (Fri, 05 Mar 2010) Log Message: ----------- CRIT-8 unit test Modified Paths: -------------- trunk/openutils-mgnlcriteria/src/test/java/net/sourceforge/openutils/mgnlcriteria/advanced/AdvancedCriteriaSearchTest.java trunk/openutils-mgnlcriteria/src/test/resources/crit-bootstrap/website.00000.xml Modified: trunk/openutils-mgnlcriteria/src/test/java/net/sourceforge/openutils/mgnlcriteria/advanced/AdvancedCriteriaSearchTest.java =================================================================== --- trunk/openutils-mgnlcriteria/src/test/java/net/sourceforge/openutils/mgnlcriteria/advanced/AdvancedCriteriaSearchTest.java 2010-03-05 09:32:47 UTC (rev 2094) +++ trunk/openutils-mgnlcriteria/src/test/java/net/sourceforge/openutils/mgnlcriteria/advanced/AdvancedCriteriaSearchTest.java 2010-03-05 13:00:25 UTC (rev 2095) @@ -32,6 +32,7 @@ import net.sourceforge.openutils.mgnlcriteria.jcr.query.AdvancedResultItem; import net.sourceforge.openutils.mgnlcriteria.jcr.query.Criteria; import net.sourceforge.openutils.mgnlcriteria.jcr.query.JCRCriteriaFactory; +import net.sourceforge.openutils.mgnlcriteria.jcr.query.JCRQueryException; import net.sourceforge.openutils.mgnlcriteria.jcr.query.ResultIterator; import net.sourceforge.openutils.mgnlcriteria.jcr.query.criterion.Disjunction; import net.sourceforge.openutils.mgnlcriteria.jcr.query.criterion.Order; @@ -84,7 +85,7 @@ // jackrabbit 2? assertSortedResults( - new String[]{"Frància", "Parigi (Francia)", "Parigi (Frància)", "federale" }, + new String[]{"Parigi (Francia)", "Parigi (Frància)", "Frància", "Tallart, Camille d'Hostun, cónte di-", "federale" }, result, "francia"); } @@ -95,10 +96,10 @@ AdvancedResult advResult = search("francia", 2, 3); - Assert.assertEquals(4, advResult.getTotalSize()); + Assert.assertEquals(5, advResult.getTotalSize()); Collection< ? extends Content> result = collectCollectionFromResult(advResult); - assertSortedResults(new String[]{"federale" }, result, "francia"); + assertSortedResults(new String[]{"Tallart, Camille d'Hostun, cónte di-", "federale" }, result, "francia"); } @Test @@ -139,6 +140,32 @@ } @Test + public void testEscapeQuotes() throws Exception + { + String title = "Tallart, Camille d'Hostun, cónte di-"; + Criteria criteria = JCRCriteriaFactory.createCriteria().setWorkspace(ContentRepository.WEBSITE); + criteria.setBasePath(StringUtils.EMPTY); + criteria.add(Restrictions.eq("@jcr:primaryType", "mgnl:content")); + criteria.add(Restrictions.eq("@title", title)); + AdvancedResult advResult = null; + try + { + advResult = criteria.execute(); + } + catch (JCRQueryException e) + { + Assert.fail("Invalid query"); + } + Assert.assertNotNull(advResult); + Collection< ? extends Content> collection = collectCollectionFromResult(advResult); + Assert.assertEquals(1, collection.size()); + for (Content content : collection) + { + Assert.assertEquals(title, content.getTitle()); + } + } + + @Test public void testNotInPrivatePropertiesNoMagnoliaUser() { Modified: trunk/openutils-mgnlcriteria/src/test/resources/crit-bootstrap/website.00000.xml =================================================================== --- trunk/openutils-mgnlcriteria/src/test/resources/crit-bootstrap/website.00000.xml 2010-03-05 09:32:47 UTC (rev 2094) +++ trunk/openutils-mgnlcriteria/src/test/resources/crit-bootstrap/website.00000.xml 2010-03-05 13:00:25 UTC (rev 2095) @@ -3812,4 +3812,278 @@ </sv:node> </sv:node> </sv:node> + <sv:node sv:name="1025978"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:content</sv:value> + </sv:property> + <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> + <sv:value>mix:lockable</sv:value> + </sv:property> + <sv:property sv:name="jcr:uuid" sv:type="String"> + <sv:value>9f4522d7-cf51-3326-be23-722d9e9fb8dd</sv:value> + </sv:property> + <sv:property sv:name="categories" sv:type="String"> + <sv:value>7fddab60-4453-3c5a-872b-3200348b9f88</sv:value> + </sv:property> + <sv:property sv:name="idLemma" sv:type="String"> + <sv:value>1025978</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="mgnl:authorid" sv:type="String"> + <sv:value>import</sv:value> + </sv:property> + <sv:property sv:name="mgnl:creationdate" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + <sv:property sv:name="startletter" sv:type="String"> + <sv:value>t</sv:value> + </sv:property> + <sv:property sv:name="title" sv:type="String"> + <sv:value>Tallart, Camille d'Hostun, cónte di-</sv:value> + </sv:property> + <sv:property sv:name="urlMappingId" sv:type="String"> + <sv:value>1164448</sv:value> + </sv:property> + <sv:property sv:name="urlMappingOtid" sv:type="String"> + <sv:value>GEDEA_tallart_camille_dhostun_conte_di_</sv:value> + </sv:property> + <sv:node sv:name="MetaData"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:metaData</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="mgnl:activated" sv:type="Boolean"> + <sv:value>true</sv:value> + </sv:property> + <sv:property sv:name="mgnl:authorid" sv:type="String"> + <sv:value>import</sv:value> + </sv:property> + <sv:property sv:name="mgnl:creationdate" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:template" sv:type="String"> + <sv:value>t-lemma-enc</sv:value> + </sv:property> + </sv:node> + <sv:node sv:name="mainframe"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:contentNode</sv:value> + </sv:property> + <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> + <sv:value>mix:lockable</sv:value> + </sv:property> + <sv:property sv:name="jcr:uuid" sv:type="String"> + <sv:value>d19844ef-1a4c-3f02-9dbb-432e5ad00dad</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:node sv:name="MetaData"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:metaData</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="mgnl:authorid" sv:type="String"> + <sv:value>import</sv:value> + </sv:property> + <sv:property sv:name="mgnl:creationdate" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + </sv:node> + <sv:node sv:name="i1"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:contentNode</sv:value> + </sv:property> + <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> + <sv:value>mix:lockable</sv:value> + </sv:property> + <sv:property sv:name="jcr:uuid" sv:type="String"> + <sv:value>36bc081b-3a94-32d2-a06c-2748553de12a</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="lineSeparator" sv:type="Boolean"> + <sv:value>false</sv:value> + </sv:property> + <sv:property sv:name="text" sv:type="String"> + <sv:value><p>maresciallo di Francia (Lione 1652-Parigi 1728). Luogotenente generale (1693), batté a Spira il principe d'Assia (1703) ma fu a sua volta battuto a Höchstädt da <a href="${link:{uuid:{0a284491-cb4a-3ed4-b2b2-ac175e6e5d7a},repository:{gedea},handle:{/enciclopedia/Eugenio-di-Savoia},nodeData:{},extension:{html}}}">Eugenio di Savoia</a> e fatto prigioniero (1704). Nel 1717 entrò nel Consiglio di reggenza e nel 1726 divenne ministro di stato. +</p></sv:value> + </sv:property> + <sv:property sv:name="titleh2" sv:type="String"> + <sv:value/> + </sv:property> + <sv:node sv:name="MetaData"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:metaData</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="mgnl:authorid" sv:type="String"> + <sv:value>import</sv:value> + </sv:property> + <sv:property sv:name="mgnl:creationdate" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:template" sv:type="String"> + <sv:value>p-text-image</sv:value> + </sv:property> + </sv:node> + <sv:node sv:name="text_files"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:contentNode</sv:value> + </sv:property> + <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> + <sv:value>mix:lockable</sv:value> + </sv:property> + <sv:property sv:name="jcr:uuid" sv:type="String"> + <sv:value>fea1bf7a-1b2f-34bc-92c6-75d82978d07f</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:node sv:name="MetaData"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:metaData</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="mgnl:creationdate" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + </sv:node> + </sv:node> + </sv:node> + <sv:node sv:name="999"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:contentNode</sv:value> + </sv:property> + <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> + <sv:value>mix:lockable</sv:value> + </sv:property> + <sv:property sv:name="jcr:uuid" sv:type="String"> + <sv:value>fda788ae-12bf-3e99-9fe5-6865e52ee1da</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="paths" sv:type="String"> + <sv:value>7fddab60-4453-3c5a-872b-3200348b9f88 +</sv:value> + </sv:property> + <sv:node sv:name="MetaData"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:metaData</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="mgnl:authorid" sv:type="String"> + <sv:value>import</sv:value> + </sv:property> + <sv:property sv:name="mgnl:creationdate" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:template" sv:type="String"> + <sv:value>p-box-paths</sv:value> + </sv:property> + </sv:node> + </sv:node> + </sv:node> + <sv:node sv:name="columnDx"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:contentNode</sv:value> + </sv:property> + <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> + <sv:value>mix:lockable</sv:value> + </sv:property> + <sv:property sv:name="jcr:uuid" sv:type="String"> + <sv:value>c6eb8148-d4f3-3151-9d5d-4116470cf5fc</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:node sv:name="MetaData"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:metaData</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="mgnl:authorid" sv:type="String"> + <sv:value>import</sv:value> + </sv:property> + <sv:property sv:name="mgnl:creationdate" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + </sv:node> + <sv:node sv:name="1"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:contentNode</sv:value> + </sv:property> + <sv:property sv:name="jcr:mixinTypes" sv:type="Name"> + <sv:value>mix:lockable</sv:value> + </sv:property> + <sv:property sv:name="jcr:uuid" sv:type="String"> + <sv:value>49f75f99-97ff-3a7b-8ac0-91849228b93b</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="links" sv:type="String"> + <sv:value>Eugenio di Savoia 0a284491-cb4a-3ed4-b2b2-ac175e6e5d7a +</sv:value> + </sv:property> + <sv:property sv:name="title" sv:type="String"> + <sv:value>Collegamenti</sv:value> + </sv:property> + <sv:node sv:name="MetaData"> + <sv:property sv:name="jcr:primaryType" sv:type="Name"> + <sv:value>mgnl:metaData</sv:value> + </sv:property> + <sv:property sv:name="jcr:createdBy" sv:type="String"> + <sv:value>admin</sv:value> + </sv:property> + <sv:property sv:name="mgnl:authorid" sv:type="String"> + <sv:value>import</sv:value> + </sv:property> + <sv:property sv:name="mgnl:creationdate" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:lastmodified" sv:type="Date"> + <sv:value>2010-02-02T02:02:42.001+01:00</sv:value> + </sv:property> + <sv:property sv:name="mgnl:template" sv:type="String"> + <sv:value>p-box-links</sv:value> + </sv:property> + </sv:node> + </sv:node> + </sv:node> + </sv:node> </sv:node> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |