java-tests/../user -> users
authorwneuper
Tue, 03 May 2005 18:12:32 +0200
changeset 22799e56e9ea6d19
parent 2278 805facc8c123
child 2280 8b99ede29abb
java-tests/../user -> users
src/java-tests/isac/util/user/TestUser.java
src/java-tests/isac/util/user/Testall.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/java-tests/isac/util/user/TestUser.java	Tue May 03 18:12:32 2005 +0200
     1.3 @@ -0,0 +1,73 @@
     1.4 +/*
     1.5 + * @author Walther Neuper, member of the ISAC-team, 
     1.6 + * Copyright (c) 2005 by Walther Neuper 
     1.7 + * created Apr 15, 2005 8:26:54 AM
     1.8 + * Institute for Softwaretechnology, Graz University of Technology, Austria.
     1.9 + * 
    1.10 + * Use is subject to PGPL license terms.
    1.11 + */
    1.12 +package isac.util.user;
    1.13 +
    1.14 +import isac.session.SDialog;
    1.15 +import isac.util.InformationProcessor;
    1.16 +import isac.util.users.IUserSettings;
    1.17 +import isac.util.users.User;
    1.18 +import isac.util.users.UserSettings;
    1.19 +
    1.20 +import java.rmi.RemoteException;
    1.21 +
    1.22 +import junit.framework.TestCase;
    1.23 +
    1.24 +/**
    1.25 + * @author neuper
    1.26 + *
    1.27 + * TODO To change the template for this generated type comment go to
    1.28 + * Window - Preferences - Java - Code Style - Code Templates
    1.29 + */
    1.30 +public class TestUser extends TestCase {
    1.31 +
    1.32 +	/**
    1.33 +	 * set up a minimal testbed for getting UserSettings
    1.34 +	 * 
    1.35 +	 * @exception RemoteException
    1.36 +	 *                if SessionDialog=ObjectManager NOT launched (ObjectManager
    1.37 +	 *                launchedd after KEStore, BridgeMain)
    1.38 +	 * @see isac.kestore.TestSessionDialog#testLogin
    1.39 +	 */
    1.40 +	public void testGetUserSettings() {
    1.41 +		System.out
    1.42 +				.println("---BEGIN isac.util.user.TestUser#testGetUserSettings");
    1.43 +
    1.44 +		// see isac.gui.WindowApplication#login
    1.45 +		String session_id = InformationProcessor.login("x", "x");
    1.46 +		assertEquals("sessionID from InformationProcessor.login", session_id,
    1.47 +				"x0");
    1.48 +		SDialog session_dialog = InformationProcessor.getSDialog();
    1.49 +
    1.50 +		// see isac.wsdialog.DialogGuide#constructor
    1.51 +		User user = null;
    1.52 +		try {
    1.53 +			user = session_dialog.getUser(session_id);
    1.54 +		} catch (RemoteException e1) {
    1.55 +			// TODO Auto-generated catch block
    1.56 +			e1.printStackTrace();
    1.57 +		}
    1.58 +		String usern = user.getUsername();
    1.59 +		assertEquals("username", usern, "x");
    1.60 +
    1.61 +		//this stores the whole UserSettings in the local 'user_settings'
    1.62 +		UserSettings user_settings = user.getUserSettings();
    1.63 +		
    1.64 +		// in isac/xmldata/users/x_settings.txt we have:
    1.65 +		// key = IUserSettings.start_worksheet
    1.66 +		// val = IUserSettings.SKIP_SPECIFY_START_SOLVE
    1.67 +		int val = user_settings.getValue(IUserSettings.KEY1_START_SPECIFY);
    1.68 +		assertEquals("getValue(IUserSettings.KEY1_START_SPECIFY)", val,
    1.69 +				IUserSettings.VAL1_SKIP_SPECIFY_TO_START_SOLVE);
    1.70 +
    1.71 +		System.out.println("---END isac.util.user.TestUser#testGetUserSettings");
    1.72 +	}
    1.73 +
    1.74 +
    1.75 +	
    1.76 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/java-tests/isac/util/user/Testall.java	Tue May 03 18:12:32 2005 +0200
     2.3 @@ -0,0 +1,38 @@
     2.4 +/*
     2.5 + * @author Walther Neuper, member of the ISAC-team, 
     2.6 + * Copyright (c) 2005 by Walther Neuper 
     2.7 + * created Apr 15, 2005 8:27:13 AM
     2.8 + * Institute for Softwaretechnology, Graz University of Technology, Austria.
     2.9 + * 
    2.10 + * Use is subject to PGPL license terms.
    2.11 + */
    2.12 +package isac.util.user;
    2.13 +
    2.14 +import isac.kestore.TestKEStoreServices;
    2.15 +import junit.framework.Test;
    2.16 +import junit.framework.TestCase;
    2.17 +import junit.framework.TestSuite;
    2.18 +
    2.19 +/**
    2.20 + * @author neuper
    2.21 + *
    2.22 + * TODO To change the template for this generated type comment go to
    2.23 + * Window - Preferences - Java - Code Style - Code Templates
    2.24 + */
    2.25 +public class Testall extends TestCase {
    2.26 +
    2.27 +	public static Test suite() {
    2.28 +		System.out.println("---isac.util.user.Testall");		
    2.29 +		TestSuite suite = new TestSuite("isac.util.user.Testall");
    2.30 +
    2.31 +		//tests in this directory
    2.32 +		suite.addTestSuite(TestUser.class);
    2.33 +
    2.34 +		//tests in subdirectories
    2.35 +		//...
    2.36 +		
    2.37 +		return suite;
    2.38 +	}
    2.39 +
    2.40 +	
    2.41 +}