Skip to content

Commit

Permalink
schrodinger: configured search attributes test
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Nov 2, 2020
1 parent fb8c287 commit 76212f1
Show file tree
Hide file tree
Showing 4 changed files with 262 additions and 1 deletion.
Expand Up @@ -43,6 +43,9 @@ public class SearchPanelTest extends AbstractSchrodingerTest {
private static final File SEARCH_BY_ROLE_MEMBERSHIP_OID_ROLE_FILE = new File(COMPONENT_ROLES_DIRECTORY + "role-membership-search-by-oid.xml");
private static final File SEARCH_BY_ROLE_MEMBERSHIP_TYPE_ORG_FILE = new File(COMPONENT_ORGS_DIRECTORY + "org-membership-search-by-type.xml");
private static final File SEARCH_BY_ROLE_MEMBERSHIP_RELATIONS_ROLE_FILE = new File(COMPONENT_ROLES_DIRECTORY + "role-membership-search-by-relation.xml");
private static final File SYSTEM_CONFIG_WITH_CONFIGURED_USER_SEARCH = new File("./src/test/resources/configuration/objects/systemconfig/system-configuration-with-configured-user-search.xml");
private static final File USER_WITH_EMPLOYEE_NUMBER_FILE = new File(COMPONENT_USERS_DIRECTORY + "user-with-employee-number.xml");
private static final File USER_WITH_EMAIL_ADDRESS_FILE = new File(COMPONENT_USERS_DIRECTORY + "user-with-email-address.xml");

private static final String NAME_ATTRIBUTE = "Name";
private static final String GIVEN_NAME_ATTRIBUTE = "Given name";
Expand All @@ -57,7 +60,8 @@ protected List<File> getObjectListToImport(){
return Arrays.asList(SEARCH_BY_NAME_USER_FILE, SEARCH_BY_GIVEN_NAME_USER_FILE, SEARCH_BY_FAMILY_NAME_USER_FILE,
REQUESTABLE_ROLE_FILE, DISABLED_ROLE_FILE, SEARCH_BY_ROLE_MEMBERSHIP_NAME_USER_FILE, SEARCH_BY_ROLE_MEMBERSHIP_OID_USER_FILE,
SEARCH_BY_ROLE_MEMBERSHIP_TYPE_USER_FILE, SEARCH_BY_ROLE_MEMBERSHIP_RELATION_USER_FILE, SEARCH_BY_ROLE_MEMBERSHIP_NAME_ROLE_FILE,
SEARCH_BY_ROLE_MEMBERSHIP_OID_ROLE_FILE, SEARCH_BY_ROLE_MEMBERSHIP_TYPE_ORG_FILE, SEARCH_BY_ROLE_MEMBERSHIP_RELATIONS_ROLE_FILE);
SEARCH_BY_ROLE_MEMBERSHIP_OID_ROLE_FILE, SEARCH_BY_ROLE_MEMBERSHIP_TYPE_ORG_FILE, SEARCH_BY_ROLE_MEMBERSHIP_RELATIONS_ROLE_FILE,
SYSTEM_CONFIG_WITH_CONFIGURED_USER_SEARCH, USER_WITH_EMPLOYEE_NUMBER_FILE, USER_WITH_EMAIL_ADDRESS_FILE);
}

@Test
Expand Down Expand Up @@ -183,4 +187,22 @@ public void test0080referenceAttributeByNameSearch() {
Assert.assertTrue(search.byItemName(ROLE_MEMBERSHIP_ATTRIBUTE).matchRefSearchFieldValue(REF_SEARCH_FIELD_VALUE));
}

@Test
public void test0090configuredAttributesSearch() {
UsersPageTable table = basicPage.listUsers().table();
Search<UsersPageTable> search = (Search<UsersPageTable>) table.search();
search.byItemName("By employee number", false)
.inputValue("544")
.updateSearch();
Assert.assertEquals(table.countTableObjects(), 1);
Assert.assertTrue(table.containsLinksTextPartially("searchByEmployeeNumberUser"));

search.clearTextSearchItemByNameAndUpdate("By employee number");
search.byItemName("By email", false)
.inputValue("testEmailAddress@test.com")
.updateSearch();
Assert.assertEquals(table.countTableObjects(), 1);
Assert.assertTrue(table.containsLinksTextPartially("searchByEmailAddressUser"));
}

}
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2020 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->

<user oid="f3bbfd5e-f237-4772-94sd-18gr3d6e4gaa"
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3">
<name>searchByEmailAddressUser</name>
<emailAddress>testEmailAddress@test.com</emailAddress>
</user>

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2020 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->

<user oid="1k0ffd5e-f445-4772-9nn3-18ljcd6ed4aa"
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3">
<name>searchByEmployeeNumberUser</name>
<employeeNumber>544</employeeNumber>
</user>

@@ -0,0 +1,211 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2018 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<systemConfiguration xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:org="http://midpoint.evolveum.com/xml/ns/public/common/org-3"
oid="00000000-0000-0000-0000-000000000001">
<name>SystemConfiguration</name>
<globalSecurityPolicyRef xmlns:tns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" oid="00000000-0000-0000-0000-000000000120" relation="org:default" type="tns:SecurityPolicyType">
<!-- Default Security Policy -->
</globalSecurityPolicyRef>
<logging>
<classLogger id="1">
<level>ERROR</level>
<package>ro.isdc.wro.extensions.processor.css.Less4jProcessor</package>
</classLogger>
<classLogger id="2">
<level>OFF</level>
<package>org.hibernate.engine.jdbc.spi.SqlExceptionHelper</package>
</classLogger>
<classLogger id="3">
<level>OFF</level>
<package>org.hibernate.engine.jdbc.batch.internal.BatchingBatch</package>
</classLogger>
<classLogger id="4">
<level>WARN</level>
<package>org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl</package>
</classLogger>
<classLogger id="5">
<level>OFF</level>
<package>org.hibernate.internal.ExceptionMapperStandardImpl</package>
</classLogger>
<classLogger id="6">
<level>OFF</level>
<package>net.sf.jasperreports.engine.fill.JRFillDataset</package>
</classLogger>
<classLogger id="7">
<level>WARN</level>
<package>org.apache.wicket.resource.PropertiesFactory</package>
</classLogger>
<classLogger id="8">
<level>ERROR</level>
<package>org.springframework.context.support.ResourceBundleMessageSource</package>
</classLogger>
<classLogger id="9">
<level>INFO</level>
<package>com.evolveum.midpoint.model.impl.lens.projector.Projector</package>
</classLogger>
<classLogger id="10">
<level>INFO</level>
<package>com.evolveum.midpoint.model.impl.lens.Clockwork</package>
</classLogger>
<appender xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="11" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xsi:type="c:FileAppenderConfigurationType">
<pattern>%date [%X{subsystem}] [%thread] %level \(%logger\): %msg%n</pattern>
<name>MIDPOINT_LOG</name>
<fileName>${midpoint.home}/log/midpoint.log</fileName>
<filePattern>${midpoint.home}/log/midpoint-%d{yyyy-MM-dd}.%i.log</filePattern>
<maxHistory>10</maxHistory>
<maxFileSize>100MB</maxFileSize>
<append>true</append>
</appender>
<appender xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="12" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xsi:type="c:FileAppenderConfigurationType">
<pattern>%date %level: %msg%n</pattern>
<name>MIDPOINT_PROFILE_LOG</name>
<fileName>${midpoint.home}/log/midpoint-profile.log</fileName>
<filePattern>${midpoint.home}/log/midpoint-profile-%d{yyyy-MM-dd}.%i.log</filePattern>
<maxHistory>10</maxHistory>
<maxFileSize>100MB</maxFileSize>
<append>true</append>
</appender>
<rootLoggerAppender>MIDPOINT_LOG</rootLoggerAppender>
<rootLoggerLevel>INFO</rootLoggerLevel>
<auditing>
<enabled>false</enabled>
<details>false</details>
</auditing>
</logging>
<cleanupPolicy>
<auditRecords>
<maxAge>P3M</maxAge>
</auditRecords>
<closedTasks>
<maxAge>P1M</maxAge>
</closedTasks>
</cleanupPolicy>
<internals>
<tracing>
<profile id="13">
<name>performance</name>
<displayName>Performance tracing</displayName>
<visible>true</visible>
<default>true</default>
<fileNamePattern>performance-trace %{timestamp} %{focusName} %{milliseconds}</fileNamePattern>
<createRepoObject>true</createRepoObject>
<compressOutput>true</compressOutput>
</profile>
<profile id="14">
<name>functional</name>
<displayName>Functional tracing</displayName>
<visible>true</visible>
<fileNamePattern>functional-trace %{timestamp} %{focusName}</fileNamePattern>
<createRepoObject>true</createRepoObject>
<compressOutput>true</compressOutput>
<collectLogEntries>true</collectLogEntries>
<tracingTypeProfile id="17">
<level>normal</level>
</tracingTypeProfile>
</profile>
<profile id="15">
<name>functional-model-logging</name>
<displayName>Functional tracing (with model logging)</displayName>
<visible>true</visible>
<fileNamePattern>functional-trace %{timestamp} %{focusName}</fileNamePattern>
<createRepoObject>true</createRepoObject>
<compressOutput>true</compressOutput>
<collectLogEntries>true</collectLogEntries>
<loggingOverride>
<levelOverride id="18">
<logger>com.evolveum.midpoint.model</logger>
<level>TRACE</level>
</levelOverride>
</loggingOverride>
<tracingTypeProfile id="19">
<level>normal</level>
</tracingTypeProfile>
</profile>
<profile id="16">
<name>functional-sql-logging</name>
<displayName>Functional tracing (with SQL logging)</displayName>
<visible>true</visible>
<fileNamePattern>functional-trace %{timestamp} %{focusName}</fileNamePattern>
<createRepoObject>true</createRepoObject>
<compressOutput>true</compressOutput>
<collectLogEntries>true</collectLogEntries>
<loggingOverride>
<levelOverride id="20">
<logger>org.hibernate.SQL</logger>
<level>TRACE</level>
</levelOverride>
</loggingOverride>
<tracingTypeProfile id="21">
<level>normal</level>
</tracingTypeProfile>
</profile>
</tracing>
</internals>
<adminGuiConfiguration>
<userDashboardLink id="22">
<targetUrl>/self/profile</targetUrl>
<label>Profile</label>
<description>View/edit your profile</description>
<icon>
<cssClass>fa fa-user</cssClass>
</icon>
<color>green</color>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfProfile</authorization>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfAll</authorization>
</userDashboardLink>
<userDashboardLink id="23">
<targetUrl>/self/credentials</targetUrl>
<label>Credentials</label>
<description>View/edit your credentials</description>
<icon>
<cssClass>fa fa-shield</cssClass>
</icon>
<color>blue</color>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfCredentials</authorization>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#selfAll</authorization>
</userDashboardLink>
<userDashboardLink id="24">
<targetUrl>/admin/users</targetUrl>
<label>List users</label>
<icon>
<cssClass>fa fa-users</cssClass>
</icon>
<color>red</color>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#users</authorization>
</userDashboardLink>
<userDashboardLink id="25">
<targetUrl>/admin/resources</targetUrl>
<label>List resources</label>
<icon>
<cssClass>fa fa-database</cssClass>
</icon>
<color>purple</color>
<authorization>http://midpoint.evolveum.com/xml/ns/public/security/authorization-ui-3#resources</authorization>
</userDashboardLink>
<objectCollectionViews>
<objectCollectionView>
<identifier>user-search-config</identifier>
<searchBoxConfiguration>
<searchItems>
<searchItem id="881">
<c:path xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3">c:employeeNumber</c:path>
<displayName>By employee number</displayName>
</searchItem>
<searchItem id="882">
<c:path xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3">c:emailAddress</c:path>
<displayName>By email</displayName>
</searchItem>
</searchItems>
</searchBoxConfiguration>
<type>c:UserType</type>
</objectCollectionView>
</objectCollectionViews>
</adminGuiConfiguration>
</systemConfiguration>

0 comments on commit 76212f1

Please sign in to comment.