/** * Returns path pointing to the profile file. * * @param profile * {@link Profile} * @return Path to the file. */ public Path getProfileFilePath(Profile profile) { String secureProfileName = removeIllegalFilenameCharacters(profile.getName()); String fileName = profile.getId() + "-" + secureProfileName + ".xml"; return getProfilesPath().resolve(fileName); }
existingProfiles = new ConcurrentHashMap<>(16, 0.75f, 2); Path path = pathResolver.getProfilesPath(); final Path schemaPath = pathResolver.getSchemaPath();
/** * Saves profile and persists it to the list. * * @param profile * Profile to be saved. * @throws IOException * If {@link IOException} occurs during save. * @throws JAXBException * If {@link JAXBException} occurs during save. * @throws BusinessException * If saving of the common profile is requested. */ private void saveProfile(Profile profile) throws BusinessException, JAXBException, IOException { if (profile.isCommonProfile()) { throw new BusinessException("Save the profile '" + profile.getName() + " to disk.", ConfigurationInterfaceErrorCodeEnum.COMMON_PROFILE_CAN_NOT_BE_ALTERED); } transformator.marshall(pathResolver.getProfileFilePath(profile), profile, getRelativeToSchemaPath(pathResolver.getProfilesPath()).toString(), ISchemaVersionAware.ConfigurationInterface.SCHEMA_VERSION); }
when(pathResolver.getAgentMappingFilePath()).thenReturn(Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getAgentMappingFilePath()))); when(pathResolver.getEnvironmentPath()).thenReturn(Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getEnvironmentPath()))); when(pathResolver.getProfilesPath()).thenReturn(Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getProfilesPath()))); when(pathResolver.getSchemaPath()).thenReturn(Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getSchemaPath()))); when(pathResolver.getBusinessContextFilePath()).thenReturn(Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getBusinessContextFilePath())));