View Javadoc

1   package org.kuali.ole;
2   
3   import org.junit.Test;
4   import org.kuali.ole.bo.cql.CQLResponseBO;
5   import org.kuali.ole.bo.cql.CQLSearchClauseTag;
6   import org.kuali.ole.service.OleCQLQueryParserService;
7   import org.kuali.ole.serviceimpl.OleCQLQueryParserServiceImpl;
8   import org.slf4j.Logger;
9   import org.slf4j.LoggerFactory;
10  
11  import static junit.framework.Assert.assertNotNull;
12  
13  /**
14   * Created with IntelliJ IDEA.
15   * User: ?
16   * Date: 7/10/12
17   * Time: 6:35 PM
18   * To change this template use File | Settings | File Templates.
19   */
20  public class OleCQLParser_UT extends BaseTestCase{
21      private static Logger LOG = LoggerFactory.getLogger(OleCQLParser_UT.class);
22      private OleCQLQueryParserService oleCQLQueryParserService=new OleCQLQueryParserServiceImpl();
23      private boolean solrQueryFlag=true;
24  
25      @Test
26      public void testCQLQueryParser() throws Exception{
27  
28          String parserXml=null;
29          parserXml=oleCQLQueryParserService.parseCQLQuery("subject any \"fish frog\"");
30          assertNotNull(parserXml);
31  
32      }
33      @Test
34      public void testCQLResponseObject() throws Exception{
35  
36  
37          String parserXml=oleCQLQueryParserService.parseCQLQuery("(Title=(jon and roy) or Title=james)");
38          CQLResponseBO cQLResponseBO=oleCQLQueryParserService.getCQLResponseObject(parserXml);
39          String solrQuery=oleCQLQueryParserService.getSolrQueryFromCQLBO(cQLResponseBO);
40          assertNotNull(solrQuery);
41  
42      }
43  
44  
45  
46  }