Package org.constretto.model

Examples of org.constretto.model.ClassPathResource


*/
public class PropertiesStoreTest extends AbstractConfigurationStoreTest {

    @Override
    protected ConfigurationStore getStore() {
        Resource props = new ClassPathResource("test.properties");
        return new PropertiesStore().addResource(props);
    }
View Full Code Here


*/
public class IniFileConfigurationStoreTest extends AbstractConfigurationStoreTest {

    @Override
    protected ConfigurationStore getStore() {
        return new IniFileConfigurationStore().addResource(new ClassPathResource("test.ini"));
    }
View Full Code Here

    @Override
    public ConstrettoConfiguration prepareTests(String... tags) {
        ConstrettoBuilder constrettoBuilder = new ConstrettoBuilder();
        constrettoBuilder
                .createPropertiesStore()
                .addResource(new ClassPathResource(("org/constretto/internal/provider/helper/provider-test.properties")))
                .addResource(new ClassPathResource(("org/constretto/internal/provider/helper/provider-test-overloaded.properties")))
                .done()
                .createSystemPropertiesStore();
        for (String tag : tags) {
            constrettoBuilder.addCurrentTag(tag);
        }
View Full Code Here

    @Override
    public ConstrettoConfiguration prepareTests(String... tags) {
        ConstrettoBuilder constrettoBuilder = new ConstrettoBuilder();
        constrettoBuilder
                .createIniFileConfigurationStore()
                .addResource(new ClassPathResource(("org/constretto/internal/provider/helper/provider-test.ini")))
                .addResource(new ClassPathResource(("org/constretto/internal/provider/helper/provider-test-overloaded.ini")))
                .done()
                .createSystemPropertiesStore();
        for (String tag : tags) {
            constrettoBuilder.addCurrentTag(tag);
        }
View Full Code Here

    @Before
    public void createConfiguration() {
        config = new ConstrettoBuilder()
                .createPropertiesStore()
                .addResource(new ClassPathResource("dynamic.properties"))
                .done().getConfiguration();
    }
View Full Code Here

    }

    @Test
    public void whenResetingTagsItResolvesBackToOriginalTags() {
        ConstrettoConfiguration configuration = new ConstrettoBuilder()
                .createPropertiesStore().addResource(new ClassPathResource("dynamic.properties")).done()
                .addCurrentTag("test")
                .getConfiguration();
        assertEquals("test value", configuration.evaluateToString("stagedKey"));
        configuration.prependTag("prod");
        assertEquals("prod value", configuration.evaluateToString("stagedKey"));
View Full Code Here


    @Test
    public void whenClearingTagsItResolvesBackToDefaultValues() {
        ConstrettoConfiguration configuration = new ConstrettoBuilder()
                .createPropertiesStore().addResource(new ClassPathResource("dynamic.properties")).done()
                .addCurrentTag("test")
                .getConfiguration();
        assertEquals("test value", configuration.evaluateToString("stagedKey"));
        configuration.prependTag("prod");
        assertEquals("prod value", configuration.evaluateToString("stagedKey"));
View Full Code Here

    @Test
    public void constrettoShouldWorkWithNonExistingResources() {
        ConstrettoConfiguration configuration = new ConstrettoBuilder(false)
                .createPropertiesStore()
                .addResource(new ClassPathResource("test.properties"))
                .addResource(new ClassPathResource("IdoNoExist.properties"))
                .done()
                .getConfiguration();
        assertNotNull(configuration);
    }
View Full Code Here

    @Test(expected = ConstrettoExpressionException.class) //TODO perhaps a more specific expeption
    public void shouldThrowExceptionIfTryingToMapWithoutNeededAllTagsProvided() throws Exception {
        new ConstrettoBuilder(false)
                .createPropertiesStore()
                .addResource(new ClassPathResource("test.properties"))
                .done()
                .getConfiguration()
                .asMap();
    }
View Full Code Here

    @Test
    public void youShouldBeAbleToGetConfigurationAsAMap() throws Exception {
        Map<String, String> map = new ConstrettoBuilder(false)
                .createPropertiesStore()
                .addResource(new ClassPathResource("test.properties"))
                .done()
                .addCurrentTag("production")
                .getConfiguration()
                .asMap();
        assertEquals(4, map.size());
View Full Code Here

TOP

Related Classes of org.constretto.model.ClassPathResource

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.