openrat-java-client

Unnamed repository; edit this file 'description' to name the repository.
git clone http://git.code.weiherhei.de/openrat-java-client.git
Log | Files | Refs

TestLogin.java (957B)


      1 package de.openrat.client.test;
      2 
      3 import de.openrat.client.CMSClient;
      4 import de.openrat.client.action.LoginAction;
      5 import org.junit.Test;
      6 
      7 import javax.security.auth.login.LoginException;
      8 
      9 import static de.openrat.client.test.TestConfiguration.*;
     10 import static org.junit.Assert.fail;
     11 
     12 public class TestLogin {
     13 
     14     /**
     15      * simple example for using the client.
     16      */
     17     @Test
     18     public void test() {
     19         final CMSClient client = new CMSClient(TestConfiguration.HOST, PATH, PORT);
     20         client.setLogWriter(WRITER);
     21         client.setProxy(PROXY_HOST, PROXY_PORT);
     22         client.setLocale(LOCALE);
     23         client.setKeepAlive(false);
     24         client.setTimeout(15000);
     25 
     26         LoginAction loginAction = client.createAction(LoginAction.class);
     27 
     28         try {
     29             loginAction.login(USER, PASS, DB);
     30         } catch (LoginException e) {
     31             fail("Login failed" + e.getLocalizedMessage());
     32         }
     33 
     34         client.close();
     35     }
     36 
     37 }