use of com.evolveum.midpoint.task.api.test.NullTaskImpl in project midpoint by Evolveum.
the class AuditTest method test110AuditSecond.
@Test
public void test110AuditSecond() throws QueryException {
OperationResult result = createOperationResult();
when();
AuditEventRecord record = new AuditEventRecord();
record.addPropertyValue("prop", "val");
logger.info("Adding audit record {}", record);
auditService.audit(record, new NullTaskImpl(), result);
then();
System.out.println("Record written:\n" + record.debugDump());
System.out.println("Repo ID: " + record.getRepoId());
MAuditEventRecord loaded = getAuditEventRecord(2, 1);
System.out.println("Record loaded:\n" + loaded);
assertThat(loaded.properties).describedAs("# of properties").hasSize(1);
assertThat(loaded.properties.get("prop")).withFailMessage("Wrong prop values").containsExactlyInAnyOrder("val");
// not initialized if nothing is there, so it's null (meaning empty)
assertThat(loaded.refValues).describedAs("# of references").isNullOrEmpty();
}
use of com.evolveum.midpoint.task.api.test.NullTaskImpl in project midpoint by Evolveum.
the class AuditTest method test200AuditDelta.
@Test
public void test200AuditDelta() {
AuditEventRecord record = new AuditEventRecord();
record.setChannel("http://midpoint.evolveum.com/xml/ns/public/common/channels-3#import");
record.setEventIdentifier("1511974895961-0-1");
record.setEventStage(AuditEventStage.EXECUTION);
record.setEventType(AuditEventType.ADD_OBJECT);
ObjectDeltaOperation<UserType> delta = new ObjectDeltaOperation<>();
delta.setObjectDelta(prismContext.deltaFactory().object().createModificationAddReference(UserType.class, "1234", UserType.F_LINK_REF, "123"));
record.addDelta(delta);
delta = new ObjectDeltaOperation<>();
delta.setObjectDelta(prismContext.deltaFactory().object().createModificationAddReference(UserType.class, "1234", UserType.F_LINK_REF, "124"));
record.addDelta(delta);
auditService.audit(record, new NullTaskImpl(), createOperationResult());
}
use of com.evolveum.midpoint.task.api.test.NullTaskImpl in project midpoint by Evolveum.
the class MappingTestEvaluator method evaluateMapping.
public <T> PrismValueDeltaSetTriple<PrismPropertyValue<T>> evaluateMapping(String filename, String testName, String defaultTargetPropertyName) throws SchemaException, IOException, ExpressionEvaluationException, ObjectNotFoundException, EncryptionException, SecurityViolationException, ConfigurationException, CommunicationException {
MappingImpl<PrismPropertyValue<T>, PrismPropertyDefinition<T>> mapping = createMapping(filename, testName, defaultTargetPropertyName, null);
OperationResult opResult = new OperationResult(testName);
mapping.evaluate(new NullTaskImpl(), opResult);
assertResult(opResult);
PrismValueDeltaSetTriple<PrismPropertyValue<T>> outputTriple = mapping.getOutputTriple();
if (outputTriple != null) {
outputTriple.checkConsistence();
}
return outputTriple;
}
use of com.evolveum.midpoint.task.api.test.NullTaskImpl in project midpoint by Evolveum.
the class MappingTestEvaluator method evaluateMappingDynamicReplace.
public <T, I> PrismValueDeltaSetTriple<PrismPropertyValue<T>> evaluateMappingDynamicReplace(String filename, String testName, String defaultTargetPropertyName, String changedPropertyName, I... valuesToReplace) throws SchemaException, IOException, ExpressionEvaluationException, ObjectNotFoundException, EncryptionException, SecurityViolationException, ConfigurationException, CommunicationException {
ObjectDelta<UserType> userDelta = prismContext.deltaFactory().object().createModificationReplaceProperty(UserType.class, USER_OLD_OID, toPath(changedPropertyName), valuesToReplace);
MappingImpl<PrismPropertyValue<T>, PrismPropertyDefinition<T>> mapping = createMapping(filename, testName, defaultTargetPropertyName, userDelta);
OperationResult opResult = new OperationResult(testName);
mapping.evaluate(new NullTaskImpl(), opResult);
assertResult(opResult);
PrismValueDeltaSetTriple<PrismPropertyValue<T>> outputTriple = mapping.getOutputTriple();
if (outputTriple != null) {
outputTriple.checkConsistence();
}
return outputTriple;
}
use of com.evolveum.midpoint.task.api.test.NullTaskImpl in project midpoint by Evolveum.
the class MappingTestEvaluator method evaluateMapping.
public <T> PrismValueDeltaSetTriple<PrismPropertyValue<T>> evaluateMapping(String filename, String testName, ItemPath defaultTargetPropertyPath) throws SchemaException, IOException, ExpressionEvaluationException, ObjectNotFoundException, EncryptionException, SecurityViolationException, ConfigurationException, CommunicationException {
MappingImpl<PrismPropertyValue<T>, PrismPropertyDefinition<T>> mapping = createMapping(filename, testName, defaultTargetPropertyPath, null);
OperationResult opResult = new OperationResult(testName);
mapping.evaluate(new NullTaskImpl(), opResult);
assertResult(opResult);
PrismValueDeltaSetTriple<PrismPropertyValue<T>> outputTriple = mapping.getOutputTriple();
if (outputTriple != null) {
outputTriple.checkConsistence();
}
return outputTriple;
}
Aggregations