Skip to content

Commit

Permalink
schrodinger: started with labs tests resources restructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Jan 19, 2021
1 parent f3a2da4 commit 545e01d
Show file tree
Hide file tree
Showing 15 changed files with 1,082 additions and 2 deletions.
Expand Up @@ -29,7 +29,7 @@ public class AbstractLabTest extends AbstractSchrodingerTest {
protected static final String LAB_SOURCES_DIRECTORY = LAB_DIRECTORY + "sources/";

protected static final File EXTENSION_SCHEMA_FILE = new File(LAB_DIRECTORY +"schema/extension-example.xsd");
protected static final File CSV_1_SIMPLE_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access-simple.xml");
protected File CSV_1_SIMPLE_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access-simple.xml");
protected static final File CSV_1_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access.xml");
protected static final File CSV_1_SOURCE_FILE = new File(LAB_SOURCES_DIRECTORY + "csv-1.csv");
protected static final File CSV_1_SOURCE_FILE_7_3 = new File(LAB_SOURCES_DIRECTORY + "csv-1-7-3.csv");
Expand Down Expand Up @@ -103,7 +103,7 @@ public class AbstractLabTest extends AbstractSchrodingerTest {

protected File getTestTargetDir() throws IOException {
if (testTargetDir == null) {
initTestDirectory(DIRECTORY_CURRENT_TEST, false);
initTestDirectory(DIRECTORY_CURRENT_TEST, true);
}
return testTargetDir;
}
Expand Down
Expand Up @@ -44,6 +44,7 @@

public class M10ObjectTemplate extends AbstractLabTest{

protected static final String LAB_OBJECTS_DIRECTORY = LAB_DIRECTORY + "M10/";
private static final File OBJECT_TEMPLATE_USER_SIMPLE_FILE = new File(LAB_OBJECTS_DIRECTORY + "objectTemplate/object-template-example-user-simple.xml");
private static final File OBJECT_TEMPLATE_USER_FILE_10_3 = new File(LAB_OBJECTS_DIRECTORY + "objectTemplate/object-template-example-user-10-3.xml");
private static final File LOOKUP_EMP_STATUS_FILE = new File(LAB_OBJECTS_DIRECTORY + "lookupTables/lookup-emp-status.xml");
Expand Down
Expand Up @@ -27,6 +27,7 @@
public class M11SystemConfiguration extends AbstractLabTest {

private static final Logger LOG = LoggerFactory.getLogger(M11SystemConfiguration.class);
protected static final String LAB_OBJECTS_DIRECTORY = LAB_DIRECTORY + "M11/";

private static final File SYSTEM_CONFIGURATION_FILE_11_2 = new File(LAB_OBJECTS_DIRECTORY + "systemConfiguration/system-configuration-11-2.xml");
private static final File SYSTEM_CONFIGURATION_FILE_11_3 = new File(LAB_OBJECTS_DIRECTORY + "systemConfiguration/system-configuration-11-3.xml");
Expand Down
Expand Up @@ -33,6 +33,7 @@
public class M12Authorizations extends AbstractLabTest{

private static final Logger LOG = LoggerFactory.getLogger(M12Authorizations.class);
protected static final String LAB_OBJECTS_DIRECTORY = LAB_DIRECTORY + "M12/";

private static final File ROLE_BASIC_USER_FILE = new File(LAB_OBJECTS_DIRECTORY + "roles/role-basic-user.xml");
private static final File ROLE_BASIC_USER_FILE_12_1 = new File(LAB_OBJECTS_DIRECTORY + "roles/role-basic-user-12-1.xml");
Expand Down
Expand Up @@ -36,6 +36,12 @@

public class M3ResourcesAttributesAndMappingsTest extends AbstractLabTest {

private static final String LAB_OBJECTS_DIRECTORY = LAB_DIRECTORY + "M3/";
private static final File CSV_1_SIMPLE_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access-simple.xml");
private static final File NUMERIC_PIN_FIRST_NONZERO_POLICY_FILE = new File(LAB_OBJECTS_DIRECTORY + "valuePolicies/numeric-pin-first-nonzero-policy.xml");
private static final File CSV_2_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-2-canteen.xml");
protected static final File CSV_3_RESOURCE_FILE = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-3-ldap.xml");

@BeforeClass(alwaysRun = true, dependsOnMethods = { "springTestContextPrepareTestInstance" })
@Override
public void beforeClass() throws IOException {
Expand Down
Expand Up @@ -42,6 +42,7 @@
public class M4ProvisioningToResources extends AbstractLabTest {

private static final Logger LOG = LoggerFactory.getLogger(M4ProvisioningToResources.class);
protected static final String LAB_OBJECTS_DIRECTORY = LAB_DIRECTORY + "M4/";

private static final File CSV_1_RESOURCE_FILE_4_2 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access-4-2.xml");
private static final File CSV_3_RESOURCE_FILE_4_2 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-3-ldap-4-2.xml");
Expand Down
Expand Up @@ -49,6 +49,7 @@
public class M5AccountsAssignmentsAndRoles extends AbstractLabTest {

private static final Logger LOG = LoggerFactory.getLogger(M5AccountsAssignmentsAndRoles.class);
protected static final String LAB_OBJECTS_DIRECTORY = LAB_DIRECTORY + "M5/";

private static final File TOP_SECRET_I_ROLE_FILE = new File(LAB_OBJECTS_DIRECTORY + "roles/role-top-secret-i.xml");
private static final File CSV_1_RESOURCE_FILE_5_5 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access-5-5.xml");
Expand Down
Expand Up @@ -33,6 +33,7 @@
public class M6ConfiguringMultipleAccountTypes extends AbstractLabTest {

private static final Logger LOG = LoggerFactory.getLogger(M6ConfiguringMultipleAccountTypes.class);
protected static final String LAB_OBJECTS_DIRECTORY = LAB_DIRECTORY + "M6/";

private static final File CSV_1_RESOURCE_FILE_6_1 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-1-document-access-6-1.xml");
private static final File CSV_3_RESOURCE_FILE_6_1 = new File(LAB_OBJECTS_DIRECTORY + "resources/localhost-csvfile-3-ldap-6-1.xml");
Expand Down
Expand Up @@ -37,6 +37,7 @@

public class M7SynchronizationFlavours extends AbstractLabTest{

protected static final String LAB_OBJECTS_DIRECTORY = LAB_DIRECTORY + "M7/";
private static final Logger LOG = LoggerFactory.getLogger(M7SynchronizationFlavours.class);

@BeforeClass(alwaysRun = true, dependsOnMethods = { "springTestContextPrepareTestInstance" })
Expand Down
Expand Up @@ -33,6 +33,7 @@

public class M8ExtendingMidPointXMLSchema extends AbstractLabTest {

protected static final String LAB_OBJECTS_DIRECTORY = LAB_DIRECTORY + "M8/";

@BeforeClass(alwaysRun = true, dependsOnMethods = { "springTestContextPrepareTestInstance" })
@Override
Expand Down
Expand Up @@ -30,6 +30,7 @@

public class M9OrganizationalStructure extends AbstractLabTest{

protected static final String LAB_OBJECTS_DIRECTORY = LAB_DIRECTORY + "M9/";

@BeforeClass(alwaysRun = true, dependsOnMethods = { "springTestContextPrepareTestInstance" })
@Override
Expand Down
@@ -0,0 +1,208 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2019 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<c:objects xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3">
<c:resource oid="10000000-9999-9999-0000-a000ff000002">
<c:name>CSV-1 (Document Access)</c:name>
<connectorRef type="ConnectorType">
<filter>
<q:equal>
<q:path>c:connectorType</q:path>
<q:value>com.evolveum.polygon.connector.csv.CsvConnector</q:value>
</q:equal>
</filter>
</connectorRef>
<c:connectorConfiguration>
<icfc:configurationProperties xmlns:icfcsv="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/com.evolveum.polygon.connector-csv/com.evolveum.polygon.connector.csv.CsvConnector">
<icfcsv:filePath>/opt/training/midpoint-labs/flatfiles/csv-1.csv</icfcsv:filePath>
<icfcsv:encoding>utf-8</icfcsv:encoding>
<icfcsv:quoteMode>ALL</icfcsv:quoteMode>
<icfcsv:quote>"</icfcsv:quote>
<icfcsv:fieldDelimiter>,</icfcsv:fieldDelimiter>
<icfcsv:multivalueDelimiter>;</icfcsv:multivalueDelimiter>
<icfcsv:uniqueAttribute>login</icfcsv:uniqueAttribute>
<icfcsv:passwordAttribute>password</icfcsv:passwordAttribute>
</icfc:configurationProperties>
</c:connectorConfiguration>
<schemaHandling>
<objectType>
<kind>account</kind>
<intent>default</intent>
<displayName>Default Account</displayName>
<default>true</default>
<objectClass>ri:AccountObjectClass</objectClass>
<attribute>
<ref>ri:login</ref>
<displayName>Login</displayName>
<limitations>
<minOccurs>0</minOccurs>
</limitations>
<outbound>
<source>
<path>name</path>
</source>
</outbound>
</attribute>
<attribute>
<ref>ri:enumber</ref>
<displayName>Employee Number</displayName>
<description>Definition of Employee Number attribute handling.</description>
<outbound>
<source>
<path>employeeNumber</path>
</source>
</outbound>
</attribute>
<attribute>
<ref>ri:fname</ref>
<displayName>First name</displayName>
<description>Definition of Firstname attribute handling.</description>
<outbound>
<source>
<path>givenName</path>
</source>
</outbound>
</attribute>
<attribute>
<ref>ri:lname</ref>
<displayName>Last name</displayName>
<description>Definition of Lastname attribute handling.</description>
<outbound>
<source>
<path>familyName</path>
</source>
</outbound>
</attribute>
<attribute>
<ref>ri:dep</ref>
<displayName>Department</displayName>
<description>Definition of Department attribute handling.</description>
<outbound>
<source>
<path>organizationalUnit</path>
</source>
</outbound>
</attribute>
<attribute>
<ref>ri:groups</ref>
<displayName>Groups</displayName>
<description>Definition of Group attribute handling.</description>
<limitations>
<minOccurs>0</minOccurs>
<maxOccurs>unbounded</maxOccurs>
</limitations>
<tolerant>false</tolerant> <!-- For also removing group values when recalculating -->
</attribute>
<protected>
<filter>
<q:equal>
<q:matching>http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase</q:matching>
<q:path>attributes/ri:login</q:path>
<q:value>admin</q:value>
</q:equal>
</filter>
</protected>
<activation>
<administrativeStatus>
<outbound>
</outbound>
</administrativeStatus>
</activation>
<credentials>
<password>
<outbound/>
</password>
</credentials>
</objectType>
</schemaHandling>
<capabilities xmlns:cap="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3">
<configured>
<cap:activation>
<cap:status>
<cap:attribute>ri:dis</cap:attribute>
<cap:enableValue>false</cap:enableValue>
<cap:disableValue>true</cap:disableValue>
</cap:status>
</cap:activation>
<cap:countObjects>
<cap:simulate>sequentialSearch</cap:simulate>
</cap:countObjects>
</configured>
</capabilities>
<synchronization>
<objectSynchronization>
<name>Default account</name>
<description>The default account name does NOT start with "_"</description>
<kind>account</kind>
<intent>default</intent>
<enabled>true</enabled>
<condition>
<script>
<code>
name = basic.getAttributeValue(projection, "login")
return !name?.startsWith('_')
</code>
</script>
</condition>
<correlation>
<q:description>
Correlation expression is a search query.
Following search queury will look for users that have "employeeNumber"
equal to the "enumber" attribute of the account.
The condition will ensure that "enumber" is not
empty, otherwise it would match any midPoint user
with empty "employeeNumber" attribute, such as "administrator".
The correlation rule by default looks for users, so it will not match
any other object type.
</q:description>
<q:equal>
<q:path>c:employeeNumber</q:path>
<expression>
<path>$projection/attributes/ri:enumber</path>
</expression>
</q:equal>
<condition>
<script>
<code>basic.getAttributeValue(projection, 'enumber') != null</code>
</script>
</condition>
</correlation>
<reaction>
<situation>linked</situation>
<synchronize>true</synchronize>
</reaction>
<reaction>
<situation>deleted</situation>
<synchronize>true</synchronize>
<action>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#unlink</handlerUri>
</action>
</reaction>
<reaction>
<situation>unlinked</situation>
<synchronize>true</synchronize>
<action>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#link</handlerUri>
</action>
</reaction>
<reaction>
<situation>unmatched</situation>
<synchronize>true</synchronize>
<action>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#inactivateShadow</handlerUri>
</action>
</reaction>
</objectSynchronization>
</synchronization>
</c:resource>
</c:objects>

0 comments on commit 545e01d

Please sign in to comment.