Skip to content

Commit

Permalink
Crude breakup of sql repo impl into a set of cooperating classes. (De…
Browse files Browse the repository at this point in the history
…lete campaign does not work yet.)
  • Loading branch information
mederly committed Dec 7, 2015
1 parent 90315d4 commit b3df277
Show file tree
Hide file tree
Showing 20 changed files with 2,133 additions and 1,567 deletions.
Expand Up @@ -873,7 +873,15 @@ public void removeContainer(ItemPath itemPath) {
removeItem(itemPath, PrismContainer.class);
}

// Expects that "self" path is NOT present in propPath
public void removeReference(QName name) {
removeReference(new ItemPath(name));
}

public void removeReference(ItemPath path) {
removeItem(path, PrismReference.class);
}

// Expects that "self" path is NOT present in propPath
<IV extends PrismValue,ID extends ItemDefinition,I extends Item<IV,ID>> void removeItem(ItemPath propPath, Class<I> itemType) {
if (items == null){
return;
Expand Down
Expand Up @@ -12154,7 +12154,7 @@
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="accessCertificationDefinition" type="tns:AccessCertificationDefinitionType" />
<xsd:element name="accessCertificationDefinition" type="tns:AccessCertificationDefinitionType" substitutionGroup="c:object"/>

<xsd:complexType name="AccessCertificationStageDefinitionType">
<xsd:annotation>
Expand Down Expand Up @@ -12435,7 +12435,7 @@
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:element name="accessCertificationCampaign" type="tns:AccessCertificationCampaignType" />
<xsd:element name="accessCertificationCampaign" type="tns:AccessCertificationCampaignType" substitutionGroup="c:object" />

<xsd:complexType name="AccessCertificationStageType">
<xsd:annotation>
Expand Down
Expand Up @@ -161,6 +161,9 @@ private void addGetCompare(File file) throws Exception {
} else if (LookupTableType.class.equals(clazz)) {
o = SelectorOptions.createCollection(LookupTableType.F_ROW,
GetOperationOptions.createRetrieve(RetrieveOption.INCLUDE));
} else if (AccessCertificationCampaignType.class.equals(clazz)) {
o = SelectorOptions.createCollection(AccessCertificationCampaignType.F_CASE,
GetOperationOptions.createRetrieve(RetrieveOption.INCLUDE));
}
PrismObject<? extends ObjectType> newObject = repositoryService.getObject(clazz, oids.get(i), o, result);
LOGGER.info("Old\n{}\nnew\n{}", new Object[]{object.debugDump(3), newObject.debugDump(3)});
Expand Down
Expand Up @@ -1368,25 +1368,19 @@ public void test330InOidTest() throws Exception {
}

@Test
public void test330OwnerInOidTest() throws Exception {
public void test335OwnerInOidTest() throws Exception {
Session session = open();
try {
ObjectQuery query = QueryBuilder.queryFor(AccessCertificationCaseType.class, prismContext)
.ownerId("1", "2").build();

String real = getInterpretedQuery2(session, AccessCertificationCaseType.class, query, false);
String expected = "select\n" +
" o.fullObject,\n" +
" o.stringsCount,\n" +
" o.longsCount,\n" +
" o.datesCount,\n" +
" o.referencesCount,\n" +
" o.polysCount,\n" +
" o.booleansCount\n" +
" a.fullObject\n" +
"from\n" +
" RObject o\n" +
" RAccessCertificationCase a\n" +
"where\n" +
" o.ownerOid in :oid\n";
" a.ownerOid in :ownerOid";
assertEqualsIgnoreWhitespace(expected, real);
} finally {
close(session);
Expand Down Expand Up @@ -1459,8 +1453,8 @@ public void test345QueryOrgAllLevels() throws Exception {
"from\n" +
" ROrg o\n" +
"where\n" +
" o.oid in (select ref.ownerOid from RObjectReference ref where ref.referenceType = com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner.OBJECT_PARENT_ORG and ref.targetOid = :orgOid)\n" +
"order by o.name.orig asc\n";
" o.oid in (select ref.ownerOid from RObjectReference ref where ref.referenceType = com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner.OBJECT_PARENT_ORG and ref.targetOid in (select descendantOid from ROrgClosure where ancestorOid = :orgOid))\n" +
"order by o.name.orig asc";

assertEqualsIgnoreWhitespace(expected, real);
} finally {
Expand Down Expand Up @@ -1494,8 +1488,8 @@ public void test348QueryRoots() throws Exception {
"from\n" +
" ROrg o\n" +
"where\n" +
" o.oid in (select ref.ownerOid from RObjectReference ref where ref.referenceType = com.evolveum.midpoint.repo.sql.data.common.other.RReferenceOwner.OBJECT_PARENT_ORG and ref.targetOid = :orgOid)\n" +
"order by o.name.orig asc\n";
" o.oid in (select descendantOid from ROrgClosure group by descendantOid having count(descendantOid) = 1)\n" +
"order by o.name.orig asc";

assertEqualsIgnoreWhitespace(expected, real);
} finally {
Expand Down Expand Up @@ -2024,7 +2018,7 @@ public void test530queryUserSubstringName() throws Exception {
objectQuery = ObjectQuery.createObjectQuery(substring);
objectQuery.setUseNewQueryInterpreter(true);
count = repositoryService.countObjects(ObjectType.class, objectQuery, result);
AssertJUnit.assertEquals(18, count);
AssertJUnit.assertEquals(19, count);

} finally {
close(session);
Expand Down
Expand Up @@ -29,7 +29,6 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.Test;
Expand All @@ -41,7 +40,7 @@
import java.util.List;
import java.util.Set;

import static com.evolveum.midpoint.repo.sql.OrgClosureManager.Edge;
import static com.evolveum.midpoint.repo.sql.helpers.OrgClosureManager.Edge;

/**
* @author mederly
Expand Down

0 comments on commit b3df277

Please sign in to comment.