Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Jan 21, 2017
2 parents f489c06 + e40e020 commit 7f9e697
Showing 1 changed file with 18 additions and 12 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 Evolveum
* Copyright (c) 2016-2017 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 @@ -35,7 +35,7 @@
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;

import com.evolveum.midpoint.model.api.PolicyViolationException;
import com.evolveum.midpoint.util.exception.PolicyViolationException;
import com.evolveum.midpoint.prism.PrismContainer;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.delta.ItemDelta;
Expand Down Expand Up @@ -370,7 +370,7 @@ public void test270UnassignVipRoleFromHROrg() throws Exception {
}

//test280AssignVipAndSuperVipRoleToHROrg required for test290UnassignVipRoleFromHROrg
//@Test
@Test
public void test280AssignVipAndSuperVipRoleToHROrg() throws Exception {
final String TEST_NAME = "test280AssignVipAndSuperVipRoleToHROrg";
TestUtil.displayTestTile(this, TEST_NAME);
Expand Down Expand Up @@ -405,9 +405,7 @@ public void test280AssignVipAndSuperVipRoleToHROrg() throws Exception {
assertLdapObject(orgAfter, ShadowKindType.GENERIC, LDAP_OU_VIP_INTENT);
}

//should result in dependency exception but results in NullPointer
//TODO: correct assertions (assertException)
//@Test
@Test
public void test290UnassignVipRoleFromHROrg() throws Exception {
final String TEST_NAME = "test290UnassignVipRoleFromHROrg";
TestUtil.displayTestTile(this, TEST_NAME);
Expand All @@ -416,15 +414,23 @@ public void test290UnassignVipRoleFromHROrg() throws Exception {

PrismObject<OrgType> orgBefore = getOrg(ORG_HR_NAME);

// WHEN
TestUtil.displayWhen(TEST_NAME);
display("unassigning vip role org", orgBefore);
unassignRoleFromOrg(orgHrOid, ROLE_META_ORG_VIP_OID, task, result);

try {
// WHEN
TestUtil.displayWhen(TEST_NAME);
unassignRoleFromOrg(orgHrOid, ROLE_META_ORG_VIP_OID, task, result);

assertNotReached();

} catch (PolicyViolationException e) {
// this is expected
}

// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
TestUtil.assertFailure(result);

dumpOrgTree();
dumpLdap();
Expand All @@ -433,8 +439,8 @@ public void test290UnassignVipRoleFromHROrg() throws Exception {
display("AFTER unassigning vip role org", orgAfter);
assertSubOrgs(orgAfter, 0);
assertSubOrgs(ORG_TOP_OID, 2);
assertRoleMembershipRef(orgAfter, ROLE_META_ORG_OID, ORG_TOP_OID);
assertNotAssignedRole(orgAfter, ROLE_META_ORG_VIP_OID);
assertRoleMembershipRef(orgAfter, ROLE_META_ORG_OID, ROLE_META_ORG_VIP_OID, ROLE_META_ORG_SUPERVIP_OID, ORG_TOP_OID);
assertAssignedRole(orgAfter, ROLE_META_ORG_VIP_OID);
assertLdapObject(orgAfter, ShadowKindType.ENTITLEMENT, LDAP_GROUP_INTENT);
assertLdapObject(orgAfter, ShadowKindType.GENERIC, LDAP_OU_INTENT);
//TODO: assert ldap vip objects deleted...
Expand Down

0 comments on commit 7f9e697

Please sign in to comment.