Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide demo of a workaround for MID-6786
- Loading branch information
Showing
5 changed files
with
239 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
model/model-intest/src/test/resources/schema/containers.xsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
|
||
<!-- | ||
~ Copyright (c) 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. | ||
--> | ||
|
||
<xsd:schema elementFormDefault="qualified" | ||
targetNamespace="http://super.org/midpoint" | ||
xmlns:tns="http://super.org/midpoint" | ||
xmlns:a="http://prism.evolveum.com/xml/ns/public/annotation-3" | ||
xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
|
||
<xsd:import namespace="http://prism.evolveum.com/xml/ns/public/query-3"/> | ||
<xsd:import namespace="http://prism.evolveum.com/xml/ns/public/types-3"/> | ||
|
||
<xsd:complexType name="UserExtensionType"> | ||
<xsd:annotation> | ||
<xsd:appinfo> | ||
<a:extension ref="c:UserType"/> | ||
</xsd:appinfo> | ||
</xsd:annotation> | ||
<xsd:sequence> | ||
<xsd:element name="myContainer" type="tns:MyContainerType" minOccurs="0" maxOccurs="unbounded"/> | ||
</xsd:sequence> | ||
</xsd:complexType> | ||
|
||
<xsd:complexType name="MyContainerType"> | ||
<xsd:annotation> | ||
<xsd:appinfo> | ||
<a:container/> | ||
</xsd:appinfo> | ||
</xsd:annotation> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string"/> | ||
<xsd:element name="embedded" type="tns:EmbeddedContainerType" minOccurs="0" maxOccurs="unbounded"/> | ||
</xsd:sequence> | ||
</xsd:complexType> | ||
|
||
<xsd:complexType name="EmbeddedContainerType"> | ||
<xsd:annotation> | ||
<xsd:appinfo> | ||
<a:container/> | ||
</xsd:appinfo> | ||
</xsd:annotation> | ||
<xsd:sequence> | ||
<xsd:element name="value" type="xsd:string"/> | ||
</xsd:sequence> | ||
</xsd:complexType> | ||
</xsd:schema> |
57 changes: 57 additions & 0 deletions
57
model/model-intest/src/test/resources/tracing/function-library-hacking.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!-- | ||
~ Copyright (c) 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. | ||
--> | ||
|
||
<functionLibrary | ||
xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||
oid="87b91749-5f92-4328-bcc3-6f1b6e6e8364"> | ||
<name>hacking</name> | ||
<function> | ||
<name>createContainerValue</name> | ||
<parameter> | ||
<name>name</name> | ||
<type>xsd:string</type> | ||
</parameter> | ||
<returnType>t:ItemDeltaType</returnType> | ||
<script> | ||
<code> | ||
import com.evolveum.midpoint.model.intest.misc.TestTracing | ||
import com.evolveum.prism.xml.ns._public.types_3.ItemDeltaType | ||
import com.evolveum.prism.xml.ns._public.types_3.RawType | ||
|
||
import static com.evolveum.midpoint.model.intest.misc.TestTracing.NAME_EMBEDDED | ||
import static com.evolveum.midpoint.model.intest.misc.TestTracing.NAME_VALUE | ||
import static com.evolveum.midpoint.model.intest.misc.TestTracing.TYPE_MY_CONTAINER | ||
|
||
itemFactory = midpoint.prismContext.itemFactory() | ||
rootPcv = itemFactory.createContainerValue() | ||
|
||
value1 = itemFactory.createProperty(NAME_VALUE) | ||
value1.setRealValue('value1') | ||
rootPcv.add(value1) | ||
|
||
embedded = itemFactory.createContainer(NAME_EMBEDDED) | ||
embeddedPcv = itemFactory.createContainerValue() | ||
embedded.add(embeddedPcv) | ||
rootPcv.add(embedded) | ||
|
||
value2 = itemFactory.createProperty(NAME_VALUE) | ||
value2.setRealValue('value2') | ||
embedded.add(value2) | ||
|
||
log.info('created PCV:\n{}', rootPcv.debugDump()) | ||
rootPcv | ||
|
||
idt = new ItemDeltaType() | ||
idt.value.add(new RawType(rootPcv, TYPE_MY_CONTAINER, midpoint.prismContext)) | ||
// idt.value.add(rootPcv) | ||
idt | ||
</code> | ||
</script> | ||
</function> | ||
</functionLibrary> |
34 changes: 34 additions & 0 deletions
34
model/model-intest/src/test/resources/tracing/role-class-less-values.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!-- | ||
~ Copyright (c) 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. | ||
--> | ||
|
||
<role xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
oid="c903aee4-8726-47cd-99e9-8aad7a60b12f"> | ||
<name>class-less-values</name> | ||
<inducement> | ||
<focusMappings> | ||
<mapping> | ||
<strength>strong</strength> | ||
<source> | ||
<path>name</path> | ||
</source> | ||
<expression> | ||
<script> | ||
<code> | ||
raw = hacking.execute("createContainerValue", [name: name]).getValue().get(0) | ||
pcv = raw.getParsedValue(null, null) // brutal hack | ||
log.info('value = {}', pcv) | ||
pcv | ||
</code> | ||
</script> | ||
</expression> | ||
<target> | ||
<path>extension/myContainer</path> | ||
</target> | ||
</mapping> | ||
</focusMappings> | ||
</inducement> | ||
</role> |
11 changes: 11 additions & 0 deletions
11
model/model-intest/src/test/resources/tracing/user-jim.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- | ||
~ Copyright (c) 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 xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3" | ||
oid="5a85ea58-ecf7-4e23-ab4f-750f877dc13a"> | ||
<name>jim</name> | ||
</user> |