use of com.evolveum.midpoint.schema.processor.ResourceSchema in project midpoint by Evolveum.
the class TestVillage method test022ResourceOpenDjRefinedSchema.
/**
* MID-3424
*/
@Test
public void test022ResourceOpenDjRefinedSchema() throws Exception {
final String TEST_NAME = "test022ResourceOpenDjRefinedSchema";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObject<ResourceType> resourceBefore = modelService.getObject(ResourceType.class, RESOURCE_OPENDJ_OID, null, task, result);
ResourceSchema resourceSchemaBefore = RefinedResourceSchema.getResourceSchema(resourceBefore, prismContext);
RefinedResourceSchema refinedSchemaBefore = RefinedResourceSchema.getRefinedSchema(resourceBefore);
rememberResourceSchemaFetchCount();
rememberResourceSchemaParseCount();
rememberConnectorCapabilitiesFetchCount();
rememberConnectorInitializationCount();
rememberConnectorSchemaParseCount();
rememberPrismObjectCloneCount();
// WHEN
TestUtil.displayWhen(TEST_NAME);
long t0 = System.currentTimeMillis();
PrismObject<ResourceType> resourceAfter = modelService.getObject(ResourceType.class, RESOURCE_OPENDJ_OID, null, task, result);
long t1 = System.currentTimeMillis();
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
long t2 = System.currentTimeMillis();
ResourceSchema resourceSchemaAfter = RefinedResourceSchema.getResourceSchema(resourceAfter, prismContext);
long t3 = System.currentTimeMillis();
RefinedResourceSchema refinedSchemaAfter = RefinedResourceSchema.getRefinedSchema(resourceAfter);
long t4 = System.currentTimeMillis();
display("Times", "getObject(RESOURCE_OPENDJ_OID): " + (t1 - t0) + "ms\ngetResourceSchema: " + (t3 - t2) + "ms\ngetRefinedSchema: " + (t4 - t3) + "ms");
// variable number of clones: 1 or 2 because of trigger scanner task
assertPrismObjectCloneIncrement(1, 2);
assertResourceSchemaFetchIncrement(0);
assertResourceSchemaParseCountIncrement(0);
assertConnectorCapabilitiesFetchIncrement(0);
assertConnectorInitializationCountIncrement(0);
assertConnectorSchemaParseIncrement(0);
assertTrue("Resource schema has changed", resourceSchemaBefore == resourceSchemaAfter);
assertTrue("Refined schema has changed", refinedSchemaBefore == refinedSchemaAfter);
}
use of com.evolveum.midpoint.schema.processor.ResourceSchema in project midpoint by Evolveum.
the class TestUnix method test010Schema.
@Test
public void test010Schema() throws Exception {
final String TEST_NAME = "test010Schema";
TestUtil.displayTestTile(this, TEST_NAME);
resourceOpenDj = getObject(ResourceType.class, RESOURCE_OPENDJ_OID);
resourceOpenDjType = resourceOpenDj.asObjectable();
IntegrationTestTools.displayXml("Initialized resource", resourceOpenDj);
ResourceSchema resourceSchema = RefinedResourceSchema.getResourceSchema(resourceOpenDj, prismContext);
display("OpenDJ schema (resource)", resourceSchema);
ObjectClassComplexTypeDefinition ocDefPosixAccount = resourceSchema.findObjectClassDefinition(OPENDJ_ACCOUNT_POSIX_AUXILIARY_OBJECTCLASS_NAME);
assertNotNull("No objectclass " + OPENDJ_ACCOUNT_POSIX_AUXILIARY_OBJECTCLASS_NAME + " in resource schema", ocDefPosixAccount);
assertTrue("Objectclass " + OPENDJ_ACCOUNT_POSIX_AUXILIARY_OBJECTCLASS_NAME + " is not auxiliary", ocDefPosixAccount.isAuxiliary());
ObjectClassComplexTypeDefinition ocDefPosixGroup = resourceSchema.findObjectClassDefinition(OPENDJ_GROUP_POSIX_AUXILIARY_OBJECTCLASS_NAME);
assertNotNull("No objectclass " + OPENDJ_GROUP_POSIX_AUXILIARY_OBJECTCLASS_NAME + " in resource schema", ocDefPosixGroup);
assertTrue("Objectclass " + OPENDJ_GROUP_POSIX_AUXILIARY_OBJECTCLASS_NAME + " is not auxiliary", ocDefPosixGroup.isAuxiliary());
RefinedResourceSchema refinedSchema = RefinedResourceSchema.getRefinedSchema(resourceOpenDj);
display("OpenDJ schema (refined)", refinedSchema);
RefinedObjectClassDefinition rOcDefPosixAccount = refinedSchema.getRefinedDefinition(OPENDJ_ACCOUNT_POSIX_AUXILIARY_OBJECTCLASS_NAME);
assertNotNull("No refined objectclass " + OPENDJ_ACCOUNT_POSIX_AUXILIARY_OBJECTCLASS_NAME + " in resource schema", rOcDefPosixAccount);
assertTrue("Refined objectclass " + OPENDJ_ACCOUNT_POSIX_AUXILIARY_OBJECTCLASS_NAME + " is not auxiliary", rOcDefPosixAccount.isAuxiliary());
RefinedObjectClassDefinition rOcDefPosixGroup = refinedSchema.getRefinedDefinition(OPENDJ_GROUP_POSIX_AUXILIARY_OBJECTCLASS_NAME);
assertNotNull("No refined objectclass " + OPENDJ_GROUP_POSIX_AUXILIARY_OBJECTCLASS_NAME + " in resource schema", rOcDefPosixGroup);
assertTrue("Refined objectclass " + OPENDJ_GROUP_POSIX_AUXILIARY_OBJECTCLASS_NAME + " is not auxiliary", rOcDefPosixGroup.isAuxiliary());
}
use of com.evolveum.midpoint.schema.processor.ResourceSchema in project midpoint by Evolveum.
the class TestDummyLegacy method test105NativeParsedSchema.
@Test
public void test105NativeParsedSchema() throws Exception {
final String TEST_NAME = "test105NativeParsedSchema";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestDummyLegacy.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
resourceNative = provisioningService.getObject(ResourceType.class, RESOURCE_DUMMY_NATIVE_OID, null, task, result);
// THEN
result.computeStatus();
assertSuccess(result);
resourceTypeNative = resourceNative.asObjectable();
ResourceSchema returnedSchema = RefinedResourceSchemaImpl.getResourceSchema(resourceTypeNative, prismContext);
display("Parsed resource schema", returnedSchema);
assertNotNull("No parsed schema", returnedSchema);
assertObjectClass(returnedSchema, OBJECTCLASS_NATIVE_ACCOUNT);
assertObjectClass(returnedSchema, OBJECTCLASS_NATIVE_GROUP);
assertObjectClass(returnedSchema, OBJECTCLASS_NATIVE_PRIVILEGE);
assertNoObjectClass(returnedSchema, OBJECTCLASS_LEGACY_ACCOUNT);
assertNoObjectClass(returnedSchema, OBJECTCLASS_LEGACY_GROUP);
assertNoObjectClass(returnedSchema, OBJECTCLASS_LEGACY_PRIVILEGE);
}
use of com.evolveum.midpoint.schema.processor.ResourceSchema in project midpoint by Evolveum.
the class TestDummyLegacy method test205LegacyParsedSchema.
@Test
public void test205LegacyParsedSchema() throws Exception {
final String TEST_NAME = "test205LegacyParsedSchema";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestDummyLegacy.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
resourceLegacy = provisioningService.getObject(ResourceType.class, RESOURCE_DUMMY_LEGACY_OID, null, task, result);
// THEN
result.computeStatus();
assertSuccess(result);
resourceTypeLegacy = resourceLegacy.asObjectable();
ResourceSchema returnedSchema = RefinedResourceSchemaImpl.getResourceSchema(resourceTypeLegacy, prismContext);
display("Parsed resource schema", returnedSchema);
assertNotNull("No parsed schema", returnedSchema);
assertObjectClass(returnedSchema, OBJECTCLASS_LEGACY_ACCOUNT);
assertObjectClass(returnedSchema, OBJECTCLASS_LEGACY_GROUP);
assertObjectClass(returnedSchema, OBJECTCLASS_LEGACY_PRIVILEGE);
assertNoObjectClass(returnedSchema, OBJECTCLASS_NATIVE_ACCOUNT);
assertNoObjectClass(returnedSchema, OBJECTCLASS_NATIVE_GROUP);
assertNoObjectClass(returnedSchema, OBJECTCLASS_NATIVE_PRIVILEGE);
}
use of com.evolveum.midpoint.schema.processor.ResourceSchema in project midpoint by Evolveum.
the class AbstractAdTest method test020Schema.
@Test
public void test020Schema() throws Exception {
final String TEST_NAME = "test020Schema";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
ResourceSchema resourceSchema = RefinedResourceSchema.getResourceSchema(resource, prismContext);
display("Resource schema", resourceSchema);
RefinedResourceSchema refinedSchema = RefinedResourceSchema.getRefinedSchema(resource);
display("Refined schema", refinedSchema);
accountObjectClassDefinition = refinedSchema.findObjectClassDefinition(getAccountObjectClass());
assertNotNull("No definition for object class " + getAccountObjectClass(), accountObjectClassDefinition);
display("Account object class def", accountObjectClassDefinition);
ResourceAttributeDefinition<String> cnDef = accountObjectClassDefinition.findAttributeDefinition("cn");
PrismAsserts.assertDefinition(cnDef, new QName(MidPointConstants.NS_RI, "cn"), DOMUtil.XSD_STRING, 0, 1);
assertTrue("cn read", cnDef.canRead());
assertFalse("cn modify", cnDef.canModify());
assertFalse("cn add", cnDef.canAdd());
ResourceAttributeDefinition<String> userPrincipalNameDef = accountObjectClassDefinition.findAttributeDefinition("userPrincipalName");
PrismAsserts.assertDefinition(userPrincipalNameDef, new QName(MidPointConstants.NS_RI, "userPrincipalName"), DOMUtil.XSD_STRING, 0, 1);
assertTrue("o read", userPrincipalNameDef.canRead());
assertTrue("o modify", userPrincipalNameDef.canModify());
assertTrue("o add", userPrincipalNameDef.canAdd());
}
Aggregations