Search in sources :

Example 1 with ActivationStatusType

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

the class OperationalDataManager method applyAssignmentValueMetadataAdd.

private <F extends FocusType> void applyAssignmentValueMetadataAdd(LensContext<F> context, PrismContainerValue<AssignmentType> assignmentContainerValue, String desc, XMLGregorianCalendar now, Task task, OperationResult result) throws SchemaException {
    AssignmentType assignmentType = assignmentContainerValue.asContainerable();
    MetadataType metadataType = assignmentType.getMetadata();
    if (metadataType == null) {
        metadataType = new MetadataType();
        assignmentType.setMetadata(metadataType);
    }
    transplantRequestMetadata(context, metadataType);
    ActivationType activationType = assignmentType.getActivation();
    ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(assignmentType.getLifecycleState(), activationType);
    if (activationType == null) {
        activationType = new ActivationType();
        assignmentType.setActivation(activationType);
    }
    activationType.setEffectiveStatus(effectiveStatus);
    applyCreateMetadata(context, metadataType, now, task);
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Adding operational data {} to assignment cval ({}):\nMETADATA:\n{}\nACTIVATION:\n{}", metadataType, desc, assignmentContainerValue.debugDump(1), activationType.asPrismContainerValue().debugDump(1));
    }
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) ActivationStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)

Example 2 with ActivationStatusType

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

the class TestActivationComputer method testCompute.

void testCompute(final String TEST_NAME, String lifecycleState, XMLGregorianCalendar now, ActivationStatusType administrativeStatus, XMLGregorianCalendar validFrom, XMLGregorianCalendar validTo, ActivationStatusType expectedEffective, TimeIntervalStatusType expectedValidity) {
    // GIVEN
    Clock clock = createClock(now);
    ActivationComputer activationComputer = createActivationComputer(clock);
    ActivationType activationType = createActivationType(administrativeStatus, validFrom, validTo);
    // WHEN
    activationComputer.computeEffective(lifecycleState, activationType);
    // 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)

Example 3 with ActivationStatusType

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

the class TestActivationComputer method testGetActiveAdministrativeEnabled.

@Test
public void testGetActiveAdministrativeEnabled() throws Exception {
    System.out.println("\n===[ testGetActiveAdministrativeEnabled ]===\n");
    // GIVEN
    Clock clock = createClock(YEAR_START);
    ActivationComputer activationComputer = createActivationComputer(clock);
    ActivationType activationType = createActivationType(ActivationStatusType.ENABLED, SPRING_EQUINOX, AUTUMN_EQUINOX);
    // WHEN
    ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(SchemaConstants.LIFECYCLE_ACTIVE, activationType);
    // THEN
    assertEquals("Unexpected effective status", ActivationStatusType.ENABLED, 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) Test(org.testng.annotations.Test)

Example 4 with ActivationStatusType

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

the class TestActivationComputer method testGetBeforeValidity.

@Test
public void testGetBeforeValidity() throws Exception {
    System.out.println("\n===[ testGetBeforeValidity ]===\n");
    // 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);
    // 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) Test(org.testng.annotations.Test)

Example 5 with ActivationStatusType

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

the class TestActivationComputer method testGetAdministrativeEnabled.

@Test
public void testGetAdministrativeEnabled() throws Exception {
    System.out.println("\n===[ testGetAdministrativeEnabled ]===\n");
    // GIVEN
    Clock clock = createClock(YEAR_START);
    ActivationComputer activationComputer = createActivationComputer(clock);
    ActivationType activationType = createActivationType(ActivationStatusType.ENABLED, SPRING_EQUINOX, AUTUMN_EQUINOX);
    // WHEN
    ActivationStatusType effectiveStatus = activationComputer.getEffectiveStatus(null, activationType);
    // THEN
    assertEquals("Unexpected effective status", ActivationStatusType.ENABLED, 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) Test(org.testng.annotations.Test)

Aggregations

ActivationStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType)48 ActivationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)43 Test (org.testng.annotations.Test)30 AbstractUnitTest (com.evolveum.midpoint.tools.testng.AbstractUnitTest)13 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)8 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)5 PrismObject (com.evolveum.midpoint.prism.PrismObject)4 ActivationStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType)4 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)3 TimeIntervalStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.TimeIntervalStatusType)3 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)2 LockoutStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType)2 ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)2 ArrayList (java.util.ArrayList)2 QName (javax.xml.namespace.QName)2 LensProjectionContext (com.evolveum.midpoint.model.impl.lens.LensProjectionContext)1 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)1 PrismPropertyValue (com.evolveum.midpoint.prism.PrismPropertyValue)1