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: *
05: * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
06: * General Public License as published by the Free Software Foundation; either version 2 of the License,
07: * or (at your option) any later version.
08: *
09: * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
10: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11: * GNU General Public License for more details.
12: *
13: * You should have received a copy of the GNU General Public License along with this program; if not,
14: * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15: */
16:
17: package wilos.test.business.services.misc.wilosuser;
18:
19: import static org.junit.Assert.assertEquals;
20: import static org.junit.Assert.assertNotNull;
21:
22: import org.junit.After;
23: import org.junit.Before;
24: import org.junit.Test;
25:
26: import wilos.business.services.misc.project.ProjectService;
27: import wilos.business.services.misc.wilosuser.ParticipantService;
28: import wilos.model.misc.project.Project;
29: import wilos.model.misc.wilosuser.Participant;
30: import wilos.test.TestConfiguration;
31:
32: public class ParticipantServiceTest {
33:
34: private ParticipantService participantService = (ParticipantService) TestConfiguration
35: .getInstance().getApplicationContext().getBean(
36: "ParticipantService");
37:
38: private ProjectService projectService = (ProjectService) TestConfiguration
39: .getInstance().getApplicationContext().getBean(
40: "ProjectService");
41:
42: private Participant participant;
43:
44: private Project p1;
45:
46: private Project p2;
47:
48: @Before
49: public void setUp() {
50: this .p1 = new Project();
51: this .p1.setConcreteName("projectTestPS1");
52: this .projectService.saveProject(p1);
53:
54: this .p2 = new Project();
55: this .p2.setConcreteName("projectTestPS2");
56: this .projectService.saveProject(p2);
57:
58: this .participant = new Participant();
59: this .participant.setLogin("My login");
60: this .participant.setName("My name");
61: this .participant.setPassword("My password");
62: this .participantService.saveParticipant(participant);
63: }
64:
65: @After
66: public void tearDown() {
67: this .projectService.deleteProject(this .p2.getId());
68: this .projectService.deleteProject(this .p1.getId());
69:
70: }
71:
72: @Test
73: public void testSaveParticipant() {
74:
75: this .participantService.saveParticipant(this .participant);
76: Participant ParticipantTmp = (Participant) this .participantService
77: .getParticipantDao().getParticipant("My login");
78:
79: assertNotNull(ParticipantTmp);
80: assertEquals(this.participant.getName(), ParticipantTmp
81: .getName());
82:
83: this.participantService.getParticipantDao().deleteParticipant(
84: this.participant);
85: }
86: }
|