use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType in project midpoint by Evolveum.
the class TestMachineIntelligence method test000Sanity.
@Test
public void test000Sanity() throws Exception {
final String TEST_NAME = "test000Sanity";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
OperationResult result = modelService.testResource(RESOURCE_HR_OID, task);
modifyObjectReplaceProperty(ResourceType.class, RESOURCE_HR_OID, new ItemPath(ResourceType.F_CONNECTOR_CONFIGURATION, SchemaConstants.ICF_CONFIGURATION_PROPERTIES, new QName(NS_RESOURCE_CSV, "filePath")), task, result, sourceFilePath);
OperationResult testResultOpenDj = modelService.testResource(RESOURCE_HR_OID, task);
TestUtil.assertSuccess(testResultOpenDj);
SystemConfigurationType systemConfiguration = getSystemConfiguration();
assertNotNull("No system configuration", systemConfiguration);
display("System config", systemConfiguration);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType in project midpoint by Evolveum.
the class TestEntertainment method test000Sanity.
@Test
public void test000Sanity() throws Exception {
final String TEST_NAME = "test000Sanity";
displayTestTile(TEST_NAME);
Task task = taskManager.createTaskInstance(TestTrafo.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
OperationResult testResultOpenDj = modelService.testResource(RESOURCE_OPENDJ_OID, task);
assertSuccess(testResultOpenDj);
SystemConfigurationType systemConfiguration = getSystemConfiguration();
assertNotNull("No system configuration", systemConfiguration);
display("System config", systemConfiguration);
PrismObject<RoleType> metaRole = modelService.getObject(RoleType.class, ROLE_META_CREATE_ORG_GROUPS_OID, null, task, result);
assertNotNull("No metarole, probably probelm with initialization", metaRole);
result.computeStatus();
assertSuccess("Role not fetch successfully", result);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType in project midpoint by Evolveum.
the class TestLdap method initSystem.
@Override
public void initSystem(Task initTask, OperationResult initResult) throws Exception {
super.initSystem(initTask, initResult);
modelService.postInit(initResult);
// System Configuration
PrismObject<SystemConfigurationType> config;
try {
config = repoAddObjectFromFile(SYSTEM_CONFIGURATION_FILE, initResult);
} catch (ObjectAlreadyExistsException e) {
throw new ObjectAlreadyExistsException("System configuration already exists in repository;" + "looks like the previous test haven't cleaned it up", e);
}
// to get profiling facilities (until better API is available)
// LoggingConfigurationManager.configure(
// ProfilingConfigurationManager.checkSystemProfilingConfiguration(config),
// config.asObjectable().getVersion(), initResult);
// administrator
PrismObject<UserType> userAdministrator = repoAddObjectFromFile(USER_ADMINISTRATOR_FILE, initResult);
repoAddObjectFromFile(ROLE_SUPERUSER_FILE, initResult);
login(userAdministrator);
// Users
repoAddObjectFromFile(USER_BARBOSSA_FILE, initResult);
repoAddObjectFromFile(USER_GUYBRUSH_FILE, initResult);
// Roles
repoAddObjectFromFile(ROLE_PIRATE_FILE, initResult);
// Resources
resourceOpenDj = importAndGetObjectFromFile(ResourceType.class, RESOURCE_OPENDJ_FILE, RESOURCE_OPENDJ_OID, initTask, initResult);
resourceOpenDjType = resourceOpenDj.asObjectable();
openDJController.setResource(resourceOpenDj);
assumeAssignmentPolicy(AssignmentPolicyEnforcementType.RELATIVE);
//initProfiling - start
ProfilingDataManager profilingManager = ProfilingDataManager.getInstance();
Map<ProfilingDataManager.Subsystem, Boolean> subsystems = new HashMap<>();
subsystems.put(ProfilingDataManager.Subsystem.MODEL, true);
subsystems.put(ProfilingDataManager.Subsystem.REPOSITORY, true);
profilingManager.configureProfilingDataManagerForTest(subsystems, true);
profilingManager.appendProfilingToTest();
//initProfiling - end
display("initial LDAP content", openDJController.dumpEntries());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType in project midpoint by Evolveum.
the class NotificationManagerImpl method processEvent.
public void processEvent(@Nullable Event event, Task task, OperationResult result) {
if (event == null) {
return;
}
if (event instanceof BaseEvent) {
((BaseEvent) event).setNotificationFunctions(notificationFunctions);
}
LOGGER.trace("NotificationManager processing event {}", event);
if (event.getAdHocHandler() != null) {
processEvent(event, event.getAdHocHandler(), task, result);
}
SystemConfigurationType systemConfigurationType = NotificationFunctionsImpl.getSystemConfiguration(cacheRepositoryService, result);
if (systemConfigurationType == null) {
// something really wrong happened (or we are doing initial import of objects)
return;
}
if (systemConfigurationType.getNotificationConfiguration() == null) {
LOGGER.trace("No notification configuration in repository, finished event processing.");
return;
}
NotificationConfigurationType notificationConfigurationType = systemConfigurationType.getNotificationConfiguration();
processNotifications(notificationConfigurationType, event, task, result);
LOGGER.trace("NotificationManager successfully processed event {} ({} top level handler(s))", event, notificationConfigurationType.getHandler().size());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType in project midpoint by Evolveum.
the class ClusterManager method checkSystemConfigurationChanged.
/**
* Check whether system configuration has not changed in repository (e.g. by another node in cluster).
* Applies new configuration if so.
*
* @param parentResult
*/
public void checkSystemConfigurationChanged(OperationResult parentResult) {
OperationResult result = parentResult.createSubresult(CHECK_SYSTEM_CONFIGURATION_CHANGED);
PrismObject<SystemConfigurationType> systemConfiguration;
try {
PrismObject<SystemConfigurationType> config = getRepositoryService().getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, result);
String versionInRepo = config.getVersion();
String versionApplied = LoggingConfigurationManager.getCurrentlyUsedVersion();
// we do not try to determine which one is "newer" - we simply use the one from repo
if (!versionInRepo.equals(versionApplied)) {
Configuration systemConfigFromFile = taskManager.getMidpointConfiguration().getConfiguration(MidpointConfiguration.SYSTEM_CONFIGURATION_SECTION);
if (systemConfigFromFile != null && versionApplied == null && systemConfigFromFile.getBoolean(LoggingConfigurationManager.SYSTEM_CONFIGURATION_SKIP_REPOSITORY_LOGGING_SETTINGS, false)) {
LOGGER.warn("Skipping application of repository logging configuration because {}=true (version={})", LoggingConfigurationManager.SYSTEM_CONFIGURATION_SKIP_REPOSITORY_LOGGING_SETTINGS, versionInRepo);
// But pretend that this was applied so the next update works normally
LoggingConfigurationManager.setCurrentlyUsedVersion(versionInRepo);
} else {
LoggingConfigurationType loggingConfig = ProfilingConfigurationManager.checkSystemProfilingConfiguration(config);
LoggingConfigurationManager.configure(loggingConfig, versionInRepo, result);
}
SystemConfigurationHolder.setCurrentConfiguration(// we rely on LoggingConfigurationManager to correctly record the current version
config.asObjectable());
SecurityUtil.setRemoteHostAddressHeaders(config.asObjectable());
getRepositoryService().applyFullTextSearchConfiguration(config.asObjectable().getFullTextSearch());
} else {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("System configuration change check: version in repo = version currently applied = {}", versionApplied);
}
}
if (result.isUnknown()) {
result.computeStatus();
}
} catch (ObjectNotFoundException e) {
// because the new config (if any) will have version number probably starting at 1 - so to be sure to read it when it comes [hope this never occurs :)]
LoggingConfigurationManager.resetCurrentlyUsedVersion();
String message = "No system configuration found, skipping application of system settings";
LOGGER.error(message + ": " + e.getMessage(), e);
result.recordWarning(message, e);
} catch (SchemaException e) {
String message = "Schema error in system configuration, skipping application of system settings";
LOGGER.error(message + ": " + e.getMessage(), e);
result.recordWarning(message, e);
} catch (RuntimeException e) {
String message = "Runtime exception in system configuration processing, skipping application of system settings";
LOGGER.error(message + ": " + e.getMessage(), e);
result.recordWarning(message, e);
}
}
Aggregations