Package restx.config

Examples of restx.config.ConsolidatedConfigFactoryMachine


        System.setProperty("restx.test.system.property", "v1");
        Factory factory = Factory.builder()
                // we add system property machine just to make sure it doesn't break anything, it isn't required
                .addMachine(new SystemPropertyFactoryMachine())

                .addMachine(new ConsolidatedConfigFactoryMachine())
                .build();

        Optional<RestxConfig> configOptional = factory.queryByClass(RestxConfig.class).findOneAsComponent();

        assertThat(configOptional.isPresent()).isTrue();
View Full Code Here


    }

    @Test
    public void should_load_configs_from_suppliers() throws Exception {
        Factory factory = Factory.builder()
                .addMachine(new ConsolidatedConfigFactoryMachine())
                .addMachine(configSupplierMachine(0, "s1", ConfigElement.of("key1", "val1")))
                .addMachine(configSupplierMachine(0, "s2", ConfigElement.of("key2", "val2")))
                .build();

        Optional<RestxConfig> configOptional = factory.queryByClass(RestxConfig.class).findOneAsComponent();
View Full Code Here

    }

    @Test
    public void should_provide_config_elements_as_named_strings() throws Exception {
        Factory factory = Factory.builder()
                .addMachine(new ConsolidatedConfigFactoryMachine())
                .addMachine(new ElementsFromConfigFactoryMachine())
                .addMachine(configSupplierMachine(0, "s1", ConfigElement.of("key1", "val1")))
                .addMachine(configSupplierMachine(0, "s2", ConfigElement.of("key2", "val2")))
                .build();
View Full Code Here

    }

    @Test
    public void should_provide_individual_config_elements() throws Exception {
        Factory factory = Factory.builder()
                .addMachine(new ConsolidatedConfigFactoryMachine())
                .addMachine(new ElementsFromConfigFactoryMachine())
                .addMachine(configSupplierMachine(0, "s1", ConfigElement.of("o1", "d1", "key1", "val1")))
                .build();

        Optional<ConfigElement> s = factory.queryByName(Name.of(ConfigElement.class, "key1")).findOneAsComponent();
View Full Code Here

    }

    @Test
    public void should_include_named_string_in_config() throws Exception {
        Factory factory = Factory.builder()
                .addMachine(new ConsolidatedConfigFactoryMachine())
                .addMachine(configSupplierMachine(0, "s1", ConfigElement.of("key1", "val1")))
                .addMachine(new SingletonFactoryMachine<>(0, NamedComponent.of(String.class, "key2", "val2")))
                .build();

        Optional<RestxConfig> configOptional = factory.queryByClass(RestxConfig.class).findOneAsComponent();
View Full Code Here

    }

    @Test
    public void should_use_doc_from_supplied_config() throws Exception {
        Factory factory = Factory.builder()
                .addMachine(new ConsolidatedConfigFactoryMachine())
                .addMachine(configSupplierMachine(0, "s1", ConfigElement.of("s1", "doc1", "key1", "val1")))
                .addMachine(new SingletonFactoryMachine<>(0, NamedComponent.of(String.class, "key1", "val2")))
                .build();

        Optional<RestxConfig> configOptional = factory.queryByClass(RestxConfig.class).findOneAsComponent();
View Full Code Here

TOP

Related Classes of restx.config.ConsolidatedConfigFactoryMachine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.