Package org.kuali.rice.krad

Examples of org.kuali.rice.krad.UserSession


  /**
   * test that users in the idmgr group have the relevant permissions
   */
  public void testIdMgrPermissions_populateGroup() throws WorkflowException {
    Map<String, Boolean> authUsers = getTestUtils().getAuthUsers();
    GlobalVariables.setUserSession(new UserSession("admin"));
    //Document document = KRADServiceLocatorWeb.getDocumentService().getNewDocument(IdentityManagementPersonDocument.class);
    Document document = mock(IdentityManagementPersonDocument.class);
    DocumentHeader header = mock(DocumentHeader.class);
    WorkflowDocument wd = mock(WorkflowDocument.class);
    when(document.getDocumentHeader()).thenReturn(header);
View Full Code Here


   * tests transactional routing
   * @throws WorkflowException
   */
  @Test
  public void testRouting() throws WorkflowException {
    GlobalVariables.setUserSession(new UserSession("lawyer1"));
    getTestUtils().testTransactionalRoutingInitToFinal(getTxDoc());
  }
View Full Code Here

   * @throws WorkflowException
   */
  @Test
  public void testProcessCustomRouteDocumentBusinessRules() throws InstantiationException, IllegalAccessException, WorkflowException {
    // not setting a value will definitely result in an error - so use a non-existent value
    GlobalVariables.setUserSession(new UserSession("clerk1"));
    MatterTxDocBase txDoc = getTxDoc();
    txDoc.setMatterId(2001l);
    assertFalse("rule should return false", getRule().processCustomRouteDocumentBusinessRules(txDoc));
    assertTrue("there should be errors", GlobalVariables.getMessageMap().hasErrors());
    txDoc.logErrors();
View Full Code Here

   * @param docType - the document type
   */
  @Deprecated//does not work anymore when document search is activated, causes 'user not authorized' errors
  public void testTransactionalRoutingAndDocumentCRUD(String docType, MatterTxDocBase txDoc)
      throws WorkflowException {
    GlobalVariables.setUserSession(new UserSession("clerk1"));
    Document doc = KRADServiceLocatorWeb.getDocumentService().saveDocument(txDoc);
    assertTrue("document should have been saved", doc.getDocumentHeader().getWorkflowDocument().isSaved());
    KRADServiceLocatorWeb.getDocumentService().routeDocument(doc, "submitted", null);
   
    // approve as lawyer1
    GlobalVariables.setUserSession(new UserSession("lawyer1"));
    doc = KRADServiceLocatorWeb.getDocumentService().getByDocumentHeaderId(doc.getDocumentNumber());
    assertTrue("document should be enroute", doc.getDocumentHeader().getWorkflowDocument().isEnroute());
    KRADServiceLocatorWeb.getDocumentService().approveDocument(doc, "approved", null);
   
    //retrieve again to confirm status
View Full Code Here

  @Test
  public void testWorkFlowDocument() throws WorkflowException {
    try {
      // save
      String initiator = "clerk1";
      GlobalVariables.setUserSession(new UserSession(initiator));
      MatterWork work = getTestUtils().populateMatterWork((MatterWork) KRADServiceLocatorWeb.getDocumentService().getNewDocument(
          getDocTypeName() + "Test"));
      // bo does not exist until it is saved - initiated docs will not show up on the inquiry
      /*MatterWork bo = getBoSvc().findBySinglePrimaryKey(work.getClass(), work.getDocumentHeader());
      assertNotNull("for initiated doc, workflow document should not be null", bo.getDocumentHeader().getWorkflowDocument());*/
     
      work = (MatterWork)KRADServiceLocatorWeb.getDocumentService().saveDocument(work);
      MatterWork bo = getBoSvc().findBySinglePrimaryKey(work.getClass(), work.getDocumentNumber());
      assertNotNull("for saved doc, workflow document should not be null", bo.getDocumentHeader().getWorkflowDocument());
      assertEquals("principal name differs", initiator, bo.getDocumentInitiatorNetworkId());
      work = (MatterWork) KRADServiceLocatorWeb.getDocumentService().routeDocument(work, "submit", null);
      WorkflowDocument workflowDoc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(initiator), work.getDocumentNumber());
      assertTrue("work should be enroute", workflowDoc.isEnroute());
     
      String approver = "lawyer1";
      GlobalVariables.setUserSession(new UserSession(approver));
      work = (MatterWork) KRADServiceLocatorWeb.getDocumentService().approveDocument(work, "approved", null);
      //workflowDoc = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName(initiator), work.getDocumentNumber());
      // assertTrue("work should be final", work.getDocumentHeader().getWorkflowDocument().isFinal()); FAIL - is it because the test bo does not have an ojb config entry?
     
      //retrieve again to confirm status
View Full Code Here

   */
  @Test(expected = ValidationException.class)
  public void testWorkFlowDocument_matterId_validation() throws WorkflowException {
    // save
    String initiator = "clerk1";
    GlobalVariables.setUserSession(new UserSession(initiator));
    MatterWork work = (MatterWork) getTxDoc();
    work.setMatterId(5001l);//non-existent

    work = (MatterWork) KRADServiceLocatorWeb.getDocumentService().routeDocument(work, "approved", null);
  }
View Full Code Here

  /**
   * tests that getting work flow doc from newly instantiated bo returns the custom null work flow doc
   */
  @Test
  public void testWorkFlowDocument_newBO() {
    GlobalVariables.setUserSession(new UserSession("clerk1"));
    MatterWork work = new MatterWork();
    WorkflowDocument wfd = work.getDocumentHeader().getWorkflowDocument();
    assertTrue("work flow document differs", wfd instanceof DummyWorkFlowDocument);
  }
View Full Code Here

   * @throws InstantiationException
   */
  protected Document getPopulatedMaintenanceDocument(String docType, PersistableBusinessObject bo, String principalName)
      throws WorkflowException, InstantiationException,
      IllegalAccessException {
        GlobalVariables.setUserSession(new UserSession(principalName));
        MaintenanceDocument doc = (MaintenanceDocument) KRADServiceLocatorWeb.getDocumentService().getNewDocument(docType);
        //old bo
        doc.getOldMaintainableObject().setDataObjectClass(bo.getClass());
        doc.getOldMaintainableObject().setDataObject(bo.getClass().newInstance());
        //new object
View Full Code Here

    //initiate as the clerk
    Document doc = getPopulatedMaintenanceDocument(docType, bo, "clerk1");
    doc = KRADServiceLocatorWeb.getDocumentService().saveDocument(doc);
    KRADServiceLocatorWeb.getDocumentService().routeDocument(doc, "submitted", null);
    //retrieve as the lawyer
    GlobalVariables.setUserSession(new UserSession("lawyer1"));
    doc = KRADServiceLocatorWeb.getDocumentService().getByDocumentHeaderId(doc.getDocumentNumber());
    assertTrue(doc.getDocumentHeader().getWorkflowDocument().isEnroute());
    KRADServiceLocatorWeb.getDocumentService().approveDocument(doc, "right", null);
    //retrieve again to confirm status
    doc = KRADServiceLocatorWeb.getDocumentService().getByDocumentHeaderId(doc.getDocumentNumber());
View Full Code Here

    inquirable = new EnhancedInquirableImpl();
    inquirable.setDataObjectClass(DATA_OBJECT_CLASS);
    dataObject = getBoSvc().findBySinglePrimaryKey(DATA_OBJECT_CLASS, new Long(1001));
   
    String initiator = "clerk1";
    GlobalVariables.setUserSession(new UserSession(initiator));
  }
View Full Code Here

TOP

Related Classes of org.kuali.rice.krad.UserSession

Copyright © 2018 www.massapicom. 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.