use of com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionPolicyType in project midpoint by Evolveum.
the class SystemConfigurationDto method getNewObject.
public SystemConfigurationType getNewObject() throws DatatypeConfigurationException {
SystemConfigurationType newObject = oldObject.clone();
if (StringUtils.isNotBlank(getPassPolicyDto().getOid())) {
ObjectReferenceType globalPassPolicyRef = ObjectTypeUtil.createObjectRef(getPassPolicyDto().getOid(), ObjectTypes.PASSWORD_POLICY);
newObject.setGlobalPasswordPolicyRef(globalPassPolicyRef);
} else {
newObject.setGlobalPasswordPolicyRef(null);
}
if (StringUtils.isNotBlank(getSecurityPolicyDto().getOid())) {
ObjectReferenceType globalSecurityPolicyRef = ObjectTypeUtil.createObjectRef(getSecurityPolicyDto().getOid(), WebComponentUtil.createPolyFromOrigString(getSecurityPolicyDto().getName()), ObjectTypes.SECURITY_POLICY);
newObject.setGlobalSecurityPolicyRef(globalSecurityPolicyRef);
} else {
newObject.setGlobalSecurityPolicyRef(null);
}
AssignmentPolicyEnforcementType globalAEP = AEPlevel.toAEPValueType(getAepLevel());
if (globalAEP != null) {
ProjectionPolicyType projectionPolicy = new ProjectionPolicyType();
projectionPolicy.setAssignmentPolicyEnforcement(globalAEP);
newObject.setGlobalAccountSynchronizationSettings(projectionPolicy);
}
Duration auditCleanupDuration = DatatypeFactory.newInstance().newDuration(getAuditCleanupValue());
Duration cleanupTaskDuration = DatatypeFactory.newInstance().newDuration(getTaskCleanupValue());
CleanupPolicyType auditCleanup = new CleanupPolicyType();
CleanupPolicyType taskCleanup = new CleanupPolicyType();
auditCleanup.setMaxAge(auditCleanupDuration);
taskCleanup.setMaxAge(cleanupTaskDuration);
CleanupPoliciesType cleanupPolicies = new CleanupPoliciesType();
cleanupPolicies.setAuditRecords(auditCleanup);
cleanupPolicies.setClosedTasks(taskCleanup);
newObject.setCleanupPolicy(cleanupPolicies);
SystemConfigurationTypeUtil.setEnableExperimentalCode(newObject, getEnableExperimentalCode());
newObject.setLogging(loggingConfig.getNewObject());
newObject.setNotificationConfiguration(notificationConfig.getNewObject(newObject));
newObject.setProfilingConfiguration(profilingDto.getNewObject());
ClassLoggerConfigurationType profilingClassLogger = profilingDto.getProfilingClassLogerConfig();
if (newObject.getLogging() != null) {
newObject.getLogging().getClassLogger().add(profilingClassLogger);
} else {
LoggingConfigurationType profLogging = new LoggingConfigurationType();
profLogging.getClassLogger().add(profilingClassLogger);
newObject.setLogging(profLogging);
}
return newObject;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionPolicyType in project midpoint by Evolveum.
the class TestDummyResourceAndSchemaCaching method test023ModifyRepoAndGetResource.
/**
* Change resource directly in repo. This simulates the change done by other node. The connector cache should
* be refreshed.
*
* Change something that is not important. The cached resource should be refreshed, the schema re-parsed
* but the connector should still be cached.
*/
@Test
public void test023ModifyRepoAndGetResource() throws Exception {
final String TEST_NAME = "test023ModifyRepoAndGetResource";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestDummyResourceAndSchemaCaching.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// Change something that's not that important
ProjectionPolicyType accountSynchronizationSettingsType = new ProjectionPolicyType();
accountSynchronizationSettingsType.setLegalize(true);
ObjectDelta<ResourceType> objectDelta = ObjectDelta.createModificationReplaceProperty(ResourceType.class, RESOURCE_DUMMY_OID, ResourceType.F_PROJECTION, prismContext, accountSynchronizationSettingsType);
// WHEN
repositoryService.modifyObject(ResourceType.class, RESOURCE_DUMMY_OID, objectDelta.getModifications(), result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
String versionAfter = repositoryService.getVersion(ResourceType.class, RESOURCE_DUMMY_OID, result);
assertResourceVersionIncrement(versionAfter, 1);
// WHEN
PrismObject<ResourceType> resourceProvisioning = provisioningService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, null, task, result);
// THEN
display("Resource", resource);
result.computeStatus();
TestUtil.assertSuccess(result);
assertHasSchema(resourceProvisioning, "provisioning resource");
assertSchemaMetadataUnchanged(resourceProvisioning);
assertResourceSchemaFetchIncrement(0);
assertConnectorSchemaParseIncrement(0);
assertConnectorCapabilitiesFetchIncrement(0);
assertConnectorInitializationCountIncrement(0);
assertResourceSchemaParseCountIncrement(1);
assertResourceVersionIncrement(resourceProvisioning, 0);
display("Resource cache", InternalMonitor.getResourceCacheStats());
assertResourceCacheHitsIncrement(0);
assertResourceCacheMissesIncrement(1);
// There are expected to be re-parsed
rememberResourceSchema(RefinedResourceSchemaImpl.getResourceSchema(resourceProvisioning, prismContext));
rememberRefinedResourceSchema(RefinedResourceSchemaImpl.getRefinedSchema(resourceProvisioning));
assertResourceSchemaParseCountIncrement(0);
assertConnectorInstanceUnchanged(resourceProvisioning);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionPolicyType in project midpoint by Evolveum.
the class TestDummyResourceAndSchemaCaching method test020ModifyAndGetResource.
/**
* Change something that is not important. The cached resource should be refreshed, the schema re-parsed
* but the connector should still be cached.
*/
@Test
public void test020ModifyAndGetResource() throws Exception {
final String TEST_NAME = "test020ModifyAndGetResource";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestDummyResourceAndSchemaCaching.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// Change something that's not that important
ProjectionPolicyType accountSynchronizationSettingsType = new ProjectionPolicyType();
accountSynchronizationSettingsType.setLegalize(true);
ObjectDelta<ResourceType> objectDelta = ObjectDelta.createModificationReplaceProperty(ResourceType.class, RESOURCE_DUMMY_OID, ResourceType.F_PROJECTION, prismContext, accountSynchronizationSettingsType);
// WHEN
provisioningService.modifyObject(ResourceType.class, RESOURCE_DUMMY_OID, objectDelta.getModifications(), null, null, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
String versionAfter = repositoryService.getVersion(ResourceType.class, RESOURCE_DUMMY_OID, result);
assertResourceVersionIncrement(versionAfter, 1);
// WHEN
PrismObject<ResourceType> resourceProvisioning = provisioningService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, null, task, result);
// THEN
display("Resource", resource);
result.computeStatus();
TestUtil.assertSuccess(result);
assertHasSchema(resourceProvisioning, "provisioning resource");
assertSchemaMetadataUnchanged(resourceProvisioning);
assertResourceSchemaFetchIncrement(0);
assertConnectorSchemaParseIncrement(0);
assertConnectorCapabilitiesFetchIncrement(0);
assertConnectorInitializationCountIncrement(0);
assertResourceSchemaParseCountIncrement(1);
assertResourceVersionIncrement(resourceProvisioning, 0);
display("Resource cache", InternalMonitor.getResourceCacheStats());
assertResourceCacheHitsIncrement(0);
assertResourceCacheMissesIncrement(1);
// There are expected to be re-parsed
rememberResourceSchema(RefinedResourceSchemaImpl.getResourceSchema(resourceProvisioning, prismContext));
rememberRefinedResourceSchema(RefinedResourceSchemaImpl.getRefinedSchema(resourceProvisioning));
assertResourceSchemaParseCountIncrement(0);
assertConnectorInstanceUnchanged(resourceProvisioning);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionPolicyType in project midpoint by Evolveum.
the class TestSanityLegacy method assertSyncSettingsAssignmentPolicyEnforcement.
private void assertSyncSettingsAssignmentPolicyEnforcement(AssignmentPolicyEnforcementType assignmentPolicy) throws ObjectNotFoundException, SchemaException {
OperationResult result = new OperationResult("Asserting sync settings");
PrismObject<SystemConfigurationType> systemConfigurationType = repositoryService.getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, result);
result.computeStatus();
TestUtil.assertSuccess("Asserting sync settings failed (result)", result);
ProjectionPolicyType globalAccountSynchronizationSettings = systemConfigurationType.asObjectable().getGlobalAccountSynchronizationSettings();
assertNotNull("globalAccountSynchronizationSettings is null", globalAccountSynchronizationSettings);
AssignmentPolicyEnforcementType assignmentPolicyEnforcement = globalAccountSynchronizationSettings.getAssignmentPolicyEnforcement();
assertNotNull("assignmentPolicyEnforcement is null", assignmentPolicyEnforcement);
assertEquals("Assignment policy mismatch", assignmentPolicy, assignmentPolicyEnforcement);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ProjectionPolicyType in project midpoint by Evolveum.
the class TestSanity method assertSyncSettingsAssignmentPolicyEnforcement.
private void assertSyncSettingsAssignmentPolicyEnforcement(AssignmentPolicyEnforcementType assignmentPolicy) throws ObjectNotFoundException, SchemaException {
OperationResult result = new OperationResult("Asserting sync settings");
PrismObject<SystemConfigurationType> systemConfigurationType = repositoryService.getObject(SystemConfigurationType.class, SystemObjectsType.SYSTEM_CONFIGURATION.value(), null, result);
result.computeStatus();
TestUtil.assertSuccess("Asserting sync settings failed (result)", result);
ProjectionPolicyType globalAccountSynchronizationSettings = systemConfigurationType.asObjectable().getGlobalAccountSynchronizationSettings();
assertNotNull("globalAccountSynchronizationSettings is null", globalAccountSynchronizationSettings);
AssignmentPolicyEnforcementType assignmentPolicyEnforcement = globalAccountSynchronizationSettings.getAssignmentPolicyEnforcement();
assertNotNull("assignmentPolicyEnforcement is null", assignmentPolicyEnforcement);
assertEquals("Assignment policy mismatch", assignmentPolicy, assignmentPolicyEnforcement);
}
Aggregations