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();
}
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());
}
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);
}
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);
}
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);
}
Aggregations