Skip to content

Commit

Permalink
adding test for search broken resource using type filter
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Aug 23, 2022
1 parent 485ddeb commit d5c8188
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import java.util.Collection;
import java.util.List;

import com.evolveum.midpoint.prism.query.ObjectFilter;

import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -554,6 +556,42 @@ public void test357SearchResourceWrongConnectorOid() throws Exception {
assertEquals("Expected partial error in fetchResult", OperationResultStatusType.PARTIAL_ERROR, fetchResult.getStatus());
}

@Test(enabled = false)
public void test358SearchResourceWrongConnectorOidUseTypeFilter() throws Exception {
Task task = getTestTask();
OperationResult result = task.getResult();

when("searching for broken resource");
ObjectFilter filter = queryFor(ResourceType.class)
.id(RESOURCE_DUMMY_WRONG_CONNECTOR_OID_OID)
.buildFilter();
List<PrismObject<AssignmentHolderType>> resources =
modelService.searchObjects(
AssignmentHolderType.class,
queryFor(AssignmentHolderType.class)
.type(ResourceType.class)
.filter(filter)
.build(),
null,
task,
result);

then("single resource is found");
displayCollection("resources", resources);
assertThat(resources).as("resources").hasSize(1);
PrismObject<AssignmentHolderType> resource = resources.get(0);

and("status is partial error");
result.computeStatus();
display("searchObjects result", result);
assertEquals("Expected partial error in result", OperationResultStatus.PARTIAL_ERROR, result.getStatus());

and("fetchResult contains an error");
OperationResultType fetchResult = resource.asObjectable().getFetchResult();
display("resource.fetchResult", fetchResult);
assertEquals("Expected partial error in fetchResult", OperationResultStatusType.PARTIAL_ERROR, fetchResult.getStatus());
}

@Test
public void test359DeleteResourceWrongConnectorOid() throws Exception {
// GIVEN
Expand Down

0 comments on commit d5c8188

Please sign in to comment.