Skip to content

Commit

Permalink
Active Directory 2019 tests, minor diag fix
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Oct 26, 2021
1 parent cd143cb commit 7a0b195
Show file tree
Hide file tree
Showing 14 changed files with 1,974 additions and 13 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,11 @@
<artifactId>connector-powershell</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.evolveum.polygon</groupId>
<artifactId>connector-ssh</artifactId>
<version>1.0</version>
</dependency>
<!-- End connectors -->

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.evolveum.midpoint.provisioning.ucf.api.*;
import com.evolveum.midpoint.schema.processor.*;
import com.evolveum.midpoint.schema.processor.ObjectFactory;
import com.evolveum.midpoint.util.exception.*;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.commons.collections4.CollectionUtils;
Expand All @@ -40,13 +41,6 @@
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ResourceTypeUtil;
import com.evolveum.midpoint.schema.util.ShadowUtil;
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.ObjectNotFoundException;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.exception.SecurityViolationException;
import com.evolveum.midpoint.util.exception.TunnelException;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ReadCapabilityType;
Expand Down Expand Up @@ -777,7 +771,12 @@ public SearchHierarchyConstraints determineSearchHierarchyConstraints(final Prov
ResourceObjectReferenceType baseContextRef = objectClassDef.getBaseContext();
ResourceObjectIdentification baseContextIdentification = null;
if (baseContextRef != null) {
PrismObject<ShadowType> baseContextShadow = resourceObjectReferenceResolver.resolve(ctx, baseContextRef, null, "base context specification in "+objectClassDef, parentResult);
PrismObject<ShadowType> baseContextShadow;
try {
baseContextShadow = resourceObjectReferenceResolver.resolve(ctx, baseContextRef, null, "base context specification in " + objectClassDef, parentResult);
} catch (RuntimeException e) {
throw new SystemException("Cannot resolve base context for "+objectClassDef+", specified as "+baseContextRef, e);
}
if (baseContextShadow == null) {
throw new ObjectNotFoundException("Base context not found for "+objectClassDef+", specified as "+baseContextRef);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
<adUsersDn>CN=Users,DC=ad,DC=evolveum,DC=com</adUsersDn>
<ad2012BaseDn>DC=ad2012,DC=lab,DC=evolveum,DC=com</ad2012BaseDn>
<ad2012UsersDn>CN=Users,DC=ad2012,DC=lab,DC=evolveum,DC=com</ad2012UsersDn>
<ad2019BaseDn>DC=ad2019,DC=evolveum,DC=com</ad2019BaseDn>
<ad2019UsersDn>CN=Users,DC=ad2019,DC=lab,DC=evolveum,DC=com</ad2019UsersDn>
</constants>
</midpoint>
</configuration>
2 changes: 2 additions & 0 deletions repo/repo-test-util/src/main/resources/test-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@
<adUsersDn>CN=Users,DC=ad,DC=evolveum,DC=com</adUsersDn>
<ad2012BaseDn>DC=ad2012,DC=lab,DC=evolveum,DC=com</ad2012BaseDn>
<ad2012UsersDn>CN=Users,DC=ad2012,DC=lab,DC=evolveum,DC=com</ad2012UsersDn>
<ad2019BaseDn>DC=ad2019,DC=evolveum,DC=com</ad2019BaseDn>
<ad2019UsersDn>CN=Users,DC=ad2019,DC=lab,DC=evolveum,DC=com</ad2019UsersDn>
</constants>
</midpoint>
</configuration>
5 changes: 5 additions & 0 deletions testing/conntest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@
<artifactId>connector-databasetable</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.evolveum.polygon</groupId>
<artifactId>connector-ssh</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.evolveum.midpoint.infra</groupId>
<artifactId>test-util</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ public void test100SearchJackBySamAccountName() throws Exception {
OperationResult result = task.getResult();

ObjectQuery query = createSamAccountNameQuery(ACCOUNT_JACK_SAM_ACCOUNT_NAME);
display("SamAccountName query:\n" + query.debugDump());

rememberCounter(InternalCounters.CONNECTOR_OPERATION_COUNT);
rememberCounter(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT);
Expand Down Expand Up @@ -619,7 +620,7 @@ public void test150SearchAllAccounts() throws Exception {
rememberCounter(InternalCounters.CONNECTOR_OPERATION_COUNT);
} else {
// TODO: Why 14? Why not 1?
assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 10); // 14?
assertCounterIncrement(InternalCounters.CONNECTOR_OPERATION_COUNT, 9); // 14?
}
assertCounterIncrement(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT, 0);

Expand Down Expand Up @@ -2277,7 +2278,7 @@ public void test850ReconcileAccounts() throws Exception {
// THEN
then();

assertUsers(11);
assertUsers(getNumberOfAllAccounts() + 2); // all accounts + administrator + ?

// TODO: better asserts

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* Copyright (c) 2015-2019 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.testing.conntest.ad;

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.Listeners;

import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;

/**
* AD multi-domain test for AD 2109 hosted in Evolveum private cloud.
*
* This test is running on ad03/ad04 servers in ad2019.lab.evolveum.com domain.
*
* These servers do not have Exchange installed, therefore exchange-specific aspects are skipped.
*
* TODO: SSH
* There is also a problem with CredSSP configuration on those servers.
* Therefore "second-hop" CredSSP tests are skipped here.
* There is still CreddSSP configured in ad01 server (top-level domain), therefore CredSSP is still tested in a way.
* In case of need the old Chimera/Hydra environment is archived, therefore it can be restored and used for full CredSSP tests.
*
* @see AbstractAdLdapMultidomainTest
*
* @author Radovan Semancik
*/
@ContextConfiguration(locations = {"classpath:ctx-conntest-test-main.xml"})
@Listeners({ com.evolveum.midpoint.tools.testng.AlphabeticalMethodInterceptor.class })
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
public class TestAdLdapAd2019 extends AbstractAdLdapMultidomainTest {

@Override
protected File getResourceFile() {
return new File(getBaseDir(), "resource-ad2019.xml");
}

@Override
protected String getLdapServerHost() {
return "ad03.ad2019.lab.evolveum.com";
}

@Override
protected String getLdapSuffix() {
return "DC=ad2019,DC=lab,DC=evolveum,DC=com";
}

@Override
protected String getLdapSubServerHost() {
return "ad04.ad2019.lab.evolveum.com";
}

@Override
protected String getLdapSubSuffix() {
return "DC=sub2019,DC=ad2019,DC=lab,DC=evolveum,DC=com";
}

@Override
protected File getReconciliationTaskFile() {
return new File(getBaseDir(), "task-reconcile-ad2019-users.xml");
}

@Override
protected String getReconciliationTaskOid() {
return "6dabfa58-d635-11ea-ae7a-5b48b3057a69";
}

@Override
protected void assertAccountDisabled(PrismObject<ShadowType> shadow) {
assertAdministrativeStatus(shadow, ActivationStatusType.DISABLED);
}

@Override
protected void assertAccountEnabled(PrismObject<ShadowType> shadow) {
assertAdministrativeStatus(shadow, ActivationStatusType.ENABLED);
}

@Override
protected String getAccountJackSid() {
return "S-1-5-21-1010034557-3261374367-4224384715-1110";
}

@Override
protected int getNumberOfAllAccounts() {
return 10;
}

@Override
protected boolean hasExchange() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2015-2019 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.testing.conntest.ad;

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.Listeners;

/**
* AD multi-domain test for AD 2019 hosted in Evolveum private cloud.
* This test has some strange configuration:
* * SPR is used instead of VLV for paging.
*
* @author Radovan Semancik
*/
@ContextConfiguration(locations = {"classpath:ctx-conntest-test-main.xml"})
@Listeners({ com.evolveum.midpoint.tools.testng.AlphabeticalMethodInterceptor.class })
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
public class TestAdLdapAd2019Strange extends TestAdLdapAd2019 {

@Override
protected File getResourceFile() {
return new File(getBaseDir(), "resource-ad2019-strange.xml");
}
}

0 comments on commit 7a0b195

Please sign in to comment.