use of com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method getSingleLinkRef.
protected <F extends FocusType> PrismReferenceValue getSingleLinkRef(PrismObject<F> focus) {
F focusType = focus.asObjectable();
assertEquals("Unexpected number of linkRefs", 1, focusType.getLinkRef().size());
ObjectReferenceType linkRefType = focusType.getLinkRef().get(0);
String accountOid = linkRefType.getOid();
assertFalse("No linkRef oid", StringUtils.isBlank(accountOid));
PrismReferenceValue accountRefValue = linkRefType.asReferenceValue();
assertEquals("OID mismatch in linkRefValue", accountOid, accountRefValue.getOid());
return accountRefValue;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method determineSynchronization.
/**
* Returns appropriate object synchronization settings for the class.
* Assumes single sync setting for now.
*/
protected ObjectSynchronizationType determineSynchronization(ResourceType resource, Class<UserType> type, String name) {
SynchronizationType synchronization = resource.getSynchronization();
if (synchronization == null) {
return null;
}
List<ObjectSynchronizationType> objectSynchronizations = synchronization.getObjectSynchronization();
if (objectSynchronizations.isEmpty()) {
return null;
}
for (ObjectSynchronizationType objSyncType : objectSynchronizations) {
QName focusTypeQName = objSyncType.getFocusType();
if (focusTypeQName == null) {
if (type != UserType.class) {
continue;
}
} else {
ObjectTypes focusType = ObjectTypes.getObjectTypeFromTypeQName(focusTypeQName);
if (type != focusType.getClassDefinition()) {
continue;
}
}
if (name == null) {
// we got it
return objSyncType;
} else {
if (name.equals(objSyncType.getName())) {
return objSyncType;
}
}
}
throw new IllegalArgumentException("Synchronization setting for " + type + " and name " + name + " not found in " + resource);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType in project midpoint by Evolveum.
the class AbstractModelIntegrationTest method getLinkRefOid.
protected <F extends FocusType> String getLinkRefOid(PrismObject<F> focus, String resourceOid, ShadowKindType kind, String intent) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
F focusType = focus.asObjectable();
for (ObjectReferenceType linkRefType : focusType.getLinkRef()) {
String linkTargetOid = linkRefType.getOid();
assertFalse("No linkRef oid", StringUtils.isBlank(linkTargetOid));
PrismObject<ShadowType> account = getShadowModel(linkTargetOid, true, false);
ShadowType shadowType = account.asObjectable();
if (kind != null && !kind.equals(shadowType.getKind())) {
continue;
}
if (!MiscUtil.equals(intent, shadowType.getIntent())) {
continue;
}
if (resourceOid.equals(shadowType.getResourceRef().getOid())) {
// This is noFetch. Therefore there is no fetchResult
return linkTargetOid;
}
}
AssertJUnit.fail("Linked shadow for resource " + resourceOid + ", kind " + kind + " and intent " + intent + " not found in " + focus);
// Never reached. But compiler complains about missing return
return null;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType in project midpoint by Evolveum.
the class MidPointAsserts method assertAssigned.
public static void assertAssigned(PrismObject<? extends FocusType> focus, String targetOid, QName refType, QName relation) {
FocusType focusType = focus.asObjectable();
for (AssignmentType assignmentType : focusType.getAssignment()) {
ObjectReferenceType targetRef = assignmentType.getTargetRef();
if (targetRef != null) {
if (refType.equals(targetRef.getType())) {
if (targetOid.equals(targetRef.getOid()) && MiscSchemaUtil.compareRelation(targetRef.getRelation(), relation)) {
return;
}
}
}
}
AssertJUnit.fail(focus + " does not have assigned " + refType.getLocalPart() + " " + targetOid + ", relation " + relation);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType in project midpoint by Evolveum.
the class MidPointAsserts method assertAssignedTargets.
public static <F extends FocusType> void assertAssignedTargets(PrismObject<F> user, String typeDesc, QName type, String... expectedTargetOids) {
F userType = user.asObjectable();
List<String> haveTagetOids = new ArrayList<>();
for (AssignmentType assignmentType : userType.getAssignment()) {
ObjectReferenceType targetRef = assignmentType.getTargetRef();
if (targetRef != null) {
if (type.equals(targetRef.getType())) {
haveTagetOids.add(targetRef.getOid());
}
}
}
PrismAsserts.assertSets("Wrong " + typeDesc + " in " + user, haveTagetOids, expectedTargetOids);
}
Aggregations