use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.
the class AbstractTestForExchangeConnector method getConfiguration.
protected SystemConfigurationType getConfiguration() throws FaultMessage {
Holder<ObjectType> objectHolder = new Holder<ObjectType>();
Holder<OperationResultType> resultHolder = new Holder<OperationResultType>();
SelectorQualifiedGetOptionsType options = new SelectorQualifiedGetOptionsType();
modelPort.getObject(ModelClientUtil.getTypeQName(SystemConfigurationType.class), SystemObjectsType.SYSTEM_CONFIGURATION.value(), options, objectHolder, resultHolder);
return (SystemConfigurationType) objectHolder.value;
}
use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.
the class AbstractAdLdapTest method test390ModifyUserBarbossaRename.
@Test
public void test390ModifyUserBarbossaRename() throws Exception {
final String TEST_NAME = "test390ModifyUserBarbossaRename";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectDelta<UserType> objectDelta = createModifyUserReplaceDelta(USER_BARBOSSA_OID, UserType.F_NAME, PrismTestUtil.createPolyString(USER_CPTBARBOSSA_USERNAME));
objectDelta.addModificationReplaceProperty(UserType.F_FULL_NAME, PrismTestUtil.createPolyString(USER_CPTBARBOSSA_FULL_NAME));
Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(objectDelta);
// WHEN
TestUtil.displayWhen(TEST_NAME);
modelService.executeChanges(deltas, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
Entry entry = assertLdapAccount(USER_CPTBARBOSSA_USERNAME, USER_CPTBARBOSSA_FULL_NAME);
assertAttribute(entry, "title", "Captain");
PrismObject<UserType> user = getUser(USER_BARBOSSA_OID);
String shadowOid = getSingleLinkOid(user);
assertEquals("Shadows have moved", accountBarbossaOid, shadowOid);
PrismObject<ShadowType> shadow = getObject(ShadowType.class, shadowOid);
display("Shadow after rename (model)", shadow);
PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, shadowOid, null, result);
display("Shadow after rename (repo)", repoShadow);
assertNoLdapAccount(USER_BARBOSSA_USERNAME, USER_BARBOSSA_FULL_NAME);
assertLdapConnectorInstances(2);
}
use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.
the class AbstractAdLdapMultidomainTest method test690ModifyUserSubmanRename.
@Test
public void test690ModifyUserSubmanRename() throws Exception {
final String TEST_NAME = "test690ModifyUserSubmanRename";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ObjectDelta<UserType> objectDelta = createModifyUserReplaceDelta(USER_SUBMAN_OID, UserType.F_NAME, PrismTestUtil.createPolyString(USER_SUBDOG_USERNAME));
objectDelta.addModificationReplaceProperty(UserType.F_FULL_NAME, PrismTestUtil.createPolyString(USER_SUBDOG_FULL_NAME));
Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(objectDelta);
// WHEN
TestUtil.displayWhen(TEST_NAME);
modelService.executeChanges(deltas, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
Entry entry = assertLdapSubAccount(USER_SUBDOG_USERNAME, USER_SUBDOG_FULL_NAME);
assertAttribute(entry, "title", "Underdog");
PrismObject<UserType> user = getUser(USER_SUBMAN_OID);
String shadowOid = getSingleLinkOid(user);
assertEquals("Shadows have moved", accountSubmanOid, shadowOid);
PrismObject<ShadowType> shadow = getObject(ShadowType.class, shadowOid);
display("Shadow after rename (model)", shadow);
PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, shadowOid, null, result);
display("Shadow after rename (repo)", repoShadow);
assertNoLdapSubAccount(USER_SUBMAN_USERNAME, USER_SUBMAN_FULL_NAME);
// assertLdapConnectorInstances(2);
}
use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.
the class TestRetirement method test300RetireUserGorc.
@Test
public void test300RetireUserGorc() throws Exception {
final String TEST_NAME = "test300RetireUserGorc";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestRetirement.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
Collection<ItemDelta<?, ?>> modifications = new ArrayList<>();
modifications.add(createAssignmentModification(orgCortuvHradOid, OrgType.COMPLEX_TYPE, null, null, null, false));
modifications.add(createAssignmentModification(ORG_RETIRED_OID, OrgType.COMPLEX_TYPE, null, null, null, true));
ObjectDelta<UserType> userDelta = ObjectDelta.createModifyDelta(userGorcOid, modifications, UserType.class, prismContext);
Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(userDelta);
// WHEN
TestUtil.displayWhen(TEST_NAME);
modelService.executeChanges(deltas, null, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
dumpOrgTree();
dumpLdap();
PrismObject<UserType> userAfter = getAndAssertRetiredUser(USER_GORC_USERNAME);
userGorcOid = userAfter.getOid();
}
use of org.mitre.cybox.cybox_2.ObjectType in project midpoint by Evolveum.
the class TestPlentyOfAssignments method test120CheesePreviewChanges.
@Test
public void test120CheesePreviewChanges() throws Exception {
final String TEST_NAME = "test120CheesePreviewChanges";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> cheeseBefore = prepareCheese();
display("Cheese before", assignmentSummary(cheeseBefore));
ObjectDelta<UserType> delta = cheeseBefore.createModifyDelta();
delta.addModificationReplaceProperty(UserType.F_EMPLOYEE_NUMBER, "123");
inspector.reset();
rememberPrismObjectCompareCount();
rememberRepositoryReadCount();
long startMillis = System.currentTimeMillis();
// WHEN
displayWhen(TEST_NAME);
ModelContext<ObjectType> modelContext = modelInteractionService.previewChanges(MiscSchemaUtil.createCollection(delta), null, task, result);
// THEN
displayThen(TEST_NAME);
long endMillis = System.currentTimeMillis();
assertSuccess(result);
display("Preview cheese in " + (endMillis - startMillis) + "ms (" + ((endMillis - startMillis) / NUMBER_OF_CHEESE_ASSIGNMENTS) + "ms per assignment)");
PrismObject<UserType> cheeseAfter = getUser(USER_CHEESE_OID);
display("Cheese after", assignmentSummary(cheeseAfter));
assertCheeseRoleMembershipRef(cheeseAfter);
display("Repo reads", InternalMonitor.getRepositoryReadCount());
display("Object compares", InternalMonitor.getPrismObjectCompareCount());
display("Inspector", inspector);
inspector.assertRead(RoleType.class, 1);
// assertRepositoryReadCount(4); // may be influenced by tasks
assertPrismObjectCompareCount(0);
}
Aggregations