Skip to content

Commit

Permalink
Attempts to reproduce ConnId thread issues (MID-5099). Not successful.
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Feb 7, 2019
1 parent e6ef3a9 commit 7ce1f01
Show file tree
Hide file tree
Showing 9 changed files with 572 additions and 2 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2017 Evolveum
* Copyright (c) 2010-2019 Evolveum
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -583,6 +583,15 @@ public static <T> T getExtensionItemRealValue(@Nullable ExtensionType extension,
Item item = extension.asPrismContainerValue().findItem(ItemName.fromQName(itemName));
return item != null ? (T) item.getRealValue() : null;
}

public static <T> T getExtensionItemRealValue(@NotNull PrismObject<? extends ObjectType> object, @NotNull QName itemName) {
PrismContainer<?> extension = object.getExtension();
if (extension == null) {
return null;
}
Item item = extension.findItem(ItemName.fromQName(itemName));
return item != null ? (T) item.getRealValue() : null;
}

public static void normalizeRelation(ObjectReferenceType reference, RelationRegistry relationRegistry) {
if (reference != null) {
Expand Down
Expand Up @@ -754,11 +754,12 @@ public void addEntry(Entry ldapEntry) {
}
}

public void addEntry(String ldif) throws IOException, LDIFException {
public Entry addEntry(String ldif) throws IOException, LDIFException {
LDIFImportConfig importConfig = new LDIFImportConfig(IOUtils.toInputStream(ldif, "utf-8"));
LDIFReader ldifReader = new LDIFReader(importConfig);
Entry ldifEntry = ldifReader.readEntry();
addEntry(ldifEntry);
return ldifEntry;
}

public ChangeRecordEntry executeRenameChange(File file) throws LDIFException, IOException{
Expand Down
Expand Up @@ -3134,6 +3134,10 @@ protected OperationResult waitForTaskNextRunAssertSuccess(Task origTask, final b
return taskResult;
}

protected OperationResult waitForTaskNextRun(final String taskOid) throws Exception {
return waitForTaskNextRun(taskOid, false, DEFAULT_TASK_WAIT_TIMEOUT, false);
}

protected OperationResult waitForTaskNextRun(final String taskOid, final boolean checkSubresult, final int timeout) throws Exception {
return waitForTaskNextRun(taskOid, checkSubresult, timeout, false);
}
Expand Down
10 changes: 10 additions & 0 deletions testing/story/src/test/resources/ldap-sync-massive/kraken.ldif
@@ -0,0 +1,10 @@
dn: uid=kraken,ou=People,dc=example,dc=com
uid: kraken
cn: Kraken Krakenoff
sn: Kraken
givenname: Krakenoff
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson

@@ -0,0 +1,249 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2019 Evolveum
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->

<!-- Modified OpenDJ configuration to cause troubles.
* Setting insanenly low operation timeout. -->

<resource oid="10000000-0000-0000-0000-000000000003"
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
xmlns:mr="http://prism.evolveum.com/xml/ns/public/matching-rule-3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"
xmlns:func="http://midpoint.evolveum.com/xml/ns/public/function/basic-3"
xmlns:ext="http://midpoint.evolveum.com/xml/ns/story/orgsync/ext">

<name>Embedded Test OpenDJ</name>

<connectorRef type="ConnectorType">
<description>Dummy description, just for the test</description>
<filter>
<q:equal>
<q:path>c:connectorType</q:path>
<q:value>com.evolveum.polygon.connector.ldap.LdapConnector</q:value>
</q:equal>
</filter>
</connectorRef>

<connectorConfiguration xmlns:icfcldap="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/bundle/com.evolveum.polygon.connector-ldap/com.evolveum.polygon.connector.ldap.LdapConnector">

<icfc:configurationProperties>
<icfcldap:port>10389</icfcldap:port>
<icfcldap:host>localhost</icfcldap:host>
<icfcldap:baseContext>dc=example,dc=com</icfcldap:baseContext>
<icfcldap:bindDn>cn=directory manager</icfcldap:bindDn>
<icfcldap:bindPassword><t:clearValue>secret</t:clearValue></icfcldap:bindPassword>
<icfcldap:pagingStrategy>auto</icfcldap:pagingStrategy>
<icfcldap:vlvSortAttribute>entryUUID</icfcldap:vlvSortAttribute>
<icfcldap:operationalAttributes>ds-pwp-account-disabled</icfcldap:operationalAttributes>
<icfcldap:operationalAttributes>isMemberOf</icfcldap:operationalAttributes>
</icfc:configurationProperties>

<icfc:resultsHandlerConfiguration>
<icfc:enableNormalizingResultsHandler>false</icfc:enableNormalizingResultsHandler>
<icfc:enableFilteredResultsHandler>false</icfc:enableFilteredResultsHandler>
<icfc:enableAttributesToGetSearchResultsHandler>false</icfc:enableAttributesToGetSearchResultsHandler>
</icfc:resultsHandlerConfiguration>

<icfc:connectorPoolConfiguration>
<icfc:maxIdle>1</icfc:maxIdle>
<icfc:maxObjects>3</icfc:maxObjects>
</icfc:connectorPoolConfiguration>

<icfc:timeouts>
<icfc:get>1</icfc:get>
</icfc:timeouts>

</connectorConfiguration>

<schemaHandling>

<objectType>
<kind>account</kind>
<intent>default</intent>
<displayName>Default Account</displayName>
<default>true</default>
<objectClass>ri:inetOrgPerson</objectClass>
<attribute>
<ref>ri:dn</ref>
<displayName>Distinguished Name</displayName>
<outbound>
<!-- Name cannot be weak. Changes in name trigger object rename. -->
<source>
<path>$user/name</path>
</source>
<expression>
<script>
<code>
basic.composeDnWithSuffix('uid', name, 'ou=people,dc=example,dc=com')
</code>
</script>
</expression>
</outbound>
</attribute>

<attribute>
<ref>ri:cn</ref>
<displayName>Common Name</displayName>
<outbound>
<source>
<path>fullName</path>
</source>
</outbound>
<inbound>
<strength>weak</strength>
<target>
<path>fullName</path>
</target>
</inbound>
</attribute>

<attribute>
<ref>ri:sn</ref>
<outbound>
<source>
<path>familyName</path>
</source>
</outbound>
<inbound>
<strength>weak</strength>
<target>
<path>familyName</path>
</target>
</inbound>
</attribute>

<attribute>
<ref>ri:givenName</ref>
<outbound>
<source>
<path>givenName</path>
</source>
</outbound>
<inbound>
<strength>weak</strength>
<target>
<path>givenName</path>
</target>
</inbound>
</attribute>

<attribute>
<ref>ri:uid</ref>
<outbound>
<!-- This MUST be weak in case of OpenDJ. If DN (name) is changed then the uid will be changed
as a side-effect as it is a naming attribute. -->
<strength>weak</strength>
<source>
<path>$user/name</path>
</source>
</outbound>
<inbound>
<strength>weak</strength>
<target>
<path>name</path>
</target>
</inbound>
</attribute>

<protected>
<filter>
<q:equal>
<q:matching>http://prism.evolveum.com/xml/ns/public/matching-rule-3#stringIgnoreCase</q:matching>
<q:path>attributes/ri:dn</q:path>
<q:value>uid=idm,ou=Administrators,dc=example,dc=com</q:value>
</q:equal>
</filter>
</protected>

<activation>
<administrativeStatus>
<outbound/>
<inbound/>
</administrativeStatus>
</activation>

<!-- No credentails mapping to avoid "echos" in sync. -->

</objectType>

</schemaHandling>

<capabilities>
<configured xmlns:cap="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3">
<cap:activation>
<cap:status>
<cap:attribute>ri:ds-pwp-account-disabled</cap:attribute>
<cap:enableValue/>
<cap:disableValue>true</cap:disableValue>
</cap:status>
</cap:activation>
</configured>
</capabilities>

<synchronization>
<objectSynchronization>
<enabled>true</enabled>
<objectClass>ri:inetOrgPerson</objectClass>
<correlation>
<q:equal>
<q:path>
declare namespace c="http://midpoint.evolveum.com/xml/ns/public/common/common-3";
c:name
</q:path>
<expression>
<path>
declare namespace c="http://midpoint.evolveum.com/xml/ns/public/common/common-3";
declare namespace dj="http://midpoint.evolveum.com/xml/ns/public/resource/instance/ef2bc95b-76e0-59e2-86d6-3d4f02d3ffff";
$c:account/c:attributes/dj:uid
</path>
</expression>
</q:equal>
</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#addFocus</handlerUri>
</action>
</reaction>
</objectSynchronization>
</synchronization>

</resource>

0 comments on commit 7ce1f01

Please sign in to comment.