Skip to content

Commit

Permalink
Fixed failing repo tests
Browse files Browse the repository at this point in the history
Signed-off-by: Tony Tkáčik <tonydamage@gmail.com>
  • Loading branch information
tonydamage committed Feb 29, 2024
1 parent 41c8d53 commit d38cb9e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,10 @@ public S transform(Tuple tuple, Q entityPath) {

@VisibleForTesting
public int additionalSelectsByDefault() {
return (int) separatellySerializedItems.entrySet().stream().filter(e -> e.getValue().includedByDefault).count();

if (storeSplitted) {
return (int) separatellySerializedItems.entrySet().stream().filter(e -> e.getValue().includedByDefault).count();
}
return 0;
}

public void setStoreSplitted(boolean storeSplitted) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,12 @@ public OperationExecutionType transform(Tuple rowTuple, QOperationExecution<OR>
if (opexContainer == null) {
throw new SystemException("Object " + object + " has no operation execution as expected from " + row);
}
// New format of value
if (row.fullObject != null) {


PrismContainerValue<OperationExecutionType> pcv = opexContainer.findValue(row.cid);

// FIXME: This should be resolved better. Use value from parent.
if (row.fullObject != null && pcv == null) {
try {
var embedded = (PrismContainerValue<OperationExecutionType>) toSchemaObjectEmbedded(rowTuple, entityPath);
opexContainer.add(embedded);
Expand All @@ -195,7 +199,6 @@ public OperationExecutionType transform(Tuple rowTuple, QOperationExecution<OR>
}
}

PrismContainerValue<OperationExecutionType> pcv = opexContainer.findValue(row.cid);
if (pcv == null) {
throw new SystemException("Object " + object + " has no operation execution with ID " + row.cid);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.repo.sqale.qmodel.focus.QUserMapping;
import com.evolveum.midpoint.schema.GetOperationOptionsBuilder;

import com.evolveum.midpoint.util.exception.ObjectNotFoundException;
Expand Down Expand Up @@ -2664,9 +2665,12 @@ public void test760SearchUsersWithRightHandReferencedPath() {

@Test
public void test770ExcludeAssignments() throws SchemaException, ObjectNotFoundException {
var options = GetOperationOptionsBuilder.create().item(F_ASSIGNMENT).dontRetrieve().build();
var user = repositoryService.getObject(UserType.class, user1Oid, options, createOperationResult());
assertThat(user.asObjectable().getAssignment()).isEmpty();
// Test only if objects are splitted
if (QUserMapping.getUserMapping().additionalSelectsByDefault() > 0) {
var options = GetOperationOptionsBuilder.create().item(F_ASSIGNMENT).dontRetrieve().build();
var user = repositoryService.getObject(UserType.class, user1Oid, options, createOperationResult());
assertThat(user.asObjectable().getAssignment()).isEmpty();
}
}

// region reference search
Expand Down

0 comments on commit d38cb9e

Please sign in to comment.