Search in sources :

Example 1 with AccountType

use of com.evolveum.midpoint.prism.foo.AccountType in project midpoint by Evolveum.

the class TestPrismContext method testBasicSchemas.

@Test
public void testBasicSchemas() throws SchemaException, SAXException, IOException {
    System.out.println("===[ testBasicSchemas ]===");
    // WHEN
    PrismContext prismContext = constructInitializedPrismContext();
    // THEN
    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 fooSchema = schemaRegistry.findSchemaByNamespace(NS_FOO);
    System.out.println("Foo schema:");
    System.out.println(fooSchema.debugDump());
    // Assert USER definition
    PrismObjectDefinition<UserType> userDefinition = fooSchema.findObjectDefinitionByElementName(new QName(NS_FOO, "user"));
    assertNotNull("No user definition", userDefinition);
    System.out.println("User definition:");
    System.out.println(userDefinition.debugDump());
    PrismObjectDefinition<UserType> userDefinitionByClass = schemaRegistry.findObjectDefinitionByCompileTimeClass(UserType.class);
    assertTrue("Different user def", userDefinition == userDefinitionByClass);
    assertUserDefinition(userDefinition);
    // Assert ACCOUNT definition
    PrismObjectDefinition<AccountType> accountDefinition = fooSchema.findObjectDefinitionByElementName(new QName(NS_FOO, "account"));
    assertNotNull("No account definition", accountDefinition);
    System.out.println("Account definition:");
    System.out.println(accountDefinition.debugDump());
    PrismObjectDefinition<AccountType> accountDefinitionByClass = schemaRegistry.findObjectDefinitionByCompileTimeClass(AccountType.class);
    assertTrue("Different user def", accountDefinition == accountDefinitionByClass);
    assertAccountDefinition(accountDefinition);
}
Also used : PrismSchema(com.evolveum.midpoint.prism.schema.PrismSchema) QName(javax.xml.namespace.QName) SchemaRegistry(com.evolveum.midpoint.prism.schema.SchemaRegistry) UserType(com.evolveum.midpoint.prism.foo.UserType) AccountType(com.evolveum.midpoint.prism.foo.AccountType) Test(org.testng.annotations.Test)

Aggregations

AccountType (com.evolveum.midpoint.prism.foo.AccountType)1 UserType (com.evolveum.midpoint.prism.foo.UserType)1 PrismSchema (com.evolveum.midpoint.prism.schema.PrismSchema)1 SchemaRegistry (com.evolveum.midpoint.prism.schema.SchemaRegistry)1 QName (javax.xml.namespace.QName)1 Test (org.testng.annotations.Test)1