use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestSchemaSanity method testAccountDefinition.
@Test
public void testAccountDefinition() {
System.out.println("===[ testAccountDefinition ]===");
// GIVEN
PrismContext prismContext = PrismTestUtil.getPrismContext();
SchemaRegistry schemaRegistry = prismContext.getSchemaRegistry();
// WHEN
PrismObjectDefinition<ShadowType> accountDefinition = schemaRegistry.findObjectDefinitionByElementName(SchemaConstants.C_SHADOW);
assertNotNull("No account definition", accountDefinition);
System.out.println("Account definition:");
System.out.println(accountDefinition.debugDump());
PrismObjectDefinition<ShadowType> accountDefinitionByClass = schemaRegistry.findObjectDefinitionByCompileTimeClass(ShadowType.class);
assertTrue("Different account def", accountDefinition == accountDefinitionByClass);
assertEquals("Wrong compile-time class in account definition", ShadowType.class, accountDefinition.getCompileTimeClass());
PrismAsserts.assertPropertyDefinition(accountDefinition, ShadowType.F_NAME, PolyStringType.COMPLEX_TYPE, 0, 1);
PrismAsserts.assertPropertyDefinition(accountDefinition, ShadowType.F_DESCRIPTION, DOMUtil.XSD_STRING, 0, 1);
assertFalse("Account definition is marked as runtime", accountDefinition.isRuntimeSchema());
PrismContainerDefinition attributesContainer = accountDefinition.findContainerDefinition(ShadowType.F_ATTRIBUTES);
PrismAsserts.assertDefinition(attributesContainer, ShadowType.F_ATTRIBUTES, ShadowAttributesType.COMPLEX_TYPE, 0, 1);
assertTrue("Attributes is NOT runtime", attributesContainer.isRuntimeSchema());
assertEquals("Wrong attributes compile-time class", ShadowAttributesType.class, attributesContainer.getCompileTimeClass());
}
use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestSchemaSanity method testIcfSchema.
@Test
public void testIcfSchema() {
System.out.println("===[ testIcfSchema ]===");
// WHEN
// The context should have parsed common schema and also other midPoint schemas
PrismContext prismContext = PrismTestUtil.getPrismContext();
assertNotNull("No prism context", prismContext);
SchemaRegistry schemaRegistry = prismContext.getSchemaRegistry();
assertNotNull("No schema registry in context", schemaRegistry);
System.out.println("Schema registry:");
System.out.println(schemaRegistry.debugDump());
PrismSchema icfSchema = schemaRegistry.findSchemaByNamespace(NS_ICFC);
assertNotNull("No ICF schema", icfSchema);
System.out.println("ICF schema:");
System.out.println(icfSchema.debugDump());
PrismContainerDefinition configurationPropertiesContainerDef = icfSchema.findContainerDefinitionByElementName(ICFC_CONFIGURATION_PROPERTIES);
PrismAsserts.assertDefinition(configurationPropertiesContainerDef, ICFC_CONFIGURATION_PROPERTIES, ICFC_CONFIGURATION_PROPERTIES_TYPE, 0, 1);
assertTrue("configurationPropertiesContainer definition is NOT marked as runtime", configurationPropertiesContainerDef.isRuntimeSchema());
assertTrue("configurationPropertiesContainer definition is NOT marked as dynamic", configurationPropertiesContainerDef.isDynamic());
}
use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestParsePasswordPolicy method testParsePasswordPolicyFile.
@Test
public void testParsePasswordPolicyFile() throws Exception {
System.out.println("===[ testParsePasswordPolicyFile ]===");
// GIVEN
PrismContext prismContext = PrismTestUtil.getPrismContext();
// WHEN
PrismObject<ValuePolicyType> policy = prismContext.parserFor(FILE).xml().parse();
// THEN
System.out.println("Parsed policy:");
System.out.println(policy.debugDump());
assertPolicy(policy);
}
use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestParseModelContext method testParseModelContextPrism.
@Test
public void testParseModelContextPrism() throws Exception {
System.out.println("===[ testParseModelContextPrism ]===");
// GIVEN
PrismContext prismContext = PrismTestUtil.getPrismContext();
// WHEN
LensContextType lensContextType = prismContext.parserFor(MODEL_CONTEXT_FILE).xml().parseRealValue(LensContextType.class);
// THEN
System.out.println("Parsed LensContextType: " + lensContextType);
}
use of com.evolveum.midpoint.prism.PrismContext in project midpoint by Evolveum.
the class TestSchemaSanity method testResourceConfigurationDefinition.
@Test
public void testResourceConfigurationDefinition() {
System.out.println("===[ testResourceConfigurationDefinition ]===");
// GIVEN
PrismContext prismContext = PrismTestUtil.getPrismContext();
SchemaRegistry schemaRegistry = prismContext.getSchemaRegistry();
// WHEN
PrismContainerDefinition<?> configurationPropertiesDefinition = schemaRegistry.findContainerDefinitionByElementName(SchemaConstantsGenerated.ICF_C_CONFIGURATION_PROPERTIES);
assertNotNull("No configurationProperties definition", configurationPropertiesDefinition);
System.out.println("configurationProperties definition:");
System.out.println(configurationPropertiesDefinition.debugDump());
assertTrue("configurationProperties definition is NOT marked as runtime", configurationPropertiesDefinition.isRuntimeSchema());
// assertNull("Unexpected compile-time class in configurationProperties definition", configurationPropertiesDefinition.getCompileTimeClass());
// assertTrue("configurationProperties definition is NOT marked as wildcard", configurationPropertiesDefinition.isWildcard());
// TODO
}
Aggregations