Search in sources :

Example 46 with PrismPropertyDefinition

use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.

the class ACAttributePanel method hasOutbound.

private boolean hasOutbound() {
    ACAttributeDto dto = getModel().getObject();
    PrismPropertyDefinition def = dto.getDefinition();
    if (!(def instanceof RefinedAttributeDefinition)) {
        return false;
    }
    RefinedAttributeDefinition refinedDef = (RefinedAttributeDefinition) def;
    return refinedDef.hasOutboundMapping();
}
Also used : PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition) RefinedAttributeDefinition(com.evolveum.midpoint.common.refinery.RefinedAttributeDefinition)

Example 47 with PrismPropertyDefinition

use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.

the class TestSchemaSanity method testResourceDefinition.

@Test
public void testResourceDefinition() {
    System.out.println("===[ testResourceDefinition ]===");
    // GIVEN
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    SchemaRegistry schemaRegistry = prismContext.getSchemaRegistry();
    // WHEN
    PrismObjectDefinition<ResourceType> resourceDefinition = schemaRegistry.findObjectDefinitionByElementName(new QName(SchemaConstantsGenerated.NS_COMMON, "resource"));
    assertNotNull("No resource definition", resourceDefinition);
    System.out.println("Resource definition:");
    System.out.println(resourceDefinition.debugDump());
    PrismObjectDefinition<ResourceType> resourceDefinitionByClass = schemaRegistry.findObjectDefinitionByCompileTimeClass(ResourceType.class);
    assertTrue("Different user def", resourceDefinition == resourceDefinitionByClass);
    assertEquals("Wrong compile-time class in resource definition", ResourceType.class, resourceDefinition.getCompileTimeClass());
    PrismAsserts.assertPropertyDefinition(resourceDefinition, ResourceType.F_NAME, PolyStringType.COMPLEX_TYPE, 0, 1);
    PrismAsserts.assertPropertyDefinition(resourceDefinition, ResourceType.F_DESCRIPTION, DOMUtil.XSD_STRING, 0, 1);
    assertFalse("Resource definition is marked as runtime", resourceDefinition.isRuntimeSchema());
    PrismContainerDefinition<ConnectorConfigurationType> connectorConfContainerDef = resourceDefinition.findContainerDefinition(ResourceType.F_CONNECTOR_CONFIGURATION);
    PrismAsserts.assertDefinition(connectorConfContainerDef, ResourceType.F_CONNECTOR_CONFIGURATION, ConnectorConfigurationType.COMPLEX_TYPE, 1, 1);
    assertTrue("<connectorConfiguration> is NOT dynamic", connectorConfContainerDef.isDynamic());
    //		assertFalse("<connectorConfiguration> is runtime", connectorConfContainerDef.isRuntimeSchema());
    assertEquals("Wrong compile-time class for <connectorConfiguration> in resource definition", ConnectorConfigurationType.class, connectorConfContainerDef.getCompileTimeClass());
    PrismContainerDefinition<XmlSchemaType> schemaContainerDef = resourceDefinition.findContainerDefinition(ResourceType.F_SCHEMA);
    PrismAsserts.assertDefinition(schemaContainerDef, ResourceType.F_SCHEMA, XmlSchemaType.COMPLEX_TYPE, 0, 1);
    assertFalse("Schema is runtime", schemaContainerDef.isRuntimeSchema());
    assertEquals("Wrong compile-time class for <schema> in resource definition", XmlSchemaType.class, schemaContainerDef.getCompileTimeClass());
    assertEquals("Unexpected number of definitions in <schema>", 3, schemaContainerDef.getDefinitions().size());
    PrismAsserts.assertPropertyDefinition(schemaContainerDef, XmlSchemaType.F_CACHING_METADATA, CachingMetadataType.COMPLEX_TYPE, 0, 1);
    PrismAsserts.assertPropertyDefinition(schemaContainerDef, XmlSchemaType.F_DEFINITION, SchemaDefinitionType.COMPLEX_TYPE, 0, 1);
    PrismPropertyDefinition definitionPropertyDef = schemaContainerDef.findPropertyDefinition(XmlSchemaType.F_DEFINITION);
    assertNotNull("Null <definition> definition", definitionPropertyDef);
//		assertFalse("schema/definition is NOT runtime", definitionPropertyDef.isRuntimeSchema());
}
Also used : ConnectorConfigurationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorConfigurationType) PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition) PrismContext(com.evolveum.midpoint.prism.PrismContext) QName(javax.xml.namespace.QName) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) XmlSchemaType(com.evolveum.midpoint.xml.ns._public.common.common_3.XmlSchemaType) SchemaRegistry(com.evolveum.midpoint.prism.schema.SchemaRegistry) Test(org.testng.annotations.Test)

Example 48 with PrismPropertyDefinition

use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.

the class TestParseMapping method processParsings.

//	@Test
//	public void testParseRoundTrip() throws Exception{
//		displayTestTitle("testParseRoundTrip");
//
//		//processParsings(v -> getPrismContext().serializerFor(language).serialize(v));													// no item name nor definition => cannot serialize
//		processParsings(v -> getPrismContext().serializerFor(language).root(new QName("dummy")).serialize(v), "s1");
//		processParsings(v -> getPrismContext().serializerFor(language).root(SchemaConstantsGenerated.C_USER).serialize(v), "s2");		// misleading item name
//		processParsings(v -> getPrismContext().serializerFor(language).serializeRealValue(v.asContainerable()), "s3");
//		processParsings(v -> getPrismContext().serializerFor(language).root(new QName("dummy")).serializeAnyData(v.asContainerable()), "s4");
//	}
private void processParsings(SerializingFunction<PrismPropertyValue<MappingType>> serializer, String serId) throws Exception {
    PrismPropertyDefinition definition = getPrismContext().getSchemaRegistry().findPropertyDefinitionByElementName(SchemaConstantsGenerated.C_MAPPING);
    processParsings(MappingType.class, MappingType.COMPLEX_TYPE, definition, serializer, serId);
}
Also used : PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition)

Example 49 with PrismPropertyDefinition

use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.

the class TestSchemaSanity method testExtensionSchema.

/**
	 * Extension schema should be loaded from src/test/resources/schema during test initialization.
	 */
@Test
public void testExtensionSchema() {
    System.out.println("===[ testExtensionSchema ]===");
    // WHEN
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    assertNotNull("No prism context", prismContext);
    SchemaRegistry schemaRegistry = prismContext.getSchemaRegistry();
    assertNotNull("No schema registry in context", schemaRegistry);
    PrismSchema extensionSchema = schemaRegistry.findSchemaByNamespace(SchemaTestConstants.NS_EXTENSION);
    assertNotNull("No extension schema", extensionSchema);
    System.out.println("Extension schema:");
    System.out.println(extensionSchema.debugDump());
    PrismPropertyDefinition locationsProperty = extensionSchema.findPropertyDefinitionByElementName(EXTENSION_LOCATIONS_ELEMENT);
    PrismAsserts.assertDefinition(locationsProperty, EXTENSION_LOCATIONS_ELEMENT, EXTENSION_LOCATIONS_TYPE, 0, -1);
}
Also used : PrismSchema(com.evolveum.midpoint.prism.schema.PrismSchema) PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition) PrismContext(com.evolveum.midpoint.prism.PrismContext) SchemaRegistry(com.evolveum.midpoint.prism.schema.SchemaRegistry) Test(org.testng.annotations.Test)

Example 50 with PrismPropertyDefinition

use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.

the class TestParseScriptOutput method processParsings.

//	private void assertNamespaceDeclarations(String context, Element element, String... prefixes) {
//		assertEquals("Wrong namespace declarations for " + context, new HashSet<>(Arrays.asList(prefixes)),
//				DOMUtil.getNamespaceDeclarations(element).keySet());
//	}
private void processParsings(SerializingFunction<PrismPropertyValue<PipelineDataType>> serializer, String serId) throws Exception {
    PrismPropertyDefinition definition = getPrismContext().getSchemaRegistry().findPropertyDefinitionByElementName(SchemaConstants.S_PIPELINE_DATA);
    processParsings(PipelineDataType.class, PipelineDataType.COMPLEX_TYPE, definition, serializer, serId);
}
Also used : PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition)

Aggregations

PrismPropertyDefinition (com.evolveum.midpoint.prism.PrismPropertyDefinition)134 PrismPropertyValue (com.evolveum.midpoint.prism.PrismPropertyValue)93 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)82 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)62 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)61 Test (org.testng.annotations.Test)60 PrismObject (com.evolveum.midpoint.prism.PrismObject)24 QName (javax.xml.namespace.QName)23 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)19 PrismPropertyDefinitionImpl (com.evolveum.midpoint.prism.PrismPropertyDefinitionImpl)18 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)15 Task (com.evolveum.midpoint.task.api.Task)12 ArrayList (java.util.ArrayList)12 ExpressionEvaluationContext (com.evolveum.midpoint.repo.common.expression.ExpressionEvaluationContext)11 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)9 PrismContainerDefinition (com.evolveum.midpoint.prism.PrismContainerDefinition)8 PrismContext (com.evolveum.midpoint.prism.PrismContext)8 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)8 ItemDefinition (com.evolveum.midpoint.prism.ItemDefinition)7 File (java.io.File)7