Skip to content

Commit

Permalink
fixing trafo tests (story)
Browse files Browse the repository at this point in the history
  • Loading branch information
katkav committed Mar 4, 2019
1 parent 7e885c1 commit 5cfe7c3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
Expand Up @@ -34,6 +34,7 @@
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.schema.processor.ResourceAttributeDefinition;
import com.evolveum.midpoint.schema.util.ResourceTypeUtil;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.web.component.search.Search;
Expand Down Expand Up @@ -97,7 +98,7 @@ private <T extends ObjectType> List<SearchItemDefinition> createAttributeDefinit

ItemPath attributePath = ShadowType.F_ATTRIBUTES;

for (ItemDefinition def : (List<ItemDefinition>) ocDef.getDefinitions()) {
for (ResourceAttributeDefinition def : ocDef.getAttributeDefinitions()) {
if (!(def instanceof PrismPropertyDefinition) && !(def instanceof PrismReferenceDefinition)) {
continue;
}
Expand Down
Expand Up @@ -345,6 +345,10 @@ protected void cleanUpSecurity() {
securityContext.setAuthentication(null);
}

protected void initDummyResource(String name, DummyResourceContoller controller) {
dummyResourceCollection.initDummyResource(name, controller);
}

protected DummyResourceContoller initDummyResource(String name, File resourceFile, String resourceOid,
FailableProcessor<DummyResourceContoller> controllerInitLambda,
Task task, OperationResult result) throws Exception {
Expand Down
Expand Up @@ -75,6 +75,13 @@ public DummyResourceContoller initDummyResource(String name, File resourceFile,
map.put(name, controller);
return controller;
}

public void initDummyResource(String name, DummyResourceContoller controller) {
if (map.containsKey(name)) {
throw new IllegalArgumentException("Dummy resource "+name+" already initialized");
}
map.put(name, controller);
}

public DummyResourceContoller get(String name) {
DummyResourceContoller contoller = map.get(name);
Expand Down
Expand Up @@ -168,6 +168,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
resourceDummyAd = importAndGetObjectFromFileIgnoreWarnings(ResourceType.class, RESOURCE_DUMMY_AD_FILE, RESOURCE_DUMMY_AD_OID, initTask, initResult);
resourceDummyAdType = resourceDummyAd.asObjectable();
dummyResourceCtlAd.setResource(resourceDummyAd);
initDummyResource(RESOURCE_DUMMY_AD_ID, dummyResourceCtlAd);

dummyResourceCtlMail = DummyResourceContoller.create(RESOURCE_DUMMY_MAIL_ID, resourceDummyMail);
dummyResourceCtlMail.populateWithDefaultSchema();
Expand All @@ -186,6 +187,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti
resourceDummyMail = importAndGetObjectFromFile(ResourceType.class, RESOURCE_DUMMY_MAIL_FILE, RESOURCE_DUMMY_MAIL_OID, initTask, initResult);
resourceDummyMailType = resourceDummyMail.asObjectable();
dummyResourceCtlMail.setResource(resourceDummyMail);
initDummyResource(RESOURCE_DUMMY_MAIL_ID, dummyResourceCtlMail);

}

Expand Down
7 changes: 3 additions & 4 deletions testing/story/src/test/resources/trafo/resource-dummy-ad.xml
Expand Up @@ -172,16 +172,16 @@ else {
<attribute>
<ref>ri:groups</ref>
<displayName>Groups</displayName>

<limitations>
<access>
<read>true</read>
<add>true</add>
<modify>true</modify>
</access>
</limitations>
<tolerant>true</tolerant>
<matchingRule>mr:stringIgnoreCase</matchingRule>
<tolerant>true</tolerant>

<outbound>
<strength>strong</strength><!-- See above -->
<source>
Expand Down Expand Up @@ -220,16 +220,15 @@ return null;
<attribute>
<ref>icfs:name</ref>
<displayName>Distinguished Name</displayName>

<limitations>
<access>
<read>true</read>
<add>true</add>
<modify>true</modify>
</access>
</limitations>

<matchingRule>mr:stringIgnoreCase</matchingRule>

<outbound>
<!--<strength>weak</strength>-->
<source>
Expand Down

0 comments on commit 5cfe7c3

Please sign in to comment.