use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.
the class ExtensionTest method test170AddAssignments.
@Test
public void test170AddAssignments() throws Exception {
OperationResult result = new OperationResult(ExtensionTest.class.getName() + ".test170AddAssignments");
AssignmentType newAssignment = new AssignmentType(prismContext).id(777L).targetRef("999999", OrgType.COMPLEX_TYPE);
PrismContainerValue<?> newExtValue = newAssignment.asPrismContainerValue().findOrCreateContainer(AssignmentType.F_EXTENSION).getValue();
newExtValue.findOrCreateProperty(EXT_WEAPON).addRealValues("W2.1", "W2.2");
newExtValue.findOrCreateProperty(EXT_SHIP_NAME).addRealValues("ship2");
AssignmentType newAssignment2 = new AssignmentType(prismContext).id(888L).targetRef("999999", OrgType.COMPLEX_TYPE);
PrismContainerValue<?> newExtValue2 = newAssignment2.asPrismContainerValue().findOrCreateContainer(AssignmentType.F_EXTENSION).getValue();
newExtValue2.findOrCreateProperty(EXT_WEAPON).addRealValues("W3.1", "W3.2");
newExtValue2.findOrCreateProperty(EXT_SHIP_NAME).addRealValues("ship3");
ObjectDelta<UserType> delta = getPrismContext().deltaFor(UserType.class).item(UserType.F_ASSIGNMENT).add(newAssignment, newAssignment2).asObjectDelta("");
delta.applyTo(expectedUser);
queryListener.start();
repositoryService.modifyObject(UserType.class, userOid, delta.getModifications(), getOptions(), result);
queryListener.dumpAndStop();
try (Session session = factory.openSession()) {
RUser u = session.get(RUser.class, userOid);
assertExtension(u, itemHidden1, "h1.1", "h1.2");
assertExtension(u, itemHidden2);
assertExtension(u, itemHidden3);
assertExtension(u, itemVisible, "v1", "v2", "v3");
assertExtension(u, itemWeapon);
RAssignment a1 = find(u.getAssignments(), 1);
RAssignment a2 = find(u.getAssignments(), 777);
RAssignment a3 = find(u.getAssignments(), 888);
assertExtension(a1, itemWeapon);
assertExtension(a1, itemShipName);
assertExtension(a2, itemWeapon, "W2.1", "W2.2");
assertExtension(a2, itemShipName, "ship2");
assertExtension(a3, itemWeapon, "W3.1", "W3.2");
assertExtension(a3, itemShipName, "ship3");
}
assertGetObject(result);
/*
[1] select oid from m_object where oid = ? for update
[1] select ruser0_.oid as oid1_27_, ruser0_2_.createChannel as createCh2_27_, ruser0_2_.createTimestamp as createTi3_27_, ruser0_2_.creatorRef_relation as creatorR4_27_, ruser0_2_.creatorRef_targetOid as creatorR5_27_, ruser0_2_.creatorRef_type as creatorR6_27_, ruser0_2_.fullObject as fullObje7_27_, ruser0_2_.lifecycleState as lifecycl8_27_, ruser0_2_.modifierRef_relation as modifier9_27_, ruser0_2_.modifierRef_targetOid as modifie10_27_, ruser0_2_.modifierRef_type as modifie11_27_, ruser0_2_.modifyChannel as modifyC12_27_, ruser0_2_.modifyTimestamp as modifyT13_27_, ruser0_2_.name_norm as name_no14_27_, ruser0_2_.name_orig as name_or15_27_, ruser0_2_.objectTypeClass as objectT16_27_, ruser0_2_.tenantRef_relation as tenantR17_27_, ruser0_2_.tenantRef_targetOid as tenantR18_27_, ruser0_2_.tenantRef_type as tenantR19_27_, ruser0_2_.version as version20_27_, ruser0_1_.administrativeStatus as administ1_53_, ruser0_1_.archiveTimestamp as archiveT2_53_, ruser0_1_.disableReason as disableR3_53_, ruser0_1_.disableTimestamp as disableT4_53_, ruser0_1_.effectiveStatus as effectiv5_53_, ruser0_1_.enableTimestamp as enableTi6_53_, ruser0_1_.validFrom as validFro7_53_, ruser0_1_.validTo as validTo8_53_, ruser0_1_.validityChangeTimestamp as validity9_53_, ruser0_1_.validityStatus as validit10_53_, ruser0_1_.costCenter as costCen11_53_, ruser0_1_.emailAddress as emailAd12_53_, ruser0_1_.hasPhoto as hasPhot13_53_, ruser0_1_.locale as locale14_53_, ruser0_1_.locality_norm as localit15_53_, ruser0_1_.locality_orig as localit16_53_, ruser0_1_.preferredLanguage as preferr17_53_, ruser0_1_.telephoneNumber as telepho18_53_, ruser0_1_.timezone as timezon19_53_, ruser0_.additionalName_norm as addition1_73_, ruser0_.additionalName_orig as addition2_73_, ruser0_.employeeNumber as employee3_73_, ruser0_.familyName_norm as familyNa4_73_, ruser0_.familyName_orig as familyNa5_73_, ruser0_.fullName_norm as fullName6_73_, ruser0_.fullName_orig as fullName7_73_, ruser0_.givenName_norm as givenNam8_73_, ruser0_.givenName_orig as givenNam9_73_, ruser0_.honorificPrefix_norm as honorif10_73_, ruser0_.honorificPrefix_orig as honorif11_73_, ruser0_.honorificSuffix_norm as honorif12_73_, ruser0_.honorificSuffix_orig as honorif13_73_, ruser0_.name_norm as name_no14_73_, ruser0_.name_orig as name_or15_73_, ruser0_.nickName_norm as nickNam16_73_, ruser0_.nickName_orig as nickNam17_73_, ruser0_.title_norm as title_n18_73_, ruser0_.title_orig as title_o19_73_ from m_user ruser0_ inner join m_focus ruser0_1_ on ruser0_.oid=ruser0_1_.oid inner join m_object ruser0_2_ on ruser0_.oid=ruser0_2_.oid where ruser0_.oid=?
[1] select assignment0_.owner_oid as owner_oi2_5_0_, assignment0_.id as id1_5_0_, assignment0_.id as id1_5_1_, assignment0_.owner_oid as owner_oi2_5_1_, assignment0_.administrativeStatus as administ3_5_1_, assignment0_.archiveTimestamp as archiveT4_5_1_, assignment0_.disableReason as disableR5_5_1_, assignment0_.disableTimestamp as disableT6_5_1_, assignment0_.effectiveStatus as effectiv7_5_1_, assignment0_.enableTimestamp as enableTi8_5_1_, assignment0_.validFrom as validFro9_5_1_, assignment0_.validTo as validTo10_5_1_, assignment0_.validityChangeTimestamp as validit11_5_1_, assignment0_.validityStatus as validit12_5_1_, assignment0_.assignmentOwner as assignm13_5_1_, assignment0_.createChannel as createC14_5_1_, assignment0_.createTimestamp as createT15_5_1_, assignment0_.creatorRef_relation as creator16_5_1_, assignment0_.creatorRef_targetOid as creator17_5_1_, assignment0_.creatorRef_type as creator18_5_1_, assignment0_.extId as extId38_5_1_, assignment0_.extOid as extOid39_5_1_, assignment0_.lifecycleState as lifecyc19_5_1_, assignment0_.modifierRef_relation as modifie20_5_1_, assignment0_.modifierRef_targetOid as modifie21_5_1_, assignment0_.modifierRef_type as modifie22_5_1_, assignment0_.modifyChannel as modifyC23_5_1_, assignment0_.modifyTimestamp as modifyT24_5_1_, assignment0_.orderValue as orderVa25_5_1_, assignment0_.orgRef_relation as orgRef_26_5_1_, assignment0_.orgRef_targetOid as orgRef_27_5_1_, assignment0_.orgRef_type as orgRef_28_5_1_, assignment0_.resourceRef_relation as resourc29_5_1_, assignment0_.resourceRef_targetOid as resourc30_5_1_, assignment0_.resourceRef_type as resourc31_5_1_, assignment0_.targetRef_relation as targetR32_5_1_, assignment0_.targetRef_targetOid as targetR33_5_1_, assignment0_.targetRef_type as targetR34_5_1_, assignment0_.tenantRef_relation as tenantR35_5_1_, assignment0_.tenantRef_targetOid as tenantR36_5_1_, assignment0_.tenantRef_type as tenantR37_5_1_, rassignmen1_.owner_id as owner_id1_12_2_, rassignmen1_.owner_owner_oid as owner_ow2_12_2_ from m_assignment assignment0_ left outer join m_assignment_extension rassignmen1_ on assignment0_.extId=rassignmen1_.owner_id and assignment0_.extOid=rassignmen1_.owner_owner_oid where assignment0_.owner_oid=?
[1] select rassignmen_.owner_id, rassignmen_.owner_owner_oid from m_assignment_extension rassignmen_ where rassignmen_.owner_id=? and rassignmen_.owner_owner_oid=?
[1] select raextstrin_.item_id, raextstrin_.anyContainer_owner_id, raextstrin_.anyContainer_owner_owner_oid, raextstrin_.stringValue from m_assignment_ext_string raextstrin_ where raextstrin_.item_id=? and raextstrin_.anyContainer_owner_id=? and raextstrin_.anyContainer_owner_owner_oid=? and raextstrin_.stringValue=?
[1] select raextstrin_.item_id, raextstrin_.anyContainer_owner_id, raextstrin_.anyContainer_owner_owner_oid, raextstrin_.stringValue from m_assignment_ext_string raextstrin_ where raextstrin_.item_id=? and raextstrin_.anyContainer_owner_id=? and raextstrin_.anyContainer_owner_owner_oid=? and raextstrin_.stringValue=?
[1] select raextstrin_.item_id, raextstrin_.anyContainer_owner_id, raextstrin_.anyContainer_owner_owner_oid, raextstrin_.stringValue from m_assignment_ext_string raextstrin_ where raextstrin_.item_id=? and raextstrin_.anyContainer_owner_id=? and raextstrin_.anyContainer_owner_owner_oid=? and raextstrin_.stringValue=?
[1] select rassignmen_.owner_id, rassignmen_.owner_owner_oid from m_assignment_extension rassignmen_ where rassignmen_.owner_id=? and rassignmen_.owner_owner_oid=?
[1] select raextstrin_.item_id, raextstrin_.anyContainer_owner_id, raextstrin_.anyContainer_owner_owner_oid, raextstrin_.stringValue from m_assignment_ext_string raextstrin_ where raextstrin_.item_id=? and raextstrin_.anyContainer_owner_id=? and raextstrin_.anyContainer_owner_owner_oid=? and raextstrin_.stringValue=?
[1] select raextstrin_.item_id, raextstrin_.anyContainer_owner_id, raextstrin_.anyContainer_owner_owner_oid, raextstrin_.stringValue from m_assignment_ext_string raextstrin_ where raextstrin_.item_id=? and raextstrin_.anyContainer_owner_id=? and raextstrin_.anyContainer_owner_owner_oid=? and raextstrin_.stringValue=?
[1] select raextstrin_.item_id, raextstrin_.anyContainer_owner_id, raextstrin_.anyContainer_owner_owner_oid, raextstrin_.stringValue from m_assignment_ext_string raextstrin_ where raextstrin_.item_id=? and raextstrin_.anyContainer_owner_id=? and raextstrin_.anyContainer_owner_owner_oid=? and raextstrin_.stringValue=?
[1] insert into m_assignment (administrativeStatus, archiveTimestamp, disableReason, disableTimestamp, effectiveStatus, enableTimestamp, validFrom, validTo, validityChangeTimestamp, validityStatus, assignmentOwner, createChannel, createTimestamp, creatorRef_relation, creatorRef_targetOid, creatorRef_type, extId, extOid, lifecycleState, modifierRef_relation, modifierRef_targetOid, modifierRef_type, modifyChannel, modifyTimestamp, orderValue, orgRef_relation, orgRef_targetOid, orgRef_type, resourceRef_relation, resourceRef_targetOid, resourceRef_type, targetRef_relation, targetRef_targetOid, targetRef_type, tenantRef_relation, tenantRef_targetOid, tenantRef_type, id, owner_oid) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[1] insert into m_assignment_extension (owner_id, owner_owner_oid) values (?, ?)
[3] insert into m_assignment_ext_string (item_id, anyContainer_owner_id, anyContainer_owner_owner_oid, stringValue) values (?, ?, ?, ?)
[1] insert into m_assignment (administrativeStatus, archiveTimestamp, disableReason, disableTimestamp, effectiveStatus, enableTimestamp, validFrom, validTo, validityChangeTimestamp, validityStatus, assignmentOwner, createChannel, createTimestamp, creatorRef_relation, creatorRef_targetOid, creatorRef_type, extId, extOid, lifecycleState, modifierRef_relation, modifierRef_targetOid, modifierRef_type, modifyChannel, modifyTimestamp, orderValue, orgRef_relation, orgRef_targetOid, orgRef_type, resourceRef_relation, resourceRef_targetOid, resourceRef_type, targetRef_relation, targetRef_targetOid, targetRef_type, tenantRef_relation, tenantRef_targetOid, tenantRef_type, id, owner_oid) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
[1] insert into m_assignment_extension (owner_id, owner_owner_oid) values (?, ?)
[3] insert into m_assignment_ext_string (item_id, anyContainer_owner_id, anyContainer_owner_owner_oid, stringValue) values (?, ?, ?, ?)
[1] update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, fullObject=?, lifecycleState=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=?
[2] update m_assignment set administrativeStatus=?, archiveTimestamp=?, disableReason=?, disableTimestamp=?, effectiveStatus=?, enableTimestamp=?, validFrom=?, validTo=?, validityChangeTimestamp=?, validityStatus=?, assignmentOwner=?, createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, extId=?, extOid=?, lifecycleState=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, orderValue=?, orgRef_relation=?, orgRef_targetOid=?, orgRef_type=?, resourceRef_relation=?, resourceRef_targetOid=?, resourceRef_type=?, targetRef_relation=?, targetRef_targetOid=?, targetRef_type=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=? where id=? and owner_oid=?
*/
// TODO why there are specific SELECTs for assignment extension values? But let's keep that for now.
assertCounts(19, 24);
}
use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.
the class ExtensionTest method test040ReplaceHiddenExtensionValues.
@Test
public void test040ReplaceHiddenExtensionValues() throws Exception {
OperationResult result = new OperationResult(ExtensionTest.class.getName() + ".test040ReplaceHiddenExtensionValues");
ObjectDelta<UserType> delta = getPrismContext().deltaFor(UserType.class).item(UserType.F_EXTENSION, EXT_HIDDEN1).replace("h1.2", "h1.5").item(UserType.F_EXTENSION, EXT_HIDDEN2).replace().item(UserType.F_EXTENSION, EXT_HIDDEN3).replace().asObjectDelta("");
delta.applyTo(expectedUser);
queryListener.start();
repositoryService.modifyObject(UserType.class, userOid, delta.getModifications(), getOptions(), result);
queryListener.dumpAndStop();
try (Session session = factory.openSession()) {
RUser u = session.get(RUser.class, userOid);
assertExtension(u, itemHidden1, "h1.2", "h1.5");
assertExtension(u, itemHidden2);
assertExtension(u, itemHidden3);
assertExtension(u, itemVisible, "v1", "v2", "v3");
assertExtension(u, itemWeapon, "w1");
}
assertGetObject(result);
assertSearch(EXT_HIDDEN1, "h1.1", 0, result);
assertSearch(EXT_HIDDEN1, "h1.2", 1, result);
assertSearch(EXT_HIDDEN1, "h1.3", 0, result);
assertSearch(EXT_HIDDEN1, "h1.4", 0, result);
assertSearch(EXT_HIDDEN1, "h1.5", 1, result);
assertSearch(EXT_HIDDEN2, "h2.1", 0, result);
assertSearch(EXT_HIDDEN2, "h2.2", 0, result);
assertSearch(EXT_HIDDEN3, "h3.1", 0, result);
assertSearch(EXT_HIDDEN3, "h1.3", 0, result);
/*
[1] select oid from m_object where oid = ? for update
[1] select ruser0_.oid as oid1_27_, ruser0_2_.createChannel as createCh2_27_, ruser0_2_.createTimestamp as createTi3_27_, ruser0_2_.creatorRef_relation as creatorR4_27_, ruser0_2_.creatorRef_targetOid as creatorR5_27_, ruser0_2_.creatorRef_type as creatorR6_27_, ruser0_2_.fullObject as fullObje7_27_, ruser0_2_.lifecycleState as lifecycl8_27_, ruser0_2_.modifierRef_relation as modifier9_27_, ruser0_2_.modifierRef_targetOid as modifie10_27_, ruser0_2_.modifierRef_type as modifie11_27_, ruser0_2_.modifyChannel as modifyC12_27_, ruser0_2_.modifyTimestamp as modifyT13_27_, ruser0_2_.name_norm as name_no14_27_, ruser0_2_.name_orig as name_or15_27_, ruser0_2_.objectTypeClass as objectT16_27_, ruser0_2_.tenantRef_relation as tenantR17_27_, ruser0_2_.tenantRef_targetOid as tenantR18_27_, ruser0_2_.tenantRef_type as tenantR19_27_, ruser0_2_.version as version20_27_, ruser0_1_.administrativeStatus as administ1_53_, ruser0_1_.archiveTimestamp as archiveT2_53_, ruser0_1_.disableReason as disableR3_53_, ruser0_1_.disableTimestamp as disableT4_53_, ruser0_1_.effectiveStatus as effectiv5_53_, ruser0_1_.enableTimestamp as enableTi6_53_, ruser0_1_.validFrom as validFro7_53_, ruser0_1_.validTo as validTo8_53_, ruser0_1_.validityChangeTimestamp as validity9_53_, ruser0_1_.validityStatus as validit10_53_, ruser0_1_.costCenter as costCen11_53_, ruser0_1_.emailAddress as emailAd12_53_, ruser0_1_.hasPhoto as hasPhot13_53_, ruser0_1_.locale as locale14_53_, ruser0_1_.locality_norm as localit15_53_, ruser0_1_.locality_orig as localit16_53_, ruser0_1_.preferredLanguage as preferr17_53_, ruser0_1_.telephoneNumber as telepho18_53_, ruser0_1_.timezone as timezon19_53_, ruser0_.additionalName_norm as addition1_73_, ruser0_.additionalName_orig as addition2_73_, ruser0_.employeeNumber as employee3_73_, ruser0_.familyName_norm as familyNa4_73_, ruser0_.familyName_orig as familyNa5_73_, ruser0_.fullName_norm as fullName6_73_, ruser0_.fullName_orig as fullName7_73_, ruser0_.givenName_norm as givenNam8_73_, ruser0_.givenName_orig as givenNam9_73_, ruser0_.honorificPrefix_norm as honorif10_73_, ruser0_.honorificPrefix_orig as honorif11_73_, ruser0_.honorificSuffix_norm as honorif12_73_, ruser0_.honorificSuffix_orig as honorif13_73_, ruser0_.name_norm as name_no14_73_, ruser0_.name_orig as name_or15_73_, ruser0_.nickName_norm as nickNam16_73_, ruser0_.nickName_orig as nickNam17_73_, ruser0_.title_norm as title_n18_73_, ruser0_.title_orig as title_o19_73_ from m_user ruser0_ inner join m_focus ruser0_1_ on ruser0_.oid=ruser0_1_.oid inner join m_object ruser0_2_ on ruser0_.oid=ruser0_2_.oid where ruser0_.oid=?
[1] select strings0_.owner_oid as owner_oi2_33_0_, strings0_.item_id as item_id1_33_0_, strings0_.ownerType as ownerTyp3_33_0_, strings0_.stringValue as stringVa4_33_0_, strings0_.item_id as item_id1_33_1_, strings0_.owner_oid as owner_oi2_33_1_, strings0_.ownerType as ownerTyp3_33_1_, strings0_.stringValue as stringVa4_33_1_ from m_object_ext_string strings0_ where strings0_.owner_oid=?
[1] select roextstrin_.item_id, roextstrin_.owner_oid, roextstrin_.ownerType, roextstrin_.stringValue from m_object_ext_string roextstrin_ where roextstrin_.item_id=? and roextstrin_.owner_oid=? and roextstrin_.ownerType=? and roextstrin_.stringValue=?
[1] select roextstrin_.item_id, roextstrin_.owner_oid, roextstrin_.ownerType, roextstrin_.stringValue from m_object_ext_string roextstrin_ where roextstrin_.item_id=? and roextstrin_.owner_oid=? and roextstrin_.ownerType=? and roextstrin_.stringValue=?
[2] insert into m_object_ext_string (item_id, owner_oid, ownerType, stringValue) values (?, ?, ?, ?)
[1] update m_object set createChannel=?, createTimestamp=?, creatorRef_relation=?, creatorRef_targetOid=?, creatorRef_type=?, fullObject=?, lifecycleState=?, modifierRef_relation=?, modifierRef_targetOid=?, modifierRef_type=?, modifyChannel=?, modifyTimestamp=?, name_norm=?, name_orig=?, objectTypeClass=?, tenantRef_relation=?, tenantRef_targetOid=?, tenantRef_type=?, version=? where oid=?
[5] delete from m_object_ext_string where item_id=? and owner_oid=? and ownerType=? and stringValue=?
*/
assertCounts(8, 13);
}
use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.
the class ObjectDeltaUpdaterTest method test187DeleteModifyApproverRef.
@Test
public void test187DeleteModifyApproverRef() throws Exception {
OperationResult result = new OperationResult("test185AddModifyApproverRef");
List<ItemDelta<?, ?>> modifications = prismContext.deltaFor(UserType.class).item(UserType.F_METADATA, MetadataType.F_MODIFY_APPROVER_REF).delete(createRef(UserType.COMPLEX_TYPE, "654")).asItemDeltas();
TestStatementInspector.start();
repositoryService.modifyObject(UserType.class, userOid, modifications, result);
TestStatementInspector.dump();
if (isUsingH2()) {
AssertJUnit.assertEquals(5, TestStatementInspector.getQueryCount());
}
try (Session session = factory.openSession()) {
RUser u = session.get(RUser.class, userOid);
AssertJUnit.assertEquals(0, u.getModifyApproverRef().size());
}
}
use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.
the class ObjectDeltaUpdaterTest method test192DeleteWholeMetadata.
@Test
public void test192DeleteWholeMetadata() throws Exception {
OperationResult result = new OperationResult("test192DeleteWholeMetadata");
List<ItemDelta<?, ?>> modifications = prismContext.deltaFor(UserType.class).item(UserType.F_METADATA).delete(new MetadataType(prismContext).createChannel("ch1").modifierRef(createRef(UserType.COMPLEX_TYPE, "44")).createApproverRef(createRef(UserType.COMPLEX_TYPE, "55")).createApproverRef(createRef(UserType.COMPLEX_TYPE, "77")).modifyApproverRef(createRef(UserType.COMPLEX_TYPE, "55")).modifyApproverRef(createRef(UserType.COMPLEX_TYPE, "66"))).asItemDeltas();
TestStatementInspector.start();
repositoryService.modifyObject(UserType.class, userOid, modifications, result);
TestStatementInspector.dump();
if (isUsingH2()) {
AssertJUnit.assertEquals(6, TestStatementInspector.getQueryCount());
}
try (Session session = factory.openSession()) {
RUser u = session.get(RUser.class, userOid);
AssertJUnit.assertNull(u.getCreateChannel());
AssertJUnit.assertNull(u.getModifierRef());
AssertJUnit.assertEquals(0, u.getModifyApproverRef().size());
AssertJUnit.assertEquals(0, u.getCreateApproverRef().size());
}
}
use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.
the class ObjectDeltaUpdaterTest method test185AddModifyApproverRef.
@Test
public void test185AddModifyApproverRef() throws Exception {
OperationResult result = new OperationResult("test185AddModifyApproverRef");
List<ItemDelta<?, ?>> modifications = prismContext.deltaFor(UserType.class).item(UserType.F_METADATA, MetadataType.F_MODIFY_APPROVER_REF).add(createRef(UserType.COMPLEX_TYPE, "654")).asItemDeltas();
TestStatementInspector.start();
repositoryService.modifyObject(UserType.class, userOid, modifications, result);
TestStatementInspector.dump();
if (isUsingH2()) {
AssertJUnit.assertEquals(5, TestStatementInspector.getQueryCount());
}
try (Session session = factory.openSession()) {
RUser u = session.get(RUser.class, userOid);
AssertJUnit.assertEquals(1, u.getModifyApproverRef().size());
// noinspection unchecked
assertReferences((Collection) u.getModifyApproverRef(), createRepoRef(UserType.COMPLEX_TYPE, "654"));
}
}
Aggregations