Examples of MatterWork


Examples of org.martinlaw.bo.MatterWork

   
    RouteContext context = mock(RouteContext.class);
    DocumentRouteHeaderValue docHdr = mock(DocumentRouteHeaderValue.class);
    when(context.getDocument()).thenReturn(docHdr);
   
    MatterWork work = mock(MatterWork.class);
    MatterAnnexType annexType = new MatterAnnexType();
    when(work.getAnnexType()).thenReturn(annexType);
   
    final String documentId = "2013";
    when(docHdr.getDocumentId()).thenReturn(documentId);
    when(boSvc.findBySinglePrimaryKey(same(MatterWork.class), same(documentId))).thenReturn(work);
    assertTrue("branch list should be empty since requiresApproval is by default false"
        annexTypeApprovalSplit.process(context, null).getBranchNames().isEmpty());
   
    annexType.setRequiresApproval(true);
    final List<String> branchNames = annexTypeApprovalSplit.process(context, null).getBranchNames();
    assertFalse("branch list should not be empty since requiresApproval is set to true", branchNames.isEmpty());
    assertEquals("branch name differs", MartinlawConstants.RoutingBranches.ANNEX_TYPE_APPROVAL, branchNames.get(0));
   
    when(work.getAnnexType()).thenReturn(null);
    assertTrue("branch list should be empty since annex type is null"
        annexTypeApprovalSplit.process(context, null).getBranchNames().isEmpty());
   
    when(docHdr.getDocumentId()).thenReturn("none existent doc id");
    assertFalse("branch list should not be empty if document does not exist, workflow testing mode is assumed"
View Full Code Here

Examples of org.martinlaw.bo.MatterWork

   * @param klass
   * @return
   */
  @Test
  public void testWorkRetrieve() {
    MatterWork work = getBoSvc().findBySinglePrimaryKey(getWorkClass(), getMatterWorkDocNumber());
    assertNotNull("result should not be null", work);
    assertNotNull("matter should not be null", work.getMatter());
    assertNotNull("work type should not be null", work.getAnnexType());
    assertEquals("default annex type differs", MartinlawConstants.DEFAULT_ANNEX_TYPE_ID, work.getAnnexTypeId());
  }
View Full Code Here

Examples of org.martinlaw.bo.MatterWork

  /**
   * @return the work
   */
  public MatterTxDocBase getWork() {
    return new MatterWork();
  }
View Full Code Here

Examples of org.martinlaw.bo.MatterWork

  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
      bo = getBoSvc().findBySinglePrimaryKey(work.getClass(), work.getDocumentNumber());
      assertNotNull("for final doc, workflow document should not be null", bo.getDocumentHeader().getWorkflowDocument());
      assertEquals("principal name differs", initiator, bo.getDocumentInitiatorNetworkId());
      assertFalse("completion period should not be empty", StringUtils.isEmpty( bo.getPeriodToCompletion()));
      assertFalse("approval period should not be empty", StringUtils.isEmpty( bo.getPeriodToApprove()));
     
      work.refreshNonUpdateableReferences();
      assertNotNull("annex type should not be null", work.getAnnexType());
      assertEquals("default annex type differs", MartinlawConstants.DEFAULT_ANNEX_TYPE_ID, work.getAnnexTypeId());
    } catch (Exception e) {
View Full Code Here

Examples of org.martinlaw.bo.MatterWork

  @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

Examples of org.martinlaw.bo.MatterWork

    crits.add(crit2);
    crits.add(crit3);
    getTestUtils().runDocumentSearch(crits, getDocTypeName());
   
    try {
      MatterWork work1;
      work1 = getTestUtils().populateMatterWork((MatterWork) KRADServiceLocatorWeb.getDocumentService().getNewDocument(
          getDocTypeName()));
      work1.setAnnexTypeId(annexTypeId );
      getTestUtils().testTransactionalRoutingInitToFinal(work1);
     
      MatterWork work2 = getTestUtils().populateMatterWork((MatterWork) KRADServiceLocatorWeb.getDocumentService().getNewDocument(
          getDocTypeName()));
      work2.setMatterId(matterId );
      getTestUtils().testTransactionalRoutingInitToFinal(work2);
     
      crit2.setExpectedDocuments(1);
      crit3.setExpectedDocuments(1);
      getTestUtils().runDocumentSearch(crits, getDocTypeName());
View Full Code Here

Examples of org.martinlaw.bo.MatterWork

   * 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

Examples of org.martinlaw.bo.MatterWork

  public SplitResult process(RouteContext context, RouteHelper helper)
      throws Exception {
    List<String> branchNames = new ArrayList<String>();
    // If work document has an annex type that requires approval, return the approval branch name, otherwise empty branch list
    if (context != null && context.getDocument() != null && context.getDocument().getDocumentId() != null) {
      MatterWork work = getBusinessObjectService().findBySinglePrimaryKey(
          MatterWork.class, context.getDocument().getDocumentId());
      if (work == null) {
        /**
         * when work is null, workflow testing mode is assumed (where no BO's are present)
         * this is not anticipated on the UI since work is auto created by the framework and annex type is
         * a required field
         */
        branchNames.add(MartinlawConstants.RoutingBranches.ANNEX_TYPE_APPROVAL);
        log.error("work with doc number '" + context.getDocument().getDocumentId() "' is  null. testing?");
      } else {
        work.refreshNonUpdateableReferences();
        if (work.getAnnexType() != null && work.getAnnexType().getRequiresApproval()) {
          branchNames.add(MartinlawConstants.RoutingBranches.ANNEX_TYPE_APPROVAL);
        }
        if (work.getAnnexType() == null) {
          log.error("annexType for work with doc number '" + context.getDocument().getDocumentId() "' is null");
        }
      }
    }
   
View Full Code Here
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.