Search in sources :

Example 76 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class AbstractActivationComputerTest method createActivationType.

protected ActivationType createActivationType(ActivationStatusType administrativeStatus, XMLGregorianCalendar validFrom, XMLGregorianCalendar validTo) {
    ActivationType activationType = new ActivationType();
    activationType.setAdministrativeStatus(administrativeStatus);
    activationType.setValidFrom(validFrom);
    activationType.setValidTo(validTo);
    return activationType;
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)

Example 77 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class AbstractActivationComputerTest method testGetActiveAdministrativeDisabled.

@Test
public void testGetActiveAdministrativeDisabled() throws Exception {
    // GIVEN
    Clock clock = createClock(YEAR_START);
    ActivationComputer activationComputer = createActivationComputer(clock);
    ActivationType activationType = createActivationType(ActivationStatusType.DISABLED, SPRING_EQUINOX, AUTUMN_EQUINOX);
    // WHEN
    ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(SchemaConstants.LIFECYCLE_ACTIVE, activationType, createLifecycleModel());
    // THEN
    assertEquals("Unexpected effective status", ActivationStatusType.DISABLED, effectiveStatus);
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) ActivationStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType) AbstractUnitTest(com.evolveum.midpoint.tools.testng.AbstractUnitTest) Test(org.testng.annotations.Test)

Example 78 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class AbstractActivationComputerTest method testGetBeforeValidity.

@Test
public void testGetBeforeValidity() throws Exception {
    // GIVEN
    Clock clock = createClock(YEAR_START);
    ActivationComputer activationComputer = createActivationComputer(clock);
    ActivationType activationType = createActivationType(null, SPRING_EQUINOX, AUTUMN_EQUINOX);
    // WHEN
    ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(null, activationType, createLifecycleModel());
    // THEN
    assertEquals("Unexpected effective status", ActivationStatusType.DISABLED, effectiveStatus);
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) ActivationStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType) AbstractUnitTest(com.evolveum.midpoint.tools.testng.AbstractUnitTest) Test(org.testng.annotations.Test)

Example 79 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class AbstractActivationComputerTest method testGetArchivedAdministrativeEnabled.

@Test
public void testGetArchivedAdministrativeEnabled() throws Exception {
    // GIVEN
    Clock clock = createClock(SUMMER_SOLSTICE);
    ActivationComputer activationComputer = createActivationComputer(clock);
    ActivationType activationType = createActivationType(ActivationStatusType.ENABLED, SPRING_EQUINOX, AUTUMN_EQUINOX);
    // WHEN
    ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(SchemaConstants.LIFECYCLE_ARCHIVED, activationType, createLifecycleModel());
    // THEN
    assertEquals("Unexpected effective status", ActivationStatusType.ARCHIVED, effectiveStatus);
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) ActivationStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType) AbstractUnitTest(com.evolveum.midpoint.tools.testng.AbstractUnitTest) Test(org.testng.annotations.Test)

Example 80 with ActivationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType in project midpoint by Evolveum.

the class AbstractActivationComputerTest method testCompute.

protected void testCompute(String lifecycleState, XMLGregorianCalendar now, ActivationStatusType administrativeStatus, XMLGregorianCalendar validFrom, XMLGregorianCalendar validTo, ActivationStatusType expectedEffective, TimeIntervalStatusType expectedValidity) throws SchemaException, IOException {
    // GIVEN
    Clock clock = createClock(now);
    ActivationComputer activationComputer = createActivationComputer(clock);
    ActivationType activationType = createActivationType(administrativeStatus, validFrom, validTo);
    // WHEN
    activationComputer.computeEffective(lifecycleState, activationType, createLifecycleModel());
    // THEN
    assertEquals("Unexpected effective status", expectedEffective, activationType.getEffectiveStatus());
    assertEquals("Unexpected validity status", expectedValidity, activationType.getValidityStatus());
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)

Aggregations

ActivationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)76 Test (org.testng.annotations.Test)48 ActivationStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType)40 AbstractUnitTest (com.evolveum.midpoint.tools.testng.AbstractUnitTest)13 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)11 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)10 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)9 Task (com.evolveum.midpoint.task.api.Task)9 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)8 PrismObject (com.evolveum.midpoint.prism.PrismObject)7 MetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)7 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)7 LockoutStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType)6 ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)6 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)6 ActivationStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType)5 SchemaConstants (com.evolveum.midpoint.schema.constants.SchemaConstants)4 TimeIntervalStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.TimeIntervalStatusType)4 ActivationLockoutStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationLockoutStatusCapabilityType)4 QName (javax.xml.namespace.QName)4