From 6c7e7bfb73be9f3fcd5a6e93d58d62e09accf033 Mon Sep 17 00:00:00 2001 From: Richard Richter Date: Tue, 10 Mar 2020 13:53:08 +0100 Subject: [PATCH] last TEST_NAME variables removed from test classes --- .../midpoint/testing/story/TestVillage.java | 19 +- .../midpoint/testing/story/TestWriter.java | 31 +- .../ldap/TestLdapAssociationPerformance.java | 103 +++--- .../testing/story/ldap/TestLdapComplex.java | 312 +++++++----------- .../testing/story/ldap/TestLdapMutilated.java | 53 +-- .../story/ldap/TestLdapReconPerformance.java | 202 +++++------- .../story/ldap/TestLdapSyncMassive.java | 20 +- .../story/ldap/TestLdapVirtualGroup.java | 87 ++--- .../hierarchy/AbstractLdapHierarchyTest.java | 6 +- .../notorious/AbstractNotoriousTest.java | 52 --- .../testing/story/perf/TestImport.java | 8 +- .../testing/story/security/TestPrivacy.java | 16 +- .../story/security/TestRoleMembers.java | 78 ++--- .../testing/story/uuid/AbstractUuidTest.java | 32 +- .../testing/story/uuid/TestUuidClient.java | 54 ++- .../testing/story/uuid/TestUuidExtension.java | 6 - 16 files changed, 393 insertions(+), 686 deletions(-) diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestVillage.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestVillage.java index ea94d16471b..fe0979033bb 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestVillage.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestVillage.java @@ -45,14 +45,13 @@ import com.evolveum.midpoint.test.asserter.UserAsserter; import com.evolveum.midpoint.test.util.MidPointTestConstants; import com.evolveum.midpoint.test.util.TestUtil; +import com.evolveum.midpoint.tools.testng.UnusedTestElement; import com.evolveum.midpoint.util.DOMUtil; import com.evolveum.midpoint.util.MiscUtil; import com.evolveum.midpoint.util.exception.*; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; -/** - * @author Radovan Semancik - */ +@UnusedTestElement("disabled in suite in 2019-09, fails on setup") @ContextConfiguration(locations = { "classpath:ctx-story-test-main.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) public class TestVillage extends AbstractStoryTest { @@ -205,7 +204,7 @@ protected void startResources() throws Exception { } @AfterClass - public static void stopResources() throws Exception { + public static void stopResources() { openDJController.stop(); } @@ -320,8 +319,7 @@ public void test020ResourceOpenDjGet() throws Exception { */ @Test public void test022ResourceOpenDjRefinedSchema() throws Exception { - final String TEST_NAME = "test022ResourceOpenDjRefinedSchema"; - Task task = taskManager.createTaskInstance(TestVillage.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult result = task.getResult(); PrismObject resourceBefore = modelService.getObject(ResourceType.class, RESOURCE_OPENDJ_OID, null, task, result); @@ -769,8 +767,7 @@ public void test300AddProjectJollyRoger() throws Exception { */ @Test public void test310ProjectJollyRogerNestedGroup() throws Exception { - final String TEST_NAME = "test310ProjectJollyRogerNestedGroup"; - Task task = taskManager.createTaskInstance(TestVillage.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult result = task.getResult(); openDJController.addEntry("dn: " + GROUP_JOLLYROGERS_DN + "\n" + @@ -806,8 +803,7 @@ ShadowType.F_ATTRIBUTES, new QName(RESOURCE_OPENDJ_NAMESPACE, "cn")).eq("admins" @Test public void test319DeleteProjectJollyRoger() throws Exception { - final String TEST_NAME = "test319DeleteProjectJollyRoger"; - Task task = taskManager.createTaskInstance(TestVillage.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult result = task.getResult(); // WHEN @@ -830,8 +826,7 @@ public void test319DeleteProjectJollyRoger() throws Exception { */ @Test public void test350AddRepoUserNoEmployeeNumberRecompute() throws Exception { - final String TEST_NAME = "test350AddRepoUserNoEmployeeNumberRecompute"; - Task task = taskManager.createTaskInstance(TestVillage.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult result = task.getResult(); PrismObject user = PrismTestUtil.parseObject(USER_MURRAY_FILE); diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestWriter.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestWriter.java index b8b915efe06..776dd3ca0bc 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestWriter.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/TestWriter.java @@ -6,7 +6,13 @@ */ package com.evolveum.midpoint.testing.story; -import com.evolveum.icf.dummy.resource.DummyResource; +import java.io.File; + +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.ContextConfiguration; +import org.testng.annotations.Test; + import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.task.api.Task; @@ -15,20 +21,13 @@ import com.evolveum.midpoint.test.util.TestUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.annotation.DirtiesContext.ClassMode; -import org.springframework.test.context.ContextConfiguration; -import org.testng.annotations.Test; - -import java.io.File; /** * Test with a resource that can only write. It cannot read the accounts. It has to cache the values. * * @author semancik - * */ -@ContextConfiguration(locations = {"classpath:ctx-story-test-main.xml"}) +@ContextConfiguration(locations = { "classpath:ctx-story-test-main.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) public class TestWriter extends AbstractStoryTest { @@ -41,26 +40,20 @@ public class TestWriter extends AbstractStoryTest { private static final String USER_JACK_FULL_NAME_CAPTAIN = "Captain Jack Sparrow"; private static final String USER_JACK_LOCALITY = "Seven seas"; - private DummyResourceContoller writerDummyController; - private DummyResource writerDummy; - private PrismObject resourceWriter; - @Override public void initSystem(Task initTask, OperationResult initResult) throws Exception { super.initSystem(initTask, initResult); - writerDummyController = DummyResourceContoller.create(RESOURCE_WRITER_DUMMY_NAME); + DummyResourceContoller writerDummyController = DummyResourceContoller.create(RESOURCE_WRITER_DUMMY_NAME); writerDummyController.extendSchemaPirate(); - writerDummy = writerDummyController.getDummyResource(); dummyResourceCollection.initDummyResource(RESOURCE_WRITER_DUMMY_NAME, writerDummyController); - resourceWriter = importAndGetObjectFromFile(ResourceType.class, RESOURCE_WRITER_FILE, RESOURCE_WRITER_OID, initTask, initResult); + PrismObject resourceWriter = importAndGetObjectFromFile(ResourceType.class, RESOURCE_WRITER_FILE, RESOURCE_WRITER_OID, initTask, initResult); writerDummyController.setResource(resourceWriter); } @Test public void test000Sanity() throws Exception { - final String TEST_NAME = "test000Sanity"; Task task = getTestTask(); OperationResult testResultWriter = modelService.testResource(RESOURCE_WRITER_OID, task); @@ -69,8 +62,6 @@ public void test000Sanity() throws Exception { @Test public void test100AssignJackDummyAccount() throws Exception { - final String TEST_NAME = "test100AssignJackDummyAccount"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -94,8 +85,6 @@ public void test100AssignJackDummyAccount() throws Exception { */ @Test public void test110ModifyCaptainJack() throws Exception { - final String TEST_NAME = "test110ModifyCaptainJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapAssociationPerformance.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapAssociationPerformance.java index cfc76c1e5bd..1a17d449963 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapAssociationPerformance.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapAssociationPerformance.java @@ -7,6 +7,20 @@ package com.evolveum.midpoint.testing.story.ldap; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertNotNull; + +import java.io.File; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.ContextConfiguration; +import org.testng.annotations.AfterClass; +import org.testng.annotations.Test; + import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.PrismProperty; import com.evolveum.midpoint.prism.path.ItemName; @@ -19,29 +33,16 @@ import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.task.api.Task; import com.evolveum.midpoint.test.IntegrationTestTools; -import com.evolveum.midpoint.util.exception.*; +import com.evolveum.midpoint.util.exception.SchemaException; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.annotation.DirtiesContext.ClassMode; -import org.springframework.test.context.ContextConfiguration; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; - -import java.io.File; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.Map; - -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertNotNull; /** * Performance tests for accounts with large number of role assignments and group associations; using assignmentTargetSearch, * associationFromLink and similar mappings. - * + *

* MID-5341 */ -@ContextConfiguration(locations = {"classpath:ctx-story-test-main.xml"}) +@ContextConfiguration(locations = { "classpath:ctx-story-test-main.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) public class TestLdapAssociationPerformance extends AbstractLdapTest { @@ -93,9 +94,7 @@ public class TestLdapAssociationPerformance extends AbstractLdapTest { private static final String SUMMARY_LINE_FORMAT = "%50s: %5d ms (%4d ms/user, %7.2f ms/user/role)\n"; private static final String REPO_LINE_FORMAT = "%6d (%8.1f/%s)\n"; - private Map durations = new LinkedHashMap<>(); - - private PrismObject resourceOpenDj; + private Map durations = new LinkedHashMap<>(); @Override protected File getSystemConfigurationFile() { @@ -113,7 +112,7 @@ protected void startResources() throws Exception { } @AfterClass - public static void stopResources() throws Exception { + public static void stopResources() { openDJController.stop(); } @@ -127,7 +126,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti super.initSystem(initTask, initResult); // Resources - resourceOpenDj = importAndGetObjectFromFile(ResourceType.class, RESOURCE_OPENDJ_FILE, RESOURCE_OPENDJ_OID, initTask, initResult); + PrismObject resourceOpenDj = importAndGetObjectFromFile(ResourceType.class, RESOURCE_OPENDJ_FILE, RESOURCE_OPENDJ_OID, initTask, initResult); openDJController.setResource(resourceOpenDj); importObjectFromFile(ROLE_LDAP_FILE); @@ -156,9 +155,10 @@ public void test000ClonePerformance() throws SchemaException { CloneUtil.clone(systemConfiguration.asObjectable().getGlobalPolicyRule()); } long duration = System.currentTimeMillis() - start; - System.out.println("Time per clone = " + duration*1000.0/COUNT + " us"); + System.out.println("Time per clone = " + duration * 1000.0 / COUNT + " us"); } + @Test public void test010Sanity() throws Exception { Task task = getTestTask(); @@ -170,8 +170,8 @@ public void test010Sanity() throws Exception { addObject(ROLE_TEST_FILE, task, result); addObject(USER_TEST_FILE, task, result); - // THEN - then(); + // THEN + then(); dumpLdap(); openDJController.assertUniqueMember("cn=role-test,ou=groups,dc=example,dc=com", "uid=user-test,ou=people,dc=example,dc=com"); @@ -183,8 +183,6 @@ public void test010Sanity() throws Exception { @Test public void test020GenerateRoles() throws Exception { - final String TEST_NAME = "test020GenerateRoles"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -212,7 +210,7 @@ public void test020GenerateRoles() throws Exception { PerformanceInformation performanceInformation = getRepoPerformanceMonitor() .getThreadLocalPerformanceInformation(); - dumpRepoSnapshot("SQL operations for " + TEST_NAME, performanceInformation, "role", NUMBER_OF_GENERATED_ROLES); + dumpRepoSnapshot(performanceInformation, "role", NUMBER_OF_GENERATED_ROLES); dumpGlobalCachePerformanceData(); result.computeStatus(); @@ -231,8 +229,6 @@ private void resetPerformanceCollectors() { @Test public void test100AddUsers() throws Exception { - final String TEST_NAME = "test100AddUsers"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -282,12 +278,14 @@ public void test100AddUsers() throws Exception { } private void dumpRepoSnapshotPerUser(PerformanceInformation performanceInformation) { - dumpRepoSnapshot("SQL operations for " + getTestNameShort(), - performanceInformation, "user", NUMBER_OF_GENERATED_USERS); + dumpRepoSnapshot(performanceInformation, "user", NUMBER_OF_GENERATED_USERS); } - private void dumpRepoSnapshot(String label, PerformanceInformation performanceInformation, String unit, int unitCount) { - display(label + " (" + NUMBER_OF_GENERATED_USERS + " users, " + NUMBER_OF_GENERATED_ROLES + " roles) (got from global monitor)", performanceInformation); + private void dumpRepoSnapshot( + PerformanceInformation performanceInformation, String unit, int unitCount) { + String label = "SQL operations for " + getTestNameShort(); + display(label + " (" + NUMBER_OF_GENERATED_USERS + " users, " + NUMBER_OF_GENERATED_ROLES + + " roles) (got from global monitor)", performanceInformation); // per unit: Map counters = performanceInformation.getAllData(); @@ -295,7 +293,10 @@ private void dumpRepoSnapshot(String label, PerformanceInformation performanceIn kinds.sort(String::compareToIgnoreCase); int max = kinds.stream().mapToInt(String::length).max().orElse(0); StringBuilder sb = new StringBuilder(); - kinds.forEach(kind -> sb.append(String.format("%" + (max+2) + "s: " + REPO_LINE_FORMAT, kind, counters.get(kind).getInvocationCount(), (double) counters.get(kind).getInvocationCount() / unitCount, unit))); + kinds.forEach(kind -> sb.append( + String.format("%" + (max + 2) + "s: " + REPO_LINE_FORMAT, + kind, counters.get(kind).getInvocationCount(), + (double) counters.get(kind).getInvocationCount() / unitCount, unit))); display(label + " (" + NUMBER_OF_GENERATED_USERS + " users, " + NUMBER_OF_GENERATED_ROLES + " roles) - per " + unit, sb.toString()); } @@ -339,13 +340,8 @@ public void test110RecomputeUsers() throws Exception { @Test public void test120RecomputeUsersNoRoleAndShadowCache() throws Exception { - final String TEST_NAME = "test120RecomputeUsersNoRoleAndShadowCache"; - rememberConnectorResourceCounters(); - Task task = getTestTask(); - OperationResult result = task.getResult(); - // WHEN when(); @@ -383,13 +379,8 @@ public void test120RecomputeUsersNoRoleAndShadowCache() throws Exception { @Test public void test130RecomputeUsersMultinode() throws Exception { - final String TEST_NAME = "test130RecomputeUsersMultinode"; - rememberConnectorResourceCounters(); - Task task = getTestTask(); - OperationResult result = task.getResult(); - // WHEN when(); @@ -431,13 +422,8 @@ public void test130RecomputeUsersMultinode() throws Exception { @Test public void test140RecomputeUsersMultinodeMultithreaded() throws Exception { - final String TEST_NAME = "test140RecomputeUsersMultinodeMultithreaded"; - rememberConnectorResourceCounters(); - Task task = getTestTask(); - OperationResult result = task.getResult(); - // WHEN when(); @@ -480,8 +466,6 @@ public void test140RecomputeUsersMultinodeMultithreaded() throws Exception { @Test public void test200RecomputeUsersNoDefaultRoleCache() throws Exception { - final String TEST_NAME = "test200RecomputeUsersNoDefaultRoleCache"; - rememberConnectorResourceCounters(); Task task = getTestTask(); @@ -526,22 +510,17 @@ public void test200RecomputeUsersNoDefaultRoleCache() throws Exception { } @Test - public void test900Summarize() throws Exception { - final String TEST_NAME = "test900Summarize"; - - Task task = getTestTask(); - OperationResult result = task.getResult(); - + public void test900Summarize() { StringBuilder sb = new StringBuilder(); for (Map.Entry entry : durations.entrySet()) { sb.append(summary(entry.getKey(), entry.getValue())); } - display("Summary ("+NUMBER_OF_GENERATED_USERS+" users, "+NUMBER_OF_GENERATED_ROLES+" roles)", sb.toString()); + display("Summary (" + NUMBER_OF_GENERATED_USERS + " users, " + NUMBER_OF_GENERATED_ROLES + " roles)", sb.toString()); - // THEN - then(); + // THEN + then(); - // TODO: more thresholds + // TODO: more thresholds } @@ -573,6 +552,6 @@ private long recordDuration(long duration) { } private Object summary(String label, long duration) { - return String.format(SUMMARY_LINE_FORMAT, label, duration, duration/NUMBER_OF_GENERATED_USERS, (double) duration/(NUMBER_OF_GENERATED_USERS * NUMBER_OF_GENERATED_ROLES)); + return String.format(SUMMARY_LINE_FORMAT, label, duration, duration / NUMBER_OF_GENERATED_USERS, (double) duration / (NUMBER_OF_GENERATED_USERS * NUMBER_OF_GENERATED_ROLES)); } } diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapComplex.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapComplex.java index da122427ed7..df94444f8cd 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapComplex.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapComplex.java @@ -7,19 +7,13 @@ package com.evolveum.midpoint.testing.story.ldap; - -import static org.testng.AssertJUnit.assertNull; -import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertTrue; -import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.*; import java.io.File; import java.util.ArrayList; import java.util.List; - import javax.xml.namespace.QName; -import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import org.apache.commons.lang3.StringUtils; import org.opends.server.types.Entry; import org.springframework.test.annotation.DirtiesContext; @@ -45,20 +39,18 @@ import com.evolveum.midpoint.util.DebugUtil; import com.evolveum.midpoint.util.MiscUtil; import com.evolveum.midpoint.util.exception.SchemaException; +import com.evolveum.midpoint.xml.ns._public.common.common_3.*; /** * Complex LDAP tests: - * + *

* Testing PolyString all the way to LDAP connector. The PolyString data should be translated * to LDAP "language tag" attributes (attribute options). * MID-5210 - * + *

* search scope limited to "one" (MID-5485) - * - * - * */ -@ContextConfiguration(locations = {"classpath:ctx-story-test-main.xml"}) +@ContextConfiguration(locations = { "classpath:ctx-story-test-main.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) public class TestLdapComplex extends AbstractLdapTest { @@ -77,19 +69,19 @@ public class TestLdapComplex extends AbstractLdapTest { private static final String[] JACK_FULL_NAME_LANG_EN_SK = { "en", "Jack Sparrow", "sk", "Džek Sperou" - }; + }; private static final String[] JACK_FULL_NAME_LANG_EN_SK_RU_HR = { "en", "Jack Sparrow", "sk", "Džek Sperou", "ru", "Джек Воробей", "hr", "Ðek Sperou" - }; + }; private static final String[] JACK_FULL_NAME_LANG_CZ_HR = { "cz", "Džek Sperou", "hr", "Ðek Sperou" - }; + }; protected static final String USER_JACK_FULL_NAME_CAPTAIN = "Captain Jack Sparrow"; @@ -97,31 +89,31 @@ public class TestLdapComplex extends AbstractLdapTest { "en", "Captain Jack Sparrow", "cz", "Kapitán Džek Sperou", "sk", "Kapitán Džek Sperou" - }; + }; private static final String TITLE_CAPTAIN = "captain"; private static final String[] TITLE_EN_SK_RU = { "en", "captain", "sk", "kapitán", "ru", "капитан" - }; + }; private static final String[] TITLE_HR = { "hr", "kapetan" - }; + }; private static final String[] TITLE_EN_SK_RU_HR = { "en", "captain", "sk", "kapitán", "ru", "капитан", "hr", "kapetan" - }; + }; private static final String[] TITLE_RU = { "ru", "капитан" - }; + }; private static final String[] TITLE_EN_SK_HR = { "en", "captain", "sk", "kapitán", "hr", "kapetan" - }; + }; private static final String USER_JACK_BLAHBLAH = "BlahBlahBlah!"; @@ -135,9 +127,6 @@ public class TestLdapComplex extends AbstractLdapTest { private static final String PROJECT_WALK_THE_PLANK_NAME = "Walk the Plank"; private static final String ORG_RUM_DEPARTMENT_NAME = "Rum department"; - - private PrismObject resourceOpenDj; - private String accountJackOid; private String projectKeelhaulOid; private String projectWalkThePlankOid; @@ -152,7 +141,7 @@ protected void startResources() throws Exception { } @AfterClass - public static void stopResources() throws Exception { + public static void stopResources() { openDJController.stop(); } @@ -161,11 +150,11 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti super.initSystem(initTask, initResult); // Resources - resourceOpenDj = importAndGetObjectFromFile(ResourceType.class, RESOURCE_OPENDJ_FILE, RESOURCE_OPENDJ_OID, initTask, initResult); + PrismObject resourceOpenDj = importAndGetObjectFromFile(ResourceType.class, RESOURCE_OPENDJ_FILE, RESOURCE_OPENDJ_OID, initTask, initResult); openDJController.setResource(resourceOpenDj); - openDJController.addEntry("dn: ou=orgStruct,dc=example,dc=com\n"+ - "objectClass: organizationalUnit\n"+ + openDJController.addEntry("dn: ou=orgStruct,dc=example,dc=com\n" + + "objectClass: organizationalUnit\n" + "ou: orgStruct"); importObjectFromFile(ORG_PROJECT_TOP_FILE); @@ -181,7 +170,6 @@ protected String getLdapResourceOid() { @Test public void test000Sanity() throws Exception { - final String TEST_NAME = "test000Sanity"; Task task = getTestTask(); OperationResult testResultOpenDj = modelService.testResource(RESOURCE_OPENDJ_OID, task); @@ -197,7 +185,6 @@ public void test000Sanity() throws Exception { */ @Test public void test010Shadows() throws Exception { - final String TEST_NAME = "test010Shadows"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -220,7 +207,6 @@ public void test010Shadows() throws Exception { */ @Test public void test050AssignAccountOpenDjSimple() throws Exception { - final String TEST_NAME = "test050AssignAccountOpenDjSimple"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -233,11 +219,11 @@ public void test050AssignAccountOpenDjSimple() throws Exception { assertSuccess(result); accountJackOid = assertUserAfter(USER_JACK_OID) - .singleLink() + .singleLink() .getOid(); assertModelShadow(accountJackOid) - .display(); + .display(); Entry accountEntry = getLdapEntryByUid(USER_JACK_USERNAME); display("Jack LDAP entry", accountEntry); @@ -253,7 +239,6 @@ public void test050AssignAccountOpenDjSimple() throws Exception { */ @Test public void test055Shadows() throws Exception { - final String TEST_NAME = "test055Shadows"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -274,7 +259,6 @@ public void test055Shadows() throws Exception { @Test public void test059UnassignAccountOpenDjSimple() throws Exception { - final String TEST_NAME = "test059UnassignAccountOpenDjSimple"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -287,7 +271,7 @@ public void test059UnassignAccountOpenDjSimple() throws Exception { assertSuccess(result); assertUserAfter(USER_JACK_OID) - .links() + .links() .assertNone(); assertNoShadow(accountJackOid); @@ -304,7 +288,6 @@ public void test059UnassignAccountOpenDjSimple() throws Exception { */ @Test public void test100ModifyJackFullNameLang() throws Exception { - final String TEST_NAME = "test100ModifyJackFullNameLang"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -320,12 +303,12 @@ public void test100ModifyJackFullNameLang() throws Exception { assertSuccess(result); assertUserAfter(USER_JACK_OID) - .fullName() + .fullName() .display() .assertOrig(USER_JACK_FULL_NAME) .assertLangs(JACK_FULL_NAME_LANG_EN_SK) .end() - .links() + .links() .assertNone(); } @@ -337,7 +320,6 @@ public void test100ModifyJackFullNameLang() throws Exception { */ @Test public void test110AssignAccountOpenDjLang() throws Exception { - final String TEST_NAME = "test110AssignAccountOpenDjLang"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -350,11 +332,11 @@ public void test110AssignAccountOpenDjLang() throws Exception { assertSuccess(result); accountJackOid = assertUserAfter(USER_JACK_OID) - .fullName() + .fullName() .assertOrig(USER_JACK_FULL_NAME) .assertLangs(JACK_FULL_NAME_LANG_EN_SK) .end() - .singleLink() + .singleLink() .getOid(); assertModelShadow(accountJackOid); @@ -372,7 +354,6 @@ public void test110AssignAccountOpenDjLang() throws Exception { */ @Test public void test112ModifyJackFullNameLangEnSkRuHr() throws Exception { - final String TEST_NAME = "test112ModifyJackFullNameLangEnSkRuHr"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -388,12 +369,12 @@ public void test112ModifyJackFullNameLangEnSkRuHr() throws Exception { assertSuccess(result); assertUserAfter(USER_JACK_OID) - .fullName() + .fullName() .display() .assertOrig(USER_JACK_FULL_NAME) .assertLangs(JACK_FULL_NAME_LANG_EN_SK_RU_HR) .end() - .singleLink() + .singleLink() .assertOid(accountJackOid); Entry accountEntry = getLdapEntryByUid(USER_JACK_USERNAME); @@ -409,7 +390,6 @@ public void test112ModifyJackFullNameLangEnSkRuHr() throws Exception { */ @Test public void test114ModifyJackFullNameLangCzHr() throws Exception { - final String TEST_NAME = "test114ModifyJackFullNameLangCzHr"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -425,12 +405,12 @@ public void test114ModifyJackFullNameLangCzHr() throws Exception { assertSuccess(result); assertUserAfter(USER_JACK_OID) - .fullName() + .fullName() .display() .assertOrig(USER_JACK_FULL_NAME) .assertLangs(JACK_FULL_NAME_LANG_CZ_HR) .end() - .singleLink() + .singleLink() .assertOid(accountJackOid); Entry accountEntry = getLdapEntryByUid(USER_JACK_USERNAME); @@ -446,7 +426,6 @@ public void test114ModifyJackFullNameLangCzHr() throws Exception { */ @Test public void test116ModifyJackFullNameLangCaptain() throws Exception { - final String TEST_NAME = "test116ModifyJackFullNameLangCaptain"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -462,12 +441,12 @@ public void test116ModifyJackFullNameLangCaptain() throws Exception { assertSuccess(result); assertUserAfter(USER_JACK_OID) - .fullName() + .fullName() .display() .assertOrig(USER_JACK_FULL_NAME_CAPTAIN) .assertLangs(JACK_FULL_NAME_LANG_CAPTAIN_EN_CZ_SK) .end() - .singleLink() + .singleLink() .assertOid(accountJackOid); Entry accountEntry = getLdapEntryByUid(USER_JACK_USERNAME); @@ -482,7 +461,6 @@ public void test116ModifyJackFullNameLangCaptain() throws Exception { */ @Test public void test118ModifyJackFullNameCaptain() throws Exception { - final String TEST_NAME = "test118ModifyJackFullNameCaptain"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -497,12 +475,12 @@ public void test118ModifyJackFullNameCaptain() throws Exception { assertSuccess(result); assertUserAfter(USER_JACK_OID) - .fullName() + .fullName() .display() .assertOrig(USER_JACK_FULL_NAME_CAPTAIN) .assertNoLangs() .end() - .singleLink() + .singleLink() .assertOid(accountJackOid); Entry accountEntry = getLdapEntryByUid(USER_JACK_USERNAME); @@ -514,7 +492,6 @@ public void test118ModifyJackFullNameCaptain() throws Exception { @Test public void test119UnassignAccountOpenDjLang() throws Exception { - final String TEST_NAME = "test119UnassignAccountOpenDjLang"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -527,7 +504,7 @@ public void test119UnassignAccountOpenDjLang() throws Exception { assertSuccess(result); assertUserAfter(USER_JACK_OID) - .links() + .links() .assertNone(); assertNoShadow(accountJackOid); @@ -544,16 +521,15 @@ public void test119UnassignAccountOpenDjLang() throws Exception { */ @Test public void test120ModifyJackTitleMap() throws Exception { - final String TEST_NAME = "test120ModifyJackTitleMap"; Task task = getTestTask(); OperationResult result = task.getResult(); List> cvals = createTitleMapValues(TITLE_EN_SK_RU); ObjectDelta delta = deltaFor(UserType.class) - .item(PATH_EXTENSION_TITLE_MAP) + .item(PATH_EXTENSION_TITLE_MAP) .replace(cvals) - .asObjectDelta(USER_JACK_OID); + .asObjectDelta(USER_JACK_OID); // WHEN when(); @@ -564,12 +540,12 @@ public void test120ModifyJackTitleMap() throws Exception { assertSuccess(result); assertUserAfter(USER_JACK_OID) - .extension() + .extension() .container(TITLE_MAP_QNAME) - .assertSize(TITLE_EN_SK_RU.length/2) - .end() + .assertSize(TITLE_EN_SK_RU.length / 2) .end() - .links() + .end() + .links() .assertNone(); } @@ -581,7 +557,6 @@ public void test120ModifyJackTitleMap() throws Exception { */ @Test public void test130AssignAccountOpenDjTitleMap() throws Exception { - final String TEST_NAME = "test130AssignAccountOpenDjTitleMap"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -594,16 +569,16 @@ public void test130AssignAccountOpenDjTitleMap() throws Exception { assertSuccess(result); accountJackOid = assertUserAfter(USER_JACK_OID) - .fullName() + .fullName() .assertOrig(USER_JACK_FULL_NAME_CAPTAIN) .assertNoLangs() .end() - .extension() + .extension() .container(TITLE_MAP_QNAME) - .assertSize(TITLE_EN_SK_RU.length/2) - .end() + .assertSize(TITLE_EN_SK_RU.length / 2) .end() - .singleLink() + .end() + .singleLink() .getOid(); assertModelShadow(accountJackOid); @@ -621,16 +596,15 @@ public void test130AssignAccountOpenDjTitleMap() throws Exception { */ @Test public void test132AssignAccountOpenDjTitleMapAdd() throws Exception { - final String TEST_NAME = "test132AssignAccountOpenDjTitleMapAdd"; Task task = getTestTask(); OperationResult result = task.getResult(); List> cvals = createTitleMapValues(TITLE_HR); ObjectDelta delta = deltaFor(UserType.class) - .item(PATH_EXTENSION_TITLE_MAP) + .item(PATH_EXTENSION_TITLE_MAP) .add(cvals) - .asObjectDelta(USER_JACK_OID); + .asObjectDelta(USER_JACK_OID); // WHEN when(); @@ -641,16 +615,16 @@ public void test132AssignAccountOpenDjTitleMapAdd() throws Exception { assertSuccess(result); accountJackOid = assertUserAfter(USER_JACK_OID) - .fullName() + .fullName() .assertOrig(USER_JACK_FULL_NAME_CAPTAIN) .assertNoLangs() .end() - .extension() + .extension() .container(TITLE_MAP_QNAME) - .assertSize(TITLE_EN_SK_RU_HR.length/2) - .end() + .assertSize(TITLE_EN_SK_RU_HR.length / 2) .end() - .singleLink() + .end() + .singleLink() .getOid(); assertModelShadow(accountJackOid); @@ -668,16 +642,15 @@ public void test132AssignAccountOpenDjTitleMapAdd() throws Exception { */ @Test public void test134AssignAccountOpenDjTitleMapDelete() throws Exception { - final String TEST_NAME = "test134AssignAccountOpenDjTitleMapDelete"; Task task = getTestTask(); OperationResult result = task.getResult(); List> cvals = createTitleMapValues(TITLE_RU); ObjectDelta delta = deltaFor(UserType.class) - .item(PATH_EXTENSION_TITLE_MAP) + .item(PATH_EXTENSION_TITLE_MAP) .delete(cvals) - .asObjectDelta(USER_JACK_OID); + .asObjectDelta(USER_JACK_OID); // WHEN when(); @@ -688,16 +661,16 @@ public void test134AssignAccountOpenDjTitleMapDelete() throws Exception { assertSuccess(result); accountJackOid = assertUserAfter(USER_JACK_OID) - .fullName() + .fullName() .assertOrig(USER_JACK_FULL_NAME_CAPTAIN) .assertNoLangs() .end() - .extension() + .extension() .container(TITLE_MAP_QNAME) - .assertSize(TITLE_EN_SK_HR.length/2) - .end() + .assertSize(TITLE_EN_SK_HR.length / 2) .end() - .singleLink() + .end() + .singleLink() .getOid(); assertModelShadow(accountJackOid); @@ -715,16 +688,15 @@ public void test134AssignAccountOpenDjTitleMapDelete() throws Exception { */ @Test public void test138AssignAccountOpenDjTitleMapReplace() throws Exception { - final String TEST_NAME = "test138AssignAccountOpenDjTitleMapReplace"; Task task = getTestTask(); OperationResult result = task.getResult(); List> cvals = createTitleMapValues(TITLE_EN_SK_RU); ObjectDelta delta = deltaFor(UserType.class) - .item(PATH_EXTENSION_TITLE_MAP) + .item(PATH_EXTENSION_TITLE_MAP) .replace(cvals) - .asObjectDelta(USER_JACK_OID); + .asObjectDelta(USER_JACK_OID); // WHEN when(); @@ -735,16 +707,16 @@ public void test138AssignAccountOpenDjTitleMapReplace() throws Exception { assertSuccess(result); accountJackOid = assertUserAfter(USER_JACK_OID) - .fullName() + .fullName() .assertOrig(USER_JACK_FULL_NAME_CAPTAIN) .assertNoLangs() .end() - .extension() + .extension() .container(TITLE_MAP_QNAME) - .assertSize(TITLE_EN_SK_RU.length/2) - .end() + .assertSize(TITLE_EN_SK_RU.length / 2) .end() - .singleLink() + .end() + .singleLink() .getOid(); assertModelShadow(accountJackOid); @@ -758,7 +730,6 @@ public void test138AssignAccountOpenDjTitleMapReplace() throws Exception { @Test public void test139UnassignAccountOpenDjTitleMap() throws Exception { - final String TEST_NAME = "test139UnassignAccountOpenDjTitleMap"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -771,7 +742,7 @@ public void test139UnassignAccountOpenDjTitleMap() throws Exception { assertSuccess(result); assertUserAfter(USER_JACK_OID) - .links() + .links() .assertNone(); assertNoShadow(accountJackOid); @@ -787,7 +758,6 @@ public void test139UnassignAccountOpenDjTitleMap() throws Exception { */ @Test public void test150AssignAccountOpenDj() throws Exception { - final String TEST_NAME = "test150AssignAccountOpenDj"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -800,16 +770,16 @@ public void test150AssignAccountOpenDj() throws Exception { assertSuccess(result); accountJackOid = assertUserAfter(USER_JACK_OID) - .fullName() + .fullName() .assertOrig(USER_JACK_FULL_NAME_CAPTAIN) .assertNoLangs() .end() - .extension() + .extension() .container(TITLE_MAP_QNAME) - .assertSize(TITLE_EN_SK_RU.length/2) - .end() + .assertSize(TITLE_EN_SK_RU.length / 2) .end() - .singleLink() + .end() + .singleLink() .getOid(); assertModelShadow(accountJackOid); @@ -831,7 +801,6 @@ public void test150AssignAccountOpenDj() throws Exception { */ @Test public void test152JackMultivalueDescriptionGet() throws Exception { - final String TEST_NAME = "test152JackMultivalueDescriptionGet"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -849,7 +818,7 @@ public void test152JackMultivalueDescriptionGet() throws Exception { USER_JACK_FULL_NAME_CAPTAIN, USER_JACK_BLAHBLAH); String accountJackOid = assertUserBefore(USER_JACK_OID) - .singleLink() + .singleLink() .getOid(); // WHEN @@ -861,13 +830,13 @@ public void test152JackMultivalueDescriptionGet() throws Exception { assertSuccess(result); PolyString descriptionShadowAttribute = (PolyString) assertShadow(shadow, "Jack's shadow after read") - .attributes() + .attributes() .attribute(LDAP_ATTRIBUTE_DESCRIPTION) - .assertIncomplete() - .singleValue() - .getPrismValue().getRealValue(); + .assertIncomplete() + .singleValue() + .getPrismValue().getRealValue(); - assertTrue("Unexpected value of description attribute from shadow: "+descriptionShadowAttribute, + assertTrue("Unexpected value of description attribute from shadow: " + descriptionShadowAttribute, USER_JACK_FULL_NAME_CAPTAIN.equals(descriptionShadowAttribute.getOrig()) || USER_JACK_BLAHBLAH.equals(descriptionShadowAttribute.getOrig())); accountEntry = getLdapEntryByUid(USER_JACK_USERNAME); @@ -885,7 +854,6 @@ public void test152JackMultivalueDescriptionGet() throws Exception { */ @Test public void test300Shadows() throws Exception { - final String TEST_NAME = "test300Shadows"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -909,23 +877,18 @@ public void test300Shadows() throws Exception { */ @Test public void test310SearchLdapAccounts() throws Exception { - final String TEST_NAME = "test310SearchLdapAccounts"; - ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ACCOUNT, SchemaConstants.INTENT_DEFAULT, prismContext); // WHEN when(); searchObjectsIterative(ShadowType.class, query, o -> display("Found object", o), 4); - } /** - * * MID-5544 */ @Test public void test312Shadows() throws Exception { - final String TEST_NAME = "test312Shadows"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -944,15 +907,15 @@ public void test312Shadows() throws Exception { assertEquals("Unexpected number of shadows", 6, shadows.size()); PrismObject peopleShadow = null; for (PrismObject shadow : shadows) { - if (StringUtils.equalsIgnoreCase(shadow.getName().getOrig(),OPENDJ_PEOPLE_SUFFIX)) { + if (StringUtils.equalsIgnoreCase(shadow.getName().getOrig(), OPENDJ_PEOPLE_SUFFIX)) { peopleShadow = shadow; } } assertNotNull("No ou=people shadow", peopleShadow); assertShadow(peopleShadow, "ou=people shadow") - .display() - .assertObjectClass(new QName(MidPointConstants.NS_RI, "organizationalUnit")) - .assertKind(ShadowKindType.UNKNOWN); + .display() + .assertObjectClass(new QName(MidPointConstants.NS_RI, "organizationalUnit")) + .assertKind(ShadowKindType.UNKNOWN); } /** @@ -962,8 +925,6 @@ public void test312Shadows() throws Exception { */ @Test public void test320SearchLdapAccountsBelow() throws Exception { - final String TEST_NAME = "test320SearchLdapAccountsBelow"; - openDJController.addEntry("dn: ou=below,ou=People,dc=example,dc=com\n" + "ou: below\n" + "objectclass: top\n" + @@ -993,15 +954,12 @@ public void test320SearchLdapAccountsBelow() throws Exception { */ @Test public void test400SearchLdapProjectGroups() throws Exception { - final String TEST_NAME = "test400SearchLdapProjectGroups"; - ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, INTENT_LDAP_PROJECT_GROUP, prismContext); // WHEN when(); // Group "pirates" already exists searchObjectsIterative(ShadowType.class, query, o -> display("Found object", o), 1); - } /** @@ -1010,14 +968,11 @@ public void test400SearchLdapProjectGroups() throws Exception { */ @Test public void test401SearchLdapOrgGroups() throws Exception { - final String TEST_NAME = "test401SearchLdapOrgGroups"; - ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, INTENT_LDAP_ORG_GROUP, prismContext); // WHEN when(); searchObjectsIterative(ShadowType.class, query, o -> display("Found object", o), 0); - } /** @@ -1025,12 +980,10 @@ public void test401SearchLdapOrgGroups() throws Exception { */ @Test public void test410CreateProjectKeelhaul() throws Exception { - final String TEST_NAME = "test410CreateProjectKeelhaul"; - PrismObject projectKeelhaul = createObject(OrgType.class, PROJECT_KEELHAUL_NAME); projectKeelhaul.asObjectable() .beginAssignment() - .targetRef(ORG_PROJECT_TOP_OID, OrgType.COMPLEX_TYPE); + .targetRef(ORG_PROJECT_TOP_OID, OrgType.COMPLEX_TYPE); // WHEN when(); @@ -1042,8 +995,8 @@ public void test410CreateProjectKeelhaul() throws Exception { projectKeelhaulOid = orgKeelhaul.getOid(); groupKeelhaulOid = assertOrg(orgKeelhaul, "after") .links() - .single() - .getOid(); + .single() + .getOid(); ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, INTENT_LDAP_PROJECT_GROUP, prismContext); searchObjectsIterative(ShadowType.class, query, o -> display("Found object", o), 2); @@ -1054,8 +1007,6 @@ public void test410CreateProjectKeelhaul() throws Exception { */ @Test public void test412CreateProjectWalkThePlank() throws Exception { - final String TEST_NAME = "test412CreateProjectWalkThePlank"; - PrismObject projectKeelhaul = createObject(OrgType.class, PROJECT_WALK_THE_PLANK_NAME); projectKeelhaul.asObjectable() .beginAssignment() @@ -1071,8 +1022,8 @@ public void test412CreateProjectWalkThePlank() throws Exception { projectWalkThePlankOid = orgWalkThePlank.getOid(); groupWalkThePlankOid = assertOrg(orgWalkThePlank, "after") .links() - .single() - .getOid(); + .single() + .getOid(); ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, INTENT_LDAP_PROJECT_GROUP, prismContext); searchObjectsIterative(ShadowType.class, query, o -> display("Found object", o), 3); @@ -1086,8 +1037,6 @@ public void test412CreateProjectWalkThePlank() throws Exception { */ @Test public void test415CreateOrgRumDepartment() throws Exception { - final String TEST_NAME = "test415CreateOrgRumDepartment"; - PrismObject orgBefore = createObject(OrgType.class, ORG_RUM_DEPARTMENT_NAME); orgBefore.asObjectable() .beginAssignment() @@ -1104,8 +1053,8 @@ public void test415CreateOrgRumDepartment() throws Exception { assertNotNull("Null org oid", orgRumDepartmentOid); groupRumDepartmentOid = assertOrg(orgAfter, "after") .links() - .single() - .getOid(); + .single() + .getOid(); ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ENTITLEMENT, INTENT_LDAP_PROJECT_GROUP, prismContext); searchObjectsIterative(ShadowType.class, query, o -> display("Found object", o), 3); @@ -1120,16 +1069,14 @@ public void test415CreateOrgRumDepartment() throws Exception { */ @Test public void test420AssignJackToKeelhaul() throws Exception { - final String TEST_NAME = "test412AssignJackToKeelhaul"; - Task task = getTestTask(); OperationResult result = task.getResult(); String accountJackOid = assertUserBefore(USER_JACK_OID) .singleLink() - .target() - .assertResource(RESOURCE_OPENDJ_OID) - .end() + .target() + .assertResource(RESOURCE_OPENDJ_OID) + .end() .getOid(); // WHEN @@ -1140,18 +1087,18 @@ public void test420AssignJackToKeelhaul() throws Exception { then(); assertSuccess(result); - openDJController.assertUniqueMembers("cn="+PROJECT_KEELHAUL_NAME+",ou=groups,dc=example,dc=com", "uid="+USER_JACK_USERNAME+",ou=people,dc=example,dc=com"); - openDJController.assertUniqueMembers("cn="+PROJECT_WALK_THE_PLANK_NAME+",ou=groups,dc=example,dc=com" /* no value */); - openDJController.assertUniqueMembers("cn="+ORG_RUM_DEPARTMENT_NAME+",ou=orgStruct,dc=example,dc=com" /* no value */); + openDJController.assertUniqueMembers("cn=" + PROJECT_KEELHAUL_NAME + ",ou=groups,dc=example,dc=com", "uid=" + USER_JACK_USERNAME + ",ou=people,dc=example,dc=com"); + openDJController.assertUniqueMembers("cn=" + PROJECT_WALK_THE_PLANK_NAME + ",ou=groups,dc=example,dc=com" /* no value */); + openDJController.assertUniqueMembers("cn=" + ORG_RUM_DEPARTMENT_NAME + ",ou=orgStruct,dc=example,dc=com" /* no value */); assertModelShadow(accountJackOid) .associations() - .association(ASSOCIATION_LDAP_PROJECT_GROUP) - .assertShadowOids(groupKeelhaulOid) - .end() - .association(ASSOCIATION_LDAP_ORG_GROUP) - // MID-5790 - .assertNone(); + .association(ASSOCIATION_LDAP_PROJECT_GROUP) + .assertShadowOids(groupKeelhaulOid) + .end() + .association(ASSOCIATION_LDAP_ORG_GROUP) + // MID-5790 + .assertNone(); } /** @@ -1160,16 +1107,14 @@ public void test420AssignJackToKeelhaul() throws Exception { */ @Test public void test422AssignJackToWalkThePlank() throws Exception { - final String TEST_NAME = "test414AssignJackToWalkThePlank"; - Task task = getTestTask(); OperationResult result = task.getResult(); String accountJackOid = assertUserBefore(USER_JACK_OID) .singleLink() - .target() - .assertResource(RESOURCE_OPENDJ_OID) - .end() + .target() + .assertResource(RESOURCE_OPENDJ_OID) + .end() .getOid(); // WHEN @@ -1180,18 +1125,18 @@ public void test422AssignJackToWalkThePlank() throws Exception { then(); assertSuccess(result); - openDJController.assertUniqueMembers("cn="+PROJECT_KEELHAUL_NAME+",ou=groups,dc=example,dc=com", "uid="+USER_JACK_USERNAME+",ou=people,dc=example,dc=com"); - openDJController.assertUniqueMembers("cn="+PROJECT_WALK_THE_PLANK_NAME+",ou=groups,dc=example,dc=com", "uid="+USER_JACK_USERNAME+",ou=people,dc=example,dc=com"); - openDJController.assertUniqueMembers("cn="+ORG_RUM_DEPARTMENT_NAME+",ou=orgStruct,dc=example,dc=com" /* no value */); + openDJController.assertUniqueMembers("cn=" + PROJECT_KEELHAUL_NAME + ",ou=groups,dc=example,dc=com", "uid=" + USER_JACK_USERNAME + ",ou=people,dc=example,dc=com"); + openDJController.assertUniqueMembers("cn=" + PROJECT_WALK_THE_PLANK_NAME + ",ou=groups,dc=example,dc=com", "uid=" + USER_JACK_USERNAME + ",ou=people,dc=example,dc=com"); + openDJController.assertUniqueMembers("cn=" + ORG_RUM_DEPARTMENT_NAME + ",ou=orgStruct,dc=example,dc=com" /* no value */); assertModelShadow(accountJackOid) .associations() - .association(ASSOCIATION_LDAP_PROJECT_GROUP) - .assertShadowOids(groupKeelhaulOid, groupWalkThePlankOid) - .end() - .association(ASSOCIATION_LDAP_ORG_GROUP) - // MID-5790 - .assertNone(); + .association(ASSOCIATION_LDAP_PROJECT_GROUP) + .assertShadowOids(groupKeelhaulOid, groupWalkThePlankOid) + .end() + .association(ASSOCIATION_LDAP_ORG_GROUP) + // MID-5790 + .assertNone(); } /** @@ -1200,16 +1145,14 @@ public void test422AssignJackToWalkThePlank() throws Exception { */ @Test public void test424AssignJackToRumDepartment() throws Exception { - final String TEST_NAME = "test424AssignJackToRumDepartment"; - Task task = getTestTask(); OperationResult result = task.getResult(); String accountJackOid = assertUserBefore(USER_JACK_OID) .singleLink() - .target() - .assertResource(RESOURCE_OPENDJ_OID) - .end() + .target() + .assertResource(RESOURCE_OPENDJ_OID) + .end() .getOid(); // WHEN @@ -1220,23 +1163,23 @@ public void test424AssignJackToRumDepartment() throws Exception { then(); assertSuccess(result); - openDJController.assertUniqueMembers("cn="+PROJECT_KEELHAUL_NAME+",ou=groups,dc=example,dc=com", "uid="+USER_JACK_USERNAME+",ou=people,dc=example,dc=com"); - openDJController.assertUniqueMembers("cn="+PROJECT_WALK_THE_PLANK_NAME+",ou=groups,dc=example,dc=com", "uid="+USER_JACK_USERNAME+",ou=people,dc=example,dc=com"); - openDJController.assertUniqueMembers("cn="+ORG_RUM_DEPARTMENT_NAME+",ou=orgStruct,dc=example,dc=com", "uid="+USER_JACK_USERNAME+",ou=people,dc=example,dc=com"); + openDJController.assertUniqueMembers("cn=" + PROJECT_KEELHAUL_NAME + ",ou=groups,dc=example,dc=com", "uid=" + USER_JACK_USERNAME + ",ou=people,dc=example,dc=com"); + openDJController.assertUniqueMembers("cn=" + PROJECT_WALK_THE_PLANK_NAME + ",ou=groups,dc=example,dc=com", "uid=" + USER_JACK_USERNAME + ",ou=people,dc=example,dc=com"); + openDJController.assertUniqueMembers("cn=" + ORG_RUM_DEPARTMENT_NAME + ",ou=orgStruct,dc=example,dc=com", "uid=" + USER_JACK_USERNAME + ",ou=people,dc=example,dc=com"); assertModelShadow(accountJackOid) .associations() - .association(ASSOCIATION_LDAP_PROJECT_GROUP) - .assertShadowOids(groupKeelhaulOid, groupWalkThePlankOid) - .end() - .association(ASSOCIATION_LDAP_ORG_GROUP) - // MID-5790 - .assertShadowOids(groupRumDepartmentOid); + .association(ASSOCIATION_LDAP_PROJECT_GROUP) + .assertShadowOids(groupKeelhaulOid, groupWalkThePlankOid) + .end() + .association(ASSOCIATION_LDAP_ORG_GROUP) + // MID-5790 + .assertShadowOids(groupRumDepartmentOid); } private List> createTitleMapValues(String... params) throws SchemaException { List> cvals = new ArrayList<>(); - for(int i = 0; i < params.length; i+=2) { + for (int i = 0; i < params.length; i += 2) { PrismContainerValue cval = prismContext.itemFactory().createContainerValue(); PrismProperty keyProp = prismContext.itemFactory().createProperty(TITLE_MAP_KEY_QNAME); @@ -1244,7 +1187,7 @@ private List> createTitleMapValues(String... params) thro cval.add(keyProp); PrismProperty valueProp = prismContext.itemFactory().createProperty(TITLE_MAP_VALUE_QNAME); - valueProp.setRealValue(params[i+1]); + valueProp.setRealValue(params[i + 1]); cval.add(valueProp); cvals.add(cval); @@ -1260,5 +1203,4 @@ private void assertTitle(Entry entry, String expectedOrigValue, String... params OpenDJController.assertAttributeLang(entry, "title", expectedOrigValue, params); } - } diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapMutilated.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapMutilated.java index 11b4c1649aa..67ea6592612 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapMutilated.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapMutilated.java @@ -7,14 +7,9 @@ package com.evolveum.midpoint.testing.story.ldap; - -import static org.testng.AssertJUnit.assertNull; -import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertTrue; -import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.*; import java.io.File; - import javax.xml.namespace.QName; import org.apache.commons.lang3.StringUtils; @@ -43,7 +38,7 @@ * LDAP Tests with LDAP content that is completely mutilated. It is all wrong. * Wrong capitalization in objectClass attributes, spaces in DNs and so on. */ -@ContextConfiguration(locations = {"classpath:ctx-story-test-main.xml"}) +@ContextConfiguration(locations = { "classpath:ctx-story-test-main.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) public class TestLdapMutilated extends AbstractLdapTest { @@ -55,8 +50,6 @@ public class TestLdapMutilated extends AbstractLdapTest { protected static final String OPENDJ_ACCOUNTS_SUFFIX = "ou=accounts,dc=example,dc=com"; - private PrismObject resourceOpenDj; - private String accountJackOid; @Override @@ -65,7 +58,7 @@ protected void startResources() throws Exception { } @AfterClass - public static void stopResources() throws Exception { + public static void stopResources() { openDJController.stop(); } @@ -82,7 +75,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti "objectclass: organizationalunit"); // Resources - resourceOpenDj = importAndGetObjectFromFile(ResourceType.class, RESOURCE_OPENDJ_FILE, RESOURCE_OPENDJ_OID, initTask, initResult); + PrismObject resourceOpenDj = importAndGetObjectFromFile(ResourceType.class, RESOURCE_OPENDJ_FILE, RESOURCE_OPENDJ_OID, initTask, initResult); openDJController.setResource(resourceOpenDj); DebugUtil.setDetailedDebugDump(false); @@ -95,7 +88,6 @@ protected String getLdapResourceOid() { @Test public void test000Sanity() throws Exception { - final String TEST_NAME = "test000Sanity"; Task task = getTestTask(); OperationResult testResultOpenDj = modelService.testResource(RESOURCE_OPENDJ_OID, task); @@ -111,7 +103,6 @@ public void test000Sanity() throws Exception { */ @Test public void test010Shadows() throws Exception { - final String TEST_NAME = "test010Shadows"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -134,7 +125,6 @@ public void test010Shadows() throws Exception { */ @Test public void test100AssignAccountOpenDjSimple() throws Exception { - final String TEST_NAME = "test100AssignAccountOpenDjSimple"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -147,11 +137,11 @@ public void test100AssignAccountOpenDjSimple() throws Exception { assertSuccess(result); accountJackOid = assertUserAfter(USER_JACK_OID) - .singleLink() + .singleLink() .getOid(); assertModelShadow(accountJackOid) - .display(); + .display(); Entry accountEntry = getLdapEntryByUid(USER_JACK_USERNAME); display("Jack LDAP entry", accountEntry); @@ -165,7 +155,6 @@ public void test100AssignAccountOpenDjSimple() throws Exception { */ @Test public void test105Shadows() throws Exception { - final String TEST_NAME = "test105Shadows"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -186,7 +175,6 @@ public void test105Shadows() throws Exception { @Test public void test109UnassignAccountOpenDjSimple() throws Exception { - final String TEST_NAME = "test109UnassignAccountOpenDjSimple"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -199,7 +187,7 @@ public void test109UnassignAccountOpenDjSimple() throws Exception { assertSuccess(result); assertUserAfter(USER_JACK_OID) - .links() + .links() .assertNone(); assertNoShadow(accountJackOid); @@ -209,7 +197,6 @@ public void test109UnassignAccountOpenDjSimple() throws Exception { assertNull("Unexpected LDAP entry for jack", accountEntry); } - /** * Make sure there is no shadow for ou=accounts,dc=example,dc=com. * We haven't searched for accounts yet. @@ -217,7 +204,6 @@ public void test109UnassignAccountOpenDjSimple() throws Exception { */ @Test public void test300Shadows() throws Exception { - final String TEST_NAME = "test300Shadows"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -241,9 +227,8 @@ public void test300Shadows() throws Exception { */ @Test public void test310SearchLdapAccounts() throws Exception { - final String TEST_NAME = "test310SearchLdapAccounts"; - - ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ACCOUNT, SchemaConstants.INTENT_DEFAULT, prismContext); + ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, + ShadowKindType.ACCOUNT, SchemaConstants.INTENT_DEFAULT, prismContext); // WHEN when(); @@ -256,7 +241,6 @@ public void test310SearchLdapAccounts() throws Exception { */ @Test public void test312Shadows() throws Exception { - final String TEST_NAME = "test312Shadows"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -275,15 +259,15 @@ public void test312Shadows() throws Exception { assertEquals("Unexpected number of shadows", 1, shadows.size()); PrismObject peopleShadow = null; for (PrismObject shadow : shadows) { - if (StringUtils.equalsIgnoreCase(shadow.getName().getOrig(),OPENDJ_ACCOUNTS_SUFFIX)) { + if (StringUtils.equalsIgnoreCase(shadow.getName().getOrig(), OPENDJ_ACCOUNTS_SUFFIX)) { peopleShadow = shadow; } } assertNotNull("No ou=accounts shadow", peopleShadow); assertShadow(peopleShadow, "ou=accounts") - .display() - .assertObjectClass(new QName(MidPointConstants.NS_RI, "organizationalUnit")) - .assertKind(ShadowKindType.UNKNOWN); + .display() + .assertObjectClass(new QName(MidPointConstants.NS_RI, "organizationalUnit")) + .assertKind(ShadowKindType.UNKNOWN); } /** @@ -291,7 +275,6 @@ public void test312Shadows() throws Exception { */ @Test public void test320AssignAccountOpenDj() throws Exception { - final String TEST_NAME = "test320AssignAccountOpenDj"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -304,11 +287,11 @@ public void test320AssignAccountOpenDj() throws Exception { assertSuccess(result); accountJackOid = assertUserAfter(USER_JACK_OID) - .singleLink() + .singleLink() .getOid(); assertModelShadow(accountJackOid) - .display(); + .display(); Entry accountEntry = getLdapEntryByUid(USER_JACK_USERNAME); display("Jack LDAP entry", accountEntry); @@ -321,13 +304,11 @@ public void test320AssignAccountOpenDj() throws Exception { */ @Test public void test322SearchLdapAccounts() throws Exception { - final String TEST_NAME = "test310SearchLdapAccounts"; - - ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, ShadowKindType.ACCOUNT, SchemaConstants.INTENT_DEFAULT, prismContext); + ObjectQuery query = ObjectQueryUtil.createResourceAndKindIntent(RESOURCE_OPENDJ_OID, + ShadowKindType.ACCOUNT, SchemaConstants.INTENT_DEFAULT, prismContext); // WHEN when(); searchObjectsIterative(ShadowType.class, query, o -> display("Found object", o), 1); - } } diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapReconPerformance.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapReconPerformance.java index 2cd7a79ce71..a7ce8f95ce0 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapReconPerformance.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapReconPerformance.java @@ -7,16 +7,14 @@ package com.evolveum.midpoint.testing.story.ldap; +import static org.testng.AssertJUnit.assertEquals; + +import java.io.File; +import java.io.IOException; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; -import com.evolveum.midpoint.prism.PrismObject; -import com.evolveum.midpoint.schema.constants.MidPointConstants; -import com.evolveum.midpoint.schema.internals.InternalCounters; -import com.evolveum.midpoint.schema.result.OperationResult; -import com.evolveum.midpoint.task.api.Task; -import com.evolveum.midpoint.test.util.TestUtil; -import com.evolveum.midpoint.util.exception.*; -import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; -import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; import org.opends.server.types.DirectoryException; import org.opends.server.types.Entry; import org.opends.server.util.LDIFException; @@ -26,23 +24,26 @@ import org.testng.annotations.AfterClass; import org.testng.annotations.Test; -import java.io.File; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import static org.testng.AssertJUnit.assertEquals; +import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.schema.constants.MidPointConstants; +import com.evolveum.midpoint.schema.internals.InternalCounters; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.task.api.Task; +import com.evolveum.midpoint.test.ldap.OpenDJController; +import com.evolveum.midpoint.test.util.TestUtil; +import com.evolveum.midpoint.util.exception.*; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; +import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; /** * Reconciliation performance tests. - * + *

* We want a resource that is quite real. E.g. it needs to have quite a big schema, real * initialization costs and so on. - * + *

* MID-5284 */ -@ContextConfiguration(locations = {"classpath:ctx-story-test-main.xml"}) +@ContextConfiguration(locations = { "classpath:ctx-story-test-main.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) public class TestLdapReconPerformance extends AbstractLdapTest { @@ -69,9 +70,7 @@ public class TestLdapReconPerformance extends AbstractLdapTest { private static final int RECON_TASK_WAIT_TIMEOUT = 60000; - private PrismObject resourceOpenDj; - - private Map durations = new LinkedHashMap<>(); + private Map durations = new LinkedHashMap<>(); private long reconDuration1ThreadBaseline; private long reconDuration4ThreadBaseline; @@ -82,7 +81,7 @@ protected void startResources() throws Exception { } @AfterClass - public static void stopResources() throws Exception { + public static void stopResources() { openDJController.stop(); } @@ -91,7 +90,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti super.initSystem(initTask, initResult); // Resources - resourceOpenDj = importAndGetObjectFromFile(ResourceType.class, RESOURCE_OPENDJ_FILE, RESOURCE_OPENDJ_OID, initTask, initResult); + PrismObject resourceOpenDj = importAndGetObjectFromFile(ResourceType.class, RESOURCE_OPENDJ_FILE, RESOURCE_OPENDJ_OID, initTask, initResult); openDJController.setResource(resourceOpenDj); // InternalMonitor.setTrace(InternalOperationClasses.CONNECTOR_OPERATIONS, true); @@ -104,8 +103,6 @@ protected String getLdapResourceOid() { @Test public void test010GenerateUsers() throws Exception { - final String TEST_NAME = "test010GenerateUsers"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -114,57 +111,49 @@ public void test010GenerateUsers() throws Exception { // WHEN when(); // Add objects using model, we also want to create LDAP accounts - generateObjects(UserType.class, NUMBER_OF_GENERATED_USERS, GENERATED_USER_NAME_FORMAT, GENERATED_USER_OID_FORMAT, - (user,i) -> { - user - .fullName(String.format(GENERATED_USER_FULL_NAME_FORMAT, i)) - .givenName(String.format(GENERATED_USER_GIVEN_NAME_FORMAT, i)) - .familyName(String.format(GENERATED_USER_FAMILY_NAME_FORMAT, i)) - .beginAssignment() - .beginConstruction() - .resourceRef(RESOURCE_OPENDJ_OID, ResourceType.COMPLEX_TYPE); - }, - user -> addObject(user, task, result), - result); - - // THEN - then(); - - long endMillis = System.currentTimeMillis(); - recordDuration(TEST_NAME, (endMillis - startMillis)); - - assertUsers(getNumberOfUsers() + NUMBER_OF_GENERATED_USERS); + generateObjects(UserType.class, NUMBER_OF_GENERATED_USERS, GENERATED_USER_NAME_FORMAT, GENERATED_USER_OID_FORMAT, + (user, i) -> user + .fullName(String.format(GENERATED_USER_FULL_NAME_FORMAT, i)) + .givenName(String.format(GENERATED_USER_GIVEN_NAME_FORMAT, i)) + .familyName(String.format(GENERATED_USER_FAMILY_NAME_FORMAT, i)) + .beginAssignment() + .beginConstruction() + .resourceRef(RESOURCE_OPENDJ_OID, ResourceType.COMPLEX_TYPE), + user -> addObject(user, task, result), + result); + + // THEN + then(); + + long endMillis = System.currentTimeMillis(); + recordDuration((endMillis - startMillis)); + + assertUsers(getNumberOfUsers() + NUMBER_OF_GENERATED_USERS); dumpLdap(); assertLdapAccounts(); assertLdapConnectorInstances(1); } - /** * No changes for recon to fix. Single-threaded recon. */ @Test public void test100Reconcile1ThreadLdap0() throws Exception { - final String TEST_NAME = "test100Reconcile1ThreadLdap0"; - rememberConnectorResourceCounters(); - Task task = getTestTask(); - OperationResult result = task.getResult(); - // WHEN when(); addTask(TASK_RECON_1_OPENDJ_FILE); waitForTaskFinish(TASK_RECON_1_OPENDJ_OID, true, RECON_TASK_WAIT_TIMEOUT); - // THEN - then(); + // THEN + then(); - recordDuration(TEST_NAME,getRunDurationMillis(TASK_RECON_1_OPENDJ_OID)); + recordDuration(getRunDurationMillis(TASK_RECON_1_OPENDJ_OID)); - assertUsers(getNumberOfUsers() + NUMBER_OF_GENERATED_USERS); + assertUsers(getNumberOfUsers() + NUMBER_OF_GENERATED_USERS); assertLdapAccounts(); assertLdapConnectorInstances(1); @@ -176,12 +165,12 @@ public void test100Reconcile1ThreadLdap0() throws Exception { @Test public void test110Reconcile1ThreadLdap1() throws Exception { - reconDuration1ThreadBaseline = testReconcileLdapRestart1Thread("test110Reconcile1ThreadLdap1"); + reconDuration1ThreadBaseline = testReconcileLdapRestart1Thread(); } @Test public void test120Reconcile1ThreadLdap2() throws Exception { - testReconcileLdapRestart1Thread("test110Reconcile1ThreadLdap2"); + testReconcileLdapRestart1Thread(); } /** @@ -189,25 +178,20 @@ public void test120Reconcile1ThreadLdap2() throws Exception { */ @Test public void test200ReconcileLdap0() throws Exception { - final String TEST_NAME = "test200ReconcileLdap0"; - rememberConnectorResourceCounters(); - Task task = getTestTask(); - OperationResult result = task.getResult(); - // WHEN when(); addTask(TASK_RECON_4_OPENDJ_FILE); waitForTaskFinish(TASK_RECON_4_OPENDJ_OID, true, RECON_TASK_WAIT_TIMEOUT); - // THEN - then(); + // THEN + then(); - recordDuration(TEST_NAME,getRunDurationMillis(TASK_RECON_4_OPENDJ_OID)); + recordDuration(getRunDurationMillis(TASK_RECON_4_OPENDJ_OID)); - assertUsers(getNumberOfUsers() + NUMBER_OF_GENERATED_USERS); + assertUsers(getNumberOfUsers() + NUMBER_OF_GENERATED_USERS); assertLdapAccounts(); assertLdapConnectorInstances(1); @@ -217,63 +201,56 @@ public void test200ReconcileLdap0() throws Exception { @Test public void test210ReconcileLdap1() throws Exception { - reconDuration4ThreadBaseline = testReconcileLdapRestart("test210ReconcileLdap1"); + reconDuration4ThreadBaseline = testReconcileLdapRestart(); } @Test public void test220ReconcileLdap2() throws Exception { - testReconcileLdapRestart("test220ReconcileLdap2"); + testReconcileLdapRestart(); } @Test public void test230ReconcileLdap3() throws Exception { - testReconcileLdapRestart("test230ReconcileLdap3"); + testReconcileLdapRestart(); } @Test public void test310ReconcileLdapX1() throws Exception { - final String TEST_NAME = "test310ReconcileLdapX1"; - - Task task = taskManager.createTaskInstance(TestLdapReconPerformance.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult testResultOpenDj = modelService.testResource(RESOURCE_OPENDJ_OID, task); TestUtil.assertSuccess(testResultOpenDj); display("Test connection result", testResultOpenDj); - testReconcileLdapRestartWhen(TEST_NAME, TASK_RECON_4_OPENDJ_OID); + testReconcileLdapRestartWhen(TASK_RECON_4_OPENDJ_OID); } @Test public void test320ReconcileLdapX2() throws Exception { - testReconcileLdapRestart("test320ReconcileLdapX2"); + testReconcileLdapRestart(); } @Test public void test330ReconcileLdapX3() throws Exception { - testReconcileLdapRestart("test330ReconcileLdapX3"); + testReconcileLdapRestart(); } - private long testReconcileLdapRestart1Thread(final String TEST_NAME) throws Exception { - - long duration = testReconcileLdapRestartWhen(TEST_NAME, TASK_RECON_1_OPENDJ_OID); + private long testReconcileLdapRestart1Thread() throws Exception { + long duration = testReconcileLdapRestartWhen(TASK_RECON_1_OPENDJ_OID); assertLdapConnectorInstances(1); return duration; } - private long testReconcileLdapRestart(final String TEST_NAME) throws Exception { - - long duration = testReconcileLdapRestartWhen(TEST_NAME, TASK_RECON_4_OPENDJ_OID); + private long testReconcileLdapRestart() throws Exception { + long duration = testReconcileLdapRestartWhen(TASK_RECON_4_OPENDJ_OID); assertLdapConnectorInstances(); return duration; } - private long testReconcileLdapRestartWhen(final String TEST_NAME, String taskOid) throws Exception { - Task task = getTestTask(); - OperationResult result = task.getResult(); - + private long testReconcileLdapRestartWhen(String taskOid) throws Exception { ruinLdapAccounts(); rememberConnectorResourceCounters(); @@ -283,42 +260,37 @@ private long testReconcileLdapRestartWhen(final String TEST_NAME, String taskOid restartTask(taskOid); waitForTaskFinish(taskOid, true, RECON_TASK_WAIT_TIMEOUT); - // THEN - then(); + // THEN + then(); - long duration = recordDuration(TEST_NAME, getRunDurationMillis(taskOid)); + long duration = recordDuration(getRunDurationMillis(taskOid)); - assertUsers(getNumberOfUsers() + NUMBER_OF_GENERATED_USERS); + assertUsers(getNumberOfUsers() + NUMBER_OF_GENERATED_USERS); assertLdapAccounts(); assertSteadyResource(); // Re-reading modified account after the modificaiton (because context is not fresh), hence 2*NUMBER_OF_GENERATED_USERS - assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 1 + 1 + 2*NUMBER_OF_GENERATED_USERS); + assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 1 + 1 + 2 * NUMBER_OF_GENERATED_USERS); assertCounterIncrement(InternalCounters.CONNECTOR_MODIFICATION_COUNT, NUMBER_OF_GENERATED_USERS); return duration; } @Test - public void test900Summarize() throws Exception { - final String TEST_NAME = "test900Summarize"; - - Task task = getTestTask(); - OperationResult result = task.getResult(); - + public void test900Summarize() { StringBuilder sb = new StringBuilder(); for (Map.Entry entry : durations.entrySet()) { sb.append(summary(entry.getKey(), entry.getValue())); } - display("Summary ("+NUMBER_OF_GENERATED_USERS+" users)", sb.toString()); + display("Summary (" + NUMBER_OF_GENERATED_USERS + " users)", sb.toString()); - // THEN - then(); + // THEN + then(); - if (reconDuration1ThreadBaseline < reconDuration4ThreadBaseline) { - fail("Multi-thread recon SLOWER than single-thread! singlethread="+reconDuration1ThreadBaseline+"ms, multithread="+reconDuration4ThreadBaseline+"ms"); - } + if (reconDuration1ThreadBaseline < reconDuration4ThreadBaseline) { + fail("Multi-thread recon SLOWER than single-thread! singlethread=" + reconDuration1ThreadBaseline + "ms, multithread=" + reconDuration4ThreadBaseline + "ms"); + } - // TODO: more threasholds + // TODO: more thresholds } @@ -345,8 +317,8 @@ private void assertSteadyResource() { } private void ruinLdapAccounts() throws DirectoryException, LDIFException, IOException { - for (Entry entry : openDJController.search("objectclass="+OBJECTCLASS_INETORGPERSON)) { - String cn = openDJController.getAttributeValue(entry, "cn"); + for (Entry entry : openDJController.search("objectclass=" + OBJECTCLASS_INETORGPERSON)) { + String cn = OpenDJController.getAttributeValue(entry, "cn"); if (cn.startsWith("Random")) { cn = cn.replace("Random", "Broken"); openDJController.modifyReplace(entry.getDN().toString(), "cn", cn); @@ -359,12 +331,12 @@ private void ruinLdapAccounts() throws DirectoryException, LDIFException, IOExce } protected void assertLdapAccounts() throws DirectoryException { - List entries = openDJController.search("objectclass="+OBJECTCLASS_INETORGPERSON); + List entries = openDJController.search("objectclass=" + OBJECTCLASS_INETORGPERSON); int randoms = 0; - for (Entry entry : openDJController.search("objectclass="+OBJECTCLASS_INETORGPERSON)) { - String cn = openDJController.getAttributeValue(entry, "cn"); + for (Entry entry : openDJController.search("objectclass=" + OBJECTCLASS_INETORGPERSON)) { + String cn = OpenDJController.getAttributeValue(entry, "cn"); if (cn.startsWith("Broken")) { - fail("Broken LDAP account: "+entry); + fail("Broken LDAP account: " + entry); } if (cn.startsWith("Random")) { randoms++; @@ -373,12 +345,14 @@ protected void assertLdapAccounts() throws DirectoryException { assertEquals("Wrong number of Random LDAP accounts", NUMBER_OF_GENERATED_USERS, randoms); } - protected void assertLdapConnectorInstances() throws NumberFormatException, SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, ExpressionEvaluationException, IOException, InterruptedException { - assertLdapConnectorInstances(2,4); + protected void assertLdapConnectorInstances() + throws NumberFormatException, SchemaException, ObjectNotFoundException, + CommunicationException, ConfigurationException, ExpressionEvaluationException { + assertLdapConnectorInstances(2, 4); } - private long recordDuration(String label, long duration) { - durations.put(label, duration); + private long recordDuration(long duration) { + durations.put(getTestNameShort(), duration); return duration; } diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapSyncMassive.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapSyncMassive.java index c76ac333cad..5a1b9c73299 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapSyncMassive.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapSyncMassive.java @@ -125,8 +125,6 @@ public void test000Sanity() throws Exception { @Test public void test080ImportSyncTask() throws Exception { - final String TEST_NAME = "test080ImportSyncTask"; - // WHEN when(); @@ -155,8 +153,6 @@ public void test080ImportSyncTask() throws Exception { */ @Test public void test110SyncAddWill() throws Exception { - final String TEST_NAME = "test110SyncAddWill"; - Entry entry = openDJController.addEntryFromLdifFile(ACCOUNT_WILL_LDIF_FILE); display("Entry from LDIF", entry); @@ -196,8 +192,6 @@ public void test110SyncAddWill() throws Exception { */ @Test public void test112SyncAddGoods() throws Exception { - final String TEST_NAME = "test112SyncAddGoods"; - // WHEN when(); @@ -223,8 +217,6 @@ public void test112SyncAddGoods() throws Exception { */ @Test public void test150AddGoblins() throws Exception { - final String TEST_NAME = "test150AddGoblins"; - // WHEN when(); @@ -292,8 +284,6 @@ public void test200SyncAddKraken() throws Exception { */ @Test public void test210SyncAddKraken() throws Exception { - final String TEST_NAME = "test210SyncAddKraken"; - Entry entry = openDJController.addEntryFromLdifFile(ACCOUNT_KRAKEN_LDIF_FILE); display("Entry from LDIF", entry); @@ -330,8 +320,6 @@ public void test210SyncAddKraken() throws Exception { */ @Test public void test212SyncAddBads() throws Exception { - final String TEST_NAME = "test212SyncAddBads"; - // WHEN when(); @@ -352,8 +340,6 @@ public void test212SyncAddBads() throws Exception { */ @Test public void test219StopSyncTask() throws Exception { - final String TEST_NAME = "test219StopSyncTask"; - // WHEN when(); @@ -368,10 +354,9 @@ public void test219StopSyncTask() throws Exception { } + // this runs for ~20+ minutes @Test public void test230UserRecomputeSequential() throws Exception { - final String TEST_NAME = "test230UserRecomputeSequential"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -393,8 +378,6 @@ public void test230UserRecomputeSequential() throws Exception { @Test public void test232UserRecomputeParallel() throws Exception { - final String TEST_NAME = "test232UserRecomputeParallel"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -512,5 +495,4 @@ private void assertSyncTokenIncrement(int expectedIncrement) throws ObjectNotFou protected void dumpLdap() throws DirectoryException { display("LDAP server tree", openDJController.dumpTree()); } - } diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapVirtualGroup.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapVirtualGroup.java index fb7bbe5c91b..2072c9309f7 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapVirtualGroup.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/TestLdapVirtualGroup.java @@ -7,6 +7,20 @@ package com.evolveum.midpoint.testing.story.ldap; +import static org.testng.Assert.assertEquals; +import static org.testng.AssertJUnit.assertNotNull; + +import java.io.File; +import java.util.*; + +import org.opends.server.types.DirectoryException; +import org.opends.server.types.Entry; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.ContextConfiguration; +import org.testng.annotations.AfterClass; +import org.testng.annotations.Test; + import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.util.PrismAsserts; import com.evolveum.midpoint.prism.util.PrismTestUtil; @@ -17,55 +31,39 @@ import com.evolveum.midpoint.util.exception.*; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import com.evolveum.prism.xml.ns._public.types_3.PolyStringType; -import org.opends.server.types.DirectoryException; -import org.opends.server.types.Entry; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.annotation.DirtiesContext.ClassMode; -import org.springframework.test.context.ContextConfiguration; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; - -import java.io.File; -import java.util.*; - -import static org.testng.Assert.assertEquals; -import static org.testng.AssertJUnit.assertNotNull; /** * Testing virtual groups in openDJ. Group membership is based on attributes of user object. * When a role is assigned midpoint should just write the correct user attribute values * instead of managing the group membership by associations. - * + *

* in this test attribute description is used to do this magic (in real life this should be a custom attribute). * Object of class groupOfURLs is looking for description in users, object of class ds-virtual-static-group is * evaluating object of class groupOfURLs in OpenDj set ds-cfg-allow-retrieving-membership: true to show uniqueMember * in objects of class ds-virtual-static-group - * + *

* dumpLdap() does not show uniqueMember but when looking to DJ uniqueMember-attributes do exist. * (Seems uniqueMember must be defined explicitly in returnAttributes which is not the case) - * + *

* Primary intent of test was to find replacement for $thisObject assignment variable. Tests are succesfull without using thisObject, though it * seems to be necessary to use different assignment variables. (depends on order of inducement) - * + *

* Setting useThisObject = true will import IT-Role-HR and role-meta-ldap using "thisObject" assignment variable. - * + *

* used roles: * IT-Role-HR: contains assignments for LDAP-Objects and inducement for setting description to user-account * role-meta-ldap: same as in IT-Role-HR but desinged as meta-role: creating LDAP-Objects is induced, inducement for setting description to user-account is order 2 * IT-Role-Dev and IT-Role-Op: have assigend role-meta-ldap * Job-Role-DevOps: induces IT-Role-Dev and IT-Role-Op * Job-Role-MultiJobs: induces Job-Role-DevOps and IT-Role-HR - * + *

* Users and the roles being assigned in tests: * User0: IT-Role-HR * User1: IT-Role-Dev * User2: Job-Role-DevOps * User3: Job-Role-MultiJobs * - * - * * @author michael gruber - * */ @ContextConfiguration(locations = { "classpath:ctx-story-test-main.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) @@ -88,7 +86,6 @@ public class TestLdapVirtualGroup extends AbstractLdapTest { private static final String ROLE_IT_DEV_NAME = "IT-Role-Dev"; private static final String ROLE_IT_OP_NAME = "IT-Role-Op"; - private static String roleItDevOid; private static String roleItOpOid; @@ -176,8 +173,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti @Test public void test000Sanity() throws Exception { - final String TEST_NAME = "test000Sanity"; - Task task = taskManager.createTaskInstance(TestLdapVirtualGroup.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult testResultOpenDj = modelService.testResource(RESOURCE_OPENDJ_OID, task); TestUtil.assertSuccess(testResultOpenDj); @@ -187,16 +183,14 @@ public void test000Sanity() throws Exception { display("FINISHED: test000Sanity"); } - @Test public void test090AddItRoleHR() throws Exception { - final String TEST_NAME = "test090AddItRoleHR"; - Task task = taskManager.createTaskInstance(TestLdapVirtualGroup.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult result = task.getResult(); // WHEN when(); - display("recompute role "+ROLE_IT_HR_NAME); + display("recompute role " + ROLE_IT_HR_NAME); modelService.recompute(RoleType.class, ROLE_IT_HR_OID, task, result); @@ -215,7 +209,6 @@ public void test090AddItRoleHR() throws Exception { assertLdapObject(roleAfter, ShadowKindType.GENERIC, LDAP_INTENT_DYNAMIC); } - @Test public void test100AddItDevRole() throws Exception { Task task = getTestTask(); @@ -245,8 +238,7 @@ public void test100AddItDevRole() throws Exception { @Test public void test110AddItOpRole() throws Exception { - final String TEST_NAME = "test100AddItOpRole"; - Task task = taskManager.createTaskInstance(TestLdapVirtualGroup.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult result = task.getResult(); PrismObject roleBefore = createLdapRole(ROLE_IT_OP_NAME); @@ -273,8 +265,7 @@ public void test110AddItOpRole() throws Exception { @Test public void test200CreateUsers() throws Exception { - final String TEST_NAME = "test200CreateUsers"; - Task task = taskManager.createTaskInstance(TestLdapVirtualGroup.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult result = task.getResult(); PrismObject user0Before = createUser(USER_0_NAME, "givenName0", "familyName0", true); @@ -316,9 +307,7 @@ public void test200CreateUsers() throws Exception { @Test public void test210AssignItHrRoleToUser0() throws Exception { - final String TEST_NAME = "test210AssignItHrRoleToUser0"; - - Task task = taskManager.createTaskInstance(TestLdapVirtualGroup.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult result = task.getResult(); PrismObject user0Before = getObjectByName(UserType.class, USER_0_NAME); @@ -347,9 +336,7 @@ public void test210AssignItHrRoleToUser0() throws Exception { @Test public void test220AssignItDevRoleToUser1() throws Exception { - final String TEST_NAME = "test220AssignItDevRoleToUser1"; - - Task task = taskManager.createTaskInstance(TestLdapVirtualGroup.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult result = task.getResult(); PrismObject user1Before = getObjectByName(UserType.class, USER_1_NAME); @@ -378,9 +365,7 @@ public void test220AssignItDevRoleToUser1() throws Exception { @Test public void test230AssignJobRoleToUser2() throws Exception { - final String TEST_NAME = "test230AssignJobRoleToUser2"; - - Task task = taskManager.createTaskInstance(TestLdapVirtualGroup.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult result = task.getResult(); importObjectFromFile(getRoleJobRoleDevOpsFile(), result); @@ -413,9 +398,7 @@ public void test230AssignJobRoleToUser2() throws Exception { @Test public void test240AssignJobRoleMultiJobToUser3() throws Exception { - final String TEST_NAME = "test230AssignJobRoleMultiJobToUser3"; - - Task task = taskManager.createTaskInstance(TestLdapVirtualGroup.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult result = task.getResult(); importObjectFromFile(getRoleJobRoleMultiJobsFile(), result); @@ -474,8 +457,7 @@ private void assertLdapUserObject(PrismObject user, ShadowKindType kin String search = ""; if (kind.equals(ShadowKindType.ACCOUNT)) { - if (LDAP_INTENT_DEFAULT.equals(intent)) - search = "uid=" + userName; + if (LDAP_INTENT_DEFAULT.equals(intent)) { search = "uid=" + userName; } } Entry objEntry = openDJController.searchSingle(search); assertNotNull("No LDAP entry for " + userName + ", kind " + kind + ", intent " + intent, objEntry); @@ -495,12 +477,10 @@ private void assertLdapObject(PrismObject role, ShadowKindType kind, S String search = ""; if (kind.equals(ShadowKindType.ENTITLEMENT)) { - if (LDAP_INTENT_VIRTUALSTATIC.equals(intent)) - search = "cn=vrtgrp-" + roleName; + if (LDAP_INTENT_VIRTUALSTATIC.equals(intent)) { search = "cn=vrtgrp-" + roleName; } } if (kind.equals(ShadowKindType.GENERIC)) { - if (LDAP_INTENT_DYNAMIC.equals(intent)) - search = "cn=dyngrp-" + roleName; + if (LDAP_INTENT_DYNAMIC.equals(intent)) { search = "cn=dyngrp-" + roleName; } } Entry objEntry = openDJController.searchSingle(search); assertNotNull("No LDAP entry for " + roleName + ", kind " + kind + ", intent " + intent, objEntry); @@ -541,7 +521,8 @@ private void assertShadowAttribute(PrismObject focus, } protected PrismObject getObjectByName( - Class clazz, String name) throws SchemaException, ObjectNotFoundException, SecurityViolationException, + Class clazz, String name) + throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException { PrismObject object = (PrismObject) findObjectByName(clazz, name); assertNotNull("The object " + name + " of type " + clazz + " is missing!", object); diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/hierarchy/AbstractLdapHierarchyTest.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/hierarchy/AbstractLdapHierarchyTest.java index 7cc6a954121..299492babae 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/hierarchy/AbstractLdapHierarchyTest.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/ldap/hierarchy/AbstractLdapHierarchyTest.java @@ -137,8 +137,7 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti @Test public void test000Sanity() throws Exception { - final String TEST_NAME = "test000Sanity"; - Task task = taskManager.createTaskInstance(AbstractLdapHierarchyTest.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult testResultOpenDj = modelService.testResource(RESOURCE_OPENDJ_OID, task); TestUtil.assertSuccess(testResultOpenDj); @@ -341,7 +340,6 @@ public void test300RenameOrgCortuvHrad() throws Exception { @Test public void test310RenameUserGorc() throws Exception { - final String TEST_NAME = "test310RenameUserGorc"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -364,7 +362,6 @@ public void test310RenameUserGorc() throws Exception { @Test public void test320AddOrgRoyulaDiabolica() throws Exception { - final String TEST_NAME = "test320AddOrgRoyulaDiabolica"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -393,7 +390,6 @@ public void test320AddOrgRoyulaDiabolica() throws Exception { @Test public void test322MoveOrgZblo() throws Exception { - final String TEST_NAME = "test322MoveOrgZblo"; Task task = getTestTask(); OperationResult result = task.getResult(); diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/notorious/AbstractNotoriousTest.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/notorious/AbstractNotoriousTest.java index 12072fbb84f..3f317c01727 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/notorious/AbstractNotoriousTest.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/notorious/AbstractNotoriousTest.java @@ -166,8 +166,6 @@ public void test000Sanity() throws Exception { @Test public void test100AssignRa0ToJack() throws Exception { - final String TEST_NAME = "test100AssignRa0ToJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -202,8 +200,6 @@ public void test100AssignRa0ToJack() throws Exception { @Test public void test102RecomputeJack() throws Exception { - final String TEST_NAME = "test102RecomputeJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -234,8 +230,6 @@ public void test102RecomputeJack() throws Exception { @Test public void test104PreviewChangesJack() throws Exception { - final String TEST_NAME = "test104PreviewChangesJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -273,8 +267,6 @@ public void test104PreviewChangesJack() throws Exception { @Test public void test109UnassignRa0FromJack() throws Exception { - final String TEST_NAME = "test109UnassignRa0FromJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -306,8 +298,6 @@ public void test109UnassignRa0FromJack() throws Exception { @Test public void test110Assign5ARolesToJack() throws Exception { - final String TEST_NAME = "test110AssignAllARolesToJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -338,8 +328,6 @@ public void test110Assign5ARolesToJack() throws Exception { @Test public void test112RecomputeJack() throws Exception { - final String TEST_NAME = "test112RecomputeJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -370,8 +358,6 @@ public void test112RecomputeJack() throws Exception { @Test public void test119Unassign5ARolesFromJack() throws Exception { - final String TEST_NAME = "test119Unassign5ARolesFromJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -403,8 +389,6 @@ public void test119Unassign5ARolesFromJack() throws Exception { @Test public void test120AssignAllARolesToJack() throws Exception { - final String TEST_NAME = "test120AssignAllARolesToJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -435,8 +419,6 @@ public void test120AssignAllARolesToJack() throws Exception { @Test public void test122RecomputeJack() throws Exception { - final String TEST_NAME = "test122RecomputeJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -467,8 +449,6 @@ public void test122RecomputeJack() throws Exception { @Test public void test124PreviewChangesJack() throws Exception { - final String TEST_NAME = "test124PreviewChangesJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -506,8 +486,6 @@ public void test124PreviewChangesJack() throws Exception { @Test public void test129UnassignAllARolesFromJack() throws Exception { - final String TEST_NAME = "test129UnassignAllARolesFromJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -539,8 +517,6 @@ public void test129UnassignAllARolesFromJack() throws Exception { @Test public void test130AssignRb0ToJack() throws Exception { - final String TEST_NAME = "test130AssignRb0ToJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -581,8 +557,6 @@ public void test130AssignRb0ToJack() throws Exception { */ @Test public void test132AssignRa0ToJack() throws Exception { - final String TEST_NAME = "test132AssignRa0ToJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -617,8 +591,6 @@ public void test132AssignRa0ToJack() throws Exception { @Test public void test134RecomputeJack() throws Exception { - final String TEST_NAME = "test134RecomputeJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -651,8 +623,6 @@ public void test134RecomputeJack() throws Exception { @Test public void test136UnassignRb0FromJack() throws Exception { - final String TEST_NAME = "test136UnassignRb0FromJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -687,8 +657,6 @@ public void test136UnassignRb0FromJack() throws Exception { @Test public void test138AssignRb0ToJackAgain() throws Exception { - final String TEST_NAME = "test138AssignRb0ToJackAgain"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -723,8 +691,6 @@ public void test138AssignRb0ToJackAgain() throws Exception { @Test public void test140RecomputeJackAgain() throws Exception { - final String TEST_NAME = "test140RecomputeJackAgain"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -757,8 +723,6 @@ public void test140RecomputeJackAgain() throws Exception { @Test public void test142RecomputeJackAlt() throws Exception { - final String TEST_NAME = "test142RecomputeJackAlt"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -792,8 +756,6 @@ public void test142RecomputeJackAlt() throws Exception { @Test public void test144UnassignRa0FromJack() throws Exception { - final String TEST_NAME = "test144UnassignRa0FromJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -828,8 +790,6 @@ public void test144UnassignRa0FromJack() throws Exception { @Test public void test149UnassignRb0FromJack() throws Exception { - final String TEST_NAME = "test149UnassignRb0FromJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -869,8 +829,6 @@ public void test149UnassignRb0FromJack() throws Exception { */ @Test public void test150AssignNotoriousDefaultToJack() throws Exception { - final String TEST_NAME = "test150AssignNotoriousDefaultToJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -911,8 +869,6 @@ public void test150AssignNotoriousDefaultToJack() throws Exception { */ @Test public void test152AssignNotoriousAltRelationToJack() throws Exception { - final String TEST_NAME = "test152AssignNotoriousAltRelationToJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -954,8 +910,6 @@ public void test152AssignNotoriousAltRelationToJack() throws Exception { @Test public void test154RecomputeJack() throws Exception { - final String TEST_NAME = "test154RecomputeJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -1000,8 +954,6 @@ protected int getTest15xRoleEvaluationIncrement() { @Test public void test156RecomputeJackAlt() throws Exception { - final String TEST_NAME = "test156RecomputeJackAlt"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -1042,8 +994,6 @@ public void test156RecomputeJackAlt() throws Exception { @Test public void test158UnassignNotoriousDefaultFromJack() throws Exception { - final String TEST_NAME = "test156UnassignNotoriousDefaultFromJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); @@ -1083,8 +1033,6 @@ protected void assertTest158RoleMembershipRef(PrismObject userAfter) { @Test public void test159UnassignNotoriousAltRelationFromJack() throws Exception { - final String TEST_NAME = "test159UnassignNotoriousAltRelationFromJack"; - Task task = getTestTask(); OperationResult result = task.getResult(); diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/perf/TestImport.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/perf/TestImport.java index de0a4585da6..f9c4fe0d863 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/perf/TestImport.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/perf/TestImport.java @@ -16,6 +16,7 @@ import com.evolveum.midpoint.test.util.MidPointTestConstants; import com.evolveum.midpoint.test.util.TestUtil; import com.evolveum.midpoint.testing.story.AbstractStoryTest; +import com.evolveum.midpoint.tools.testng.UnusedTestElement; import com.evolveum.midpoint.util.statistics.OperationExecutionLogger; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import com.mysql.cj.jdbc.Driver; @@ -37,6 +38,7 @@ * This test is not meant to be run automatically. * It requires externally-configured MySQL database with the data to be imported. */ +@UnusedTestElement("not in suite, failing on spring init") @ContextConfiguration(locations = {"classpath:ctx-story-test-main.xml","classpath:ctx-interceptor.xml"}) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) public class TestImport extends AbstractStoryTest { @@ -109,8 +111,7 @@ protected void importSystemTasks(OperationResult initResult) { @Test public void test000Sanity() throws Exception { - final String TEST_NAME = "test000Sanity"; - Task task = taskManager.createTaskInstance(TestImport.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult testResultHr = modelService.testResource(RESOURCE_SOURCE_OID, task); TestUtil.assertSuccess(testResultHr); @@ -122,8 +123,7 @@ public void test000Sanity() throws Exception { @Test public void test100RunImport() throws Exception { - final String TEST_NAME = "test100RunImport"; - Task task = taskManager.createTaskInstance(TestImport.class.getName() + "." + TEST_NAME); + Task task = getTestTask(); OperationResult result = task.getResult(); // WHEN diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/security/TestPrivacy.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/security/TestPrivacy.java index 1d32777e2bd..e1432ed629c 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/security/TestPrivacy.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/security/TestPrivacy.java @@ -6,14 +6,6 @@ */ package com.evolveum.midpoint.testing.story.security; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertNotEquals; -import static org.testng.Assert.assertNull; -import static org.testng.Assert.assertTrue; -import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertNull; - import java.io.File; import org.springframework.test.annotation.DirtiesContext; @@ -22,7 +14,6 @@ import org.testng.annotations.Test; import com.evolveum.icf.dummy.resource.DummySyncStyle; -import com.evolveum.midpoint.schema.constants.MidPointConstants; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.task.api.Task; import com.evolveum.midpoint.test.util.MidPointTestConstants; @@ -33,9 +24,8 @@ * Tests for privacy-enhancing setup. E.g. broad get authorizations, but limited search. * * @author semancik - * */ -@ContextConfiguration(locations = {"classpath:ctx-story-test-main.xml"}) +@ContextConfiguration(locations = { "classpath:ctx-story-test-main.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) public class TestPrivacy extends AbstractStoryTest { @@ -52,8 +42,6 @@ public class TestPrivacy extends AbstractStoryTest { protected static final File RESOURCE_DUMMY_FILE = new File(TEST_DIR, "resource-dummy.xml"); protected static final String RESOURCE_DUMMY_OID = "dfc012e2-b813-11e8-82af-679b6f0a6ad4"; - private static final String RESOURCE_DUMMY_NS = MidPointConstants.NS_RI; - @Override public void initSystem(Task initTask, OperationResult initResult) throws Exception { @@ -72,8 +60,6 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti */ @Test public void test100AutzJackReadSearch() throws Exception { - final String TEST_NAME = "test100AutzJackReadSearch"; - assignRole(USER_JACK_OID, ROLE_PRIVACY_END_USER_OID); login(USER_JACK_USERNAME); diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/security/TestRoleMembers.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/security/TestRoleMembers.java index 2667cb20ab3..642bdd1cc24 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/security/TestRoleMembers.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/security/TestRoleMembers.java @@ -6,10 +6,7 @@ */ package com.evolveum.midpoint.testing.story.security; -import static org.testng.AssertJUnit.assertFalse; -import static org.testng.AssertJUnit.assertNotNull; -import static org.testng.AssertJUnit.assertNull; -import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.*; import java.io.File; import java.util.Collections; @@ -31,14 +28,7 @@ import com.evolveum.midpoint.task.api.Task; import com.evolveum.midpoint.test.util.MidPointTestConstants; import com.evolveum.midpoint.testing.story.AbstractStoryTest; -import com.evolveum.midpoint.util.exception.CommunicationException; -import com.evolveum.midpoint.util.exception.ConfigurationException; -import com.evolveum.midpoint.util.exception.ExpressionEvaluationException; -import com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException; -import com.evolveum.midpoint.util.exception.ObjectNotFoundException; -import com.evolveum.midpoint.util.exception.PolicyViolationException; -import com.evolveum.midpoint.util.exception.SchemaException; -import com.evolveum.midpoint.util.exception.SecurityViolationException; +import com.evolveum.midpoint.util.exception.*; import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType; import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType; @@ -46,9 +36,8 @@ * Tests for privacy-enhancing setup. E.g. broad get authorizations, but limited search. * * @author semancik - * */ -@ContextConfiguration(locations = {"classpath:ctx-story-test-main.xml"}) +@ContextConfiguration(locations = { "classpath:ctx-story-test-main.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) public class TestRoleMembers extends AbstractStoryTest { @@ -72,8 +61,6 @@ public class TestRoleMembers extends AbstractStoryTest { protected static final String ROLE_GOVERNOR_OID = "78a76270-cafd-11e8-ba0c-4f7b8e8b4e57"; protected static final String ROLE_PIRATE_OID = "31d5bdce-cafd-11e8-b41d-b373e6c564cb"; - protected static final String ROLE_PIRATE_NAME = "Pirate"; - @Override public void initSystem(Task initTask, OperationResult initResult) throws Exception { @@ -82,37 +69,34 @@ public void initSystem(Task initTask, OperationResult initResult) throws Excepti importObjectsFromFileNotRaw(USERS_ROLES_FILE, initTask, initResult); } - @Test public void test000Sanity() throws Exception { - final String TEST_NAME = "test000Sanity"; - // WHEN when(); assertUserBefore(USER_GUYBRUSH_OID) - .assertName(USER_GUYBRUSH_USERNAME) - .roleMembershipRefs() + .assertName(USER_GUYBRUSH_USERNAME) + .roleMembershipRefs() .assertRole(ROLE_END_USER_OID, SchemaConstants.ORG_DEFAULT) .assertRoleMemberhipRefs(1); assertUserBefore(USER_ELAINE_OID) - .assertName(USER_ELAINE_USERNAME) - .roleMembershipRefs() + .assertName(USER_ELAINE_USERNAME) + .roleMembershipRefs() .assertRole(ROLE_PIRATE_OID, SchemaConstants.ORG_OWNER) .assertRole(ROLE_GOVERNOR_OID, SchemaConstants.ORG_DEFAULT) .assertRole(ROLE_END_USER_OID, SchemaConstants.ORG_DEFAULT) .assertRoleMemberhipRefs(3); assertUserBefore(USER_MANCOMB_OID) - .assertName(USER_MANCOMB_USERNAME) - .assertFullName(USER_MANCOMB_FULL_NAME) - .assertGivenName(USER_MANCOMB_GIVEN_NAME) - .assignments() + .assertName(USER_MANCOMB_USERNAME) + .assertFullName(USER_MANCOMB_FULL_NAME) + .assertGivenName(USER_MANCOMB_GIVEN_NAME) + .assignments() .assertAssignments(1) .assertRole(ROLE_PIRATE_OID) .end() - .roleMembershipRefs() + .roleMembershipRefs() .assertRole(ROLE_PIRATE_OID, SchemaConstants.ORG_DEFAULT) .assertRoleMemberhipRefs(1); @@ -133,8 +117,6 @@ public void test000Sanity() throws Exception { */ @Test public void test100AutzGuybrushNoMembers() throws Exception { - final String TEST_NAME = "test100AutzGuybrushNoMembers"; - login(USER_GUYBRUSH_USERNAME); // WHEN @@ -142,9 +124,9 @@ public void test100AutzGuybrushNoMembers() throws Exception { PrismObject userMancomb = assertGetAllow(UserType.class, USER_MANCOMB_OID); assertUser(userMancomb, "mancomb") - .assertName(USER_MANCOMB_USERNAME) - .assertAssignments(0) - .assertRoleMemberhipRefs(0); + .assertName(USER_MANCOMB_USERNAME) + .assertAssignments(0) + .assertRoleMemberhipRefs(0); assertCanSearchPirateMembers(false); @@ -155,17 +137,17 @@ public void test100AutzGuybrushNoMembers() throws Exception { // in the object. SearchResultList> members = searchPirateMembers(1); assertUser(members.get(0), "pirate role member") - .assertName(USER_MANCOMB_USERNAME) - .assertFullName(USER_MANCOMB_FULL_NAME) - .assertNoGivenName() - .assertRoleMemberhipRefs(0); + .assertName(USER_MANCOMB_USERNAME) + .assertFullName(USER_MANCOMB_FULL_NAME) + .assertNoGivenName() + .assertRoleMemberhipRefs(0); ModelContext previewContext = previewUser(USER_MANCOMB_OID); assertUser(previewContext.getFocusContext().getObjectOld(), "preview user old") - .assertName(USER_MANCOMB_USERNAME) - .assertFullName(USER_MANCOMB_FULL_NAME) - .assertNoGivenName(); + .assertName(USER_MANCOMB_USERNAME) + .assertFullName(USER_MANCOMB_FULL_NAME) + .assertNoGivenName(); DeltaSetTriple> evaluatedAssignmentTriple = previewContext.getEvaluatedAssignmentTriple(); assertNull("Preview evaluated assignment triple sneaked in", evaluatedAssignmentTriple); @@ -183,7 +165,7 @@ private ModelContext previewUser(String userOid) throws SchemaExceptio result.computeStatus(); if (!result.isSuccess() && !result.isHandledError() && !result.isWarning()) { display("Unexpected preview result", result); - fail("Unexpected preview result: "+result.getStatus()); + fail("Unexpected preview result: " + result.getStatus()); } return previewContext; } @@ -193,8 +175,6 @@ private ModelContext previewUser(String userOid) throws SchemaExceptio */ @Test public void test105AutzElaineMembers() throws Exception { - final String TEST_NAME = "test105AutzElaineMembers"; - login(USER_ELAINE_USERNAME); // WHEN @@ -202,9 +182,9 @@ public void test105AutzElaineMembers() throws Exception { PrismObject userMancomb = assertGetAllow(UserType.class, USER_MANCOMB_OID); assertUser(userMancomb, "mancomb") - .assertName(USER_MANCOMB_USERNAME) - .assertAssignments(0) - .roleMembershipRefs() + .assertName(USER_MANCOMB_USERNAME) + .assertAssignments(0) + .roleMembershipRefs() .assertRole(ROLE_PIRATE_OID) .assertRoleMemberhipRefs(1); @@ -212,8 +192,8 @@ public void test105AutzElaineMembers() throws Exception { SearchResultList> members = searchPirateMembers(1); assertUser(members.get(0), "pirate role member") - .assertName(USER_MANCOMB_USERNAME) - .roleMembershipRefs() + .assertName(USER_MANCOMB_USERNAME) + .roleMembershipRefs() .assertRole(ROLE_PIRATE_OID, SchemaConstants.ORG_DEFAULT) .assertRoleMemberhipRefs(1); @@ -222,8 +202,6 @@ public void test105AutzElaineMembers() throws Exception { } - - private void assertCanSearchPirateMembers(boolean expected) throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { assertEquals("Wrong canSearch on pirate members", expected, canSearchPirateMembers()); } diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/AbstractUuidTest.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/AbstractUuidTest.java index a8d9e8a11b6..707febb02ce 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/AbstractUuidTest.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/AbstractUuidTest.java @@ -6,14 +6,7 @@ * and European Union Public License. See LICENSE file for details. */ -import com.evolveum.midpoint.prism.PrismObject; -import com.evolveum.midpoint.schema.constants.MidPointConstants; -import com.evolveum.midpoint.schema.result.OperationResult; -import com.evolveum.midpoint.task.api.Task; -import com.evolveum.midpoint.test.util.MidPointTestConstants; -import com.evolveum.midpoint.test.util.TestUtil; -import com.evolveum.midpoint.testing.story.AbstractStoryTest; -import com.evolveum.midpoint.xml.ns._public.common.common_3.*; +import java.io.File; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.annotation.DirtiesContext.ClassMode; @@ -22,15 +15,16 @@ import org.testng.annotations.Listeners; import org.testng.annotations.Test; -import java.io.File; - -import static org.testng.AssertJUnit.assertEquals; +import com.evolveum.midpoint.prism.PrismObject; +import com.evolveum.midpoint.schema.constants.MidPointConstants; +import com.evolveum.midpoint.schema.result.OperationResult; +import com.evolveum.midpoint.task.api.Task; +import com.evolveum.midpoint.test.util.MidPointTestConstants; +import com.evolveum.midpoint.test.util.TestUtil; +import com.evolveum.midpoint.testing.story.AbstractStoryTest; +import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType; -/** - * @author Radovan Semancik - * - */ -@ContextConfiguration(locations = {"classpath:ctx-story-test-main.xml"}) +@ContextConfiguration(locations = { "classpath:ctx-story-test-main.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) @Listeners({ com.evolveum.midpoint.tools.testng.AlphabeticalMethodInterceptor.class }) public abstract class AbstractUuidTest extends AbstractStoryTest { @@ -50,16 +44,13 @@ public abstract class AbstractUuidTest extends AbstractStoryTest { protected ResourceType resourceOpenDjType; protected PrismObject resourceOpenDj; - protected String userRappOid; - protected String userMancombOid; - @Override protected void startResources() throws Exception { openDJController.startCleanServer(); } @AfterClass - public static void stopResources() throws Exception { + public static void stopResources() { openDJController.stop(); } @@ -86,7 +77,6 @@ protected File getSystemConfigurationFile() { @Test public void test000Sanity() throws Exception { - final String TEST_NAME = "test000Sanity"; Task task = getTestTask(); OperationResult testResultOpenDj = modelService.testResource(RESOURCE_OPENDJ_OID, task); diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/TestUuidClient.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/TestUuidClient.java index 802a7e30ca0..3a4903775a9 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/TestUuidClient.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/TestUuidClient.java @@ -6,6 +6,18 @@ * and European Union Public License. See LICENSE file for details. */ +import static org.testng.AssertJUnit.assertEquals; + +import java.io.File; + +import org.opends.server.types.DirectoryException; +import org.springframework.test.annotation.DirtiesContext; +import org.springframework.test.annotation.DirtiesContext.ClassMode; +import org.springframework.test.context.ContextConfiguration; +import org.testng.AssertJUnit; +import org.testng.annotations.Listeners; +import org.testng.annotations.Test; + import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.PrismReferenceValue; import com.evolveum.midpoint.prism.util.PrismTestUtil; @@ -16,23 +28,11 @@ import com.evolveum.midpoint.util.exception.*; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import com.evolveum.prism.xml.ns._public.types_3.PolyStringType; -import org.opends.server.types.DirectoryException; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.annotation.DirtiesContext.ClassMode; -import org.springframework.test.context.ContextConfiguration; -import org.testng.AssertJUnit; -import org.testng.annotations.Listeners; -import org.testng.annotations.Test; - -import java.io.File; - -import static org.testng.AssertJUnit.assertEquals; /** * @author Radovan Semancik - * */ -@ContextConfiguration(locations = {"classpath:ctx-story-test-main.xml"}) +@ContextConfiguration(locations = { "classpath:ctx-story-test-main.xml" }) @DirtiesContext(classMode = ClassMode.AFTER_CLASS) @Listeners({ com.evolveum.midpoint.tools.testng.AlphabeticalMethodInterceptor.class }) public class TestUuidClient extends AbstractUuidTest { @@ -97,7 +97,6 @@ protected File getSystemConfigurationFile() { @Test public void test100AddUserRapp() throws Exception { - final String TEST_NAME = "test100AddUserRapp"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -117,7 +116,6 @@ public void test100AddUserRapp() throws Exception { @Test public void test101RappAssignRoleClient() throws Exception { - final String TEST_NAME = "test101RappAssignRoleClient"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -137,7 +135,6 @@ public void test101RappAssignRoleClient() throws Exception { @Test public void test107RappUnAssignRoleClient() throws Exception { - final String TEST_NAME = "test107RappUnAssignRoleClient"; Task task = getTestTask(); // WHEN @@ -151,7 +148,6 @@ public void test107RappUnAssignRoleClient() throws Exception { @Test public void test110AddMancombWithRoleClient() throws Exception { - final String TEST_NAME = "test110AddMancombWithRoleClient"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -175,7 +171,6 @@ public void test110AddMancombWithRoleClient() throws Exception { */ @Test public void test112RenameMancomb() throws Exception { - final String TEST_NAME = "test112RenameMancomb"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -197,7 +192,6 @@ public void test112RenameMancomb() throws Exception { @Test public void test119MancombDelete() throws Exception { - final String TEST_NAME = "test119MancombDelete"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -208,7 +202,7 @@ public void test119MancombDelete() throws Exception { assertSuccess(result); assertNoObject(UserType.class, userMancombOid, task, result); - openDJController.assertNoEntry("uid="+userMancombOid+",ou=clients,dc=example,dc=com"); + openDJController.assertNoEntry("uid=" + userMancombOid + ",ou=clients,dc=example,dc=com"); } /** @@ -216,7 +210,6 @@ public void test119MancombDelete() throws Exception { */ @Test public void test120AddKateWithRoleClient() throws Exception { - final String TEST_NAME = "test120AddKateWithRoleClient"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -238,7 +231,6 @@ public void test120AddKateWithRoleClient() throws Exception { */ @Test public void test122AddWallyWithRoleClient() throws Exception { - final String TEST_NAME = "test122AddWallyWithRoleClient"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -260,7 +252,6 @@ public void test122AddWallyWithRoleClient() throws Exception { */ @Test public void test124AddRogersWithRoleClient() throws Exception { - final String TEST_NAME = "test124AddMartyWithRoleClient"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -282,7 +273,6 @@ public void test124AddRogersWithRoleClient() throws Exception { */ @Test public void test126AddMartyWithRoleClient() throws Exception { - final String TEST_NAME = "test124AddMartyWithRoleClient"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -301,10 +291,10 @@ public void test126AddMartyWithRoleClient() throws Exception { // THEN assertNoObject(UserType.class, USER_MARTY_OID, task, result); - openDJController.assertNoEntry("uid="+USER_MARTY_OID+",ou=clients,dc=example,dc=com"); + openDJController.assertNoEntry("uid=" + USER_MARTY_OID + ",ou=clients,dc=example,dc=com"); } - private void assertUser(PrismObject user, String firstName, String lastName) { + private void assertUser(PrismObject user, String firstName, String lastName) { display("User", user); String oid = user.getOid(); PolyStringType name = user.asObjectable().getName(); @@ -312,7 +302,9 @@ private void assertUser(PrismObject user, String firstName, String las // TODO } - private void assertLdapClient(PrismObject user, String firstName, String lastName) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException { + private void assertLdapClient(PrismObject user, String firstName, String lastName) + throws ObjectNotFoundException, SchemaException, SecurityViolationException, + CommunicationException, ConfigurationException, ExpressionEvaluationException { assertLinks(user, 1); assertAssignments(user, RoleType.class, 1); assertAssignedRole(user, ROLE_CLIENT_OID); @@ -320,8 +312,8 @@ private void assertLdapClient(PrismObject user, String firstName, Stri assertAccount(user, RESOURCE_OPENDJ_OID); PrismReferenceValue linkRef = getLinkRef(user, RESOURCE_OPENDJ_OID); PrismObject shadow = getShadowModel(linkRef.getOid()); - display("OpenDJ shadow linked to "+user, shadow); - IntegrationTestTools.assertSecondaryIdentifier(shadow, "uid="+user.getOid()+",ou=clients,dc=example,dc=com"); + display("OpenDJ shadow linked to " + user, shadow); + IntegrationTestTools.assertSecondaryIdentifier(shadow, "uid=" + user.getOid() + ",ou=clients,dc=example,dc=com"); // TODO: cn, sn, givenName // MID-5114 @@ -329,12 +321,12 @@ private void assertLdapClient(PrismObject user, String firstName, Stri assertAttribute(resourceOpenDj, shadow.asObjectable(), ATTR_MOBILE, user.getOid()); } - private void assertNoLdapClient(PrismObject user) throws ObjectNotFoundException, SchemaException, SecurityViolationException, CommunicationException, ConfigurationException, DirectoryException { + private void assertNoLdapClient(PrismObject user) throws DirectoryException { assertLinks(user, 0); assertAssignments(user, RoleType.class, 0); assertNotAssignedRole(user, ROLE_CLIENT_OID); - openDJController.assertNoEntry("uid="+user.getOid()+",ou=clients,dc=example,dc=com"); + openDJController.assertNoEntry("uid=" + user.getOid() + ",ou=clients,dc=example,dc=com"); } protected PrismObject createNoNameUser(String givenName, String familyName, Boolean enabled) throws SchemaException { diff --git a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/TestUuidExtension.java b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/TestUuidExtension.java index cd333743932..683361d764c 100644 --- a/testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/TestUuidExtension.java +++ b/testing/story/src/test/java/com/evolveum/midpoint/testing/story/uuid/TestUuidExtension.java @@ -73,7 +73,6 @@ protected File getSystemConfigurationFile() { @Test public void test100AddUserRapp() throws Exception { - final String TEST_NAME = "test100AddUserRapp"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -93,7 +92,6 @@ public void test100AddUserRapp() throws Exception { @Test public void test101RappAssignRoleEmployee() throws Exception { - final String TEST_NAME = "test101RappAssignRoleEmployee"; Task task = getTestTask(); OperationResult result = task.getResult(); @@ -112,9 +110,6 @@ public void test101RappAssignRoleEmployee() throws Exception { @Test public void test107RappUnAssignRoleEmployee() throws Exception { - final String TEST_NAME = "test107RappUnAssignRoleEmployee"; - Task task = getTestTask(); - // WHEN unassignRole(userRappOid, ROLE_EMPLOYEE_OID); @@ -129,7 +124,6 @@ public void test107RappUnAssignRoleEmployee() throws Exception { */ @Test public void test110AddKateWithRoleEmployee() throws Exception { - final String TEST_NAME = "test110AddKateWithRoleEmployee"; Task task = getTestTask(); OperationResult result = task.getResult();