Package util

Source Code of util.Util

/*
* Danet GmbH
* Beratung und Software-Entwicklung
* Gesch�ftstelle AN
*
* $Id: Util.java 1657 2006-10-07 20:41:34Z mlipp $
*
* $Log$
* Revision 1.1.1.3  2003/12/19 13:01:51  drmlipp
* Updated to 1.1rc1
*
* Revision 1.10  2003/10/21 21:00:44  lipp
* Moved EJBClientTest to new junit sub-package.
*
* Revision 1.9  2003/09/26 19:58:29  lipp
* Adapted to staff member name change.
*
* Revision 1.8  2003/08/27 11:50:13  lipp
* WLS support.
*
* Revision 1.7  2003/08/25 15:18:24  lipp
* Fixed changes checked in by mistake.
*
* Revision 1.6  2003/08/25 14:23:08  lipp
* Better support for different application servers in the build process.
*
* Revision 1.5  2003/08/22 13:02:44  lipp
* Fixed jndi name.
*
* Revision 1.4  2003/04/26 16:46:55  lipp
* Made unittests and systemtests coexist in eclipse.
*
* Revision 1.3  2003/04/16 19:25:03  lipp
* Adapted to jdk 1.4
*
* Revision 1.2  2002/11/18 14:58:37  montag
* Retrieve getLoggedOnUser() from Util ejb.
*
* Revision 1.1  2002/11/15 15:41:53  montag
* New session ejb Util.
*
*
*/
package util;

import java.security.Principal;

import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.security.auth.login.LoginException;

import de.danet.an.util.UtilHome;
import de.danet.an.util.junit.EJBClientTest;

import common.UTLoginContext;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

/**
* Zusammenstellung aller Tests.
*/
public class Util extends TestCase {

    private static UTLoginContext plc = null;
    static {
  try {
      plc = new UTLoginContext();
      plc.login();
  } catch (LoginException e) {
      throw new IllegalStateException (e.getMessage ());
  }
    }

    /**
     * Konstruktor zum Erzeugen eines TestCase
     */
    public Util(String name) {
  super (name);
    }

    /**
     * Stellt diese TestSuite zusammen.
     */
    public static Test suite() {
        TestSuite suite = new TestSuite();
  suite.addTest(new Util("getEJBPrincipal"));
        return new EJBClientTest (plc, suite);
    }
    
    /**
     * Try to get a EJBPrincipal.
     */
    public void getEJBPrincipal() throws Exception {
  InitialContext ic = new InitialContext();
  Object objref = ic.lookup
      ("ejb/de.danet.an.workflow.util-lib.Util");
  UtilHome home = (UtilHome)PortableRemoteObject.narrow
      (objref, UtilHome.class);
  assertTrue (home != null);
  de.danet.an.util.Util ut = home.create();
  assertTrue (ut != null);
  Principal p = ut.getEJBPrincipal();
  assertTrue(p != null);
  assertTrue("Principal is: " + p.getName(),
       p.getName().startsWith("StaffManagementMember_"));
    }
}
TOP

Related Classes of util.Util

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.