Search in sources :

Example 66 with ActivationType

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

the class AbstractModelIntegrationTest method getActivation.

protected ActivationType getActivation(PrismObject<? extends ObjectType> obj) {
    ObjectType objectType = obj.asObjectable();
    ActivationType activation;
    if (objectType instanceof ShadowType) {
        activation = ((ShadowType) objectType).getActivation();
    } else if (objectType instanceof UserType) {
        activation = ((UserType) objectType).getActivation();
    } else {
        throw new IllegalArgumentException("Cannot get activation from " + obj);
    }
    assertNotNull("No activation in " + obj, activation);
    return activation;
}
Also used : ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Example 67 with ActivationType

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

the class AbstractModelIntegrationTest method assertEnableTimestampShadow.

protected void assertEnableTimestampShadow(PrismObject<? extends ShadowType> shadow, XMLGregorianCalendar startTime, XMLGregorianCalendar endTime) {
    ActivationType activationType = shadow.asObjectable().getActivation();
    assertNotNull("No activation in " + shadow, activationType);
    XMLGregorianCalendar userDisableTimestamp = activationType.getEnableTimestamp();
    TestUtil.assertBetween("Wrong shadow enableTimestamp in " + shadow, startTime, endTime, userDisableTimestamp);
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)

Example 68 with ActivationType

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

the class TestUnitObjectWrapperFactory method testCreateWrapperUser.

@Test
public void testCreateWrapperUser() throws Exception {
    final String TEST_NAME = "testCreateWrapperUser";
    TestUtil.displayTestTile(TEST_NAME);
    PrismObject<UserType> user = PrismTestUtil.parseObject(USER_JACK_REPO_FILE);
    PrismObjectDefinition<UserType> objDef = user.getDefinition();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    ObjectWrapperFactory factory = new ObjectWrapperFactory(getServiceLocator());
    ObjectWrapper<UserType> objectWrapper = factory.createObjectWrapper("user display name", "user description", user, objDef, null, ContainerStatus.MODIFYING, false);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    IntegrationTestTools.display("Wrapper after", objectWrapper);
    WrapperTestUtil.assertWrapper(objectWrapper, "user display name", "user description", user, ContainerStatus.MODIFYING);
    assertEquals("wrong number of containers in " + objectWrapper, 11, objectWrapper.getContainers().size());
    ContainerWrapper mainContainerWrapper = objectWrapper.findContainerWrapper(null);
    WrapperTestUtil.assertWrapper(mainContainerWrapper, "prismContainer.mainPanelDisplayName", (ItemPath) null, user, ContainerStatus.MODIFYING);
    WrapperTestUtil.assertPropertyWrapper(mainContainerWrapper, UserType.F_NAME, PrismTestUtil.createPolyString("jack"));
    WrapperTestUtil.assertPropertyWrapper(mainContainerWrapper, UserType.F_TIMEZONE, null);
    ContainerWrapper<ActivationType> activationContainerWrapper = objectWrapper.findContainerWrapper(new ItemPath(UserType.F_ACTIVATION));
    WrapperTestUtil.assertWrapper(activationContainerWrapper, "ActivationType.activation", UserType.F_ACTIVATION, user, ContainerStatus.MODIFYING);
    WrapperTestUtil.assertPropertyWrapper(activationContainerWrapper, ActivationType.F_ADMINISTRATIVE_STATUS, ActivationStatusType.ENABLED);
    WrapperTestUtil.assertPropertyWrapper(activationContainerWrapper, ActivationType.F_LOCKOUT_STATUS, null);
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) ObjectWrapperFactory(com.evolveum.midpoint.web.component.prism.ObjectWrapperFactory) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ContainerWrapper(com.evolveum.midpoint.web.component.prism.ContainerWrapper) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Example 69 with ActivationType

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

the class ActivationUtil method createDisabled.

public static ActivationType createDisabled() {
    ActivationType activationType = new ActivationType();
    activationType.setAdministrativeStatus(ActivationStatusType.DISABLED);
    return activationType;
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)

Example 70 with ActivationType

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

the class SchemaTestUtil method assertFocusDefinition.

public static void assertFocusDefinition(ComplexTypeDefinition complexTypeDefinition, String defDesc) {
    assertNotNull("No " + defDesc + " definition", complexTypeDefinition);
    PrismAsserts.assertPropertyDefinition(complexTypeDefinition, ObjectType.F_NAME, PolyStringType.COMPLEX_TYPE, 0, 1);
    PrismAsserts.assertItemDefinitionDisplayName(complexTypeDefinition, ObjectType.F_NAME, "ObjectType.name");
    PrismAsserts.assertItemDefinitionDisplayOrder(complexTypeDefinition, ObjectType.F_NAME, 0);
    PrismAsserts.assertPropertyDefinition(complexTypeDefinition, ObjectType.F_DESCRIPTION, DOMUtil.XSD_STRING, 0, 1);
    PrismAsserts.assertItemDefinitionDisplayName(complexTypeDefinition, ObjectType.F_DESCRIPTION, "ObjectType.description");
    PrismAsserts.assertItemDefinitionDisplayOrder(complexTypeDefinition, ObjectType.F_DESCRIPTION, 10);
    assertFalse("" + defDesc + " definition is marked as runtime", complexTypeDefinition.isRuntimeSchema());
    PrismContainerDefinition extensionContainer = complexTypeDefinition.findContainerDefinition(UserType.F_EXTENSION);
    PrismAsserts.assertDefinition(extensionContainer, UserType.F_EXTENSION, ExtensionType.COMPLEX_TYPE, 0, 1);
    assertTrue("Extension is NOT runtime", extensionContainer.isRuntimeSchema());
    assertTrue("Extension is NOT dynamic", extensionContainer.isDynamic());
    assertEquals("Extension size", 0, extensionContainer.getDefinitions().size());
    PrismAsserts.assertItemDefinitionDisplayName(complexTypeDefinition, UserType.F_EXTENSION, "ObjectType.extension");
    PrismAsserts.assertItemDefinitionDisplayOrder(complexTypeDefinition, UserType.F_EXTENSION, 1000);
    PrismContainerDefinition<ActivationType> activationContainer = complexTypeDefinition.findContainerDefinition(UserType.F_ACTIVATION);
    PrismAsserts.assertDefinition(activationContainer, UserType.F_ACTIVATION, ActivationType.COMPLEX_TYPE, 0, 1);
    assertFalse("Activation is runtime", activationContainer.isRuntimeSchema());
    assertEquals("Activation size", 12, activationContainer.getDefinitions().size());
    PrismAsserts.assertPropertyDefinition(activationContainer, ActivationType.F_ADMINISTRATIVE_STATUS, SchemaConstants.C_ACTIVATION_STATUS_TYPE, 0, 1);
    PrismContainerDefinition<AssignmentType> assignmentContainer = complexTypeDefinition.findContainerDefinition(UserType.F_ASSIGNMENT);
    PrismAsserts.assertDefinition(assignmentContainer, UserType.F_ASSIGNMENT, AssignmentType.COMPLEX_TYPE, 0, -1);
    assertFalse("Assignment is runtime", assignmentContainer.isRuntimeSchema());
    assertEquals("Assignment definition size", 21, assignmentContainer.getDefinitions().size());
    PrismContainerDefinition<ConstructionType> constructionContainer = assignmentContainer.findContainerDefinition(AssignmentType.F_CONSTRUCTION);
    PrismAsserts.assertDefinition(constructionContainer, AssignmentType.F_CONSTRUCTION, ConstructionType.COMPLEX_TYPE, 0, 1);
    assertFalse("Construction is runtime", constructionContainer.isRuntimeSchema());
    PrismReferenceDefinition accountRefDef = complexTypeDefinition.findItemDefinition(UserType.F_LINK_REF, PrismReferenceDefinition.class);
    PrismAsserts.assertDefinition(accountRefDef, UserType.F_LINK_REF, ObjectReferenceType.COMPLEX_TYPE, 0, -1);
    assertEquals("Wrong target type in accountRef", ShadowType.COMPLEX_TYPE, accountRefDef.getTargetTypeName());
    assertEquals("Wrong composite object element name in accountRef", UserType.F_LINK, accountRefDef.getCompositeObjectElementName());
    PrismContainerDefinition<MetadataType> metadataContainer = complexTypeDefinition.findContainerDefinition(UserType.F_METADATA);
    PrismAsserts.assertDefinition(extensionContainer, UserType.F_EXTENSION, ExtensionType.COMPLEX_TYPE, 0, 1);
    assertFalse("Metadata is runtime", metadataContainer.isRuntimeSchema());
    assertFalse("Metadata is dynamic", metadataContainer.isDynamic());
    assertTrue("Metadata is NOT operational", metadataContainer.isOperational());
    assertEquals("Metadata size", 12, metadataContainer.getDefinitions().size());
    PrismReferenceDefinition tenantRefDef = complexTypeDefinition.findItemDefinition(UserType.F_TENANT_REF, PrismReferenceDefinition.class);
    PrismAsserts.assertDefinition(tenantRefDef, UserType.F_TENANT_REF, ObjectReferenceType.COMPLEX_TYPE, 0, 1);
    assertEquals("Wrong target type in tenantRef", ShadowType.COMPLEX_TYPE, accountRefDef.getTargetTypeName());
}
Also used : ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) ConstructionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) PrismContainerDefinition(com.evolveum.midpoint.prism.PrismContainerDefinition) PrismReferenceDefinition(com.evolveum.midpoint.prism.PrismReferenceDefinition)

Aggregations

ActivationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)59 Test (org.testng.annotations.Test)34 ActivationStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType)22 Task (com.evolveum.midpoint.task.api.Task)13 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)13 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)13 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)12 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)11 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)10 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)9 ObjectWrapperFactory (com.evolveum.midpoint.web.component.prism.ObjectWrapperFactory)5 LockoutStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.LockoutStatusType)5 ActivationCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType)4 ActivationStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationStatusCapabilityType)4 QName (javax.xml.namespace.QName)4 TestValidityRecomputeTask (com.evolveum.midpoint.model.intest.sync.TestValidityRecomputeTask)3 PrismContext (com.evolveum.midpoint.prism.PrismContext)3 MetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)3 TimeIntervalStatusType (com.evolveum.midpoint.xml.ns._public.common.common_3.TimeIntervalStatusType)3 ActivationLockoutStatusCapabilityType (com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationLockoutStatusCapabilityType)3