Search in sources :

Example 1 with HoconPresentation

use of org.apache.ignite.internal.configuration.rest.presentation.hocon.HoconPresentation in project ignite-3 by apache.

the class ConfigurationPresentationTest method beforeAll.

/**
 * Before all.
 */
@BeforeAll
static void beforeAll() {
    Validator<Value, Object> validator = new Validator<>() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void validate(Value annotation, ValidationContext<Object> ctx) {
            if (Objects.equals("error", ctx.getNewValue())) {
                ctx.addIssue(new ValidationIssue("Error word"));
            }
        }
    };
    cfgRegistry = new ConfigurationRegistry(List.of(TestRootConfiguration.KEY), Map.of(Value.class, Set.of(validator)), new TestConfigurationStorage(LOCAL), List.of(), List.of());
    cfgRegistry.start();
    cfgPresentation = new HoconPresentation(cfgRegistry);
    cfg = cfgRegistry.getConfiguration(TestRootConfiguration.KEY);
}
Also used : TestConfigurationStorage(org.apache.ignite.internal.configuration.storage.TestConfigurationStorage) Matchers.nullValue(org.hamcrest.Matchers.nullValue) ConfigValue(org.apache.ignite.configuration.annotation.ConfigValue) Value(org.apache.ignite.configuration.annotation.Value) HoconPresentation(org.apache.ignite.internal.configuration.rest.presentation.hocon.HoconPresentation) ConfigurationRegistry(org.apache.ignite.internal.configuration.ConfigurationRegistry) ValidationIssue(org.apache.ignite.configuration.validation.ValidationIssue) Validator(org.apache.ignite.configuration.validation.Validator) ValidationContext(org.apache.ignite.configuration.validation.ValidationContext) BeforeAll(org.junit.jupiter.api.BeforeAll)

Aggregations

ConfigValue (org.apache.ignite.configuration.annotation.ConfigValue)1 Value (org.apache.ignite.configuration.annotation.Value)1 ValidationContext (org.apache.ignite.configuration.validation.ValidationContext)1 ValidationIssue (org.apache.ignite.configuration.validation.ValidationIssue)1 Validator (org.apache.ignite.configuration.validation.Validator)1 ConfigurationRegistry (org.apache.ignite.internal.configuration.ConfigurationRegistry)1 HoconPresentation (org.apache.ignite.internal.configuration.rest.presentation.hocon.HoconPresentation)1 TestConfigurationStorage (org.apache.ignite.internal.configuration.storage.TestConfigurationStorage)1 Matchers.nullValue (org.hamcrest.Matchers.nullValue)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1