Skip to content

Commit

Permalink
AbstractIntegrationTest: better before-/after-method with test context
Browse files Browse the repository at this point in the history
MidpointTestMethodContext is used ALWAYS, but some cleanup of all the
integration tests is necessary.
Previously conditional autoTaskManagementEnabled is gone.
  • Loading branch information
virgo47 committed Feb 25, 2020
1 parent a3705d5 commit 5fa80ee
Show file tree
Hide file tree
Showing 20 changed files with 240 additions and 363 deletions.

Large diffs are not rendered by default.

Expand Up @@ -154,8 +154,6 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
initDummyResourcePirate(RESOURCE_DUMMY_EMPTY_INSTANCE_NAME, RESOURCE_DUMMY_EMPTY_FILE,
RESOURCE_DUMMY_EMPTY_OID, initTask, initResult);

setAutoTaskManagementEnabled(true);

if (FIRST_PART) {
createObjectsInFirstPart(false, initTask, initResult, null);
}
Expand Down
Expand Up @@ -50,8 +50,6 @@ public abstract class TestPasswordPolicyProcessor<F extends FocusType> extends A
@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
super.initSystem(initTask, initResult);

setAutoTaskManagementEnabled(true);
}

abstract Class<F> getType();
Expand Down
Expand Up @@ -79,16 +79,11 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
// setPredefinedTestMethodTracing(MODEL_LOGGING);
}

@Override
protected boolean isAutoTaskManagementEnabled() {
return true;
}

@Test
public void test005JackAttemptAssignRoleJudge() throws Exception {
Task task = getTask();
OperationResult result = getResult();

// GIVEN

LensContext<UserType> context = createUserLensContext();
Expand Down
Expand Up @@ -139,8 +139,6 @@ public void initSystem(Task initTask, OperationResult initResult)
throws Exception {
super.initSystem(initTask, initResult);

setAutoTaskManagementEnabled(true);

initDummyResource(RESOURCE_DUMMY_CIRCUS_NAME, RESOURCE_DUMMY_CIRCUS_FILE, RESOURCE_DUMMY_CIRCUS_OID, initTask, initResult);

getDummyResourceController(RESOURCE_DUMMY_RED_NAME).addAccount(ACCOUNT_GUYBRUSH_DUMMY_USERNAME, "Guybrush Threepwood", "Monkey Island");
Expand Down
Expand Up @@ -114,18 +114,13 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
repoAddObjectFromFile(USER_TEMPLATE_MAROONED_FILE, initResult);
repoAddObjectFromFile(USER_TEMPLATE_USELESS_FILE, initResult);
repoAdd(USER_TEMPLATE_MID_5892, initResult);

setDefaultObjectTemplate(UserType.COMPLEX_TYPE, USER_TEMPLATE_COMPLEX_OID, initResult);
setDefaultObjectTemplate(UserType.COMPLEX_TYPE, SUBTYPE_MAROONED, USER_TEMPLATE_MAROONED_OID, initResult);
setDefaultObjectTemplate(UserType.COMPLEX_TYPE, SUBTYPE_USELESS, USER_TEMPLATE_USELESS_OID, initResult);
setDefaultObjectTemplate(UserType.COMPLEX_TYPE, SUBTYPE_MID_5892, USER_TEMPLATE_MID_5892.oid, initResult);
}

@Override
protected boolean isAutoTaskManagementEnabled() {
return true;
}

protected int getNumberOfRoles() {
return super.getNumberOfRoles() + NUMBER_OF_IMPORTED_ROLES;
}
Expand Down
Expand Up @@ -69,11 +69,6 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
importObjectFromFile(RESOURCE_HR.file, initResult);
}

@Override
protected boolean isAutoTaskManagementEnabled() {
return true;
}

@Override
protected File getSystemConfigurationFile() {
return SYSTEM_CONFIGURATION_FILE;
Expand Down
Expand Up @@ -170,8 +170,6 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);

setDefaultObjectTemplate(UserType.COMPLEX_TYPE, USER_TYPE_CARTHESIAN, USER_TEMPLATE_CARTHESIAN_OID, initResult);

setAutoTaskManagementEnabled(true);
}

/**
Expand Down
Expand Up @@ -62,8 +62,6 @@ public class TestProgressReporting extends AbstractInitializedModelIntegrationTe
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
super.initSystem(initTask, initResult);

setAutoTaskManagementEnabled(true);

interruptedSyncResource = new DummyInterruptedSyncResource();
interruptedSyncResource.init(dummyResourceCollection, initTask, initResult);

Expand Down
Expand Up @@ -87,10 +87,6 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
addObject(ARCHETYPE_TASK_RECOMPUTATION, initTask, initResult);

assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL);

setAutoTaskManagementEnabled(true);

// DebugUtil.setDetailedDebugDump(true);
}

@Test
Expand Down
Expand Up @@ -39,7 +39,6 @@
import com.evolveum.midpoint.wf.util.ApprovalUtils;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
Expand Down Expand Up @@ -87,11 +86,6 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
super.initSystem(initTask, initResult);
}

@Override
protected boolean isAutoTaskManagementEnabled() {
return true;
}

protected File getSystemConfigurationFile() {
return SYSTEM_CONFIGURATION_FILE;
}
Expand Down
Expand Up @@ -112,11 +112,6 @@ protected File getSystemConfigurationFile() {
return SYSTEM_CONFIGURATION_FILE;
}

@Override
protected boolean isAutoTaskManagementEnabled() {
return true;
}

private PrismObject<UserType> createUserWill() throws SchemaException {
PrismObject<UserType> user = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(UserType.class).instantiate();
user.asObjectable()
Expand Down
Expand Up @@ -95,11 +95,6 @@ protected TracingProfileType getTestMethodTracingProfile() {
.fileNamePattern(TEST_METHOD_TRACING_FILENAME_PATTERN);
}

@Override
protected boolean isAutoTaskManagementEnabled() {
return true;
}

@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
// We need to switch off the encryption checks. Some values cannot be encrypted as we do
Expand Down

0 comments on commit 5fa80ee

Please sign in to comment.