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.application.console;
18:
19: import java.io.File;
20:
21: import org.springframework.context.ApplicationContext;
22: import org.springframework.context.support.ClassPathXmlApplicationContext;
23:
24: import wilos.business.services.misc.wilosuser.ProcessManagerService;
25: import wilos.business.services.spem2.process.ProcessService;
26: import wilos.model.misc.wilosuser.ProcessManager;
27: import wilos.model.misc.wilosuser.WilosUser;
28: import wilos.model.spem2.process.Process;
29:
30: public class InitAppliTest {
31: public static void main(String[] args) {
32: importXML();
33: instanciation();
34: affectation();
35: }
36:
37: private static void importXML() {
38: // Getback the application context from the spring configuration file
39: ApplicationContext ctx = new ClassPathXmlApplicationContext(
40: "applicationContext.xml");
41: ProcessManagerService pser = (ProcessManagerService) ctx
42: .getBean("ProcessManagerService");
43: ProcessManager pm = new ProcessManager();
44: pm.setLogin("pmtest");
45: pm.setPassword("blabla");
46: pm.setName("test");
47: pser.saveProcessManager(pm);
48: WilosUser wu = pser.getProcessManagers().iterator().next();
49: ProcessService am = (ProcessService) ctx
50: .getBean("ProcessService");
51: Process scrum = am.importProcessFromEpfComposer(new File(
52: "applitest/wilos/application/console/scrum.xml"));
53: am.saveProcess(scrum, wu.getId());
54:
55: Process openup = am.importProcessFromEpfComposer(new File(
56: "applitest/wilos/application/console/openUP.xml"));
57: // Process openup = am.spelpParsingXML(new
58: // File("applitest/wilos/application/console/openup.zip"));
59: am.saveProcess(openup, wu.getId());
60:
61: }
62:
63: private static void instanciation() {
64: // Notre fabrique SPRING permettant l'acc�s aux beans d�clar�s
65: ApplicationContext factory = new ClassPathXmlApplicationContext(
66: "applicationContextTest.xml");
67: // import des processus
68: InitAppliService am = (InitAppliService) factory
69: .getBean("InitAppliService");
70: am.projectInstanciation();
71: }
72:
73: private static void affectation() {
74: // Notre fabrique SPRING permettant l'acc�s aux beans d�clar�s
75: ApplicationContext factory = new ClassPathXmlApplicationContext(
76: "applicationContextTest.xml");
77: // import des processus
78: InitAppliService am = (InitAppliService) factory
79: .getBean("InitAppliService");
80: am.initAppli();
81: }
82: }
|