Skip to content

Commit

Permalink
native repo tests: replace of "attribute" for "item" where appropriate
Browse files Browse the repository at this point in the history
Attributes, while in general usabe for Java fields/attributes, were
rather misleading from domain-language (prism) perspective.
  • Loading branch information
virgo47 committed Mar 28, 2022
1 parent 5e780a5 commit 08476fd
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ protected String extensionKey(Containerable extContainer, String itemName) {
return extKey(extContainer, itemName, MExtItemHolderType.EXTENSION);
}

/** Returns extension item key (from m_ext_item table) for the specified shadow attribute. */
protected String shadowAttributeKey(Containerable extContainer, String itemName) {
return extKey(extContainer, itemName, MExtItemHolderType.ATTRIBUTES);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ public void test181SearchByNodeIdentifierThatIsNotUsed() throws SchemaException

@Test
public void test185SearchByParameter() throws SchemaException {
when("searching audit filtered by parameter attribute");
when("searching audit filtered by parameter item");
SearchResultList<AuditEventRecordType> result = searchObjects(prismContext
.queryFor(AuditEventRecordType.class)
.item(AuditEventRecordType.F_PARAMETER).eq("1")
Expand Down Expand Up @@ -965,7 +965,7 @@ public void test281SearchByResourceOidAnyValue() throws SchemaException {
}

@Test
public void test300SearchReturnsMappedToManyAttributes() throws SchemaException {
public void test300SearchReturnsMappedToManyEntities() throws SchemaException {
when("searching audit with query without any conditions and paging");
List<AuditEventRecordType> result = searchObjects(prismContext
.queryFor(AuditEventRecordType.class)
Expand All @@ -979,7 +979,7 @@ public void test300SearchReturnsMappedToManyAttributes() throws SchemaException
.sorted(Comparator.comparing(AuditEventRecordType::getParameter))
.collect(Collectors.toList());

and("record 1 has all the attributes filled");
and("record 1 has all the items filled");
AuditEventRecordType record1 = result.get(0);
assertThat(record1.getProperty()).hasSize(1);
AuditEventRecordPropertyType prop1 = record1.getProperty().get(0);
Expand All @@ -988,7 +988,7 @@ public void test300SearchReturnsMappedToManyAttributes() throws SchemaException
// Changed items are not returned, they are used for query only and can be found in deltas.
// Also, they may be stored in wrong format (e.g. "canonicalized").
assertThat(record1.getChangedItem()).isNullOrEmpty();
// for other attributes we just use the size check, fetch mechanism is similar
// for other items we just use the size check, fetch mechanism is similar
assertThat(record1.getDelta()).hasSize(3)
.allMatch(d -> d.getObjectDelta() != null);
assertThat(record1.getReference()).hasSize(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ public void test291DuplicateCidInDifferentContainersIsTolerated()
}
// endregion

// region extension attributes
// region extension items
@Test
public void test300AddObjectWithIndexedStringExtension()
throws ObjectAlreadyExistsException, SchemaException, ObjectNotFoundException {
Expand Down Expand Up @@ -962,7 +962,7 @@ public void test320AddShadowWithAttributes()

// this test covers function of QObjectMapping and all the basic object fields
@Test
public void test800SystemConfigurationBasicObjectAttributes() throws Exception {
public void test800SystemConfigurationBasicObjectItems() throws Exception {
OperationResult result = createOperationResult();

given("system configuration");
Expand Down Expand Up @@ -991,7 +991,7 @@ public void test800SystemConfigurationBasicObjectAttributes() throws Exception {
when("adding it to the repository");
repositoryService.addObject(systemConfiguration.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MObject row = selectObjectByOid(
Expand Down Expand Up @@ -1302,7 +1302,7 @@ public void test810ResourceAndItsBusinessApproverReferences() throws Exception {
when("adding it to the repository");
repositoryService.addObject(resource.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MResource row = selectObjectByOid(QResource.class, resource.getOid());
Expand Down Expand Up @@ -1349,7 +1349,7 @@ public void test811Connector() throws Exception {
when("adding it to the repository");
repositoryService.addObject(connector.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MConnector row = selectObjectByOid(QConnector.class, connector.getOid());
Expand Down Expand Up @@ -1423,7 +1423,7 @@ public void test814ConnectorHost() throws Exception {
when("adding it to the repository");
repositoryService.addObject(connectorHost.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MConnectorHost row = selectObjectByOid(QConnectorHost.class, connectorHost.getOid());
Expand Down Expand Up @@ -1464,7 +1464,7 @@ public void test816ReportData() throws Exception {
when("adding it to the repository");
repositoryService.addObject(report.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MReportData row = selectObjectByOid(QReportData.class, report.getOid());
Expand Down Expand Up @@ -1509,7 +1509,7 @@ public void test818Shadow() throws Exception {
when("adding it to the repository");
repositoryService.addObject(shadow.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MShadow row = selectObjectByOid(QShadow.class, shadow.getOid());
Expand All @@ -1534,7 +1534,7 @@ public void test818Shadow() throws Exception {
assertThat(row.correlationSituation).isEqualTo(CorrelationSituationType.EXISTING_OWNER);
}

// This covers mapping of attributes in QFocusMapping + GenericObject.
// This covers mapping of items in QFocusMapping + GenericObject.
@Test
public void test820GenericObject() throws Exception {
OperationResult result = createOperationResult();
Expand Down Expand Up @@ -1574,7 +1574,7 @@ public void test820GenericObject() throws Exception {
when("adding it to the repository");
repositoryService.addObject(genericObject.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MFocus row = selectObjectByOid(
Expand Down Expand Up @@ -1607,7 +1607,7 @@ public void test820GenericObject() throws Exception {
assertThat(row.subtypes).containsExactlyInAnyOrder("some-custom-object-type-uri");
}

// This covers mapping of attributes in AbstractRole + Archetype + inducement mapping.
// This covers mapping of items in AbstractRole + Archetype + inducement mapping.
// There is no focus on QFocusMapping that is covered above.
@Test
public void test821ArchetypeAndInducement() throws Exception {
Expand All @@ -1622,24 +1622,24 @@ public void test821ArchetypeAndInducement() throws Exception {
.identifier("identifier")
.requestable(false)
.riskLevel("extremely-high")
// we don't need all attributes here, this is tested in test803ContainerAssignment
// we don't need all items here, this is tested in test803ContainerAssignment
.inducement(new AssignmentType()
.order(2)
.targetRef(UUID.randomUUID().toString(), RoleType.COMPLEX_TYPE))
.inducement(new AssignmentType()
.order(3)
.targetRef(UUID.randomUUID().toString(), RoleType.COMPLEX_TYPE));
// this is no additional attribute specific for archetype
// this is no additional items specific for archetype

when("adding it to the repository");
repositoryService.addObject(archetype.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

UUID archetypeOid = UUID.fromString(archetype.getOid());
MArchetype row = selectObjectByOid(QArchetype.class, archetypeOid);
// all attributes from MAbstractRole
// all items from MAbstractRole
assertThat(row.autoAssignEnabled).isTrue();
assertThat(row.displayNameOrig).isEqualTo("display-name");
assertThat(row.displayNameNorm).isEqualTo("displayname");
Expand Down Expand Up @@ -1680,12 +1680,12 @@ public void test825User() throws Exception {
when("adding it to the repository");
repositoryService.addObject(user.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

UUID userOid = UUID.fromString(user.getOid());
MUser row = selectObjectByOid(QUser.class, userOid);
// all attributes from MUser
// all items from MUser
assertThat(row.additionalNameOrig).isEqualTo("additional-name");
assertThat(row.additionalNameNorm).isEqualTo("additionalname");
assertThat(row.employeeNumber).isEqualTo("3");
Expand Down Expand Up @@ -1755,7 +1755,7 @@ public void test830Task() throws Exception {
when("adding it to the repository");
repositoryService.addObject(task.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MTask row = selectObjectByOid(QTask.class, task.getOid());
Expand Down Expand Up @@ -1804,7 +1804,7 @@ public void test838Node() throws Exception {
when("adding it to the repository");
repositoryService.addObject(node.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MNode row = selectObjectByOid(QNode.class, node.getOid());
Expand Down Expand Up @@ -1832,7 +1832,7 @@ public void test840AccessCertificationDefinition() throws Exception {
when("adding it to the repository");
repositoryService.addObject(accessCertificationDefinition.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MAccessCertificationDefinition row = selectObjectByOid(
Expand Down Expand Up @@ -2005,7 +2005,7 @@ public void test842AccessCertificationCampaign() throws Exception {
when("adding it to the repository");
repositoryService.addObject(accessCertificationCampaign.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MAccessCertificationCampaign row = selectObjectByOid(
Expand Down Expand Up @@ -2314,7 +2314,7 @@ public void test850Case() throws Exception {
when("adding it to the repository");
repositoryService.addObject(acase.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MCase caseRow = selectObjectByOid(QCase.class, acase.getOid());
Expand Down Expand Up @@ -2454,7 +2454,7 @@ public void test860MessageTemplate() throws Exception {
when("adding it to the repository");
repositoryService.addObject(messageTemplate.asPrismObject(), null, result);

then("it is stored and relevant attributes are in columns");
then("it is stored and relevant items are in columns");
assertThatOperationResult(result).isSuccess();

MObject row = selectObjectByOid(QMessageTemplate.class, messageTemplate.getOid());
Expand Down

0 comments on commit 08476fd

Please sign in to comment.