use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractAdLdapTest method test105SeachPiratesByCn.
@Test
public void test105SeachPiratesByCn() throws Exception {
final String TEST_NAME = "test105SeachPiratesByCn";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getGroupObjectClass(), prismContext);
ObjectQueryUtil.filterAnd(query.getFilter(), createAttributeFilter("cn", GROUP_PIRATES_NAME));
rememberConnectorOperationCount();
rememberConnectorSimulatedPagingSearchCount();
// WHEN
TestUtil.displayWhen(TEST_NAME);
SearchResultList<PrismObject<ShadowType>> shadows = modelService.searchObjects(ShadowType.class, query, null, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals("Unexpected search result: " + shadows, 1, shadows.size());
PrismObject<ShadowType> shadow = shadows.get(0);
display("Shadow", shadow);
groupPiratesOid = shadow.getOid();
assertConnectorOperationIncrement(1);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = shadows.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
assertLdapConnectorInstances(1);
}
use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractEDirTest method test800JackLockoutExpires.
// Wait until the lockout of Jack expires, check status
@Test
public void test800JackLockoutExpires() throws Exception {
final String TEST_NAME = "test800JackLockoutExpires";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
long now = System.currentTimeMillis();
long lockoutExpires = jackLockoutTimestamp + LOCKOUT_EXPIRATION_SECONDS * 1000;
if (now < lockoutExpires) {
display("Sleeping for " + (lockoutExpires - now) + "ms (waiting for lockout expiration)");
Thread.sleep(lockoutExpires - now);
}
now = System.currentTimeMillis();
display("Time is now " + now);
ObjectQuery query = createUidQuery(ACCOUNT_JACK_UID);
rememberConnectorOperationCount();
rememberConnectorSimulatedPagingSearchCount();
// WHEN
TestUtil.displayWhen(TEST_NAME);
SearchResultList<PrismObject<ShadowType>> shadows = modelService.searchObjects(ShadowType.class, query, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals("Unexpected search result: " + shadows, 1, shadows.size());
PrismObject<ShadowType> shadow = shadows.get(0);
display("Shadow", shadow);
assertAccountShadow(shadow, toAccountDn(ACCOUNT_JACK_UID));
assertShadowLockout(shadow, LockoutStatusType.NORMAL);
assertConnectorOperationIncrement(1);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = shadows.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
}
use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractEDirTest method test820JackLockoutAndUnlock.
@Test
public void test820JackLockoutAndUnlock() throws Exception {
final String TEST_NAME = "test820JackLockoutAndUnlock";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
makeBadLoginAttempt(ACCOUNT_JACK_UID);
makeBadLoginAttempt(ACCOUNT_JACK_UID);
makeBadLoginAttempt(ACCOUNT_JACK_UID);
makeBadLoginAttempt(ACCOUNT_JACK_UID);
jackLockoutTimestamp = System.currentTimeMillis();
ObjectQuery query = createUidQuery(ACCOUNT_JACK_UID);
// precondition
SearchResultList<PrismObject<ShadowType>> shadows = modelService.searchObjects(ShadowType.class, query, null, task, result);
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals("Unexpected search result: " + shadows, 1, shadows.size());
PrismObject<ShadowType> shadowLocked = shadows.get(0);
display("Locked shadow", shadowLocked);
assertAccountShadow(shadowLocked, toAccountDn(ACCOUNT_JACK_UID));
assertShadowLockout(shadowLocked, LockoutStatusType.LOCKED);
rememberConnectorOperationCount();
rememberConnectorSimulatedPagingSearchCount();
// WHEN
TestUtil.displayWhen(TEST_NAME);
modifyObjectReplaceProperty(ShadowType.class, shadowLocked.getOid(), new ItemPath(ShadowType.F_ACTIVATION, ActivationType.F_LOCKOUT_STATUS), task, result, LockoutStatusType.NORMAL);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
assertConnectorOperationIncrement(1);
assertConnectorSimulatedPagingSearchIncrement(0);
PrismObject<ShadowType> shadowAfter = getObject(ShadowType.class, shadowLocked.getOid());
display("Shadow after", shadowAfter);
assertAccountShadow(shadowAfter, toAccountDn(ACCOUNT_JACK_UID));
assertShadowLockout(shadowAfter, LockoutStatusType.NORMAL);
assertLdapPassword(ACCOUNT_JACK_UID, ACCOUNT_JACK_PASSWORD);
SearchResultMetadata metadata = shadows.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
}
use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractEDirTest method test105SeachPiratesByCn.
@Test
public void test105SeachPiratesByCn() throws Exception {
final String TEST_NAME = "test105SeachPiratesByCn";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = ObjectQueryUtil.createResourceAndObjectClassQuery(getResourceOid(), getGroupObjectClass(), prismContext);
ObjectQueryUtil.filterAnd(query.getFilter(), createAttributeFilter("cn", GROUP_PIRATES_NAME));
rememberConnectorOperationCount();
rememberConnectorSimulatedPagingSearchCount();
// WHEN
TestUtil.displayWhen(TEST_NAME);
SearchResultList<PrismObject<ShadowType>> shadows = modelService.searchObjects(ShadowType.class, query, null, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals("Unexpected search result: " + shadows, 1, shadows.size());
PrismObject<ShadowType> shadow = shadows.get(0);
display("Shadow", shadow);
groupPiratesOid = shadow.getOid();
assertConnectorOperationIncrement(2);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = shadows.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
}
use of com.evolveum.midpoint.schema.SearchResultMetadata in project midpoint by Evolveum.
the class AbstractEDirTest method test100SeachJackByLdapUid.
@Test
public void test100SeachJackByLdapUid() throws Exception {
final String TEST_NAME = "test100SeachJackByLdapUid";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectQuery query = createUidQuery(ACCOUNT_JACK_UID);
rememberConnectorOperationCount();
rememberConnectorSimulatedPagingSearchCount();
// WHEN
TestUtil.displayWhen(TEST_NAME);
SearchResultList<PrismObject<ShadowType>> shadows = modelService.searchObjects(ShadowType.class, query, null, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
assertEquals("Unexpected search result: " + shadows, 1, shadows.size());
PrismObject<ShadowType> shadow = shadows.get(0);
display("Shadow", shadow);
assertAccountShadow(shadow, toAccountDn(ACCOUNT_JACK_UID));
assertShadowLockout(shadow, LockoutStatusType.NORMAL);
jackAccountOid = shadow.getOid();
assertNotNull("Null OID in " + shadow, jackAccountOid);
assertConnectorOperationIncrement(2);
assertConnectorSimulatedPagingSearchIncrement(0);
SearchResultMetadata metadata = shadows.getMetadata();
if (metadata != null) {
assertFalse(metadata.isPartialResults());
}
}
Aggregations