Search in sources :

Example 1 with PolicyDTO

use of org.simbasecurity.core.service.manager.dto.PolicyDTO in project simba-os by cegeka.

the class PolicyDTOAssemblerTest method testAssembleMultiplePolicies.

@Test
public void testAssembleMultiplePolicies() {
    Policy policy = new PolicyEntity("policy name");
    Collection<PolicyDTO> policyDataList = PolicyDTOAssembler.assemble(Arrays.asList(policy));
    assertNotNull(policyDataList);
    assertEquals(1, policyDataList.size());
}
Also used : Policy(org.simbasecurity.core.domain.Policy) PolicyDTO(org.simbasecurity.core.service.manager.dto.PolicyDTO) PolicyEntity(org.simbasecurity.core.domain.PolicyEntity) Test(org.junit.Test)

Example 2 with PolicyDTO

use of org.simbasecurity.core.service.manager.dto.PolicyDTO in project simba-os by cegeka.

the class PolicyDTOAssembler method assemble.

public static PolicyDTO assemble(final Policy policy) {
    final PolicyDTO policyDTO = new PolicyDTO();
    applyVersionAndId((AbstractVersionedEntity) policy, policyDTO);
    policyDTO.setName(policy.getName());
    return policyDTO;
}
Also used : PolicyDTO(org.simbasecurity.core.service.manager.dto.PolicyDTO)

Example 3 with PolicyDTO

use of org.simbasecurity.core.service.manager.dto.PolicyDTO in project simba-os by cegeka.

the class PolicyDTOAssemblerTest method testAssembleSinglePolicy.

@Test
public void testAssembleSinglePolicy() {
    Policy policy = new PolicyEntity("policy name");
    PolicyDTO policyData = PolicyDTOAssembler.assemble(policy);
    assertNotNull(policyData);
    assertEquals(0, policyData.getId());
    assertEquals(policy.getName(), policyData.getName());
    assertEquals(0, policyData.getId());
    assertEquals(0, policyData.getVersion());
}
Also used : Policy(org.simbasecurity.core.domain.Policy) PolicyDTO(org.simbasecurity.core.service.manager.dto.PolicyDTO) PolicyEntity(org.simbasecurity.core.domain.PolicyEntity) Test(org.junit.Test)

Aggregations

PolicyDTO (org.simbasecurity.core.service.manager.dto.PolicyDTO)3 Test (org.junit.Test)2 Policy (org.simbasecurity.core.domain.Policy)2 PolicyEntity (org.simbasecurity.core.domain.PolicyEntity)2