001: /**
002: *
003: * Bonita
004: * Copyright (C) 1999 Bull S.A.
005: * Bull 68 route de versailles 78434 Louveciennes Cedex France
006: * Further information: bonita@objectweb.org
007: *
008: * This library is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Lesser General Public
010: * License as published by the Free Software Foundation; either
011: * version 2.1 of the License, or any later version.
012: *
013: * This library is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * Lesser General Public License for more details.
017: *
018: * You should have received a copy of the GNU Lesser General Public
019: * License along with this library; if not, write to the Free Software
020: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
021: * USA
022: *
023: *
024: --------------------------------------------------------------------------
025: * $Id: PerformanceTests.java,v 1.1 2004/07/30 14:57:58 mvaldes Exp $
026: *
027: --------------------------------------------------------------------------
028: */package hero.client.test.performance;
029:
030: /*
031: *
032: * PerformanceTests.java -
033: * Copyright (C) 2003 Ecoo Team
034: * valdes@loria.fr
035: *
036: *
037: * This program is free software; you can redistribute it and/or
038: * modify it under the terms of the GNU Lesser General Public License
039: * as published by the Free Software Foundation; either version 2
040: * of the License, or (at your option) any later version.
041: *
042: * This program is distributed in the hope that it will be useful,
043: * but WITHOUT ANY WARRANTY; without even the implied warranty of
044: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
045: * GNU Lesser General Public License for more details.
046: *
047: * You should have received a copy of the GNU Lesser General Public License
048: * along with this program; if not, write to the Free Software
049: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
050: */
051:
052: import hero.interfaces.UserSession;
053: import hero.interfaces.UserSessionHome;
054: import hero.interfaces.UserSessionUtil;
055: import hero.interfaces.ProjectSession;
056: import hero.interfaces.ProjectSessionHome;
057: import hero.interfaces.ProjectSessionUtil;
058: import junit.framework.TestCase;
059: import junit.framework.TestSuite;
060: import javax.security.auth.login.LoginContext;
061: import hero.client.test.SimpleCallbackHandler;
062: import java.util.Collection;
063: import java.util.Iterator;
064:
065: public class PerformanceTests extends TestCase {
066:
067: public PerformanceTests(String testname) {
068: super (testname);
069: }
070:
071: public static TestSuite suite() {
072: return new TestSuite(PerformanceTests.class);
073: }
074:
075: public void setUp() throws Exception {
076: }
077:
078: public void testUsersInteraction() throws Exception {
079: int i = 0;
080: UserSessionHome uHome = UserSessionUtil.getHome();
081: for (i = 0; i < 15; i++) {
082: String uName = "user" + i;
083: char[] password = uName.toCharArray();
084: SimpleCallbackHandler handler = new SimpleCallbackHandler(
085: uName, password);
086: LoginContext lc = new LoginContext("TestClient", handler);
087: lc.login();
088: UserSession us = uHome.create();
089: Collection instances = us.getProjectListNames();
090: Iterator index = instances.iterator();
091: while (index.hasNext()) {
092: String name = (String) index.next();
093: if (name.matches("Stress.*")) {
094: ProjectSessionHome pHome = ProjectSessionUtil
095: .getHome();
096: ProjectSession ps = pHome.create();
097: ps.initProject(name);
098: ps.setUserRole("user" + i, "InitialRole");
099: Collection task = us.getToDoList(name);
100: Iterator tsk = task.iterator();
101: while (tsk.hasNext()) {
102: us.startActivity(name, (String) tsk.next());
103: task = us.getToDoList(name);
104: tsk = task.iterator();
105: }
106: ps.remove();
107: }
108: }
109: us.remove();
110: }
111:
112: }
113: }
|