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

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


        assertTrue("Status = " + next.getStatus(), next.getStatus() == ApprovalDataVO.STATUS_WAITINGFORAPPROVAL);
        assertTrue(next.getRemainingApprovals() == 1);

        Approval approvalAgain = new Approval("apAgaintest");
        try {
            approvalExecutionSessionRemote.approve(admin1, nonExecutableRequest.generateApprovalId(), approvalAgain, gc);
            fail("The same admin shouldn't be able to approve a request twice");
        } catch (AdminAlreadyApprovedRequestException e) {
        }

        Approval approval2 = new Approval("ap2test");
View Full Code Here


            fail("The same admin shouldn't be able to approve a request twice");
        } catch (AdminAlreadyApprovedRequestException e) {
        }

        Approval approval2 = new Approval("ap2test");
        approvalExecutionSessionRemote.approve(admin2, nonExecutableRequest.generateApprovalId(), approval2, gc);

        result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        assertTrue(result.size() == 1);

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

        }

        Approval approval2 = new Approval("ap2test");
        approvalExecutionSessionRemote.approve(admin2, nonExecutableRequest.generateApprovalId(), approval2, gc);

        result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        assertTrue(result.size() == 1);

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

        assertTrue("Status = " + next.getStatus(), next.getStatus() == ApprovalDataVO.STATUS_APPROVED);
        assertTrue(next.getRemainingApprovals() == 0);

        // Test that the approval exipres 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

        approvalSessionRemote.addApprovalRequest(admin1, executableRequest, gc);

        approvalExecutionSessionRemote.approve(admin1, nonExecutableRequest.generateApprovalId(), approval1, gc);
        approvalExecutionSessionRemote.approve(admin2, nonExecutableRequest.generateApprovalId(), approval2, gc);

        result = approvalSessionRemote.findApprovalDataVO(admin1, executableRequest.generateApprovalId());
        assertTrue(result.size() == 1);
        next = (ApprovalDataVO) result.iterator().next();
        assertTrue("Status = " + next.getStatus(), next.getStatus() == ApprovalDataVO.STATUS_EXECUTED);

        // Make sure that the approval still have status executed after
View Full Code Here

        assertTrue("Status = " + next.getStatus(), next.getStatus() == ApprovalDataVO.STATUS_EXECUTED);

        // Make sure that the approval still have status executed after
        // exiration
        Thread.sleep(5000);
        result = approvalSessionRemote.findApprovalDataVO(admin1, executableRequest.generateApprovalId());
        assertTrue(result.size() == 1);

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

        try {
            approvalExecutionSessionRemote.approve(reqadmin, nonExecutableRequest.generateApprovalId(), approvalUsingReqAdmin, gc);
            fail("Request admin shouln't be able to approve their own request");
        } catch (AdminAlreadyApprovedRequestException e) {
        }
        result = approvalSessionRemote.findApprovalDataVO(admin1, executableRequest.generateApprovalId());
        assertTrue(result.size() == 1);
        next = (ApprovalDataVO) result.iterator().next();
        approvalSessionRemote.removeApprovalRequest(admin1, next.getId());

    }
View Full Code Here

        log.trace(">testReject()");
        DummyApprovalRequest nonExecutableRequest = new DummyApprovalRequest(reqadmin, null, caid, SecConst.EMPTY_ENDENTITYPROFILE, false);
        approvalSessionRemote.addApprovalRequest(reqadmin, nonExecutableRequest, gc);

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

        Collection<ApprovalDataVO> result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        ApprovalDataVO next = result.iterator().next();
        assertTrue("Status = " + next.getStatus(), next.getStatus() == ApprovalDataVO.STATUS_WAITINGFORAPPROVAL);
        assertTrue(next.getRemainingApprovals() == 1);
View Full Code Here

        approvalSessionRemote.addApprovalRequest(reqadmin, nonExecutableRequest, gc);

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

        Collection<ApprovalDataVO> result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        ApprovalDataVO next = result.iterator().next();
        assertTrue("Status = " + next.getStatus(), next.getStatus() == ApprovalDataVO.STATUS_WAITINGFORAPPROVAL);
        assertTrue(next.getRemainingApprovals() == 1);

        Approval rejection = new Approval("rejectiontest");
View Full Code Here

        ApprovalDataVO next = result.iterator().next();
        assertTrue("Status = " + next.getStatus(), next.getStatus() == ApprovalDataVO.STATUS_WAITINGFORAPPROVAL);
        assertTrue(next.getRemainingApprovals() == 1);

        Approval rejection = new Approval("rejectiontest");
        approvalSessionRemote.reject(admin2, nonExecutableRequest.generateApprovalId(), rejection, gc);
        result = approvalSessionRemote.findApprovalDataVO(admin1, nonExecutableRequest.generateApprovalId());
        next = (ApprovalDataVO) result.iterator().next();
        assertTrue("Status = " + next.getStatus(), next.getStatus() == ApprovalDataVO.STATUS_REJECTED);
        assertTrue(next.getRemainingApprovals() == 0);
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.