Exemplo n.º 1
0
  @Test
  public void testDrafts() throws CvqException {

    this.createDrafts(2);

    List<Request> drafts = this.getDrafts();
    assertEquals(2, drafts.size());

    requestWorkflowService.delete(drafts.get(0).getId());
    continueWithNewTransaction();

    drafts = getDrafts();
    assertEquals(1, drafts.size());

    Request draft2 = drafts.get(0);
    draft2.setState(RequestState.PENDING);
    requestWorkflowService.modify(draft2);

    continueWithNewTransaction();
    try {
      this.getDraftById(draft2.getId());
      fail();
    } catch (IndexOutOfBoundsException e) {
    }
    requestWorkflowService.delete(draft2.getId());

    continueWithNewTransaction();

    assertEquals(0, getDrafts().size());
  }
 public void sendRequests() {
   List<Request> requests = requestExternalService.getSendableRequests(edemandeService.getLabel());
   for (Request request : requests) {
     try {
       requestExternalService.sendRequest(request);
     } catch (CvqException e) {
       logger.warn(
           "sendRequests() Unable to send request "
               + request.getId()
               + " to "
               + edemandeService.getLabel());
     }
   }
 }