01: /**
02: * @(#)ProjectDAOImplTest.java
03: *
04: * JFoxSOAF, Service-Oriented Application Framework
05: *
06: * Copyright(c) JFoxSOAF Team
07: *
08: * Licensed under the GNU LGPL, Version 2.1 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.gnu.org/copyleft/lesser.html
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: * For more information, please visit:
21: * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
22: * http://www.huihoo.org/jfox/jfoxsoaf
23: */package org.huihoo.jfox.soaf.samples.jdbc.dao;
24:
25: import java.util.Iterator;
26: import java.util.List;
27:
28: import junit.framework.TestCase;
29:
30: import org.apache.commons.logging.Log;
31: import org.apache.commons.logging.LogFactory;
32: import org.huihoo.jfox.soaf.container.ServiceLoader;
33: import org.huihoo.jfox.soaf.samples.jdbc.model.ProjectBean;
34:
35: /**
36: * @author peter
37: *
38: * TODO To change the template for this generated type comment go to
39: * Window - Preferences - Java - Code Style - Code Templates
40: */
41: public class ProjectDAOImplTest extends TestCase {
42:
43: private final Log log = LogFactory.getLog(getClass());
44:
45: private ServiceLoader sl = ServiceLoader.getInstance();
46:
47: private ProjectDAOImpl projectDAOImpl;
48:
49: /*
50: * @see TestCase#setUp()
51: */
52: protected void setUp() throws Exception {
53: super .setUp();
54:
55: if (!sl.isServiceLoaded()) {
56: sl.initService("jfoxsoaf-config.xml");
57: }
58:
59: projectDAOImpl = new ProjectDAOImpl();
60: }
61:
62: /*
63: * @see TestCase#tearDown()
64: */
65: protected void tearDown() throws Exception {
66: super .tearDown();
67: }
68:
69: public void testGetProjectById() {
70: ProjectBean pb = projectDAOImpl.getProjectById();
71: log.info("id" + pb.getId());
72: log.info("name" + pb.getName());
73: log.info("type" + pb.getType());
74: }
75:
76: public void testGetProjects() {
77: List projectList = projectDAOImpl.getProjects();
78: Iterator iter = projectList.iterator();
79: while (iter.hasNext()) {
80: ProjectBean pb = (ProjectBean) iter.next();
81: log.info("id" + pb.getId());
82: log.info("name" + pb.getName());
83: log.info("type" + pb.getType());
84: }
85: }
86:
87: public void testCountProject() {
88: System.out.println("hell");
89: int count = projectDAOImpl.countProject();
90: System.out.println("count is: " + String.valueOf(count));
91: }
92: }
|