01: /*
02: * Wilos Is a cLever process Orchestration Software - http://www.wilos-project.org
03: * Copyright (C) 2006-2007 Paul Sabatier University, IUP ISI (Toulouse, France) <massie@irit.fr>
04: * Copyright (C) 2007 Sebastien BALARD <sbalard@wilos-project.org>
05: *
06: * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
07: * General Public License as published by the Free Software Foundation; either version 2 of the License,
08: * or (at your option) any later version.
09: *
10: * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
11: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License along with this program; if not,
15: * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16: */
17:
18: package wilos.test.hibernate.misc.wilosuser;
19:
20: import static org.junit.Assert.assertEquals;
21: import static org.junit.Assert.assertNotNull;
22: import static org.junit.Assert.assertNull;
23: import static org.junit.Assert.assertTrue;
24:
25: import java.util.List;
26:
27: import org.junit.After;
28: import org.junit.Before;
29: import org.junit.Test;
30:
31: import wilos.hibernate.misc.wilosuser.ProcessManagerDao;
32: import wilos.model.misc.wilosuser.ProcessManager;
33: import wilos.test.TestConfiguration;
34:
35: public class ProcessManagerDaoTest {
36:
37: private ProcessManagerDao pmd = (ProcessManagerDao) TestConfiguration
38: .getInstance().getApplicationContext().getBean(
39: "ProcessManagerDao");
40:
41: private ProcessManager pm;
42:
43: @Before
44: public void setUp() {
45:
46: this .pm = new ProcessManager();
47: this .pm.setLogin("testPM");
48: this .pm.setName("Lopes");
49: }
50:
51: @After
52: public void tearDown() {
53: this .pm = null;
54: }
55:
56: @Test
57: public void testSaveOrUpdateProcessManager() {
58: this .pmd.saveOrUpdateProcessManager(this .pm);
59:
60: ProcessManager pmTmp = this .pmd.getProcessManager("testPM");
61: assertNotNull(pmTmp);
62: assertTrue(this .pm.getLogin().equals(pmTmp.getLogin()));
63: assertTrue(this .pm.getName().equals(pmTmp.getName()));
64: this .pmd.deleteProcessManager(this .pm);
65: }
66:
67: @Test
68: public void testGetAllProcessManagers() {
69: this .pmd.saveOrUpdateProcessManager(this .pm);
70:
71: List<ProcessManager> setTmp = this .pmd.getAllProcessManagers();
72: assertNotNull(setTmp);
73: assertTrue(setTmp.size() >= 1);
74: this .pmd.deleteProcessManager(this .pm);
75: }
76:
77: @Test
78: public void testGetProcessManager() {
79: this .pmd.saveOrUpdateProcessManager(this .pm);
80: ProcessManager pmTmp = this .pmd.getProcessManager("testPM");
81: assertNotNull(pmTmp);
82: assertEquals(pmTmp.getLogin(), "testPM");
83: assertEquals(pmTmp.getName(), "Lopes");
84: this .pmd.deleteProcessManager(this .pm);
85: }
86:
87: @Test
88: public void testDeleteProcessManager() {
89: this .pmd.saveOrUpdateProcessManager(this .pm);
90: this .pmd.deleteProcessManager(this .pm);
91:
92: ProcessManager pmTmp = this .pmd.getProcessManager("testPM");
93: assertNull(pmTmp);
94: }
95:
96: }
|