Skip to content

Commit

Permalink
Additional test for query builder/convertor.
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Dec 7, 2017
1 parent a5f851e commit d5874f9
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 1 deletion.
Expand Up @@ -312,7 +312,7 @@ public S_FilterEntryOrEmpty exists(QName... names) {
return new R_Filter(queryBuilder, clazz, OrFilter.createOr(), null, false, this, null, existsPath, null, null,null, null);
}

<ID extends ItemDefinition> ID resolveItemPath(ItemPath itemPath, Class<ID> type) {
private <ID extends ItemDefinition> ID resolveItemPath(ItemPath itemPath, Class<ID> type) {
Validate.notNull(type, "type");
ComplexTypeDefinition ctd = queryBuilder.getPrismContext().getSchemaRegistry().findComplexTypeDefinitionByCompileTimeClass(currentClass);
if (ctd == null) {
Expand Down
Expand Up @@ -706,6 +706,26 @@ public void test590Logicals() throws Exception {
checkQueryRoundtripFile(UserType.class, q, TEST_NAME);
}

@Test
public void test595Logicals2() throws Exception {
final String TEST_NAME = "test595Logicals2";
displayTestTitle(TEST_NAME);
ObjectQuery q = QueryBuilder.queryFor(UserType.class, getPrismContext())
.item(UserType.F_DESCRIPTION).eq("A")
.and().item(UserType.F_DESCRIPTION).eq("B")
.or().item(UserType.F_DESCRIPTION).eq("C")
.and().item(UserType.F_DESCRIPTION).eq("D")
.and()
.block()
.item(UserType.F_DESCRIPTION).eq("E1")
.and().item(UserType.F_DESCRIPTION).eq("E2")
.or().item(UserType.F_DESCRIPTION).eq("E3")
.endBlock()
.build();

checkQueryRoundtripFile(UserType.class, q, TEST_NAME);
}

@Test
public void test600Type() throws Exception {
final String TEST_NAME = "test600Type";
Expand Down
@@ -0,0 +1,59 @@
<?xml version="1.0"?>
<!--
~ Copyright (c) 2010-2017 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.
-->

<query xmlns="http://prism.evolveum.com/xml/ns/public/query-3">
<filter>
<or>
<and>
<equal>
<path>description</path>
<value>A</value>
</equal>
<equal>
<path>description</path>
<value>B</value>
</equal>
</and>
<and>
<equal>
<path>description</path>
<value>C</value>
</equal>
<equal>
<path>description</path>
<value>D</value>
</equal>
<or>
<and>
<equal>
<path>description</path>
<value>E1</value>
</equal>
<equal>
<path>description</path>
<value>E2</value>
</equal>
</and>
<equal>
<path>description</path>
<value>E3</value>
</equal>
</or>
</and>
</or>
</filter>
</query>

0 comments on commit d5874f9

Please sign in to comment.