Skip to content

Commit

Permalink
Adapt TestResources to changes in ResourceManager
Browse files Browse the repository at this point in the history
There is a slight increase in resource object clone counts
(most probably harmless) and a re-arrangement in schema parsing
operations.
  • Loading branch information
mederly committed Dec 27, 2019
1 parent ed97892 commit 39752b6
Showing 1 changed file with 8 additions and 7 deletions.
Expand Up @@ -175,7 +175,7 @@ public void test050GetResourceRaw() throws Exception {

display("Resource", resource);

assertCounterIncrement(InternalCounters.PRISM_OBJECT_CLONE_COUNT, 0);
assertCounterIncrement(InternalCounters.PRISM_OBJECT_CLONE_COUNT, 2);

assertResourceDummy(resource, false);

Expand Down Expand Up @@ -382,7 +382,7 @@ public void test100SearchResourcesNoFetch() throws Exception {

assertSuccess(result);

assertCounterIncrement(InternalCounters.PRISM_OBJECT_CLONE_COUNT, 4);
assertCounterIncrement(InternalCounters.PRISM_OBJECT_CLONE_COUNT, 8);

for (PrismObject<ResourceType> resource: resources) {
assertResource(resource, false);
Expand Down Expand Up @@ -1043,7 +1043,8 @@ public void handleGlobalError(OperationResult currentResult) {
});
}

public void modifyConfigurationDiffExpressionRaw(final String TEST_NAME, FailableFunction<String, PrismObject<ResourceType>> parser) throws Exception {
private void modifyConfigurationDiffExpressionRaw(final String TEST_NAME,
FailableFunction<String, PrismObject<ResourceType>> parser) throws Exception {
displayTestTitle(TEST_NAME);

Task task = createTask(TEST_NAME);
Expand Down Expand Up @@ -1086,16 +1087,16 @@ public void modifyConfigurationDiffExpressionRaw(final String TEST_NAME, Failabl
assertCounterIncrement(InternalCounters.CONNECTOR_INSTANCE_CONFIGURATION_COUNT, 1);
assertCounterIncrement(InternalCounters.RESOURCE_SCHEMA_FETCH_COUNT, 1);
assertCounterIncrement(InternalCounters.CONNECTOR_CAPABILITIES_FETCH_COUNT, 1);
assertCounterIncrement(InternalCounters.RESOURCE_SCHEMA_PARSE_COUNT, 1);
assertCounterIncrement(InternalCounters.RESOURCE_SCHEMA_PARSE_COUNT, 2);

PrismObject<ResourceType> resourceAfter = modelService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, null, task, result);
display("Resource after", resourceAfter);

assertEquals("Wrong default useless string", IntegrationTestTools.CONST_USELESS, dummyResource.getUselessString());

// TODO: strictly speaking, this should not be necessary.
// But now the schema is re-parsed a bit more than is needed
assertCounterIncrement(InternalCounters.RESOURCE_SCHEMA_PARSE_COUNT, 1);
// The resource is already cached (along with the parsed schema) as a result of "modify availability state" action
// in testConnection operation.
assertCounterIncrement(InternalCounters.RESOURCE_SCHEMA_PARSE_COUNT, 0);
}

private ObjectDelta<ResourceType> createConfigurationPropertyDelta(QName elementQName, String newValue) {
Expand Down

0 comments on commit 39752b6

Please sign in to comment.