DefaultSysSystemAttributeMappingService extends AbstractReadWriteDtoService<SysSystemAttributeMappingDto, SysSystemAttributeMapping, SysSystemAttributeMappingFilter> implements SysSystemAttributeMappingService { @Override public Object transformValueToResource(String uid, Object value, AttributeMapping attributeMapping, AbstractDto entity) { return transformValueToResource(uid, value, attributeMapping, entity, null); } @Autowired  DefaultSysSystemAttributeMappingService(SysSystemAttributeMappingRepository repository,
			GroovyScriptService groovyScriptService, FormService formService,
			SysRoleSystemAttributeRepository roleSystemAttributeRepository, FormPropertyManager formPropertyManager,
			SysSyncConfigRepository syncConfigRepository, List<AbstractScriptEvaluator> evaluators,
			ConfidentialStorage confidentialStorage, SysSchemaAttributeService schemaAttributeService,
			SysSchemaObjectClassService schemaObjectClassService, SysSystemMappingService systemMappingService); @Override AuthorizableType getAuthorizableType(); @Override @Transactional(readOnly = true) List<SysSystemAttributeMappingDto> findBySystemMapping(SysSystemMappingDto systemMapping); @Override @Transactional(readOnly = true) SysSystemAttributeMappingDto findBySystemMappingAndName(UUID systemMappingId, String name); @Override Object transformValueToResource(String uid, Object value, AttributeMapping attributeMapping,
										   AbstractDto entity); @Override Object transformValueToResource(String uid, Object value, AttributeMapping attributeMapping,
			AbstractDto entity, MappingContext mappingContext); @Override Object transformValueToResource(String uid, Object value, String script, AbstractDto entity,
										   SysSystemDto system); @Override Object transformValueToResource(String uid, Object value, String script, AbstractDto entity,
			SysSystemDto system, MappingContext mappingContext); @Override Object transformValueFromResource(Object value, AttributeMapping attributeMapping,
			List<IcAttribute> icAttributes); @Override Object transformValueFromResource(Object value, String script, List<IcAttribute> icAttributes,
			SysSystemDto system); @Override @Transactional SysSystemAttributeMappingDto saveInternal(SysSystemAttributeMappingDto dto); @Override void validate(SysSystemAttributeMappingDto dto, SysSystemMappingDto systemMappingDto); @Override List<SysSystemAttributeMappingDto> getAllPasswordAttributes(UUID systemId, UUID systemMappingId); @Override @Transactional void createExtendedAttributeDefinition(AttributeMapping entity, Class<? extends Identifiable> ownerType); @Override @Transactional void delete(SysSystemAttributeMappingDto dto, BasePermission... permission); @Override IcAttribute createIcAttribute(SysSchemaAttributeDto schemaAttribute, Object idmValue); @Override SysSystemAttributeMappingDto clone(UUID id); @Override SysSystemAttributeMappingDto getAuthenticationAttribute(UUID systemId, SystemEntityType entityType); @Override Object getAttributeValue(String uid, AbstractDto entity, AttributeMapping attributeHandling); @Override Object getAttributeValue(String uid, AbstractDto entity, AttributeMapping attributeHandling, MappingContext mappingContext); @Override String generateUid(AbstractDto entity, SysSystemAttributeMappingDto uidAttribute); @Override SysSystemAttributeMappingDto getUidAttribute(List<SysSystemAttributeMappingDto> mappedAttributes,
			SysSystemDto system); @Override Object getValueByMappedAttribute(AttributeMapping attribute, List<IcAttribute> icAttributes); @Override String getUidValueFromResource(List<IcAttribute> icAttributes,
			List<SysSystemAttributeMappingDto> mappedAttributes, SysSystemDto system); @Override List<Serializable> getControlledAttributeValues(UUID systemId, SystemEntityType entityType,
			String schemaAttributeName); @Override List<Serializable> getCachedControlledAndHistoricAttributeValues(UUID systemId, SystemEntityType entityType,
			String schemaAttributeName); @Override synchronized List<Serializable> recalculateAttributeControlledValues(UUID systemId, SystemEntityType entityType,
			String schemaAttributeName, SysSystemAttributeMappingDto attributeMapping); @Override void export(UUID id, IdmExportImportDto batch);  }
@Test public void transformationToScriptFailure() { SysSystemDto system = createSystem(); SysSchemaObjectClassDto objClass = createObjectClass(system); SysSchemaAttributeDto schemaAttr = createSchemaAttribute(objClass); SysSystemMappingDto systemMapping = testHelper.createMappingSystem(SystemEntityType.IDENTITY, objClass); SysSystemAttributeMappingDto attrMapping = createAttributeMappingSystem(systemMapping, AttributeMappingStrategyType.CREATE, schemaAttr.getId()); String script = "xxxxx"; attrMapping.setTransformToResourceScript(script); systemMapping = mappingService.save(systemMapping); try { attributeMappingService.transformValueToResource(null, "testValue", attrMapping, new IdmIdentityDto()); fail(); } catch (ResultCodeException ex) { ErrorModel errModel = ex.getError().getError(); String message = (String)errModel.getParameters().get(SysSystemAttributeMappingService.MAPPING_SCRIPT_FAIL_MESSAGE_KEY); String idmPath = (String)errModel.getParameters().get(SysSystemAttributeMappingService.MAPPING_SCRIPT_FAIL_IDM_PATH_KEY); assertEquals(errModel.getStatusEnum(), AccResultCode.GROOVY_SCRIPT_ATTR_TRANSFORMATION_FAILED.getCode()); assertTrue(message.contains(script)); assertTrue(idmPath.contains(system.getCode())); assertTrue(idmPath.contains(systemMapping.getName())); assertTrue(idmPath.contains(attrMapping.getName())); } catch (Exception e) { fail(); } }