01: /*
02: * ChainBuilder ESB
03: * Visual Enterprise Integration
04: *
05: * Copyright (C) 2006 Bostech Corporation
06: *
07: * This program is free software; you can redistribute it and/or modify
08: * it under the terms of the GNU General Public License as published by
09: * the Free Software Foundation; either version 2 of the License, or
10: * (at your option) any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307
20: * USA
21: *
22: *
23: *
24: */
25: package com.bostechcorp.cbesb.common.sa.dao;
26:
27: import java.util.Iterator;
28: import java.util.List;
29:
30: import junit.framework.TestCase;
31:
32: import com.bostechcorp.cbesb.common.sa.vo.ServiceAssemblyVO;
33:
34: public class daoTest extends TestCase {
35:
36: public void testDao() throws Exception {
37:
38: ServiceAssemblyDao saDao = DaoFactory
39: .createServiceAssemblyDao();
40: ServiceAssemblyVO saObj = new ServiceAssemblyVO();
41: saObj.setDescription("descript");
42: saObj.setName("trn2");
43: List saList = saDao.selectByName(saObj.getName());
44: for (Iterator it = saList.iterator(); it.hasNext();) {
45: ServiceAssemblyVO saVO = (ServiceAssemblyVO) it.next();
46: saDao.deleteByID(saVO.getServiceAssemblyID());
47: }
48: saDao.add(saObj);
49:
50: List resultList = saDao.selectByName(saObj.getName());
51: for (Iterator it = resultList.iterator(); it.hasNext();) {
52: ServiceAssemblyVO result = (ServiceAssemblyVO) it.next();
53: assert (result.getName().equals(saObj.getName()) && result
54: .getDescription().equals(saObj.getDescription()));
55:
56: }
57: }
58:
59: public void getAllSa() throws Exception {
60: }
61:
62: }
|