Search in sources :

Example 1 with CaseDTO

use of gov.ca.cwds.testapp.domain.CaseDTO in project perry by ca-cwds.

the class ApiSecurityTest method testArgUnauthorizedCompositeObject.

@Test(expected = UnauthorizedException.class)
public void testArgUnauthorizedCompositeObject() throws Exception {
    CaseDTO caseDTO = new CaseDTO();
    Case caseObject = new Case(2L, "name");
    caseDTO.setCaseObject(caseObject);
    testService.testCompositeObject(caseDTO);
}
Also used : CaseDTO(gov.ca.cwds.testapp.domain.CaseDTO) Case(gov.ca.cwds.testapp.domain.Case) Test(org.junit.Test)

Example 2 with CaseDTO

use of gov.ca.cwds.testapp.domain.CaseDTO in project perry by ca-cwds.

the class ApiSecurityTest method testArgAuthorizedCompositeObject.

@Test
public void testArgAuthorizedCompositeObject() throws Exception {
    CaseDTO caseDTO = new CaseDTO();
    Case caseObject = new Case(1L, "name");
    caseDTO.setCaseObject(caseObject);
    testService.testCompositeObject(caseDTO);
}
Also used : CaseDTO(gov.ca.cwds.testapp.domain.CaseDTO) Case(gov.ca.cwds.testapp.domain.Case) Test(org.junit.Test)

Example 3 with CaseDTO

use of gov.ca.cwds.testapp.domain.CaseDTO in project perry by ca-cwds.

the class TestServiceImpl method testFilter.

@Override
@Authorize("case:read:caseDTO.caseObject.id")
public List<CaseDTO> testFilter() {
    List<CaseDTO> result = new ArrayList<>();
    CaseDTO caseDTO = new CaseDTO();
    caseDTO.setCaseObject(new Case(1L, "valid"));
    result.add(caseDTO);
    caseDTO = new CaseDTO();
    caseDTO.setCaseObject(new Case(2L, "name"));
    result.add(caseDTO);
    return result;
}
Also used : CaseDTO(gov.ca.cwds.testapp.domain.CaseDTO) ArrayList(java.util.ArrayList) Case(gov.ca.cwds.testapp.domain.Case) Authorize(gov.ca.cwds.security.annotations.Authorize)

Example 4 with CaseDTO

use of gov.ca.cwds.testapp.domain.CaseDTO in project perry by ca-cwds.

the class ApiSecurityTest method testArgAuthorizedCompositeObjectList.

@Test
public void testArgAuthorizedCompositeObjectList() throws Exception {
    CaseDTO caseDTO = new CaseDTO();
    Case caseObject = new Case(1L, "name");
    caseDTO.getCases().add(caseObject);
    caseDTO.getCases().add(new Case(1L, "name"));
    testService.testCompositeObjectList(caseDTO);
}
Also used : CaseDTO(gov.ca.cwds.testapp.domain.CaseDTO) Case(gov.ca.cwds.testapp.domain.Case) Test(org.junit.Test)

Example 5 with CaseDTO

use of gov.ca.cwds.testapp.domain.CaseDTO in project perry by ca-cwds.

the class ApiSecurityTest method testArgUnauthorizedCompositeObjectList.

@Test(expected = UnauthorizedException.class)
public void testArgUnauthorizedCompositeObjectList() throws Exception {
    CaseDTO caseDTO = new CaseDTO();
    Case caseObject = new Case(1L, "name");
    caseDTO.getCases().add(caseObject);
    caseDTO.getCases().add(new Case(2L, "name"));
    testService.testCompositeObjectList(caseDTO);
}
Also used : CaseDTO(gov.ca.cwds.testapp.domain.CaseDTO) Case(gov.ca.cwds.testapp.domain.Case) Test(org.junit.Test)

Aggregations

Case (gov.ca.cwds.testapp.domain.Case)7 CaseDTO (gov.ca.cwds.testapp.domain.CaseDTO)7 Test (org.junit.Test)4 Authorize (gov.ca.cwds.security.annotations.Authorize)3 ArrayList (java.util.ArrayList)1