@Test public void test100AddUserJack() throws Exception { final String TEST_NAME = "test100AddUserJack"; displayTestTitle(TEST_NAME); LogfileTestTailer tailer = createLogTailer(); UserType userNobody = ModelClientUtil.unmarshallFile(USER_JACK_FILE); XMLGregorianCalendar startTs = TestUtil.currentTime(); // WHEN String oid = addObject(userNobody); // THEN XMLGregorianCalendar endTs = TestUtil.currentTime(); tailer.tail(); displayAudit(tailer); assertAuditLoginLogout(tailer); assertAuditIds(tailer); assertAuditOperation(tailer, "ADD_OBJECT"); tailer.assertAudit(4); // GET user UserType userAfter = getObject(UserType.class, USER_JACK_OID); display(userAfter); assertUser(userAfter, oid, USER_JACK_USERNAME, USER_JACK_GIVEN_NAME, USER_JACK_FAMILY_NAME); assertCreateMetadata(userAfter, USER_ADMINISTRATOR_OID, startTs, endTs); assertPasswordCreateMetadata(userAfter, USER_ADMINISTRATOR_OID, startTs, endTs); }
@Test public void test110AssignOpenDJAccountToJack() throws Exception { final String TEST_NAME = "test110AssignOpenDJAccountToJack"; displayTestTitle(TEST_NAME); LogfileTestTailer tailer = createLogTailer(); XMLGregorianCalendar startTs = TestUtil.currentTime(); ObjectDeltaType delta = ModelClientUtil.createConstructionAssignDelta( UserType.class, USER_JACK_OID, RESOURCE_OPENDJ_OID); // WHEN ObjectDeltaOperationListType executedDeltas = modelPort.executeChanges(ModelClientUtil.createDeltaList(delta), null); // THEN XMLGregorianCalendar endTs = TestUtil.currentTime(); assertSuccess(executedDeltas); tailer.tail(); displayAudit(tailer); assertAuditLoginLogout(tailer); assertAuditIds(tailer); assertAuditOperation(tailer, "MODIFY_OBJECT"); tailer.assertAudit(4); // GET user UserType userAfter = getObject(UserType.class, USER_JACK_OID); display(userAfter); assertUser( userAfter, USER_JACK_OID, USER_JACK_USERNAME, USER_JACK_GIVEN_NAME, USER_JACK_FAMILY_NAME); assertModifyMetadata(userAfter, USER_ADMINISTRATOR_OID, startTs, endTs); accountJackOid = getSingleLinkOid(userAfter); assertNotNull(accountJackOid); SearchResultEntry ldapEntry = openDJController.fetchEntry( "uid=" + USER_JACK_USERNAME + "," + openDJController.getSuffixPeople()); display(ldapEntry.toLDIFString()); OpenDJController.assertAttribute(ldapEntry, "uid", "jack"); OpenDJController.assertAttribute(ldapEntry, "givenName", "Jack"); OpenDJController.assertAttribute(ldapEntry, "sn", "Sparrow"); OpenDJController.assertAttribute(ldapEntry, "cn", "Jack Sparrow"); OpenDJController.assertAttribute(ldapEntry, "displayName", "Jack Sparrow"); }
@Test public void test020AddResourceOpenDj() throws Exception { final String TEST_NAME = "test020AddResourceOpenDj"; displayTestTitle(TEST_NAME); LogfileTestTailer tailer = createLogTailer(); ResourceType resource = ModelClientUtil.unmarshallFile(RESOURCE_OPENDJ_FILE); ObjectDeltaListType deltaList = new ObjectDeltaListType(); ObjectDeltaType delta = new ObjectDeltaType(); delta.setObjectType(getTypeQName(ResourceType.class)); delta.setChangeType(ChangeTypeType.ADD); delta.setObjectToAdd(resource); deltaList.getDelta().add(delta); ModelExecuteOptionsType options = new ModelExecuteOptionsType(); options.setIsImport(Boolean.TRUE); XMLGregorianCalendar startTs = TestUtil.currentTime(); // WHEN ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, options); // THEN assertSuccess(deltaOpList); String oid = deltaOpList.getDeltaOperation().get(0).getObjectDelta().getOid(); XMLGregorianCalendar endTs = TestUtil.currentTime(); tailer.tail(); displayAudit(tailer); assertAuditLoginLogout(tailer); assertAuditIds(tailer); assertAuditOperation(tailer, "ADD_OBJECT"); tailer.assertAudit(4); assertEquals("Wrong OID", RESOURCE_OPENDJ_OID, oid); ResourceType resourceAfter = getObject(ResourceType.class, RESOURCE_OPENDJ_OID); display(resourceAfter); assertEquals("Wrong connector OID", connectorLdapOid, resourceAfter.getConnectorRef().getOid()); assertCreateMetadata(resourceAfter, USER_ADMINISTRATOR_OID, startTs, endTs); }
@Test public void test120Log() throws Exception { final String TEST_NAME = "test120Log"; TestUtil.displayTestTile(this, TEST_NAME); // GIVEN OperationResult result = new OperationResult(DOT_CLASS + TEST_NAME); PrismProperty<ScriptingExpressionType> logAction = parseAnyData(LOG_FILE); LogfileTestTailer tailer = new LogfileTestTailer(LoggingConfigurationManager.AUDIT_LOGGER_NAME); tailer.tail(); tailer.setExpecteMessage("Custom message:"); // WHEN ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(logAction.getAnyValue().getValue(), result); // THEN assertNoOutputData(output); result.computeStatus(); TestUtil.assertSuccess(result); tailer.tail(); tailer.assertExpectedMessage(); }