Package rms

Source Code of rms.Rms

/*
* Danet GmbH
* Beratung und Software-Entwicklung
* Gesch�ftstelle AN
*
* $Id: Rms.java 777 2005-08-18 14:49:12Z drmlipp $
*
* $Log$
* Revision 1.1.1.2  2003/12/19 13:01:52  drmlipp
* Updated to 1.1rc1
*
* Revision 1.23  2003/10/21 21:00:45  lipp
* Moved EJBClientTest to new junit sub-package.
*
* Revision 1.22  2003/10/08 11:52:55  huaiyang
* make test weblogic compatible.
*
* Revision 1.21  2003/10/02 13:00:39  lipp
* Interface improvements.
*
* Revision 1.20  2003/05/23 15:42:41  lipp
* Fixed deployment unit dependencies.
*
* Revision 1.19  2003/04/26 16:46:55  lipp
* Made unittests and systemtests coexist in eclipse.
*
* Revision 1.18  2003/04/16 19:25:04  lipp
* Adapted to jdk 1.4
*
* Revision 1.17  2003/01/13 20:29:42  lipp
* Classpath fixes.
*
* Revision 1.16  2002/12/19 21:37:42  lipp
* Reorganized interfaces.
*
* Revision 1.15  2002/08/30 13:37:05  lipp
* Using Workflow engine facade now.
*
* Revision 1.14  2002/06/27 10:48:36  lipp
* Adapted to change in RAS/RMS interface.
*
* Revision 1.13  2002/02/03 21:41:42  lipp
* Cleaned up unittests.
*
* Revision 1.12  2002/01/09 14:00:01  lipp
* Cleaned up relation between wfcore, resource assignment and resource
* management service.
*
* Revision 1.11  2002/01/09 10:23:37  lipp
* Removed no longer needed newRMSFactory.
*
* Revision 1.10  2001/12/19 09:04:26  robert
* added self configuration for the test case
*
* Revision 1.9  2001/12/18 16:11:03  robert
* added test case for authorizers method
*
* Revision 1.8  2001/12/18 15:50:06  robert
* Redesign the test cases.
*
* Revision 1.7  2001/12/18 13:08:10  robert
* modify to new constructors and methods of the Resource class.
*
* Revision 1.6  2001/12/17 15:22:15  robert
* test case for resourceByKey
*
* Revision 1.5  2001/12/17 12:14:04  lipp
* Adapted to configurable ResourceManagement/AssignmentServices.
*
* Revision 1.4  2001/12/13 16:19:59  robert
* Temporary test method for resource management service.
*
* Revision 1.3  2001/12/13 12:20:08  robert
* Introduced security and added JNDI test case
*
* Revision 1.2  2001/12/06 10:55:46  robert
* changed to correct class cast
*
* Revision 1.1  2001/12/05 13:58:44  robert
* basically test cases for ResourceManagementServiceFactory and
* ResourceManagementService
*
*
*
*/
package rms;

import java.util.Collection;
import java.util.Iterator;

import javax.security.auth.login.LoginException;

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

// import de.danet.an.staffmgmt.domain.DuplicateGroupNameException;
// import de.danet.an.staffmgmt.domain.StaffDirectory;
// import de.danet.an.staffmgmt.domain.StaffGroup;
// import de.danet.an.staffmgmt.ejbs.StaffDirectoryHome;
// import de.danet.an.staffmgmt.resource.Resource;
import de.danet.an.workflow.spis.ras.ResourceAssignmentService;
import de.danet.an.workflow.spis.ras.ResourceAssignmentServiceFactory;
import de.danet.an.workflow.spis.rms.ResourceManagementService;
import de.danet.an.workflow.spis.rms.ResourceManagementServiceFactory;
import de.danet.an.workflow.spis.rms.ResourceNotFoundException;

import junit.framework.*;

import common.UTLoginContext;

/**
* Zusammenstellung aller RmsObjectTests.
*/
public class Rms 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 Rms(String name) {
  super (name);
    }

    /**
     * Stellt diese TestSuite zusammen.
     */
    public static Test suite() {
        TestSuite suite = new TestSuite();
  suite.addTest(new Rms("rms"));
        return new EJBClientTest (plc, suite);
    }
    
    // Lookup as service in JARs
    public void rms() throws Exception {

//   ResourceManagementServiceFactory rmsf
//       = ResourceManagementServiceFactory.newInstance();

//   testRMSServices(rmsf);
    }

    private void testRMSServices(ResourceManagementServiceFactory rmsf)
  throws Exception {
//   StaffDirectory sd = createStaffDirectory();


//   // +++ create needed configuration +++
//   StaffGroup testGroup = null;
//   boolean toRemove = true;
//   try {
//       testGroup = sd.createStaffGroup("dfowempaffj");
//   } catch (DuplicateGroupNameException de) {
//       toRemove = false;
//   }
//   assertTrue (testGroup != null);
//   StaffGroup adminGroup = sd.findStaffGroupByKey("0");
//   adminGroup.addMember(testGroup);
//   // addMember not need catch for RecursiveMembershipException
//   // +++ end of configuration +++

//   ResourceAssignmentServiceFactory rasf
//       = ResourceAssignmentServiceFactory.newInstance();
//   ResourceAssignmentService ras
//       = rasf.newResourceAssignmentService();

//   rmsf.setResourceAssignmentService (ras); 
//   ResourceManagementService rms
//       = rmsf.newResourceManagementService();
 
//   // -------------- asResource ----------------
//   // ???

//   // -------------- authorizers ----------------
//   // StaffMember
//   Resource mr = new Resource(ras, sd.findStaffMemberByKey("0"));
//   Collection v = rms.authorizers(mr);
//   boolean test = false;
//   for (Iterator it = v.iterator(); it.hasNext(); ) {
//       Resource authMr = (Resource)it.next();
//       test = test || (authMr.resourceName().equals("Administratoren"));
//   }
//   assertTrue(test);
//   // StaffGroup
//   Resource gr = new Resource(ras, testGroup);
//   v = rms.authorizers(gr);
//   test = false;
//   for (Iterator it = v.iterator(); it.hasNext(); ) {
//       Resource authGr = (Resource)it.next();
//       test = test || (authGr.resourceName().equals("Administratoren"));
//   }
//   assertTrue(test);
//   // the group Administratoren retrieves an empty result.
//   gr = new Resource(ras, sd.findStaffGroupByKey("0"));
//   v = rms.authorizers(gr);
//   test = false;
//   for (Iterator it = v.iterator(); it.hasNext(); ) {
//       Resource authGr = (Resource)it.next();
//       test = test || (authGr.resourceName().equals("Administratoren"));
//   }
//   assertTrue(!test);

//   // -------------- resourceByKey ----------------
//   Resource r = (Resource)rms.resourceByKey ("M0");
//   assertTrue(r.resourceName().startsWith("Administrator"));
//   r = (Resource)rms.resourceByKey ("G0");
//   assertTrue(r.resourceName().startsWith("Administrator"));
//   try {
//       r = (Resource)rms.resourceByKey ("G999");
//   } catch (ResourceNotFoundException rnfe) {
//       assertTrue(true);
//   }
//   assertTrue(r.resourceName().startsWith("Administrator"));
//   try {
//       r = (Resource)rms.resourceByKey ("falscher Key");
//   } catch (IllegalArgumentException iae) {
//       assertTrue(true);
//   }

//   // -------------- listResources ----------------
//   v = rms.listResources();
//   test = false;
//   for (Iterator it = v.iterator(); it.hasNext(); ) {
//       Resource res = (Resource)it.next();
//       test = test || (res.resourceName().equals("Administratoren"));
//   }
//   assertTrue(test);

//   // +++ cleanup configuration +++
//   if(toRemove) {
//       sd.removeStaffGroup(testGroup.key());
//   }
    }

//     private StaffDirectory createStaffDirectory() throws Exception {
//   return ((StaffDirectoryHome)EJBUtil.lookupEJBHome
//     (StaffDirectoryHome.class,
//      "de.danet.an.workflow.StaffDirectory")).create();
//     }
}
TOP

Related Classes of rms.Rms

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.