KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > util > query > TestQuery


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

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 /**
23  * Tests the CertTools class .
24  *
25  * @version $Id: TestQuery.java,v 1.1.2.2 2007/05/04 09:10:25 anatom Exp $
26  */

27 public class TestQuery extends TestCase {
28     private static Logger log = Logger.getLogger(TestQuery.class);
29     /**
30      * Creates a new Test object.
31      *
32      */

33     public TestQuery(String JavaDoc name) {
34         super(name);
35     }
36
37     protected void setUp() throws Exception JavaDoc {
38     }
39
40     protected void tearDown() throws Exception JavaDoc {
41     }
42
43     /**
44      * @throws Exception DOCUMENT ME!
45      */

46     public void test01TestUserQuery() throws Exception JavaDoc {
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 JavaDoc 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