Search in sources :

Example 1 with MFocus

use of com.evolveum.midpoint.repo.sqale.qmodel.focus.MFocus in project midpoint by Evolveum.

the class SqaleRepoAddDeleteObjectTest method test820GenericObject.

// This covers mapping of attributes in QFocusMapping + GenericObject.
@Test
public void test820GenericObject() throws Exception {
    OperationResult result = createOperationResult();
    given("generic object");
    String objectName = "go" + getTestNumber();
    GenericObjectType genericObject = new GenericObjectType(prismContext).name(objectName).costCenter("cost-center").emailAddress("email-address").jpegPhoto(new byte[] { 1, 2, 3, 4, 5 }).locale("locale").locality("locality").preferredLanguage("preferred-language").telephoneNumber("telephone-number").timezone("timezone").credentials(new CredentialsType().password(new PasswordType().metadata(new MetadataType().createTimestamp(MiscUtil.asXMLGregorianCalendar(1L)).modifyTimestamp(MiscUtil.asXMLGregorianCalendar(2L))))).activation(new ActivationType().administrativeStatus(ActivationStatusType.ENABLED).effectiveStatus(ActivationStatusType.DISABLED).enableTimestamp(MiscUtil.asXMLGregorianCalendar(3L)).disableTimestamp(MiscUtil.asXMLGregorianCalendar(4L)).disableReason("disable-reason").validityStatus(TimeIntervalStatusType.IN).validFrom(MiscUtil.asXMLGregorianCalendar(5L)).validTo(MiscUtil.asXMLGregorianCalendar(6L)).validityChangeTimestamp(MiscUtil.asXMLGregorianCalendar(7L)).archiveTimestamp(MiscUtil.asXMLGregorianCalendar(8L)).lockoutStatus(LockoutStatusType.NORMAL)).subtype("some-custom-object-type-uri");
    when("adding it to the repository");
    repositoryService.addObject(genericObject.asPrismObject(), null, result);
    then("it is stored and relevant attributes are in columns");
    assertThatOperationResult(result).isSuccess();
    MFocus row = selectObjectByOid(QGenericObject.class, UUID.fromString(genericObject.getOid()));
    assertThat(row.costCenter).isEqualTo("cost-center");
    assertThat(row.emailAddress).isEqualTo("email-address");
    assertThat(row.photo).isEqualTo(new byte[] { 1, 2, 3, 4, 5 });
    assertThat(row.locale).isEqualTo("locale");
    assertThat(row.localityOrig).isEqualTo("locality");
    assertThat(row.localityNorm).isEqualTo("locality");
    assertThat(row.preferredLanguage).isEqualTo("preferred-language");
    assertThat(row.telephoneNumber).isEqualTo("telephone-number");
    assertThat(row.timezone).isEqualTo("timezone");
    assertThat(row.passwordCreateTimestamp).isEqualTo(Instant.ofEpochMilli(1));
    assertThat(row.passwordModifyTimestamp).isEqualTo(Instant.ofEpochMilli(2));
    assertThat(row.administrativeStatus).isEqualTo(ActivationStatusType.ENABLED);
    assertThat(row.effectiveStatus).isEqualTo(ActivationStatusType.DISABLED);
    assertThat(row.enableTimestamp).isEqualTo(Instant.ofEpochMilli(3));
    assertThat(row.disableTimestamp).isEqualTo(Instant.ofEpochMilli(4));
    assertThat(row.disableReason).isEqualTo("disable-reason");
    assertThat(row.validityStatus).isEqualTo(TimeIntervalStatusType.IN);
    assertThat(row.validFrom).isEqualTo(Instant.ofEpochMilli(5));
    assertThat(row.validTo).isEqualTo(Instant.ofEpochMilli(6));
    assertThat(row.validityChangeTimestamp).isEqualTo(Instant.ofEpochMilli(7));
    assertThat(row.archiveTimestamp).isEqualTo(Instant.ofEpochMilli(8));
    assertThat(row.lockoutStatus).isEqualTo(LockoutStatusType.NORMAL);
    assertThat(row.subtypes).containsExactlyInAnyOrder("some-custom-object-type-uri");
}
Also used : MFocus(com.evolveum.midpoint.repo.sqale.qmodel.focus.MFocus) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) Test(org.testng.annotations.Test) SqaleRepoBaseTest(com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)

Aggregations

PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 SqaleRepoBaseTest (com.evolveum.midpoint.repo.sqale.SqaleRepoBaseTest)1 MFocus (com.evolveum.midpoint.repo.sqale.qmodel.focus.MFocus)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Test (org.testng.annotations.Test)1