Search in sources :

Example 51 with RUser

use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.

the class ExtensionTest method test036DeleteHiddenUserExtensionValuesDuplicate.

@Test
public void test036DeleteHiddenUserExtensionValuesDuplicate() throws Exception {
    OperationResult result = new OperationResult(ExtensionTest.class.getName() + ".test036DeleteHiddenUserExtensionValuesDuplicate");
    ObjectDelta<UserType> delta = getPrismContext().deltaFor(UserType.class).item(UserType.F_EXTENSION, EXT_HIDDEN1).delete("h1.1", "h1.2").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.3", "h1.4");
        assertExtension(u, itemHidden2, "h2.1", "h2.2");
        assertExtension(u, itemHidden3, "h3.1");
        assertExtension(u, itemVisible, "v1", "v2", "v3");
        assertExtension(u, itemWeapon, "w1");
    }
    assertGetObject(result);
    assertSearch(EXT_HIDDEN1, "h1.1", 0, result);
    assertSearch(EXT_HIDDEN1, "h1.2", 0, result);
    assertSearch(EXT_HIDDEN1, "h1.3", 1, result);
    assertSearch(EXT_HIDDEN1, "h1.4", 1, result);
    assertSearch(EXT_HIDDEN1, "h1.5", 0, result);
    assertSearch(EXT_HIDDEN2, "h2.1", 1, result);
    assertSearch(EXT_HIDDEN2, "h2.2", 1, result);
    assertSearch(EXT_HIDDEN3, "h3.1", 1, result);
    assertSearch(EXT_HIDDEN3, "h1.3", 0, result);
    /*
        fetch-deletion:

 [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] 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=?

        no-fetch-deletion:

 [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] delete from m_object_ext_string where owner_oid=? and ownerType=? and item_id=? and stringValue=?
 [1] delete from m_object_ext_string where owner_oid=? and ownerType=? and item_id=? and stringValue=?
 [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=?
         */
    if (isNoFetchDeletion()) {
        assertCounts(5, 5);
    } else {
        assertCounts(4, 4);
    }
}
Also used : RUser(com.evolveum.midpoint.repo.sql.data.common.RUser) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 52 with RUser

use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.

the class ExtensionTest method test158AddWholeAssignmentExtensionDifferentValue.

/**
 * This is really tricky. We try to add another value to single-valued extension container.
 */
@Test
public void test158AddWholeAssignmentExtensionDifferentValue() throws Exception {
    OperationResult result = new OperationResult(ExtensionTest.class.getName() + ".test158AddWholeAssignmentExtensionDifferentValue");
    PrismContainerValue<?> extValue = expectedUser.getDefinition().findContainerDefinition(UserType.F_ASSIGNMENT).findContainerDefinition(AssignmentType.F_EXTENSION).instantiate().getValue();
    extValue.findOrCreateProperty(EXT_WEAPON).addRealValues("W3");
    extValue.findOrCreateProperty(EXT_SHIP_NAME).addRealValues("?");
    ObjectDelta<UserType> delta = getPrismContext().deltaFor(UserType.class).item(UserType.F_ASSIGNMENT, 1, AssignmentType.F_EXTENSION).add(extValue.clone()).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 a = u.getAssignments().iterator().next();
        assertExtension(a, itemWeapon, "W3");
        assertExtension(a, itemShipName, "?");
    }
    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 booleans0_.anyContainer_owner_id as anyConta2_6_0_, booleans0_.anyContainer_owner_owner_oid as anyConta3_6_0_, booleans0_.item_id as item_id1_6_0_, booleans0_.booleanValue as booleanV4_6_0_, booleans0_.item_id as item_id1_6_1_, booleans0_.anyContainer_owner_id as anyConta2_6_1_, booleans0_.anyContainer_owner_owner_oid as anyConta3_6_1_, booleans0_.booleanValue as booleanV4_6_1_ from m_assignment_ext_boolean booleans0_ where booleans0_.anyContainer_owner_id=? and booleans0_.anyContainer_owner_owner_oid=?
 [1] select dates0_.anyContainer_owner_id as anyConta2_7_0_, dates0_.anyContainer_owner_owner_oid as anyConta3_7_0_, dates0_.item_id as item_id1_7_0_, dates0_.dateValue as dateValu4_7_0_, dates0_.item_id as item_id1_7_1_, dates0_.anyContainer_owner_id as anyConta2_7_1_, dates0_.anyContainer_owner_owner_oid as anyConta3_7_1_, dates0_.dateValue as dateValu4_7_1_ from m_assignment_ext_date dates0_ where dates0_.anyContainer_owner_id=? and dates0_.anyContainer_owner_owner_oid=?
 [1] select longs0_.anyContainer_owner_id as anyConta2_8_0_, longs0_.anyContainer_owner_owner_oid as anyConta3_8_0_, longs0_.item_id as item_id1_8_0_, longs0_.longValue as longValu4_8_0_, longs0_.item_id as item_id1_8_1_, longs0_.anyContainer_owner_id as anyConta2_8_1_, longs0_.anyContainer_owner_owner_oid as anyConta3_8_1_, longs0_.longValue as longValu4_8_1_ from m_assignment_ext_long longs0_ where longs0_.anyContainer_owner_id=? and longs0_.anyContainer_owner_owner_oid=?
 [1] select polys0_.anyContainer_owner_id as anyConta2_9_0_, polys0_.anyContainer_owner_owner_oid as anyConta3_9_0_, polys0_.item_id as item_id1_9_0_, polys0_.orig as orig4_9_0_, polys0_.item_id as item_id1_9_1_, polys0_.anyContainer_owner_id as anyConta2_9_1_, polys0_.anyContainer_owner_owner_oid as anyConta3_9_1_, polys0_.orig as orig4_9_1_, polys0_.norm as norm5_9_1_ from m_assignment_ext_poly polys0_ where polys0_.anyContainer_owner_id=? and polys0_.anyContainer_owner_owner_oid=?
 [1] select references0_.anyContainer_owner_id as anyConta2_10_0_, references0_.anyContainer_owner_owner_oid as anyConta3_10_0_, references0_.item_id as item_id1_10_0_, references0_.targetoid as targetoi4_10_0_, references0_.item_id as item_id1_10_1_, references0_.anyContainer_owner_id as anyConta2_10_1_, references0_.anyContainer_owner_owner_oid as anyConta3_10_1_, references0_.targetoid as targetoi4_10_1_, references0_.relation as relation5_10_1_, references0_.targetType as targetTy6_10_1_ from m_assignment_ext_reference references0_ where references0_.anyContainer_owner_id=? and references0_.anyContainer_owner_owner_oid=?
 [1] select strings0_.anyContainer_owner_id as anyConta2_11_0_, strings0_.anyContainer_owner_owner_oid as anyConta3_11_0_, strings0_.item_id as item_id1_11_0_, strings0_.stringValue as stringVa4_11_0_, strings0_.item_id as item_id1_11_1_, strings0_.anyContainer_owner_id as anyConta2_11_1_, strings0_.anyContainer_owner_owner_oid as anyConta3_11_1_, strings0_.stringValue as stringVa4_11_1_ from m_assignment_ext_string strings0_ where strings0_.anyContainer_owner_id=? and strings0_.anyContainer_owner_owner_oid=?
 [2] 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] delete from m_assignment_ext_string where item_id=? and anyContainer_owner_id=? and anyContainer_owner_owner_oid=? and stringValue=?
         */
    assertCounts(12 + getExtraSafeInsertionSelects(2), 14 + getExtraSafeInsertionSelects(2));
}
Also used : RAssignment(com.evolveum.midpoint.repo.sql.data.common.container.RAssignment) RUser(com.evolveum.midpoint.repo.sql.data.common.RUser) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 53 with RUser

use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.

the class ObjectDeltaUpdaterTest method test180ReplaceSomeMetadataItems.

@Test
public void test180ReplaceSomeMetadataItems() throws Exception {
    OperationResult result = new OperationResult("test180ReplaceSomeMetadataItems");
    List<ItemDelta<?, ?>> modifications = prismContext.deltaFor(UserType.class).item(UserType.F_METADATA, MetadataType.F_CREATE_APPROVER_REF).replace(createRef(UserType.COMPLEX_TYPE, "111")).item(UserType.F_METADATA, MetadataType.F_CREATE_CHANNEL).replace("zxcv").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("zxcv", u.getCreateChannel());
        AssertJUnit.assertEquals(1, u.getCreateApproverRef().size());
        // noinspection unchecked
        assertReferences((Collection) u.getCreateApproverRef(), createRepoRef(UserType.COMPLEX_TYPE, "111"));
    }
}
Also used : RUser(com.evolveum.midpoint.repo.sql.data.common.RUser) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ItemDelta(com.evolveum.midpoint.prism.delta.ItemDelta) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 54 with RUser

use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.

the class ObjectDeltaUpdaterTest method test400AddExtensionItem.

// MID-5906
@Test
public void test400AddExtensionItem() throws Exception {
    OperationResult result = new OperationResult("test400AddExtensionItem");
    ObjectDelta<UserType> delta = getPrismContext().deltaFor(UserType.class).item(UserType.F_EXTENSION, EXT_VISIBLE_SINGLE).add("v1").asObjectDelta(userOid);
    repositoryService.modifyObject(UserType.class, userOid, delta.getModifications(), null, result);
    try (Session session = factory.openSession()) {
        RUser u = session.get(RUser.class, userOid);
        assertExtension(u, itemVisibleSingle, "v1");
    }
    assertSearch(EXT_VISIBLE_SINGLE, "v1", 1, result);
    assertSearch(EXT_VISIBLE_SINGLE, "v2", 0, result);
}
Also used : RUser(com.evolveum.midpoint.repo.sql.data.common.RUser) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Example 55 with RUser

use of com.evolveum.midpoint.repo.sql.data.common.RUser in project midpoint by Evolveum.

the class ObjectDeltaUpdaterTest method test410ReplaceExtensionItem.

// MID-5906
@Test
public void test410ReplaceExtensionItem() throws Exception {
    OperationResult result = new OperationResult("test410ReplaceExtensionItem");
    ObjectDelta<UserType> delta = getPrismContext().deltaFor(UserType.class).item(UserType.F_EXTENSION, EXT_VISIBLE_SINGLE).replace().asObjectDelta(userOid);
    repositoryService.modifyObject(UserType.class, userOid, delta.getModifications(), null, result);
    try (Session session = factory.openSession()) {
        RUser u = session.get(RUser.class, userOid);
        assertExtension(u, itemVisibleSingle);
    }
    assertSearch(EXT_VISIBLE_SINGLE, "v1", 0, result);
    assertSearch(EXT_VISIBLE_SINGLE, "v2", 0, result);
}
Also used : RUser(com.evolveum.midpoint.repo.sql.data.common.RUser) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Session(org.hibernate.Session) Test(org.testng.annotations.Test)

Aggregations

RUser (com.evolveum.midpoint.repo.sql.data.common.RUser)56 Session (org.hibernate.Session)56 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)55 Test (org.testng.annotations.Test)55 RAssignment (com.evolveum.midpoint.repo.sql.data.common.container.RAssignment)19 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)15 RFocusPhoto (com.evolveum.midpoint.repo.sql.data.common.RFocusPhoto)3 RActivation (com.evolveum.midpoint.repo.sql.data.common.embedded.RActivation)2 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)1 RAssignmentExtension (com.evolveum.midpoint.repo.sql.data.common.any.RAssignmentExtension)1 RPolyString (com.evolveum.midpoint.repo.sql.data.common.embedded.RPolyString)1 File (java.io.File)1 QName (javax.xml.namespace.QName)1