use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.
the class TestWSSecurity method test161ChangeDarthAdderPasswordSatisfiesPolicyStrict.
@Test
public void test161ChangeDarthAdderPasswordSatisfiesPolicyStrict() throws Exception {
final String TEST_NAME = "test160ChangeDarthAdderPasswordSatisfiesPolicyShortcut";
displayTestTitle(TEST_NAME);
LogfileTestTailer tailer = createLogTailer();
ProtectedStringType protectedString = ModelClientUtil.createProtectedString(USER_DARTHADDER_PASSWORD_NEW2);
ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(UserType.class, USER_DARTHADDER_OID, "credentials/password/value", ModificationTypeType.REPLACE, protectedString);
dartAdderLastPasswordChangeStartTs = TestUtil.currentTime();
// WHEN
ObjectDeltaOperationListType deltaOpList = modelPort.executeChanges(deltaList, null);
// THEN
assertSuccess(deltaOpList);
dartAdderLastPasswordChangeEndTs = TestUtil.currentTime();
tailer.tail();
displayAudit(tailer);
assertAuditLoginLogout(tailer);
assertAuditIds(tailer);
assertAuditOperation(tailer, "MODIFY_OBJECT");
tailer.assertAudit(4);
modelPort = createModelPort(USER_DARTHADDER_USERNAME, USER_DARTHADDER_PASSWORD_NEW2, WSConstants.PW_DIGEST);
UserType user = getObject(UserType.class, USER_DARTHADDER_OID);
display(user);
dartAdderLastPassword = user.getCredentials().getPassword();
assertNotNull("No password for DarthAdder", dartAdderLastPassword);
assertPasswordModifyMetadata(user, USER_DARTHADDER_OID, dartAdderLastPasswordChangeStartTs, dartAdderLastPasswordChangeEndTs);
}
use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.
the class TestWSSecurity method test135ModifyConfigAsDarthAdder.
@Test
public void test135ModifyConfigAsDarthAdder() throws Exception {
final String TEST_NAME = "test135ModifyConfigAsDarthAdder";
displayTestTitle(TEST_NAME);
LogfileTestTailer tailer = createLogTailer();
ObjectReferenceType ref = new ObjectReferenceType();
// fake
ref.setOid("c4e998e6-d903-11e4-9aaf-001e8c717e5b");
ObjectDeltaListType deltaList = ModelClientUtil.createModificationDeltaList(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), "globalSecurityPolicyRef", ModificationTypeType.REPLACE, ref);
try {
// WHEN
modelPort.executeChanges(deltaList, null);
AssertJUnit.fail("Unexpected success");
} catch (SOAPFaultException e) {
assertSoapFault(e, "FailedAuthentication", "could not be authenticated or authorized");
}
// THEN
tailer.tail();
displayAudit(tailer);
assertAuditLoginLogout(tailer);
assertAuditIds(tailer);
assertAuditOperation(tailer, "MODIFY_OBJECT", OperationResultStatusType.FATAL_ERROR, "not authorized");
tailer.assertAudit(4);
}
use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.
the class TestCleanStartup method test001Logfiles.
// work in progress
@Test
public void test001Logfiles() throws Exception {
TestUtil.displayTestTile("test001Logfiles");
// GIVEN - system startup and initialization that has already happened
LogfileTestTailer tailer = new LogfileTestTailer(LoggingConfigurationManager.AUDIT_LOGGER_NAME, false);
// THEN
display("Tailing ...");
tailer.tail();
display("... done");
display("Errors", tailer.getErrors());
display("Warnings", tailer.getWarnings());
assertMessages("Error", tailer.getErrors(), "Unable to find file com/../../keystore.jceks", "Provided Icf connector path /C:/tmp is not a directory", "Provided Icf connector path C:\\tmp is not a directory", "Provided Icf connector path C:\\var\\tmp is not a directory", "Provided Icf connector path D:\\var\\tmp is not a directory");
assertMessages("Warning", tailer.getWarnings());
tailer.close();
}
use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.
the class TestLoggingConfiguration method test004OverwriteInitialConfiguration.
/**
* Overwrite initial system configuration by itself. Check that everything
* still works.
*/
@Test
public void test004OverwriteInitialConfiguration() throws Exception {
final String TEST_NAME = "test004OverwriteInitialConfiguration";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
LogfileTestTailer tailer = new LogfileTestTailer(LoggingConfigurationManager.AUDIT_LOGGER_NAME);
Task task = taskManager.createTaskInstance(TestLoggingConfiguration.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObject<SystemConfigurationType> systemConfiguration = getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value());
String previousVersion = systemConfiguration.getVersion();
systemConfiguration.setVersion(null);
// precondition
tailer.logAndTail();
assertBasicLogging(tailer);
tailer.assertMarkerLogged(LogfileTestTailer.LEVEL_TRACE, ProfilingDataManager.Subsystem.PROVISIONING.name());
ObjectDelta<SystemConfigurationType> delta = ObjectDelta.createAddDelta(systemConfiguration);
ModelExecuteOptions options = ModelExecuteOptions.createOverwrite();
// WHEN
modelService.executeChanges(MiscSchemaUtil.createCollection(delta), options, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
tailer.logAndTail();
assertBasicLogging(tailer);
tailer.assertMarkerLogged(LogfileTestTailer.LEVEL_TRACE, ProfilingDataManager.Subsystem.PROVISIONING.name());
tailer.close();
PrismObject<SystemConfigurationType> systemConfigurationNew = getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value());
String newVersion = systemConfigurationNew.getVersion();
assertTrue("Versions do not follow: " + previousVersion + " -> " + newVersion, Integer.parseInt(previousVersion) < Integer.parseInt(newVersion));
}
use of com.evolveum.midpoint.test.util.LogfileTestTailer in project midpoint by Evolveum.
the class TestLoggingConfiguration method test101EnableBasicAudit.
@Test
public void test101EnableBasicAudit() throws Exception {
TestUtil.displayTestTile("test101EnableBasicAudit");
// GIVEN
LogfileTestTailer tailer = new LogfileTestTailer(LoggingConfigurationManager.AUDIT_LOGGER_NAME);
Task task = taskManager.createTaskInstance(TestLoggingConfiguration.class.getName() + ".test101EnableBasicAudit");
OperationResult result = task.getResult();
// Precondition
tailer.tail();
tailer.assertNoAudit();
// Setup
PrismObject<SystemConfigurationType> systemConfiguration = PrismTestUtil.parseObject(AbstractInitializedModelIntegrationTest.SYSTEM_CONFIGURATION_FILE);
LoggingConfigurationType logging = systemConfiguration.asObjectable().getLogging();
applyTestLoggingConfig(logging);
AuditingConfigurationType auditingConfigurationType = logging.getAuditing();
if (auditingConfigurationType == null) {
auditingConfigurationType = new AuditingConfigurationType();
logging.setAuditing(auditingConfigurationType);
}
auditingConfigurationType.setEnabled(true);
auditingConfigurationType.setDetails(false);
ObjectDelta<SystemConfigurationType> systemConfigDelta = ObjectDelta.createModificationReplaceProperty(SystemConfigurationType.class, AbstractInitializedModelIntegrationTest.SYSTEM_CONFIGURATION_OID, SystemConfigurationType.F_LOGGING, prismContext, logging);
Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(systemConfigDelta);
// WHEN
modelService.executeChanges(deltas, null, task, result);
// Make sure that the (optional) audit message from the above change will not get into the way
tailer.tail();
tailer.reset();
// This message will appear in the log and will help diagnose problems
display("TEST: Applied audit config, going to execute test change");
// try do execute some change (add user object), it should be audited
PrismObject<UserType> user = PrismTestUtil.parseObject(AbstractInitializedModelIntegrationTest.USER_JACK_FILE);
deltas = MiscSchemaUtil.createCollection(ObjectDelta.createAddDelta(user));
modelService.executeChanges(deltas, null, task, result);
// This message will appear in the log and will help diagnose problems
display("TEST: Executed test change");
// THEN
tailer.tail();
tailer.assertAudit(2);
tailer.assertAuditRequest();
tailer.assertAuditExecution();
tailer.close();
}
Aggregations