1 13 14 package org.ejbca.util.query; 15 16 import junit.framework.TestCase; 17 18 import org.apache.log4j.Logger; 19 import org.ejbca.core.model.ra.UserDataConstants; 20 21 22 27 public class TestQuery extends TestCase { 28 private static Logger log = Logger.getLogger(TestQuery.class); 29 33 public TestQuery(String name) { 34 super(name); 35 } 36 37 protected void setUp() throws Exception { 38 } 39 40 protected void tearDown() throws Exception { 41 } 42 43 46 public void test01TestUserQuery() throws Exception { 47 log.debug(">test01TestUserQuery()"); 48 Query query = new Query(Query.TYPE_USERQUERY); 49 query.add(UserMatch.MATCH_WITH_STATUS, BasicMatch.MATCH_TYPE_EQUALS, Integer.toString(UserDataConstants.STATUS_NEW)); 50 String str = query.getQueryString(); 51 assertEquals("status = 10", str); 52 53 query = new Query(Query.TYPE_USERQUERY); 54 query.add(UserMatch.MATCH_WITH_USERNAME, BasicMatch.MATCH_TYPE_EQUALS, "foo"); 55 str = query.getQueryString(); 56 assertEquals("username = 'foo'", str); 57 58 log.debug("<test01TestUserQuery()"); 59 } 60 61 } 62 | Popular Tags |