Changeset 24059

Show
Ignore:
Timestamp:
08/21/07 14:30:27 (3 years ago)
Author:
gracinet
Message:

Unit test for several occurrences of one parameter
(search field) with different values (schema fields).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-search-api/src/main/resources/OSGI-INF/querymodel-framework.xml

    r24056 r24059  
    2424    from the document model instead. The interpretation of the 
    2525    parameters follow a structure defined by the ``whereClause`` 
    26     attribute of the QueryModelDescritor class. 
     26    attribute of the QueryModelDescriptor class. A parameter *name* can occur 
     27    several times, possibly with different values within a single where clause. 
    2728 
    28     Among other things, it's possible to register an escaper to configure  
     29    Among other things, it's possible to register an escaper to configure 
    2930    which special characters should be escaped in fulltext-like fields ( 
    30     "escaper" attribute) for STATEFUL query models.  
    31      
     31    "escaper" attribute) for STATEFUL query models. 
     32 
    3233    Stateless ones are usually handled by some applicative code that 
    3334    can take care of this. This typically depends on both the search backend and 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-search-api/src/test/java/org/nuxeo/ecm/core/search/api/querymodel/QueryModelTestCase.java

    r23319 r24059  
    146146        documentModel.setProperty("querymodel_test", "intfield", 3); 
    147147 
     148        // adding a value to the excluded int field that points to the same 
     149        // parameter 
     150        documentModel.setProperty("querymodel_test", "intfield_excluded", 1); 
     151        assertEquals( 
     152                "SELECT * FROM Document WHERE textparameter = 'some text' " + 
     153                "AND intparameter < 3 AND intparameter != 1", 
     154                descriptor.getQuery(documentModel)); 
     155 
    148156        // setting a null or an empty value removes the corresponding predicate 
    149157        // from the where clause: 
    150158 
    151159        documentModel.setProperty("querymodel_test", "textfield", ""); 
     160        documentModel.setProperty("querymodel_test", "intfield_excluded", null); 
    152161 
    153162        assertEquals("SELECT * FROM Document WHERE intparameter < 3", 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-search-api/src/test/resources/querymodel-components-test-setup.xml

    r22280 r24059  
    5353        <predicate parameter="intparameter" operator="&lt;"> 
    5454          <field schema="querymodel_test" name="intfield" /> 
     55        </predicate> 
     56 
     57        <!-- One can have several predicates on the same parameter --> 
     58        <predicate parameter="intparameter" operator="!="> 
     59          <field schema="querymodel_test" name="intfield_excluded"/> 
    5560        </predicate> 
    5661 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-search-api/src/test/resources/schema/querymodel-test.xsd

    r22984 r24059  
    1010 
    1111  <xs:element name="intfield" type="xs:integer" /> 
     12 
     13  <xs:element name="intfield_excluded" type="xs:integer" /> 
    1214 
    1315  <xs:element name="boolfield" type="xs:boolean" />