diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/AuthorisationProvider.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/AuthorisationProvider.java index 6b5dfdb1..2e64f968 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/AuthorisationProvider.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/AuthorisationProvider.java @@ -1,5 +1,13 @@ package uk.co.gresearch.siembol.configeditor.common; - +/** + * An object for providing authorisation for Siembol services + * + *

This interface is for providing authorisation for a Siembol services. + * It decides whether the user is allowed to access a service under its role. + * + * @author Marian Novotny + * + */ public interface AuthorisationProvider { enum AuthorisationResult { UNDEFINED, @@ -7,5 +15,11 @@ public interface AuthorisationProvider { FORBIDDEN, } + /** + * Gets authorisation decision for a user and a service + * @param user a user info object + * @param serviceName the name of teh service + * @return the authorisation result + */ AuthorisationResult getUserAuthorisation(UserInfo user, String serviceName); } diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigEditorUtils.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigEditorUtils.java index 10f6719f..4236fa9c 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigEditorUtils.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigEditorUtils.java @@ -16,7 +16,13 @@ import uk.co.gresearch.siembol.configeditor.model.ConfigEditorUiLayout; import java.io.*; import java.lang.invoke.MethodHandles; import java.util.*; - +/** + * A class with static helper methods for config editor + * + *

This class exposes static helper methods for config editor. + * + * @author Marian Novotny + */ public class ConfigEditorUtils { private static final Logger LOG = LoggerFactory .getLogger(MethodHandles.lookup().lookupClass()); diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigImporter.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigImporter.java index 8c256a58..c50526fc 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigImporter.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigImporter.java @@ -1,9 +1,37 @@ package uk.co.gresearch.siembol.configeditor.common; import uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult; - +/** + * An object for importing configurations + * + *

This interface is for providing functionality for importing open standard configuration into Siembol. + * Moreover, it validates attributes and provides importer attributes schema. + * + * @author Marian Novotny + * + */ public interface ConfigImporter { + /** + * Gets a json schema for importer attributes + * @return config editor result with json schema + */ ConfigEditorResult getImporterAttributesSchema(); + + /** + * Validates importer attributes + * @param attributes a json string with importer attributes + * @return config editor result with OK status code if the attributes are valid, otherwise + * the result with ERROR status. + */ ConfigEditorResult validateImporterAttributes(String attributes); + + /** + * Imports open standard configuration into Siembol syntax + * @param user a user info object + * @param importerAttributes a json string with importer attributes + * @param configuration a configuration for importing into Siembol + * @return config editor result with OK status code and the imported config if the import was successful, otherwise + * the result with ERROR status. + */ ConfigEditorResult importConfig(UserInfo user, String importerAttributes, String configuration); } diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigInfo.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigInfo.java index 58ec7700..18e5b586 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigInfo.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigInfo.java @@ -2,7 +2,14 @@ package uk.co.gresearch.siembol.configeditor.common; import java.util.Map; import java.util.Optional; - +/** + * An object that represents information about a configuration change + * + *

This class represents information about configuration change such as the name of the configuration, + * its version, content etc. + * + * @author Marian Novotny + */ public class ConfigInfo { private String name; private Map> filesContent; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigInfoType.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigInfoType.java index 4f7c20e4..343195a4 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigInfoType.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigInfoType.java @@ -1,5 +1,13 @@ package uk.co.gresearch.siembol.configeditor.common; - +/** + * An enum of configuration types + * + * @author Marian Novotny + * @see #RULE + * @see #CONFIG + * @see #TEST_CASE + * @see #ADMIN_CONFIG + */ public enum ConfigInfoType { RULE("rule", "rules", "Rules"), CONFIG("configuration", "configurations", "Configurations"), diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigSchemaService.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigSchemaService.java index 523111d2..e83d7ed3 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigSchemaService.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigSchemaService.java @@ -4,35 +4,82 @@ import org.springframework.boot.actuate.health.Health; import uk.co.gresearch.siembol.configeditor.model.*; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.OK; - +/** + * An object for configuration schema service + * + *

This interface is for providing functionality for configuration schema service. + * It validates configurations, and provides a json schema. + * it provides config importers and testers registered for the service. + * + * @author Marian Novotny + * @see ConfigTester + * @see ConfigImporter + * + */ public interface ConfigSchemaService extends HealthCheckable { String NOT_IMPLEMENTED_MSG = "Not implemented"; String SCHEMA_INIT_ERROR = "Error during computing json schema"; + /** + * Gets a json schema for configurations + * @return a config editor result with a json schema for configurations + */ ConfigEditorResult getSchema(); + /** + * Validates a configuration + * @param configuration a json string with configuration + * @return a config editor result with OK status code if the configuration is valid, otherwise + * the result with ERROR status. + */ ConfigEditorResult validateConfiguration(String configuration); + /** + * Validates configurations + * @param configurations a json string with configurations + * @return a config editor result with OK status code if the configurations are valid, otherwise + * the result with ERROR status. + */ ConfigEditorResult validateConfigurations(String configurations); + /** + * Gets config importers + * @return the map of an importer name string to a config importer object + */ Map getConfigImporters(); + /** + * Gets config testers + * @return a config editor result with config testers registered for the service + */ default ConfigEditorResult getConfigTesters() { ConfigEditorAttributes attributes = new ConfigEditorAttributes(); attributes.setConfigTesters(new ArrayList<>()); return new ConfigEditorResult(OK, attributes); } + /** + * Gets a config tester by name + * @return a config tester + */ ConfigTester getConfigTester(String name); + /** + * Checks a health of teh service + * @return a health object with the status + * @see Health + */ default Health checkHealth() { return Health.up().build(); } + /** + * Get config importers + * @return config editor result with config importers + */ default ConfigEditorResult getImporters() { List importers = getConfigImporters().entrySet().stream().map(x -> { ConfigImporterDto importer = new ConfigImporterDto(); @@ -46,7 +93,19 @@ public interface ConfigSchemaService extends HealthCheckable { return new ConfigEditorResult(OK, attributes); } - default ConfigEditorResult importConfig(UserInfo user, String importerName, String importerAttributes, String configToImport) { + /** + * Imports a config into a service syntax + * @param user a user info object + * @param importerName the name of teh importer + * @param importerAttributes a json string with importer attributes + * @param configToImport a string with configuration to be imported + * @return config editor result with OK status code and the imported config if the import was successful, otherwise + * the result with ERROR status. + */ + default ConfigEditorResult importConfig(UserInfo user, + String importerName, + String importerAttributes, + String configToImport) { if (!getConfigImporters().containsKey(importerName)) { return ConfigEditorResult.fromMessage(ConfigEditorResult.StatusCode.BAD_REQUEST, ErrorMessages.UNKNOWN_CONFIG_IMPORTER.getMessage(importerName)); @@ -67,18 +126,38 @@ public interface ConfigSchemaService extends HealthCheckable { return importResult; } + /** + * Gets a json schema for an admin configuration + * @return a config editor result with a json schema for an admin configuration + */ default ConfigEditorResult getAdminConfigurationSchema() { return ConfigEditorResult.fromMessage(ConfigEditorResult.StatusCode.ERROR, NOT_IMPLEMENTED_MSG); } + /** + * Validates an admin configuration + * @param configuration a json string with an admin configuration + * @return a config editor result with OK status code if the admin configuration is valid, otherwise + * the result with ERROR status. + */ default ConfigEditorResult validateAdminConfiguration(String configuration) { return ConfigEditorResult.fromMessage(ConfigEditorResult.StatusCode.ERROR, NOT_IMPLEMENTED_MSG); } + /** + * Gets a topology name from an admin configuration + * @param configuration a json string with an admin configuration + * @return a config editor result with the topology name on success, otherwise + * the result with ERROR status. + */ default ConfigEditorResult getAdminConfigTopologyName(String configuration) { return ConfigEditorResult.fromMessage(ConfigEditorResult.StatusCode.ERROR, NOT_IMPLEMENTED_MSG); } + /** + * Get a config schema service with enhanced error messages + * @return a config schema service with enhanced error messages + */ default ConfigSchemaService withErrorMessage() { return new ConfigSchemaServiceWithErrorMessage(this); } diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigSchemaServiceWithErrorMessage.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigSchemaServiceWithErrorMessage.java index 0e35f033..ef6f4c15 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigSchemaServiceWithErrorMessage.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigSchemaServiceWithErrorMessage.java @@ -8,7 +8,16 @@ import uk.co.gresearch.siembol.configeditor.model.ErrorTitles; import java.util.Map; import java.util.function.Supplier; - +/** + * An object for configuration schema service with enhanced error messages + * + *

This class implements ConfigSchemaService interface, and it extends ServiceWithErrorMessage class. + * It enriches error messages on error. + * + * @author Marian Novotny + * @see ServiceWithErrorMessage + * @see ConfigSchemaService + */ public class ConfigSchemaServiceWithErrorMessage extends ServiceWithErrorMessage implements ConfigSchemaService { @@ -16,11 +25,17 @@ public class ConfigSchemaServiceWithErrorMessage extends ServiceWithErrorMessage super(service); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getSchema() { return service.getSchema(); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult validateConfiguration(String configuration) { Supplier fun = () -> service.validateConfiguration(configuration); @@ -29,6 +44,9 @@ public class ConfigSchemaServiceWithErrorMessage extends ServiceWithErrorMessage ErrorResolutions.VALIDATION.getResolution()); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult validateConfigurations(String configurations) { Supplier fun = () -> service.validateConfigurations(configurations); @@ -37,31 +55,49 @@ public class ConfigSchemaServiceWithErrorMessage extends ServiceWithErrorMessage ErrorResolutions.VALIDATION.getResolution()); } + /** + * {@inheritDoc} + */ @Override public Map getConfigImporters() { return service.getConfigImporters(); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getConfigTesters() { return service.getConfigTesters(); } + /** + * {@inheritDoc} + */ @Override public ConfigTester getConfigTester(String name) { return service.getConfigTester(name); } + /** + * {@inheritDoc} + */ @Override public Health checkHealth() { return service.checkHealth(); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getImporters() { return service.getImporters(); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult importConfig(UserInfo user, String importerName, @@ -74,11 +110,17 @@ public class ConfigSchemaServiceWithErrorMessage extends ServiceWithErrorMessage ErrorResolutions.GENERIC_BAD_REQUEST.getResolution()); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getAdminConfigurationSchema() { return service.getAdminConfigurationSchema(); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult validateAdminConfiguration(String configuration) { Supplier fun = () -> service.validateAdminConfiguration(configuration); @@ -87,6 +129,9 @@ public class ConfigSchemaServiceWithErrorMessage extends ServiceWithErrorMessage ErrorResolutions.VALIDATION.getResolution()); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getAdminConfigTopologyName(String configuration) { return service.getAdminConfigTopologyName(configuration); diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTester.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTester.java index 9a9c2b4b..17682098 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTester.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTester.java @@ -4,17 +4,39 @@ import uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult; import uk.co.gresearch.siembol.configeditor.model.ConfigTesterDto; import java.util.EnumSet; - +/** + * An object for testing configurations + * + *

This interface is for providing functionality for testing configurations. + * Moreover, it validates a test specification and provides the test specification schema. + * + * @author Marian Novotny + * + */ public interface ConfigTester { String DEFAULT_NAME = "default"; String NOT_SUPPORTED_MSG = "This type of testing is not supported"; + /** + * Gets the name of the tester + * @return the name of teh tester + */ default String getName() { return DEFAULT_NAME; } + /** + * Gets tester flags + * @return the set of test flags + * @see ConfigTesterFlag + */ EnumSet getFlags(); + /** + * Gets tester information + * @return config tester info object + * @see ConfigTesterDto + */ default ConfigTesterDto getConfigTesterInfo() { var ret = new ConfigTesterDto(); ret.setName(getName()); @@ -27,18 +49,46 @@ public interface ConfigTester { return ret; } + /** + * Gets tester specification schema + * @return config editor result with a test specification json schema + */ ConfigEditorResult getTestSpecificationSchema(); + /** + * Validates test specification + * @param attributes a json string with test specification + * @return config editor result with OK status code if the specification is valid, otherwise + * the result with ERROR status. + */ ConfigEditorResult validateTestSpecification(String attributes); + /** + * Tests a configuration against a test specification + * @param configuration a json string with configuration + * @param testSpecification a json string with test specification + * @return a config editor result with test result if the test was successful, otherwise + * the result with ERROR status. + */ default ConfigEditorResult testConfiguration(String configuration, String testSpecification) { return ConfigEditorResult.fromMessage(ConfigEditorResult.StatusCode.BAD_REQUEST, NOT_SUPPORTED_MSG); } + /** + * Tests a configurations against a test specification + * @param configurations a json string with configurations + * @param testSpecification a json string with test specification + * @return a config editor result with test result if the test was successful, otherwise + * the result with ERROR status. + */ default ConfigEditorResult testConfigurations(String configurations, String testSpecification) { return ConfigEditorResult.fromMessage(ConfigEditorResult.StatusCode.BAD_REQUEST, NOT_SUPPORTED_MSG); } + /** + * Gets a config tester with enhanced error messages + * @return a config tester with enhanced error messages + */ default ConfigTester withErrorMessage() { return new ConfigTesterWithErrorMessage(this); } diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTesterBase.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTesterBase.java index 71f9849b..600f069d 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTesterBase.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTesterBase.java @@ -2,7 +2,13 @@ package uk.co.gresearch.siembol.configeditor.common; import uk.co.gresearch.siembol.common.jsonschema.SiembolJsonSchemaValidator; import uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult; - +/** + * An object that provides base functionality for a config tester + * + *

This abstract class implements ConfigTester interface and provides common functionality for all config testers. + * + * @author Marian Novotny + */ public abstract class ConfigTesterBase implements ConfigTester { private final SiembolJsonSchemaValidator testValidator; @@ -16,11 +22,17 @@ public abstract class ConfigTesterBase implements ConfigTester { this.testProvider = testProvider; } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getTestSpecificationSchema() { return ConfigEditorResult.fromTestSchema(testSchema); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult validateTestSpecification(String attributes) { var validateResult = testValidator.validate(attributes); diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTesterFlag.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTesterFlag.java index e46f8f8d..bee62979 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTesterFlag.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTesterFlag.java @@ -1,5 +1,13 @@ package uk.co.gresearch.siembol.configeditor.common; - +/** + * An enum of config tester flags + * + * @author Marian Novotny + * @see #CONFIG_TESTING + * @see #TEST_CASE_TESTING + * @see #RELEASE_TESTING + * @see #INCOMPLETE_RESULT + */ public enum ConfigTesterFlag { CONFIG_TESTING, TEST_CASE_TESTING, diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTesterWithErrorMessage.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTesterWithErrorMessage.java index f6cb0bfa..78090ae2 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTesterWithErrorMessage.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigTesterWithErrorMessage.java @@ -7,22 +7,40 @@ import uk.co.gresearch.siembol.configeditor.model.ErrorTitles; import java.util.EnumSet; import java.util.function.Supplier; - +/** + * An object for configuration tester with enhanced error messages + * + *

This class implements ConfigTester interface, and it extends ServiceWithErrorMessage class. + * It enriches error messages on error. + * + * @author Marian Novotny + * @see ServiceWithErrorMessage + * @see ConfigTester + */ public class ConfigTesterWithErrorMessage extends ServiceWithErrorMessage implements ConfigTester { public ConfigTesterWithErrorMessage(ConfigTester service) { super(service); } + /** + * {@inheritDoc} + */ @Override public EnumSet getFlags() { return service.getFlags(); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getTestSpecificationSchema() { return service.getTestSpecificationSchema(); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult validateTestSpecification(String attributes) { Supplier fun = () -> service.validateTestSpecification(attributes); @@ -31,6 +49,9 @@ public class ConfigTesterWithErrorMessage extends ServiceWithErrorMessage fun = () -> service.testConfiguration(configuration, testSpecification); @@ -39,6 +60,9 @@ public class ConfigTesterWithErrorMessage extends ServiceWithErrorMessage fun = () -> service.testConfigurations(configurations, testSpecification); diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ServiceUserRole.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ServiceUserRole.java index 10fd4078..abf2b358 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ServiceUserRole.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ServiceUserRole.java @@ -1,7 +1,13 @@ package uk.co.gresearch.siembol.configeditor.common; import com.fasterxml.jackson.annotation.JsonProperty; - +/** + * An enum of service user roles + * + * @author Marian Novotny + * @see #SERVICE_ADMIN + * @see #SERVICE_USER + */ public enum ServiceUserRole { @JsonProperty("service_user") SERVICE_USER("service_user"), @JsonProperty("service_admin") SERVICE_ADMIN("service_admin"); diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ServiceWithErrorMessage.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ServiceWithErrorMessage.java index 66ca5bcd..38a25202 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ServiceWithErrorMessage.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ServiceWithErrorMessage.java @@ -3,7 +3,13 @@ package uk.co.gresearch.siembol.configeditor.common; import uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult; import java.util.function.Supplier; - +/** + * An object that enhances error messages for a service + * + *

This class provides functionality for enhancing error messages for a generic service. + * + * @author Marian Novotny + */ public class ServiceWithErrorMessage { protected final T service; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/UserInfo.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/UserInfo.java index 28a1106e..3cffbb7b 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/UserInfo.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/UserInfo.java @@ -2,7 +2,14 @@ package uk.co.gresearch.siembol.configeditor.common; import java.util.ArrayList; import java.util.List; - +/** + * An object that represents information about a user + * + *

This class represents information about user such as the name, email address and groups that the user belongs to. + * Moreover, it includes the user role under which is trying to access Siembol services. + * + * @author Marian Novotny + */ public class UserInfo { private String userName; private String email; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/AdminConfigInfoProvider.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/AdminConfigInfoProvider.java index f804a4e3..11e77c35 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/AdminConfigInfoProvider.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/AdminConfigInfoProvider.java @@ -1,13 +1,21 @@ package uk.co.gresearch.siembol.configeditor.configinfo; import uk.co.gresearch.siembol.configeditor.common.ConfigInfo; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.common.ConfigInfoType; import uk.co.gresearch.siembol.configeditor.common.UserInfo; import uk.co.gresearch.siembol.configeditor.model.ConfigEditorFile; import java.util.List; - +/** + * An object for providing metadata about a json admin configuration change + * + *

This class implements ConfigInfoProvider interface. It provides metadata about a json admin configuration change. + * It provides information such as the author of the change, type of change, and the version of the admin configuration. + * + * @author Marian Novotny + * @see ConfigInfoProvider + * + */ public class AdminConfigInfoProvider implements ConfigInfoProvider { private static final String UNSUPPORTED_MESSAGE = "Not supported operation"; private static final String ADMIN_CONFIG_FILE_NAME = "admin_config.json"; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigInfoProvider.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/ConfigInfoProvider.java similarity index 51% rename from config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigInfoProvider.java rename to config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/ConfigInfoProvider.java index 5f39c3bc..664d5828 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/common/ConfigInfoProvider.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/ConfigInfoProvider.java @@ -1,11 +1,22 @@ -package uk.co.gresearch.siembol.configeditor.common; +package uk.co.gresearch.siembol.configeditor.configinfo; +import uk.co.gresearch.siembol.configeditor.common.ConfigInfo; +import uk.co.gresearch.siembol.configeditor.common.ConfigInfoType; +import uk.co.gresearch.siembol.configeditor.common.UserInfo; import uk.co.gresearch.siembol.configeditor.model.ConfigEditorFile; import java.time.Instant; import java.time.LocalDateTime; import java.util.List; import java.util.TimeZone; - +/** + * An object for providing metadata about a configuration change + * + *

This interface is for providing metadata about a configuration change. + * It provides information such as the author of the change, type of change, and the version of the configuration. + * + * @author Marian Novotny + * + */ public interface ConfigInfoProvider { String RELEASE_BRANCH_TEMPLATE = "ver_%d_by_%s_on_%s"; String MISSING_ARGUMENTS_MSG = "missing user info attributes"; @@ -13,8 +24,22 @@ public interface ConfigInfoProvider { int MILLI_SECONDS = 1000; int INIT_RELEASE_VERSION = 0; + /** + * Gets the config info + * @param user a user info object + * @param config a json string with configuration + * @return a config info object + * @see ConfigInfo + */ ConfigInfo getConfigInfo(UserInfo user, String config); + /** + * Gets the config info for a default user + * + * @param config a json string with configuration + * @return a config info object + * @see ConfigInfo + */ default ConfigInfo getConfigInfo(String config) { UserInfo unknownUser = new UserInfo(); unknownUser.setUserName(UNKNOWN_USER_INFO); @@ -22,14 +47,42 @@ public interface ConfigInfoProvider { return getConfigInfo(unknownUser, config); } + /** + * Gets a release info + * @param user a user info object + * @param release a json string with a release + * @return a config info object + * @see ConfigInfo + */ ConfigInfo getReleaseInfo(UserInfo user, String release); + /** + * Gets a release version from a list of files + * @param files the list of files + * @return version of the release + */ int getReleaseVersion(List files); + /** + * Gets a release version from a release file + * @param content a json string with release + * @return version of the release + */ int getReleaseVersion(String content); + /** + * Gets information whether the config is included in the release + * @param release a json string with release + * @param configName teh name of config to check + * @return true if the config is included in the release, otherwise false + */ boolean isConfigInRelease(String release, String configName); + /** + * Gets file content type + * @return the content type of the config file + * @see ConfigEditorFile.ContentType + */ ConfigEditorFile.ContentType getFileContentType(); default ConfigInfo configInfoFromUser(UserInfo user) { @@ -63,5 +116,10 @@ public interface ConfigInfoProvider { return INIT_RELEASE_VERSION == version; } + /** + * Gets config info type + * @return config info type for a configuration + * @see ConfigInfoType + */ ConfigInfoType getConfigInfoType(); } diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/JsonConfigInfoProvider.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/JsonConfigInfoProvider.java index d8e5d816..240101f6 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/JsonConfigInfoProvider.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/JsonConfigInfoProvider.java @@ -16,7 +16,16 @@ import java.lang.invoke.MethodHandles; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; - +/** + * An object for providing metadata about a json configuration change + * + *

This class implements ConfigInfoProvider interface. It provides metadata about a json configuration change. + * It provides information such as the author of the change, type of change, and the version of the configuration. + * + * @author Marian Novotny + * @see ConfigInfoProvider + * + */ public class JsonConfigInfoProvider implements ConfigInfoProvider { private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final String RULE_COMMIT_TEMPLATE_NEW = "Adding new %s: %s"; @@ -79,6 +88,9 @@ public class JsonConfigInfoProvider implements ConfigInfoProvider { this.jsonPathConfigNameSearch = String.format(JSON_PATH_FIELD_SEARCH_FORMAT, configNameField); } + /** + * {@inheritDoc} + */ @Override public ConfigInfo getConfigInfo(UserInfo user, String config) { ConfigInfo configInfo = configInfoFromUser(user); @@ -138,6 +150,9 @@ public class JsonConfigInfoProvider implements ConfigInfoProvider { return configInfo; } + /** + * {@inheritDoc} + */ @Override public ConfigInfo getReleaseInfo(UserInfo user, String release) { ConfigInfo configInfo = configInfoFromUser(user); @@ -166,6 +181,9 @@ public class JsonConfigInfoProvider implements ConfigInfoProvider { return configInfo; } + /** + * {@inheritDoc} + */ @Override public int getReleaseVersion(String content) { Map metadata; @@ -184,6 +202,9 @@ public class JsonConfigInfoProvider implements ConfigInfoProvider { return ((Number)metadata.get(configsVersionField)).intValue(); } + /** + * {@inheritDoc} + */ @Override public boolean isConfigInRelease(String release, String configName) { JsonNode configsNode = ConfigEditorUtils.evaluateJsonPath(release, jsonPathConfigNameSearch); @@ -196,6 +217,9 @@ public class JsonConfigInfoProvider implements ConfigInfoProvider { return false; } + /** + * {@inheritDoc} + */ @Override public int getReleaseVersion(List files) { Optional release = files @@ -210,21 +234,33 @@ public class JsonConfigInfoProvider implements ConfigInfoProvider { return getReleaseVersion(release.get().getContent()); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorFile.ContentType getFileContentType() { return ConfigEditorFile.ContentType.RAW_JSON_STRING; } + /** + * {@inheritDoc} + */ @Override public boolean isStoreFile(String filename) { return filename.endsWith(jsonFileSuffix); } + /** + * {@inheritDoc} + */ @Override public boolean isReleaseFile(String filename) { return releaseFilename.equals(filename); } + /** + * {@inheritDoc} + */ @Override public ConfigInfoType getConfigInfoType() { return configType; @@ -262,6 +298,11 @@ public class JsonConfigInfoProvider implements ConfigInfoProvider { return -1; } + /** + * A builder for a json config info provider + * + * @author Marian Novotny + */ public static class Builder { private static final String COMMIT_TEMPLATE_NEW = "Adding new %s: %%s"; private static final String COMMIT_TEMPLATE_UPDATE = "Updating %s: %%s to version: %%d"; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/JsonRuleConfigInfoProvider.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/JsonRuleConfigInfoProvider.java index f724d0ef..ece9ccd7 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/JsonRuleConfigInfoProvider.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/JsonRuleConfigInfoProvider.java @@ -1,7 +1,14 @@ package uk.co.gresearch.siembol.configeditor.configinfo; - -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; - +/** + * An object for providing metadata about a json rule change + * + *

This class implements ConfigInfoProvider interface. It provides metadata about a json rule change. + * It provides information such as the author of the change, type of change, and the version of the configuration. + * + * @author Marian Novotny + * @see ConfigInfoProvider + * + */ public class JsonRuleConfigInfoProvider { private static final String AUTHOR_FIELD = "rule_author"; private static final String NAME_FIELD = "rule_name"; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/TestCaseInfoProvider.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/TestCaseInfoProvider.java index b9b5fd14..8cf17cf0 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/TestCaseInfoProvider.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configinfo/TestCaseInfoProvider.java @@ -1,13 +1,21 @@ package uk.co.gresearch.siembol.configeditor.configinfo; import uk.co.gresearch.siembol.configeditor.common.UserInfo; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.model.ConfigEditorFile; import uk.co.gresearch.siembol.configeditor.common.ConfigInfo; import uk.co.gresearch.siembol.configeditor.common.ConfigInfoType; import java.util.List; - +/** + * An object for providing metadata about a json test case change + * + *

This class implements ConfigInfoProvider interface. It provides metadata about a json test case change. + * It provides information such as the author of the change, type of change, and the version of the test case. + * + * @author Marian Novotny + * @see ConfigInfoProvider + * + */ public class TestCaseInfoProvider implements ConfigInfoProvider { private static final String UNSUPPORTED_MESSAGE = "Not supported operation"; private static final String AUTHOR_FIELD = "author"; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigItems.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigItems.java index f7374912..338eeb8a 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigItems.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigItems.java @@ -4,7 +4,7 @@ import org.apache.commons.lang3.StringUtils; import org.eclipse.jgit.api.errors.GitAPIException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; +import uk.co.gresearch.siembol.configeditor.configinfo.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.common.UserInfo; import uk.co.gresearch.siembol.configeditor.git.GitRepository; import uk.co.gresearch.siembol.configeditor.model.*; @@ -18,7 +18,15 @@ import java.util.stream.Collectors; import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.BAD_REQUEST; import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.OK; - +/** + * An object that represents a config and a test case + * + *

This class represents a config and a test case. + * It implements common logic for both types of configurations. + * It is used in ConfigStoreImpl. + * + * @author Marian Novotny + */ public class ConfigItems { private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final String INIT_START = "Trying Initialise a git repository: {}"; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigRelease.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigRelease.java index c60d43c7..a8e02edc 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigRelease.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigRelease.java @@ -4,6 +4,7 @@ import org.eclipse.jgit.api.errors.GitAPIException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import uk.co.gresearch.siembol.configeditor.common.*; +import uk.co.gresearch.siembol.configeditor.configinfo.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.git.GitRepository; import uk.co.gresearch.siembol.configeditor.git.ReleasePullRequestService; import uk.co.gresearch.siembol.configeditor.model.ConfigEditorFile; @@ -17,7 +18,15 @@ import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.OK; - +/** + * An object that represents a config release and an admin config + * + *

This class represents a config release and an admin config. + * It implements common logic for both types of configurations. + * It is used in ConfigStoreImpl. + * + * @author Marian Novotny + */ public class ConfigRelease { private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final String SUBMIT_INIT_LOG_MSG = "User: {} trying to release {} version: {}"; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigStore.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigStore.java index 0da5566d..3aa92bf9 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigStore.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigStore.java @@ -4,44 +4,147 @@ import org.springframework.boot.actuate.health.Health; import uk.co.gresearch.siembol.configeditor.common.UserInfo; import uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult; import uk.co.gresearch.siembol.configeditor.common.HealthCheckable; - +/** + * An object for storing and manipulating Siembol configurations + * + *

This interface is for storing and manipulating Siembol configurations. + * It stores configurations, test cases, an admin config and the release. + * It checks health of the service. + * + * @author Marian Novotny + * + */ public interface ConfigStore extends HealthCheckable { + /** + * Adds a test case into the store + * @param user the metadata about the user + * @param testCase a json string test case + * @return config editor result with the status and the files after adding the test cases + */ ConfigEditorResult addTestCase(UserInfo user, String testCase); + /** + * Updates an existing test case in the store + * @param user the metadata about the user + * @param testCase a json string test case + * @return config editor result with the status and the files after updating the test cases + */ ConfigEditorResult updateTestCase(UserInfo user, String testCase); + /** + * Deletes existing test case in the store + * @param user the metadata about the user + * @param configName the name of configuration of the test case + * @param testCaseName the name of teh test case to be deleted + * @return config editor result with the status and the files after updating the test cases + */ ConfigEditorResult deleteTestCase(UserInfo user, String configName, String testCaseName); + /** + * Gets test cases from the store + * @return config editor result with test cases files + */ ConfigEditorResult getTestCases(); + /** + * Adds a configuration into the store + * @param user the metadata about the user + * @param newConfig a json string configuration + * @return config editor result with the status and the files after adding the configuration + */ ConfigEditorResult addConfig(UserInfo user, String newConfig); + /** + * Updates a configuration in the store + * @param user the metadata about the user + * @param configToUpdate a json string configuration + * @return config editor result with the status and the files after updating the configuration + */ ConfigEditorResult updateConfig(UserInfo user, String configToUpdate); + /** + * Deletes existing test case in the store + * @param user the metadata about the user + * @param configName the name of configuration to be deleted + * @return config editor result with the status and the files after deleting + */ ConfigEditorResult deleteConfig(UserInfo user, String configName); + /** + * Gets configurations from the store + * @return config editor result with configuration files + */ ConfigEditorResult getConfigs(); + /** + * Gets the release form the cache + * @return config editor result with the release file + */ ConfigEditorResult getConfigsReleaseFromCache(); + /** + * Gets the release form the store + * @return config editor result with the release file + */ ConfigEditorResult getConfigsRelease(); + /** + * Gets the release status related to pending pull requests + * @return config editor result with the release status + */ ConfigEditorResult getConfigsReleaseStatus(); + /** + * Submits the release into the store + * @param user the metadata about the user + * @param rulesRelease a json string with the release + * @return config editor result with the release status + */ ConfigEditorResult submitConfigsRelease(UserInfo user, String rulesRelease); + /** + * Gets the admin configuration form the cache + * @return config editor result with the admin configuration file + */ ConfigEditorResult getAdminConfigFromCache(); + /** + * Gets the admin configuration form the store + * @return config editor result with the admin configuration file + */ ConfigEditorResult getAdminConfig(); + /** + * Gets the admin configuration status related to pending pull requests + * @return config editor result with the admin configuration status + */ ConfigEditorResult getAdminConfigStatus(); + /** + * Submits the admin configuration into the store + * @param user the metadata about the user + * @param adminConfig a json string with the admin configuration + * @return config editor result with the admin configuration status + */ ConfigEditorResult submitAdminConfig(UserInfo user, String adminConfig); + /** + * Gets urls to all store repositories + * @return the config editor result with urls to all store repositories + */ ConfigEditorResult getRepositories(); + /** + * Checks the health of the store + * @return an health object with the status information + * @see Health + */ Health checkHealth(); + /** + * Gets an store instance with enhanced error message + * @return + */ default ConfigStore withErrorMessage() { return new ConfigStoreWithErrorMessage(this); } diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigStoreImpl.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigStoreImpl.java index 819122b8..46c0d9b5 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigStoreImpl.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigStoreImpl.java @@ -6,7 +6,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.actuate.health.Health; import uk.co.gresearch.siembol.configeditor.common.ConfigEditorUtils; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; +import uk.co.gresearch.siembol.configeditor.configinfo.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.common.UserInfo; import uk.co.gresearch.siembol.configeditor.configinfo.AdminConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.configinfo.TestCaseInfoProvider; @@ -22,7 +22,21 @@ import java.util.concurrent.atomic.AtomicReference; import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.ERROR; import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.OK; - +/** + * An object for storing and manipulating Siembol configurations + * + *

This class implements ConfigStore interface is for storing and manipulating Siembol configurations. + * It is using GitRepository for storing configurations and ReleasePullRequestService for submitting a release and admin config. + * It stores configurations, test cases, an admin config and the release. + * It checks health of the service. + * All store operations are executed in dedicated threads in order to avoid concurrency issues. + * + * @author Marian Novotny + * @see ConfigStore + * @see GitRepository + * @see ReleasePullRequestService + * + */ public class ConfigStoreImpl implements ConfigStore { private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); private static final String TEST_CASES_UNSUPPORTED_MSG = "Test cases are not supported"; @@ -50,6 +64,9 @@ public class ConfigStoreImpl implements ConfigStore { this.adminConfig = builder.adminConfig; } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult addTestCase(UserInfo user, String testCase) { if (testCases == null) { @@ -60,6 +77,9 @@ public class ConfigStoreImpl implements ConfigStore { return executeStoreCommand(command, storeExecutorService); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult updateTestCase(UserInfo user, String testCase) { if (testCases == null) { @@ -70,6 +90,9 @@ public class ConfigStoreImpl implements ConfigStore { return executeStoreCommand(command, storeExecutorService); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult deleteTestCase(UserInfo user, String configName, String testCaseName) { if (testCases == null) { @@ -81,6 +104,9 @@ public class ConfigStoreImpl implements ConfigStore { return executeStoreCommand(command, storeExecutorService); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getTestCases() { if (testCases == null) { @@ -93,18 +119,27 @@ public class ConfigStoreImpl implements ConfigStore { return testCases.getFiles(); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult addConfig(UserInfo user, String newConfig) { Callable command = () -> configs.addConfigItem(user, newConfig); return executeStoreCommand(command, storeExecutorService); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult updateConfig(UserInfo user, String configToUpdate) { Callable command = () -> configs.updateConfigItem(user, configToUpdate); return executeStoreCommand(command, storeExecutorService); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult deleteConfig(UserInfo user, String configName) { Callable releaseCheckCommand = () -> release.checkConfigNotInRelease(configName); @@ -136,6 +171,9 @@ public class ConfigStoreImpl implements ConfigStore { return executeStoreCommand(deleteCommand, storeExecutorService); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getConfigs() { if (exception.get() != null) { @@ -145,6 +183,9 @@ public class ConfigStoreImpl implements ConfigStore { return configs.getFiles(); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getConfigsReleaseFromCache() { if (exception.get() != null) { @@ -154,24 +195,36 @@ public class ConfigStoreImpl implements ConfigStore { return release.getConfigsReleaseFromCache(); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getConfigsRelease() { Callable command = release::getConfigsRelease; return executeStoreCommand(command, releaseExecutorService); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getConfigsReleaseStatus() { Callable command = release::getConfigsReleaseStatus; return executeStoreCommand(command, releaseExecutorService); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult submitConfigsRelease(UserInfo user, String rulesRelease) { Callable command = () -> release.submitConfigsRelease(user, rulesRelease); return executeStoreCommand(command, releaseExecutorService); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getAdminConfigFromCache() { if (adminConfig == null) { @@ -185,6 +238,9 @@ public class ConfigStoreImpl implements ConfigStore { return adminConfig.getConfigsReleaseFromCache(); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getAdminConfig() { if (adminConfig == null) { @@ -195,6 +251,9 @@ public class ConfigStoreImpl implements ConfigStore { return executeStoreCommand(command, adminConfigExecutorService); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getAdminConfigStatus() { if (adminConfig == null) { @@ -205,6 +264,9 @@ public class ConfigStoreImpl implements ConfigStore { return executeStoreCommand(command, adminConfigExecutorService); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult submitAdminConfig(UserInfo user, String adminConfigStr) { if (adminConfig == null) { @@ -215,6 +277,9 @@ public class ConfigStoreImpl implements ConfigStore { return executeStoreCommand(command, adminConfigExecutorService); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getRepositories() { ConfigEditorRepositories repositories = new ConfigEditorRepositories(); @@ -239,6 +304,9 @@ public class ConfigStoreImpl implements ConfigStore { return new ConfigEditorResult(OK, attr); } + /** + * {@inheritDoc} + */ @Override public Health checkHealth() { Exception e = exception.get(); @@ -267,6 +335,11 @@ public class ConfigStoreImpl implements ConfigStore { } } + /** + * A builder for a config store + * + * @author Marian Novotny + */ public static class Builder { private static final ConfigInfoProvider TEST_CASE_INFO_PROVIDER = new TestCaseInfoProvider(); private static final ConfigInfoProvider ADMIN_CONFIG_INFO_PROVIDER = new AdminConfigInfoProvider(); diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigStoreWithErrorMessage.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigStoreWithErrorMessage.java index cfdd5cea..909960b5 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigStoreWithErrorMessage.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigStoreWithErrorMessage.java @@ -9,12 +9,25 @@ import uk.co.gresearch.siembol.configeditor.model.ErrorResolutions; import uk.co.gresearch.siembol.configeditor.model.ErrorTitles; import java.util.function.Supplier; - +/** + * An object for storing and manipulating Siembol configurations with enhanced error messages + * + *

This class implements ConfigStore interface and it extends ServiceWithErrorMessage class. + * It enriches error messages on error. + * + * @author Marian Novotny + * @see ServiceWithErrorMessage + * @see ConfigStore + * + */ public class ConfigStoreWithErrorMessage extends ServiceWithErrorMessage implements ConfigStore { public ConfigStoreWithErrorMessage(ConfigStore service) { super(service); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult addTestCase(UserInfo user, String testCase) { Supplier fun = () -> service.addTestCase(user, testCase); @@ -23,6 +36,9 @@ public class ConfigStoreWithErrorMessage extends ServiceWithErrorMessage fun = () -> service.updateTestCase(user, testCase); @@ -31,6 +47,9 @@ public class ConfigStoreWithErrorMessage extends ServiceWithErrorMessage fun = () -> service.deleteTestCase(user, configName, testCaseName); @@ -39,11 +58,17 @@ public class ConfigStoreWithErrorMessage extends ServiceWithErrorMessage fun = () -> service.addConfig(user, newConfig); @@ -52,6 +77,9 @@ public class ConfigStoreWithErrorMessage extends ServiceWithErrorMessage fun = () -> service.updateConfig(user, configToUpdate); @@ -60,6 +88,9 @@ public class ConfigStoreWithErrorMessage extends ServiceWithErrorMessage fun = () -> service.deleteConfig(user, configName); @@ -68,26 +99,41 @@ public class ConfigStoreWithErrorMessage extends ServiceWithErrorMessage fun = () -> service.submitConfigsRelease(user, rulesRelease); @@ -96,6 +142,9 @@ public class ConfigStoreWithErrorMessage extends ServiceWithErrorMessage fun = () -> service.submitAdminConfig(user, adminConfig); @@ -119,11 +174,17 @@ public class ConfigStoreWithErrorMessage extends ServiceWithErrorMessageThis class implements Closeable interface. + * It is used for cloning the repository, committing a change in a git repository and + * for obtaining the current files including the history of changes. + * + * @author Marian Novotny + */ public class GitRepository implements Closeable { private static final String MISSING_ARGUMENTS_MSG = "Missing arguments required for git repository initialisation"; private static final String ERROR_INIT_MSG = "Error during git repository initialisation"; @@ -63,6 +72,16 @@ public class GitRepository implements Closeable { defaultBranch = builder.defaultBranch; } + /** + * Copies and commits the files in the repository + * + * @param configInfo metadata such as a git branch, an author and files to be copied and committed + * @param directory the directory where the files should be copied + * @param fileNameFilter the filter for filtering the files to be included in the result + * @return a config editor result with the current files in the repository + * @throws GitAPIException + * @throws IOException + */ public ConfigEditorResult transactCopyAndCommit( ConfigInfo configInfo, String directory, @@ -131,10 +150,25 @@ public class GitRepository implements Closeable { } + /** + * Gets the current files from a directory + * @param directory a folder name + * @return a config editor result with the current files in the repository under the directory + * @throws IOException + * @throws GitAPIException + */ public ConfigEditorResult getFiles(String directory) throws IOException, GitAPIException { return getFiles(directory, x -> true); } + /** + * Gets the current files from a directory + * @param directory a folder name + * @param fileNameFilter a filter for filtering the files + * @return a config editor result with the current files in the repository under the directory + * @throws IOException + * @throws GitAPIException + */ public ConfigEditorResult getFiles(String directory, Function fileNameFilter) throws IOException, GitAPIException { git.pull() @@ -203,23 +237,43 @@ public class GitRepository implements Closeable { return new ConfigEditorResult(ConfigEditorResult.StatusCode.OK, attr); } + /** + * Gets a git repository URL + * @return a git repository URL + */ public String getRepoUri() { return repoUri; } + /** + * Formats a git repository URL with a directory + * @return a git repository URL with a directory + */ public String getDirectoryUrl(String directory) { return String.format(GIT_REPO_DIRECTORY_URL_FORMAT, gitUrl, repoName, defaultBranch, directory); } + /** + * Gets the default branch computed during initialisatio + * @return the default branch name + */ public String getDefaultBranch() { return defaultBranch; } + /** + * Closes the repository + */ @Override public void close() { git.close(); } + /** + * A builder for a git repository + * + * @author Marian Novotny + */ public static class Builder { private static final String GIT_REPO_URL_FORMAT = "%s/%s.git"; private String repoName; @@ -231,26 +285,53 @@ public class GitRepository implements Closeable { private Git git; private ConfigEditorFile.ContentType contentType = ConfigEditorFile.ContentType.RAW_JSON_STRING; + /** + * Sets the repository name + * @param repoName the name of teh repository + * @return this builder + */ public Builder repoName(String repoName) { this.repoName = repoName; return this; } + /** + * Sets git url + * @param gitUrl a url to git server + * @return this builder + */ public Builder gitUrl(String gitUrl) { this.gitUrl = gitUrl; return this; } + /** + * Sets folder for this repository to be considered. + * @param repoFolder the name of the folder + * @return this builder + */ public Builder repoFolder(String repoFolder) { this.repoFolder = repoFolder; return this; } + /** + * Sets the credentials for the git repository + * @param userName the name of the user + * @param password password or PAT + * @return this builder + */ public Builder credentials(String userName, String password) { credentialsProvider = new UsernamePasswordCredentialsProvider(userName, password); return this; } + /** + * Builds the git repository + * @return the git repository built from the builder state + * @throws GitAPIException + * @throws IOException + */ public GitRepository build() throws GitAPIException, IOException { if (repoName == null || gitUrl == null diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/git/ReleasePullRequestService.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/git/ReleasePullRequestService.java index 5196ec32..5a73aa49 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/git/ReleasePullRequestService.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/git/ReleasePullRequestService.java @@ -11,7 +11,15 @@ import uk.co.gresearch.siembol.configeditor.common.ConfigInfo; import java.io.IOException; import java.util.List; - +/** + * An object for interaction with a GitHub API + * + * + *

This class is used for interaction with a GitHub API in order to create a pull request and + * checks for opened pull request in the repository. + * + * @author Marian Novotny + */ public class ReleasePullRequestService { private static final String BODY_TEMPLATE = "User %s would like to release %s version %d."; private static final String PR_STATE_OPEN = "open"; @@ -27,6 +35,12 @@ public class ReleasePullRequestService { this.branchTo = builder.branchTo; } + /** + * Creates a pull request + * @param info metadata about the pull request + * @return the config editor result with pull request status + * @throws IOException + */ public ConfigEditorResult createPullRequest(ConfigInfo info) throws IOException { PullRequest request = new PullRequest(); request.setBody(String.format(BODY_TEMPLATE, @@ -44,6 +58,11 @@ public class ReleasePullRequestService { return new ConfigEditorResult(ConfigEditorResult.StatusCode.OK, attributes); } + /** + * Gets info about pending pull request in the repository + * @return the config editor result with a pending pull request flag + * @throws IOException + */ public ConfigEditorResult pendingPullRequest() throws IOException { List requests = service.getPullRequests(repoId, PR_STATE_OPEN); @@ -55,6 +74,11 @@ public class ReleasePullRequestService { return new ConfigEditorResult(ConfigEditorResult.StatusCode.OK, attributes); } + /** + * A builder for a git repository + * + * @author Marian Novotny + */ public static class Builder { private String uri; private String user; @@ -64,27 +88,53 @@ public class ReleasePullRequestService { private PullRequestService service; private String branchTo; + /** + * Sets GitHub url + * @param uri a url to git server + * @return this builder + */ public Builder uri(String uri) { this.uri = uri; return this; } + /** + * Sets the repository name + * @param repoName the name of teh repository + * @return this builder + */ public Builder repoName(String repoName) { this.repoName = repoName; return this; } + /** + * Sets the credentials for the GitHub repository + * @param user the name of the user + * @param password password or PAT + * @return this builder + */ public Builder credentials(String user, String password) { this.user = user; this.password = password; return this; } + /** + * Sets the branch name for PR to be merged into it. + * @param branchTo the name of the branch + * @return this builder + */ public Builder branchTo(String branchTo) { this.branchTo = branchTo; return this; } + /** + * Builds the release pull request service + * @return the pull request service built from the builder state + * + */ public ReleasePullRequestService build() { if (uri == null || user == null diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/AdditionalConfigTesters.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/AdditionalConfigTesters.java index b29b73f4..fddf2a66 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/AdditionalConfigTesters.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/AdditionalConfigTesters.java @@ -1,5 +1,11 @@ package uk.co.gresearch.siembol.configeditor.model; - +/** + * An object that represents additional config testers + * + *

This class represents additional config testers. + * + * @author Marian Novotny + */ public class AdditionalConfigTesters { private SparkHdfsTesterProperties sparkHdfs; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ConfigEditorAttributes.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ConfigEditorAttributes.java index d2068bd7..4c0e2c73 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ConfigEditorAttributes.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ConfigEditorAttributes.java @@ -8,7 +8,15 @@ import uk.co.gresearch.siembol.common.model.StormTopologyDto; import uk.co.gresearch.siembol.configeditor.common.ConfigInfoType; import java.util.List; - +/** + * A data transfer object that represents config editor attributes + * + *

This class represents config editor attributes. + * + * @author Marian Novotny + * @see JsonProperty + * @see JsonRawValue + */ @JsonInclude(JsonInclude.Include.NON_NULL) public class ConfigEditorAttributes { private String exception; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ConfigEditorFile.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ConfigEditorFile.java index 9da0cb88..603b876c 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ConfigEditorFile.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ConfigEditorFile.java @@ -6,7 +6,16 @@ import com.fasterxml.jackson.databind.JsonNode; import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; - +/** + * A data transfer object that represents config editor file + * + *

This class represents config editor file. It includes name, content and the history of modifications. + * + * @author Marian Novotny + * @see JsonProperty + * @see JsonRawValue + * @see ConfigEditorFileHistoryItem + */ @JsonInclude(JsonInclude.Include.NON_NULL) public class ConfigEditorFile { public enum ContentType { diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ConfigEditorFileHistoryItem.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ConfigEditorFileHistoryItem.java index 458aeae8..8aa81c75 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ConfigEditorFileHistoryItem.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ConfigEditorFileHistoryItem.java @@ -6,7 +6,15 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.time.Instant; import java.time.LocalDateTime; import java.util.TimeZone; - +/** + * A data transfer object that represents config editor file history item + * + *

This class represents config editor file history item. + * It includes the author of the change, the date of the modification and number of added/removed lines. + * + * @author Marian Novotny + * @see JsonProperty + */ public class ConfigEditorFileHistoryItem { private String author; private String date; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ErrorMessages.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ErrorMessages.java index f59a2839..f74fa908 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ErrorMessages.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ErrorMessages.java @@ -1,5 +1,10 @@ package uk.co.gresearch.siembol.configeditor.model; - +/** + * An enum for representing error messages. + * It supports formatting the message from arguments. + * + * @author Marian Novotny + */ public enum ErrorMessages { CONFIG_ITEM_ALREADY_EXISTS("%s already exists"), CONFIG_ITEM_UNEXPECTED_VERSION("Unexpected version for %s update"), diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ErrorResolutions.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ErrorResolutions.java index 9dc9f8a2..de55fb5d 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ErrorResolutions.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ErrorResolutions.java @@ -1,5 +1,10 @@ package uk.co.gresearch.siembol.configeditor.model; - +/** + * An enum for representing error messages resolutions. + * It supports formatting the title from arguments. + * + * @author Marian Novotny + */ public enum ErrorResolutions { GENERIC_BAD_REQUEST("Inspect error message and try to fix and replay your request"), CONCURRENT_USERS("Siembol UI can be used by multiple users in parallel. " + diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ErrorTitles.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ErrorTitles.java index caf696ee..52f4330e 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ErrorTitles.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/model/ErrorTitles.java @@ -1,5 +1,10 @@ package uk.co.gresearch.siembol.configeditor.model; - +/** + * An enum for representing error messages titles. + * It supports formatting the title from arguments. + * + * @author Marian Novotny + */ public enum ErrorTitles { ADD_CONFIG("Problem storing configuration in git repository"), ADD_TEST_CASE("Problem storing test case in git repository"), diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/serviceaggregator/ServiceAggregator.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/serviceaggregator/ServiceAggregator.java index 6e7932e8..85818caf 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/serviceaggregator/ServiceAggregator.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/serviceaggregator/ServiceAggregator.java @@ -8,31 +8,95 @@ import uk.co.gresearch.siembol.configeditor.configstore.ConfigStore; import java.util.List; import java.util.stream.Collectors; - +/** + * An object for composition of a config store service and a config schema service. + * + * + *

This interface is for composing a config store service and a config schema service. + * It checks an authorisation for a service and a user. + * It checks health of all services. + * + * @author Marian Novotny + * + */ public interface ServiceAggregator { + /** + * Gets a config store service for a user + * @param user a user who is trying to access the service + * @param serviceName the name of the service + * @return config store service for the service + * @throws AuthorisationException if the user is not authorised to the service + */ ConfigStore getConfigStore(UserInfo user, String serviceName) throws AuthorisationException; + /** + * Gets a config schema service for a user + * @param user a user who is trying to access the service + * @param serviceName the name of the service + * @return config schema service for the service + * @throws AuthorisationException if the user is not authorised to the service + */ ConfigSchemaService getConfigSchema(UserInfo user, String serviceName) throws AuthorisationException; + /** + * Gets a list of aggregated services + * @return the list of aggregated services + */ List getAggregatorServices(); + /** + * Gets a list of config store services + * @return a list of config store services + */ List getConfigStoreServices(); + /** + * Gets a list of config schema services + * @return a list of config schema services + */ List getConfigSchemaServices(); + /** + * Gets a list of services for which the user is authorised + * @param user a user info object + * @return a list of services for which the user is authorised + */ List getConfigEditorServices(UserInfo user); + /** + * Gets a list of admin services for which the user is authorised + * @param user a user info object + * @return a list of services for which the user is authorised + */ default List getConfigEditorAdminServices(UserInfo user) { return getConfigEditorServices(user).stream() .filter(x -> x.getUserRoles().contains(ServiceUserRole.SERVICE_ADMIN)) .collect(Collectors.toList()); } + /** + * Checks health of all config store services + * @return a health object with status + * @see Health + */ Health checkConfigStoreServicesHealth(); + /** + * Checks health of all config schema services + * @return a health object with status + * @see Health + */ Health checkConfigSchemaServicesHealth(); + /** + * Initiates shutting down of all services + * @return the result with status + */ ConfigEditorResult shutDown(); + /** + * Waits for shutting down of all services + * @return the result with status + */ ConfigEditorResult awaitShutDown(); } diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/serviceaggregator/ServiceAggregatorImpl.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/serviceaggregator/ServiceAggregatorImpl.java index 864a18bf..1de63ab8 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/serviceaggregator/ServiceAggregatorImpl.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/serviceaggregator/ServiceAggregatorImpl.java @@ -10,6 +10,7 @@ import org.springframework.boot.actuate.health.Status; import uk.co.gresearch.siembol.common.constants.ServiceType; import uk.co.gresearch.siembol.configeditor.common.*; +import uk.co.gresearch.siembol.configeditor.configinfo.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.configstore.ConfigStore; import uk.co.gresearch.siembol.configeditor.configstore.ConfigStoreImpl; import uk.co.gresearch.siembol.configeditor.git.GitRepository; @@ -28,7 +29,20 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.OK; - +/** + * An object for composition of a config store service and a config schema service. + * + * + *

This class implements ServiceAggregator and Closeable interfaces. + * It is for composing a config store service and a config schema service. + * It checks an authorisation for a service and a user using an authorisation provider. + * It checks health of all services. + * + * @author Marian Novotny + * @see ServiceAggregator + * @see AuthorisationProvider + * + */ public class ServiceAggregatorImpl implements ServiceAggregator, Closeable { private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); @@ -45,21 +59,33 @@ public class ServiceAggregatorImpl implements ServiceAggregator, Closeable { this.gitRepositoriesServices = builder.gitRepositoriesServices; } + /** + * {@inheritDoc} + */ @Override public ConfigStore getConfigStore(UserInfo user, String serviceName) throws AuthorisationException { return getService(user, serviceName).getConfigStore(); } + /** + * {@inheritDoc} + */ @Override public ConfigSchemaService getConfigSchema(UserInfo user, String serviceName) throws AuthorisationException { return getService(user, serviceName).getConfigSchemaService(); } + /** + * {@inheritDoc} + */ @Override public List getAggregatorServices() { return serviceMap.values().stream().collect(Collectors.toList()); } + /** + * {@inheritDoc} + */ @Override public List getConfigStoreServices() { return serviceMap.keySet().stream() @@ -67,6 +93,9 @@ public class ServiceAggregatorImpl implements ServiceAggregator, Closeable { .collect(Collectors.toList()); } + /** + * {@inheritDoc} + */ @Override public List getConfigSchemaServices() { return serviceMap.keySet().stream() @@ -74,6 +103,9 @@ public class ServiceAggregatorImpl implements ServiceAggregator, Closeable { .collect(Collectors.toList()); } + /** + * {@inheritDoc} + */ @Override public List getConfigEditorServices(UserInfo user) { List ret = new ArrayList<>(); @@ -107,16 +139,25 @@ public class ServiceAggregatorImpl implements ServiceAggregator, Closeable { return ret; } + /** + * {@inheritDoc} + */ @Override public Health checkConfigStoreServicesHealth() { return checkServiceHealth(getConfigStoreServices()); } + /** + * {@inheritDoc} + */ @Override public Health checkConfigSchemaServicesHealth() { return checkServiceHealth(getConfigSchemaServices()); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult shutDown() { LOG.info("Initiating shutting down the config store services"); @@ -124,6 +165,9 @@ public class ServiceAggregatorImpl implements ServiceAggregator, Closeable { return new ConfigEditorResult(OK); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult awaitShutDown() { LOG.info("Initiating awaiting shutting down the config store services"); @@ -171,6 +215,11 @@ public class ServiceAggregatorImpl implements ServiceAggregator, Closeable { gitRepositoriesServices.forEach(x -> x.getLeft().close()); } + /** + * A builder for a service aggregator + * + * @author Marian Novotny + */ public static class Builder { private static final String SERVICE_ALREADY_REGISTERED = "Service is already registered"; private static final String NO_SERVICE_REGISTERED = "No services registered in aggregator"; @@ -179,10 +228,26 @@ public class ServiceAggregatorImpl implements ServiceAggregator, Closeable { private Map> gitRepositoriesMap = new HashMap<>(); private List> gitRepositoriesServices; + /** + * Creates a builder + * + * @param authProvider an authorisation provider for evaluating the access af a user to a service + */ public Builder(AuthorisationProvider authProvider) { this.authProvider = authProvider; } + /** + * Adds a service into the builder + * @param name the name of the service + * @param type the type of the service + * @param configStore an already created config store for the service + * @param schemaService an already created config schema service for the service + * @return this builder + * @see ServiceType + * @see ConfigStore + * @see ConfigSchemaService + */ Builder addService(String name, ServiceType type, ConfigStore configStore, ConfigSchemaService schemaService) { if (serviceMap.containsKey(name)) { throw new IllegalArgumentException(SERVICE_ALREADY_REGISTERED); @@ -196,6 +261,15 @@ public class ServiceAggregatorImpl implements ServiceAggregator, Closeable { return this; } + /** + * Adds a service into the builder + * @param name the name of the service + * @param type the type of the service + * @param storeProperties properties of the config store + * @param configInfoProvider config info provider for the service + * @param schemaService an already created config schema service for the service + * @return this builder + */ public Builder addService(String name, ServiceType type, ConfigStoreProperties storeProperties, @@ -205,6 +279,10 @@ public class ServiceAggregatorImpl implements ServiceAggregator, Closeable { return addService(name, type, configStore, schemaService); } + /** + * + * @return the service aggregator built from the builder state + */ public ServiceAggregator build() { if (serviceMap.isEmpty()) { throw new IllegalArgumentException(NO_SERVICE_REGISTERED); diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/serviceaggregator/ServiceAggregatorService.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/serviceaggregator/ServiceAggregatorService.java index ce247870..e8985ce8 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/serviceaggregator/ServiceAggregatorService.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/serviceaggregator/ServiceAggregatorService.java @@ -5,7 +5,13 @@ import uk.co.gresearch.siembol.common.constants.ServiceType; import uk.co.gresearch.siembol.configeditor.configstore.ConfigStore; import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.OK; - +/** + * An object that represents a service used in the service aggregator + * + *

This class represents a service used in the service aggregator. + * + * @author Marian Novotny + */ public class ServiceAggregatorService { private final String name; private final ServiceType type; diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/TestCaseEvaluator.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/TestCaseEvaluator.java index d9299350..8d015238 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/TestCaseEvaluator.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/TestCaseEvaluator.java @@ -1,15 +1,48 @@ package uk.co.gresearch.siembol.configeditor.testcase; import uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult; - +/** + * An object for evaluating a test case + * + *

This interface is for representing a test case evaluator. + * + * @author Marian Novotny + * + */ public interface TestCaseEvaluator { + /** + * Evaluates a test case on a testing result + * + * @param jsonResult a json string with a testing result + * @param testCase a json string with test case specification + * @return a config editor result with a test case result on success, otherwise + * the result with ERROR status code. + */ ConfigEditorResult evaluate(String jsonResult, String testCase); + /** + * Validates a test case + * + * @param testCase a json string with test case specification + * @return a config editor result with OK status code if the testcase is valid, otherwise + * the result with ERROR status code. + */ ConfigEditorResult validate(String testCase); + /** + * Gets json schema for a test case + * + * @return a config editor result with a test case json schema + */ + ConfigEditorResult getSchema(); + /** + * Gets a test case evaluator with formatted error messages + * + * @return a test case evaluator with formatted error messages + */ default TestCaseEvaluator withErrorMessage() { return new TestCaseEvaluatorWithErrorMessage(this); } diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/TestCaseEvaluatorImpl.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/TestCaseEvaluatorImpl.java index 3c7797d1..dc6389a2 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/TestCaseEvaluatorImpl.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/TestCaseEvaluatorImpl.java @@ -29,7 +29,15 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import static uk.co.gresearch.siembol.configeditor.model.ConfigEditorResult.StatusCode.*; - +/** + * An object for evaluating a test case + * + *

This class is implementing TestCaseEvaluator interface. It is used for evaluating a test case, + * validating its syntax. Moreover, it provides json schema for a test case specification. + * + * @author Marian Novotny + * + */ public class TestCaseEvaluatorImpl implements TestCaseEvaluator { private static final ObjectReader TEST_CASE_READER = new ObjectMapper().readerFor(TestCaseDto.class); @@ -38,6 +46,12 @@ public class TestCaseEvaluatorImpl implements TestCaseEvaluator { private final JsonSchemaValidator jsonSchemaValidator; private final String testCaseSchema; + /** + * Creates a test case evaluator + * @param uiLayout a layout for enriching a test case json schema + * @throws Exception on error + * @see ConfigEditorUiLayout + */ public TestCaseEvaluatorImpl(ConfigEditorUiLayout uiLayout) throws Exception { this.jsonSchemaValidator = new SiembolJsonSchemaValidator(TestCaseDto.class); String schemaStr = jsonSchemaValidator.getJsonSchema().getAttributes().getJsonSchema(); @@ -92,6 +106,9 @@ public class TestCaseEvaluatorImpl implements TestCaseEvaluator { return result; } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult evaluate(String jsonResult, String testCaseJson) { ConfigEditorTestCaseResult testCaseResult = new ConfigEditorTestCaseResult(); @@ -127,6 +144,9 @@ public class TestCaseEvaluatorImpl implements TestCaseEvaluator { return new ConfigEditorResult(OK, attributes); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult validate(String testCase) { SiembolResult validationResult = jsonSchemaValidator.validate(testCase); @@ -141,6 +161,9 @@ public class TestCaseEvaluatorImpl implements TestCaseEvaluator { return new ConfigEditorResult(OK, new ConfigEditorAttributes()); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult getSchema() { return ConfigEditorResult.fromSchema(testCaseSchema); diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/TestCaseEvaluatorWithErrorMessage.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/TestCaseEvaluatorWithErrorMessage.java index 2de3e734..9378b666 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/TestCaseEvaluatorWithErrorMessage.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/TestCaseEvaluatorWithErrorMessage.java @@ -7,13 +7,29 @@ import uk.co.gresearch.siembol.configeditor.model.ErrorResolutions; import uk.co.gresearch.siembol.configeditor.model.ErrorTitles; import java.util.function.Supplier; - +/** + * An object for evaluating a test case with enhanced error messages + * + *

This class is implementing TestCaseEvaluator interface, and it extends ServiceWithErrorMessage class. + * It is used for evaluating a test case using an underlying test case evaluator. It enriches error messages on error. + * + * @author Marian Novotny + * @see ServiceWithErrorMessage + * @see TestCaseEvaluator + * @see ErrorMessages + * @see ErrorResolutions + * @see ErrorTitles + * + */ public class TestCaseEvaluatorWithErrorMessage extends ServiceWithErrorMessage implements TestCaseEvaluator { public TestCaseEvaluatorWithErrorMessage(TestCaseEvaluator service) { super(service); } + /** + * {@inheritDoc} + */ @Override public ConfigEditorResult evaluate(String jsonResult, String testCase) { Supplier fun = () -> service.evaluate(jsonResult, testCase); @@ -22,6 +38,9 @@ public class TestCaseEvaluatorWithErrorMessage extends ServiceWithErrorMessage fun = () -> service.validate(testCase); @@ -30,6 +49,9 @@ public class TestCaseEvaluatorWithErrorMessage extends ServiceWithErrorMessageThis enum is used for json (de)serialisation of an assertion type used in a test case. + * + * @author Marian Novotny + * @see com.fasterxml.jackson.annotation.JsonProperty + */ public enum AssertionTypeDto { @JsonProperty("path_and_value_matches") PATH_AND_VALUE_MATCHES("path_and_value_matches"), @JsonProperty("only_if_path_exists") ONLY_IF_PATH_EXISTS("only_if_path_exists"); diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/model/TestAssertionDto.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/model/TestAssertionDto.java index cf757f5c..9142add0 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/model/TestAssertionDto.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/model/TestAssertionDto.java @@ -2,7 +2,17 @@ package uk.co.gresearch.siembol.configeditor.testcase.model; import com.fasterxml.jackson.annotation.JsonProperty; import com.github.reinert.jjschema.Attributes; - +/** + * A data transfer object for representing a test assertion + * + *

This class is used for json (de)serialisation a test assertion, and + * for generating json schema from this class using annotations. + * + * @author Marian Novotny + * @see com.github.reinert.jjschema.Attributes + * @see com.fasterxml.jackson.annotation.JsonProperty + * @see AssertionTypeDto + */ @Attributes(title = "test assertion", description = "Test assertion used in test case") public class TestAssertionDto { @JsonProperty("assertion_type") diff --git a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/model/TestCaseDto.java b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/model/TestCaseDto.java index deed606e..da705c4e 100644 --- a/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/model/TestCaseDto.java +++ b/config-editor/config-editor-core/src/main/java/uk/co/gresearch/siembol/configeditor/testcase/model/TestCaseDto.java @@ -7,7 +7,18 @@ import com.github.reinert.jjschema.SchemaIgnore; import uk.co.gresearch.siembol.common.model.JsonRawStringDto; import java.util.List; - +/** + * A data transfer object for representing a test case + * + *

This class is used for json (de)serialisation a test case, and + * for generating json schema from this class using annotations. + * + * @author Marian Novotny + * @see com.github.reinert.jjschema.Attributes + * @see com.fasterxml.jackson.annotation.JsonProperty + * @see JsonRawStringDto + * @see TestAssertionDto + */ @Attributes(title = "test case", description = "Test case for testing configurations") public class TestCaseDto { @JsonProperty("test_case_name") diff --git a/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configinfo/AdminConfigInfoProviderTest.java b/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configinfo/AdminConfigInfoProviderTest.java index bf6c033a..8a907fdd 100644 --- a/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configinfo/AdminConfigInfoProviderTest.java +++ b/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configinfo/AdminConfigInfoProviderTest.java @@ -3,7 +3,6 @@ package uk.co.gresearch.siembol.configeditor.configinfo; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.common.UserInfo; import uk.co.gresearch.siembol.configeditor.common.ConfigInfo; diff --git a/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configinfo/JsonRuleConfigInfoProviderTest.java b/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configinfo/JsonRuleConfigInfoProviderTest.java index 8699c7ee..ce0966b7 100644 --- a/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configinfo/JsonRuleConfigInfoProviderTest.java +++ b/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configinfo/JsonRuleConfigInfoProviderTest.java @@ -3,7 +3,6 @@ package uk.co.gresearch.siembol.configeditor.configinfo; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.common.UserInfo; import uk.co.gresearch.siembol.configeditor.model.ConfigEditorFile; import uk.co.gresearch.siembol.configeditor.common.ConfigInfo; diff --git a/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigItemsTest.java b/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigItemsTest.java index 403cebf0..0dd94ca2 100644 --- a/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigItemsTest.java +++ b/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigItemsTest.java @@ -8,7 +8,7 @@ import org.mockito.Mockito; import org.junit.Before; import uk.co.gresearch.siembol.configeditor.common.ConfigInfo; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; +import uk.co.gresearch.siembol.configeditor.configinfo.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.common.ConfigInfoType; import uk.co.gresearch.siembol.configeditor.common.UserInfo; import uk.co.gresearch.siembol.configeditor.git.GitRepository; diff --git a/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigReleaseTest.java b/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigReleaseTest.java index ed8fced3..820c4a43 100644 --- a/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigReleaseTest.java +++ b/config-editor/config-editor-core/src/test/java/uk/co/gresearch/siembol/configeditor/configstore/ConfigReleaseTest.java @@ -6,7 +6,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import uk.co.gresearch.siembol.configeditor.common.ConfigInfo; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; +import uk.co.gresearch.siembol.configeditor.configinfo.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.common.ConfigInfoType; import uk.co.gresearch.siembol.configeditor.common.UserInfo; import uk.co.gresearch.siembol.configeditor.git.GitRepository; diff --git a/config-editor/config-editor-rest/src/main/java/uk/co/gresearch/siembol/configeditor/rest/application/ConfigServiceHelperImpl.java b/config-editor/config-editor-rest/src/main/java/uk/co/gresearch/siembol/configeditor/rest/application/ConfigServiceHelperImpl.java index b9bb4d63..410ba703 100644 --- a/config-editor/config-editor-rest/src/main/java/uk/co/gresearch/siembol/configeditor/rest/application/ConfigServiceHelperImpl.java +++ b/config-editor/config-editor-rest/src/main/java/uk/co/gresearch/siembol/configeditor/rest/application/ConfigServiceHelperImpl.java @@ -4,7 +4,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import uk.co.gresearch.siembol.common.zookeeper.ZooKeeperConnector; import uk.co.gresearch.siembol.common.zookeeper.ZooKeeperConnectorFactory; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; +import uk.co.gresearch.siembol.configeditor.configinfo.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.common.ConfigInfoType; import uk.co.gresearch.siembol.common.constants.ServiceType; import uk.co.gresearch.siembol.configeditor.configinfo.AdminConfigInfoProvider; diff --git a/config-editor/config-editor-services/src/main/java/uk/co/gresearch/siembol/configeditor/service/common/ConfigEditorServiceFactory.java b/config-editor/config-editor-services/src/main/java/uk/co/gresearch/siembol/configeditor/service/common/ConfigEditorServiceFactory.java index 50ad549b..f0bd296f 100644 --- a/config-editor/config-editor-services/src/main/java/uk/co/gresearch/siembol/configeditor/service/common/ConfigEditorServiceFactory.java +++ b/config-editor/config-editor-services/src/main/java/uk/co/gresearch/siembol/configeditor/service/common/ConfigEditorServiceFactory.java @@ -1,6 +1,6 @@ package uk.co.gresearch.siembol.configeditor.service.common; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; +import uk.co.gresearch.siembol.configeditor.configinfo.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.common.ConfigSchemaService; import uk.co.gresearch.siembol.common.constants.ServiceType; import uk.co.gresearch.siembol.configeditor.configinfo.JsonRuleConfigInfoProvider; diff --git a/config-editor/config-editor-services/src/main/java/uk/co/gresearch/siembol/configeditor/service/parserconfig/ParserConfigConfigInfoProvider.java b/config-editor/config-editor-services/src/main/java/uk/co/gresearch/siembol/configeditor/service/parserconfig/ParserConfigConfigInfoProvider.java index 56ffefe9..d8823700 100644 --- a/config-editor/config-editor-services/src/main/java/uk/co/gresearch/siembol/configeditor/service/parserconfig/ParserConfigConfigInfoProvider.java +++ b/config-editor/config-editor-services/src/main/java/uk/co/gresearch/siembol/configeditor/service/parserconfig/ParserConfigConfigInfoProvider.java @@ -1,6 +1,6 @@ package uk.co.gresearch.siembol.configeditor.service.parserconfig; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; +import uk.co.gresearch.siembol.configeditor.configinfo.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.common.ConfigInfoType; import uk.co.gresearch.siembol.configeditor.configinfo.JsonConfigInfoProvider; diff --git a/config-editor/config-editor-services/src/main/java/uk/co/gresearch/siembol/configeditor/service/parsingapp/ParsingAppConfigInfoProvider.java b/config-editor/config-editor-services/src/main/java/uk/co/gresearch/siembol/configeditor/service/parsingapp/ParsingAppConfigInfoProvider.java index d22cf094..c8ba14a4 100644 --- a/config-editor/config-editor-services/src/main/java/uk/co/gresearch/siembol/configeditor/service/parsingapp/ParsingAppConfigInfoProvider.java +++ b/config-editor/config-editor-services/src/main/java/uk/co/gresearch/siembol/configeditor/service/parsingapp/ParsingAppConfigInfoProvider.java @@ -1,6 +1,6 @@ package uk.co.gresearch.siembol.configeditor.service.parsingapp; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; +import uk.co.gresearch.siembol.configeditor.configinfo.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.common.ConfigInfoType; import uk.co.gresearch.siembol.configeditor.configinfo.JsonConfigInfoProvider; diff --git a/config-editor/config-editor-services/src/test/java/uk/co/gresearch/siembol/configeditor/service/parserconfig/ParserConfigConfigInfoProviderTest.java b/config-editor/config-editor-services/src/test/java/uk/co/gresearch/siembol/configeditor/service/parserconfig/ParserConfigConfigInfoProviderTest.java index bf947d3b..c04d0bb9 100644 --- a/config-editor/config-editor-services/src/test/java/uk/co/gresearch/siembol/configeditor/service/parserconfig/ParserConfigConfigInfoProviderTest.java +++ b/config-editor/config-editor-services/src/test/java/uk/co/gresearch/siembol/configeditor/service/parserconfig/ParserConfigConfigInfoProviderTest.java @@ -4,7 +4,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import uk.co.gresearch.siembol.configeditor.common.UserInfo; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; +import uk.co.gresearch.siembol.configeditor.configinfo.ConfigInfoProvider; import uk.co.gresearch.siembol.configeditor.model.ConfigEditorFile; import uk.co.gresearch.siembol.configeditor.common.ConfigInfo; diff --git a/config-editor/config-editor-services/src/test/java/uk/co/gresearch/siembol/configeditor/service/parsingapp/ParsingAppConfigInfoProviderTest.java b/config-editor/config-editor-services/src/test/java/uk/co/gresearch/siembol/configeditor/service/parsingapp/ParsingAppConfigInfoProviderTest.java index bf6dfe77..1d89fea2 100644 --- a/config-editor/config-editor-services/src/test/java/uk/co/gresearch/siembol/configeditor/service/parsingapp/ParsingAppConfigInfoProviderTest.java +++ b/config-editor/config-editor-services/src/test/java/uk/co/gresearch/siembol/configeditor/service/parsingapp/ParsingAppConfigInfoProviderTest.java @@ -5,7 +5,7 @@ import org.junit.Before; import org.junit.Test; import uk.co.gresearch.siembol.configeditor.common.UserInfo; import uk.co.gresearch.siembol.configeditor.common.ConfigInfo; -import uk.co.gresearch.siembol.configeditor.common.ConfigInfoProvider; +import uk.co.gresearch.siembol.configeditor.configinfo.ConfigInfoProvider; public class ParsingAppConfigInfoProviderTest {