Search in sources :

Example 16 with MetadataType

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

the class TestDiffEquals method testAssignmentHashcode.

@Test
public void testAssignmentHashcode() throws Exception {
    LOGGER.info("\n\n===[ testAssignmentHashcode ]===\n");
    System.out.println("\n\n===[ testAssignmentHashcode ]===\n");
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    AssignmentType a1a = new AssignmentType();
    prismContext.adopt(a1a);
    a1a.setDescription("descr1");
    AssignmentType a2 = new AssignmentType();
    prismContext.adopt(a2);
    a2.setDescription("descr2");
    AssignmentType a1b = new AssignmentType();
    prismContext.adopt(a1b);
    a1b.setDescription("descr1");
    AssignmentType a1m = new AssignmentType();
    prismContext.adopt(a1m);
    a1m.setDescription("descr1");
    MetadataType metadata1m = new MetadataType();
    metadata1m.setCreateTimestamp(XmlTypeConverter.createXMLGregorianCalendar(System.currentTimeMillis()));
    a1m.setMetadata(metadata1m);
    AssignmentType a1e = new AssignmentType();
    prismContext.adopt(a1e);
    a1e.setDescription("descr1");
    ActivationType activation1e = new ActivationType();
    activation1e.setEffectiveStatus(ActivationStatusType.ENABLED);
    a1e.setActivation(activation1e);
    // WHEN
    assertFalse(a1a.hashCode() == a2.hashCode());
    assertFalse(a1b.hashCode() == a2.hashCode());
    assertFalse(a1m.hashCode() == a2.hashCode());
    assertFalse(a1e.hashCode() == a2.hashCode());
    assertFalse(a2.hashCode() == a1a.hashCode());
    assertFalse(a2.hashCode() == a1b.hashCode());
    assertFalse(a2.hashCode() == a1m.hashCode());
    assertFalse(a2.hashCode() == a1e.hashCode());
    assertTrue(a1a.hashCode() == a1a.hashCode());
    assertTrue(a1b.hashCode() == a1b.hashCode());
    assertTrue(a1m.hashCode() == a1m.hashCode());
    assertTrue(a1e.hashCode() == a1e.hashCode());
    assertTrue(a2.hashCode() == a2.hashCode());
    assertTrue(a1a.hashCode() == a1b.hashCode());
    assertTrue(a1b.hashCode() == a1a.hashCode());
    assertTrue(a1a.hashCode() == a1m.hashCode());
    assertTrue(a1b.hashCode() == a1m.hashCode());
    assertTrue(a1m.hashCode() == a1a.hashCode());
    assertTrue(a1m.hashCode() == a1b.hashCode());
    assertTrue(a1m.hashCode() == a1e.hashCode());
    assertTrue(a1a.hashCode() == a1e.hashCode());
    assertTrue(a1b.hashCode() == a1e.hashCode());
    assertTrue(a1e.hashCode() == a1a.hashCode());
    assertTrue(a1e.hashCode() == a1b.hashCode());
    assertTrue(a1e.hashCode() == a1m.hashCode());
}
Also used : PrismContext(com.evolveum.midpoint.prism.PrismContext) ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) Test(org.testng.annotations.Test)

Example 17 with MetadataType

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

the class OperationalDataManager method applyRequestMetadata.

public <F extends ObjectType> void applyRequestMetadata(LensContext<F> context, XMLGregorianCalendar now, Task task, OperationResult result) throws SchemaException {
    MetadataType requestMetadata = new MetadataType();
    applyRequestMetadata(context, requestMetadata, now, task);
    context.setRequestMetadata(requestMetadata);
}
Also used : MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)

Example 18 with MetadataType

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

the class AbstractModelIntegrationTest method assertCreateMetadata.

protected <O extends ObjectType> void assertCreateMetadata(AssignmentType assignmentType, XMLGregorianCalendar start, XMLGregorianCalendar end) {
    MetadataType metadataType = assignmentType.getMetadata();
    PrismObject<UserType> defaultActor = getDefaultActor();
    assertMetadata(assignmentType.toString(), metadataType, true, true, start, end, defaultActor == null ? null : defaultActor.getOid(), DEFAULT_CHANNEL);
}
Also used : MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Example 19 with MetadataType

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

the class AbstractModelIntegrationTest method assertCreateMetadata.

protected <O extends ObjectType> void assertCreateMetadata(PrismObject<O> object, XMLGregorianCalendar start, XMLGregorianCalendar end) {
    MetadataType metadataType = object.asObjectable().getMetadata();
    PrismObject<UserType> defaultActor = getDefaultActor();
    assertMetadata(object.toString(), metadataType, true, true, start, end, defaultActor == null ? null : defaultActor.getOid(), DEFAULT_CHANNEL);
}
Also used : MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Example 20 with MetadataType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType 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

MetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)23 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)4 ActivationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)4 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)4 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)3 PrismContext (com.evolveum.midpoint.prism.PrismContext)2 ProtectedStringType (com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)2 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)2 Test (org.testng.annotations.Test)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 PrismContainerDefinition (com.evolveum.midpoint.prism.PrismContainerDefinition)1 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)1 PrismReferenceDefinition (com.evolveum.midpoint.prism.PrismReferenceDefinition)1 ContainerDelta (com.evolveum.midpoint.prism.delta.ContainerDelta)1 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)1 RObject (com.evolveum.midpoint.repo.sql.data.common.RObject)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 DateLabelComponent (com.evolveum.midpoint.web.component.DateLabelComponent)1 MetadataPanel (com.evolveum.midpoint.web.component.assignment.MetadataPanel)1 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)1