Skip to content

Commit

Permalink
Re-fix story tests
Browse files Browse the repository at this point in the history
(Some of them already imported marks by themselves.)
  • Loading branch information
mederly committed Mar 1, 2023
1 parent f05e0e1 commit 49d0e78
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
repoAddObjectFromFile(ROLE_SUPERUSER_FILE, initResult);
login(userAdministrator);

if (areMarksSupported()) {
CommonInitialObjects.ARCHETYPE_OBJECT_MARK.init(this, initTask, initResult);
CommonInitialObjects.MARK_PROTECTED.init(this, initTask, initResult);
}
CommonInitialObjects.addMarks(this, initTask, initResult);

assumeAssignmentPolicy(AssignmentPolicyEnforcementType.RELATIVE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,6 @@ protected File getSystemConfigurationFile() {
return SYSTEM_CONFIGURATION_FILE;
}

@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
super.initSystem(initTask, initResult);
if (!isNativeRepository()) {
return;
}
CommonInitialObjects.addMarks(this, initTask, initResult);
}

/**
* Ref: _Step I: Connect; point 6 "I may now list the accounts in the resource through midPoint to see which data I have"_
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import java.util.List;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.test.TestObject;

import org.apache.commons.lang3.BooleanUtils;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
Expand Down Expand Up @@ -47,7 +49,8 @@ public class TestMapleLeaf extends AbstractStoryTest {

private static final File SYSTEM_CONFIGURATION_FILE = new File(TEST_DIR, "system-configuration.xml");

private static final File SECURITY_POLICY_FILE = new File(TEST_DIR, "security-policy.xml");
private static final TestObject<?> SECURITY_POLICY =
TestObject.file(TEST_DIR, "security-policy.xml", "00000000-0000-0000-0000-000000000120");

private static final File RESOURCE_OPENDJ_FILE = new File(TEST_DIR, "resource-opendj.xml");
private static final String RESOURCE_OPENDJ_OID = "10000000-0000-0000-0000-000000000000";
Expand Down Expand Up @@ -106,9 +109,16 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
importObjectFromFile(ROLE_MAPLE_LEAF_GRADUATE);
importObjectFromFile(ROLE_META_MONKEY_DONKEY);
importObjectFromFile(ROLE_SQUIRREL_FILE);
importObjectFromFile(SECURITY_POLICY_FILE);
SECURITY_POLICY.init(this, initTask, initResult);
importObjectFromFile(OBJECT_TEMPLATE_USER);

executeChanges(
List.of(
deltaFor(SystemConfigurationType.class)
.item(SystemConfigurationType.F_GLOBAL_SECURITY_POLICY_REF)
.replace(SECURITY_POLICY.ref())
.asObjectDelta(SystemObjectsType.SYSTEM_CONFIGURATION.value())),
null, initTask, initResult);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,6 @@ public static void stopResources() {
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
super.initSystem(initTask, initResult);

if (isNativeRepository()) {
CommonInitialObjects.addMarks(this, initTask, initResult);
}

reconciliationTaskResultListener = new DebugReconciliationResultListener();
reconciliationActivityHandler.setReconciliationResultListener(reconciliationTaskResultListener);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@
<useLegacyApproversSpecification>never</useLegacyApproversSpecification>
<useDefaultApprovalPolicyRules>never</useDefaultApprovalPolicyRules>
</workflowConfiguration>
<globalSecurityPolicyRef oid="00000000-0000-0000-0000-000000000120" type="SecurityPolicyType"/>
<!-- Set later, because missing object 120 causes problems on startup; for some strange reasons, on native repo only! -->
<!--<globalSecurityPolicyRef oid="00000000-0000-0000-0000-000000000120" type="SecurityPolicyType"/>-->
</systemConfiguration>

0 comments on commit 49d0e78

Please sign in to comment.