Search in sources :

Example 1 with TimeCondition

use of org.simbasecurity.core.domain.condition.TimeCondition in project simba-os by cegeka.

the class ConditionDTOAssemblerTest method createTimeCondition.

private TimeCondition createTimeCondition() {
    TimeCondition condition = new TimeCondition();
    condition.setName("time condition");
    condition.setStartCondition("0 0 12 * * ?");
    condition.setEndCondition("0 0 12 * * ?");
    return condition;
}
Also used : TimeCondition(org.simbasecurity.core.domain.condition.TimeCondition)

Example 2 with TimeCondition

use of org.simbasecurity.core.domain.condition.TimeCondition in project simba-os by cegeka.

the class ConditionDTOAssemblerTest method testAssembleSingleConditionData.

@Test
public void testAssembleSingleConditionData() {
    TimeCondition condition = createTimeCondition();
    TimeConditionDTO conditionData = (TimeConditionDTO) ConditionDTOAssembler.assemble(condition);
    assertNotNull(conditionData);
    assertEquals(0, conditionData.getId());
    assertEquals(condition.getName(), conditionData.getName());
    assertEquals(condition.getStartCondition(), conditionData.getStartCondition());
    assertEquals(condition.getEndCondition(), conditionData.getEndCondition());
    assertEquals(0, conditionData.getId());
    assertEquals(0, conditionData.getVersion());
}
Also used : TimeConditionDTO(org.simbasecurity.core.service.manager.dto.TimeConditionDTO) TimeCondition(org.simbasecurity.core.domain.condition.TimeCondition) Test(org.junit.Test)

Example 3 with TimeCondition

use of org.simbasecurity.core.domain.condition.TimeCondition in project simba-os by cegeka.

the class ConditionDTOAssemblerTest method testAssembleSingleCondition.

@Test
public void testAssembleSingleCondition() {
    TimeConditionDTO condition = createTimeConditionData();
    TimeCondition conditionData = (TimeCondition) ConditionDTOAssembler.assemble(condition);
    assertNotNull(conditionData);
    assertEquals(0, conditionData.getId());
    assertEquals(condition.getName(), conditionData.getName());
    assertEquals(condition.getStartCondition(), conditionData.getStartCondition());
    assertEquals(condition.getEndCondition(), conditionData.getEndCondition());
    assertEquals(0, conditionData.getId());
    assertEquals(0, conditionData.getVersion());
}
Also used : TimeConditionDTO(org.simbasecurity.core.service.manager.dto.TimeConditionDTO) TimeCondition(org.simbasecurity.core.domain.condition.TimeCondition) Test(org.junit.Test)

Example 4 with TimeCondition

use of org.simbasecurity.core.domain.condition.TimeCondition in project simba-os by cegeka.

the class ConditionDTOAssembler method assemble.

private static Condition assemble(final TimeConditionDTO condition) {
    final Condition timeCondition = new TimeCondition(condition.getStartCondition(), condition.getEndCondition());
    timeCondition.setName(condition.getName());
    return timeCondition;
}
Also used : Condition(org.simbasecurity.core.domain.Condition) TimeCondition(org.simbasecurity.core.domain.condition.TimeCondition) TimeCondition(org.simbasecurity.core.domain.condition.TimeCondition)

Aggregations

TimeCondition (org.simbasecurity.core.domain.condition.TimeCondition)4 Test (org.junit.Test)2 TimeConditionDTO (org.simbasecurity.core.service.manager.dto.TimeConditionDTO)2 Condition (org.simbasecurity.core.domain.Condition)1