Package org.lilyproject.indexer.model.indexerconf

Examples of org.lilyproject.indexer.model.indexerconf.NameTemplate.format()


public class NameTemplateTest {

    @Test
    public void testLiteral() throws Exception {
        NameTemplate template = new NameTemplateParser().parse("foobar", defaultValidator());
        assertEquals("foobar", template.format(getResolver()));
    }

    @Test
    public void testVar() throws Exception {
        NameTemplate template = new NameTemplateParser().parse("${var1}", defaultValidator());
View Full Code Here


    }

    @Test
    public void testVar() throws Exception {
        NameTemplate template = new NameTemplateParser().parse("${var1}", defaultValidator());
        assertEquals("hello", template.format(getResolver()));
    }

    @Test
    public void testEmbeddedVar() throws Exception {
        NameTemplate template = new NameTemplateParser().parse("prefix_${var1}_suffix", defaultValidator());
View Full Code Here

    }

    @Test
    public void testEmbeddedVar() throws Exception {
        NameTemplate template = new NameTemplateParser().parse("prefix_${var1}_suffix", defaultValidator());
        assertEquals("prefix_hello_suffix", template.format(getResolver()));
    }

    @Test
    public void testCond() throws Exception {
        NameTemplate template = new NameTemplateParser().parse("${list?yes:no}", defaultValidator());
View Full Code Here

    }

    @Test
    public void testCond() throws Exception {
        NameTemplate template = new NameTemplateParser().parse("${list?yes:no}", defaultValidator());
        assertEquals("yes", template.format(getResolver()));

        template = new NameTemplateParser().parse("${multiValue?yes:no}", defaultValidator());
        assertEquals("no", template.format(getResolver()));

        template = new NameTemplateParser().parse("${multiValue?yes}", defaultValidator());
View Full Code Here

    public void testCond() throws Exception {
        NameTemplate template = new NameTemplateParser().parse("${list?yes:no}", defaultValidator());
        assertEquals("yes", template.format(getResolver()));

        template = new NameTemplateParser().parse("${multiValue?yes:no}", defaultValidator());
        assertEquals("no", template.format(getResolver()));

        template = new NameTemplateParser().parse("${multiValue?yes}", defaultValidator());
        assertEquals("", template.format(getResolver()));

        template = new NameTemplateParser().parse("${list?yes}", defaultValidator());
View Full Code Here

        template = new NameTemplateParser().parse("${multiValue?yes:no}", defaultValidator());
        assertEquals("no", template.format(getResolver()));

        template = new NameTemplateParser().parse("${multiValue?yes}", defaultValidator());
        assertEquals("", template.format(getResolver()));

        template = new NameTemplateParser().parse("${list?yes}", defaultValidator());
        assertEquals("yes", template.format(getResolver()));

        // test with disabled validator because we want it to fail @ evaluation time
View Full Code Here

        template = new NameTemplateParser().parse("${multiValue?yes}", defaultValidator());
        assertEquals("", template.format(getResolver()));

        template = new NameTemplateParser().parse("${list?yes}", defaultValidator());
        assertEquals("yes", template.format(getResolver()));

        // test with disabled validator because we want it to fail @ evaluation time
        template = new NameTemplateParser().parse("${var1?yes:no}", disabledValidator());
        try {
            assertEquals("no", template.format(getResolver()));
View Full Code Here

        assertEquals("yes", template.format(getResolver()));

        // test with disabled validator because we want it to fail @ evaluation time
        template = new NameTemplateParser().parse("${var1?yes:no}", disabledValidator());
        try {
            assertEquals("no", template.format(getResolver()));
            fail("Expected exception");
        } catch (NameTemplateEvaluationException e) {
            // expected
        }
View Full Code Here

        }

        // test with disabled validator because we want it to fail @ evaluation time
        template = new NameTemplateParser().parse("${nonexisting?yes:no}", disabledValidator());
        try {
            assertEquals("no", template.format(getResolver()));
            fail("Expected exception");
        } catch (NameTemplateEvaluationException e) {
            // expected
        }
    }
View Full Code Here

    }

    @Test
    public void testCondEmbedded() throws Exception {
        NameTemplate template = new NameTemplateParser().parse("prefix_${list?yes:no}_suffix", defaultValidator());
        assertEquals("prefix_yes_suffix", template.format(getResolver()));
    }

    @Test
    public void testIncompleteExpr() throws Exception {
        NameTemplate template = new NameTemplateParser().parse("${", defaultValidator());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.