Package org.ejbca.core.model.approval.approvalrequests

Examples of org.ejbca.core.model.approval.approvalrequests.DummyApprovalRequest.generateApprovalId()


  public void testGenerateApprovalId() throws Exception {
    Certificate testcert = CertTools.getCertfromByteArray(testcertenc);
    DummyApprovalRequest ar = new DummyApprovalRequest(new Admin(testcert, null, null),null,1,2, false);
   
      int id1 = ar.generateApprovalId();
      int id2 = ar.generateApprovalId();
      assertEquals(id1, id2);
  }

  public void setUp() throws Exception {   
View Full Code Here


  public void testGenerateApprovalId() throws Exception {
    Certificate testcert = CertTools.getCertfromByteArray(testcertenc);
    DummyApprovalRequest ar = new DummyApprovalRequest(new Admin(testcert, null, null),null,1,2, false);
   
      int id1 = ar.generateApprovalId();
      int id2 = ar.generateApprovalId();
      assertEquals(id1, id2);
  }

  public void setUp() throws Exception {   
    super.setUp();
View Full Code Here

    public void testAddApprovalRequest() throws Exception {

        DummyApprovalRequest nonExecutableRequest = new DummyApprovalRequest(reqadmin, null, caid, SecConst.EMPTY_ENDENTITYPROFILE, false);

        // Test that the approvalrequest doesn't exists.
        Collection<ApprovalDataVO> result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        assertTrue(result.size() == 0);
        approvalSessionRemote.addApprovalRequest(admin1, nonExecutableRequest, gc);

        // Test that the approvalRequest exists now
        result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
View Full Code Here

        Collection<ApprovalDataVO> result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        assertTrue(result.size() == 0);
        approvalSessionRemote.addApprovalRequest(admin1, nonExecutableRequest, gc);

        // Test that the approvalRequest exists now
        result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        assertTrue(result.size() == 1);

        ApprovalDataVO next = result.iterator().next();
        assertTrue("Status = " + next.getStatus(), next.getStatus() == ApprovalDataVO.STATUS_WAITINGFORAPPROVAL);
        assertTrue(next.getCAId() == caid);
View Full Code Here

        assertTrue("Status = " + next.getStatus(), next.getStatus() == ApprovalDataVO.STATUS_WAITINGFORAPPROVAL);
        assertTrue(next.getCAId() == caid);
        assertTrue(next.getEndEntityProfileiId() == SecConst.EMPTY_ENDENTITYPROFILE);
        assertTrue(next.getReqadmincertissuerdn().equals(CertTools.getIssuerDN(reqadmincert)));
        assertTrue(next.getReqadmincertsn().equals(CertTools.getSerialNumberAsString(reqadmincert)));
        assertTrue(next.getApprovalId() == nonExecutableRequest.generateApprovalId());
        assertTrue(next.getApprovalType() == nonExecutableRequest.getApprovalType());
        assertTrue(next.getApprovals().size() == 0);
        assertTrue(!next.getApprovalRequest().isExecutable());
        assertTrue(next.getRemainingApprovals() == 2);
View Full Code Here

        assertTrue(!next.getApprovalRequest().isExecutable());
        assertTrue(next.getRemainingApprovals() == 2);

        // Test that the request expires as it should
        Thread.sleep(5000);
        result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        assertTrue(result.size() == 1);

        next = (ApprovalDataVO) result.iterator().next();
        assertTrue("Status = " + next.getStatus(), next.getStatus() == ApprovalDataVO.STATUS_EXPIRED);
View Full Code Here

        } catch (ApprovalException e) {
        }

        // Then after one of them have expired
        Thread.sleep(5000);
        result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        ApprovalDataVO expired = (ApprovalDataVO) result.iterator().next();

        approvalSessionRemote.addApprovalRequest(admin1, nonExecutableRequest, gc);

        approvalSessionRemote.removeApprovalRequest(admin1, expired.getId());
View Full Code Here

        approvalSessionRemote.addApprovalRequest(admin1, nonExecutableRequest, gc);

        approvalSessionRemote.removeApprovalRequest(admin1, expired.getId());

        result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        next = (ApprovalDataVO) result.iterator().next();

        approvalSessionRemote.removeApprovalRequest(admin1, next.getId());
    }
View Full Code Here

       
        DummyApprovalRequest nonExecutableRequest = new DummyApprovalRequest(reqadmin, null, caid, SecConst.EMPTY_ENDENTITYPROFILE, false);
        approvalSessionRemote.addApprovalRequest(admin1, nonExecutableRequest, gc);

        Approval approval1 = new Approval("ap1test");
        approvalExecutionSessionRemote.approve(admin1, nonExecutableRequest.generateApprovalId(), approval1, gc);

        Collection<ApprovalDataVO> result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        assertTrue(result.size() == 1);

        ApprovalDataVO next = result.iterator().next();
View Full Code Here

        approvalSessionRemote.addApprovalRequest(admin1, nonExecutableRequest, gc);

        Approval approval1 = new Approval("ap1test");
        approvalExecutionSessionRemote.approve(admin1, nonExecutableRequest.generateApprovalId(), approval1, gc);

        Collection<ApprovalDataVO> result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        assertTrue(result.size() == 1);

        ApprovalDataVO next = result.iterator().next();
        assertTrue("Status = " + next.getStatus(), next.getStatus() == ApprovalDataVO.STATUS_WAITINGFORAPPROVAL);
        assertTrue(next.getRemainingApprovals() == 1);
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.