use of com.evolveum.midpoint.schema.processor.ResourceObjectClassDefinition in project midpoint by Evolveum.
the class TestDummyLegacy method assertNoObjectClass.
private void assertNoObjectClass(ResourceSchema schema, String objectClassLocalName) {
ResourceObjectClassDefinition ocDef = schema.findObjectClassDefinition(new QName(MidPointConstants.NS_RI, objectClassLocalName));
assertNull("Objectclass " + objectClassLocalName + " found in schema while not expecting it", ocDef);
}
use of com.evolveum.midpoint.schema.processor.ResourceObjectClassDefinition in project midpoint by Evolveum.
the class TestDummyLegacy method assertObjectClass.
private void assertObjectClass(ResourceSchema schema, String objectClassLocalName) {
ResourceObjectClassDefinition ocDef = schema.findObjectClassDefinition(new QName(MidPointConstants.NS_RI, objectClassLocalName));
assertNotNull("No objectclass " + objectClassLocalName + " found in schema", ocDef);
}
use of com.evolveum.midpoint.schema.processor.ResourceObjectClassDefinition in project midpoint by Evolveum.
the class UcfExecutionContext method recordIcfOperationSuspend.
public void recordIcfOperationSuspend(@NotNull ConnIdOperation operation) {
ResourceObjectClassDefinition objectClassDef = operation.getObjectClassDef();
if (operation != currentOperation) {
LOGGER.warn("Suspending operation other than current: suspending {}, recorded current {}, task {}", operation, currentOperation, task);
} else {
if (task != null) {
task.onConnIdOperationSuspend(operation);
} else {
reportNoTask(currentOperation);
}
}
currentOperation = null;
recordState("Returned from " + operation + " of " + getObjectClassName(objectClassDef) + " on " + getResourceName());
}
use of com.evolveum.midpoint.schema.processor.ResourceObjectClassDefinition in project midpoint by Evolveum.
the class TestUcfDummyMulti method test100AddAccount.
@Test
public void test100AddAccount() throws Exception {
OperationResult result = createOperationResult();
ResourceObjectClassDefinition defaultAccountDefinition = resourceSchema.findObjectClassDefinitionRequired(ACCOUNT_OBJECT_CLASS_NAME);
ShadowType shadowType = new ShadowType();
PrismTestUtil.getPrismContext().adopt(shadowType);
shadowType.setName(PrismTestUtil.createPolyStringType(ACCOUNT_JACK_USERNAME));
ObjectReferenceType resourceRef = new ObjectReferenceType();
resourceRef.setOid(resource.getOid());
shadowType.setResourceRef(resourceRef);
shadowType.setObjectClass(defaultAccountDefinition.getTypeName());
PrismObject<ShadowType> shadow = shadowType.asPrismObject();
ResourceAttributeContainer attributesContainer = ShadowUtil.getOrCreateAttributesContainer(shadow, defaultAccountDefinition);
ResourceAttribute<String> icfsNameProp = attributesContainer.findOrCreateAttribute(SchemaConstants.ICFS_NAME);
icfsNameProp.setRealValue(ACCOUNT_JACK_USERNAME);
// WHEN
cc.addObject(shadow, null, result);
// THEN
DummyAccount dummyAccount = dummyResource.getAccountByUsername(ACCOUNT_JACK_USERNAME);
assertNotNull("Account " + ACCOUNT_JACK_USERNAME + " was not created", dummyAccount);
assertNotNull("Account " + ACCOUNT_JACK_USERNAME + " has no username", dummyAccount.getName());
}
use of com.evolveum.midpoint.schema.processor.ResourceObjectClassDefinition in project midpoint by Evolveum.
the class TestUcfDummyMulti method test200BlockingSearch.
@Test
public void test200BlockingSearch() throws Exception {
// GIVEN
UcfExecutionContext ctx = createExecutionContext();
OperationResult result = createOperationResult();
final ResourceObjectClassDefinition accountDefinition = resourceSchema.findObjectClassDefinitionRequired(ACCOUNT_OBJECT_CLASS_NAME);
// Determine object class from the schema
final List<PrismObject<ShadowType>> searchResults = new ArrayList<>();
final ObjectHandler handler = (ucfObject, lResult) -> {
checkUcfShadow(ucfObject.getResourceObject(), accountDefinition);
searchResults.add(ucfObject.getResourceObject());
return true;
};
dummyResource.setBlockOperations(true);
// WHEN
Thread t = new Thread(() -> {
try {
cc.search(accountDefinition, null, handler, null, null, null, null, ctx, result);
} catch (CommunicationException | GenericFrameworkException | SchemaException | SecurityViolationException | ObjectNotFoundException e) {
logger.error("Error in the search: {}", e.getMessage(), e);
}
});
t.setName("search1");
t.start();
// Give the new thread a chance to get blocked
Thread.sleep(500);
ConnectorOperationalStatus opStat = cc.getOperationalStatus();
displayDumpable("stats (blocked)", opStat);
assertEquals("Wrong pool active", (Integer) 1, opStat.getPoolStatusNumActive());
assertEquals("Wrong pool active", (Integer) 0, opStat.getPoolStatusNumIdle());
assertEquals("Unexpected number of search results", 0, searchResults.size());
dummyResource.unblock();
t.join();
dummyResource.setBlockOperations(false);
// THEN
assertEquals("Unexpected number of search results", 1, searchResults.size());
opStat = cc.getOperationalStatus();
displayDumpable("stats (final)", opStat);
assertEquals("Wrong pool active", (Integer) 0, opStat.getPoolStatusNumActive());
assertEquals("Wrong pool active", (Integer) 1, opStat.getPoolStatusNumIdle());
PrismObject<ShadowType> searchResult = searchResults.get(0);
displayDumpable("Search result", searchResult);
}
Aggregations