Search in sources :

Example 1 with ProcessorAggregationTestDialect

use of org.thymeleaf.engine.ProcessorAggregationTestDialect in project thymeleaf-tests by thymeleaf.

the class DialectSetConfigurationTest method testProcessorComputation06.

@Test
public void testProcessorComputation06() {
    final ProcessorAggregationTestDialect dialect = ProcessorAggregationTestDialect.buildHTMLDialect("standard", "TH", "CD-4-other,C-4-other,DT-4-other,PI-4-other,T-4-other,XD-4-other");
    final DialectConfiguration dialectConfiguration = new DialectConfiguration(dialect);
    final DialectSetConfiguration dialectSetConfiguration = DialectSetConfiguration.build(Collections.singleton(dialectConfiguration));
    Assert.assertEquals("TH", dialect.getPrefix());
    Assert.assertEquals("[CD-4-other]", dialectSetConfiguration.getCDATASectionProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[C-4-other]", dialectSetConfiguration.getCommentProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[DT-4-other]", dialectSetConfiguration.getDocTypeProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[PI-4-other]", dialectSetConfiguration.getProcessingInstructionProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[T-4-other]", dialectSetConfiguration.getTextProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[XD-4-other]", dialectSetConfiguration.getXMLDeclarationProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[]", dialectSetConfiguration.getCDATASectionProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[]", dialectSetConfiguration.getCommentProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[]", dialectSetConfiguration.getDocTypeProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[]", dialectSetConfiguration.getProcessingInstructionProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[]", dialectSetConfiguration.getTextProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[]", dialectSetConfiguration.getXMLDeclarationProcessors(TemplateMode.XML).toString());
}
Also used : ProcessorAggregationTestDialect(org.thymeleaf.engine.ProcessorAggregationTestDialect) Test(org.junit.Test)

Example 2 with ProcessorAggregationTestDialect

use of org.thymeleaf.engine.ProcessorAggregationTestDialect in project thymeleaf-tests by thymeleaf.

the class DialectSetConfigurationTest method testProcessorComputation07.

@Test
public void testProcessorComputation07() {
    final ProcessorAggregationTestDialect dialect = ProcessorAggregationTestDialect.buildXMLDialect("standard", "TH", "CD-4-other,C-4-other,DT-4-other,PI-4-other,T-4-other,XD-4-other");
    final DialectConfiguration dialectConfiguration = new DialectConfiguration(dialect);
    final DialectSetConfiguration dialectSetConfiguration = DialectSetConfiguration.build(Collections.singleton(dialectConfiguration));
    Assert.assertEquals("TH", dialect.getPrefix());
    Assert.assertEquals("[CD-4-other]", dialectSetConfiguration.getCDATASectionProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[C-4-other]", dialectSetConfiguration.getCommentProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[DT-4-other]", dialectSetConfiguration.getDocTypeProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[PI-4-other]", dialectSetConfiguration.getProcessingInstructionProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[T-4-other]", dialectSetConfiguration.getTextProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[XD-4-other]", dialectSetConfiguration.getXMLDeclarationProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[]", dialectSetConfiguration.getCDATASectionProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[]", dialectSetConfiguration.getCommentProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[]", dialectSetConfiguration.getDocTypeProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[]", dialectSetConfiguration.getProcessingInstructionProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[]", dialectSetConfiguration.getTextProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[]", dialectSetConfiguration.getXMLDeclarationProcessors(TemplateMode.HTML).toString());
}
Also used : ProcessorAggregationTestDialect(org.thymeleaf.engine.ProcessorAggregationTestDialect) Test(org.junit.Test)

Example 3 with ProcessorAggregationTestDialect

use of org.thymeleaf.engine.ProcessorAggregationTestDialect in project thymeleaf-tests by thymeleaf.

the class DialectSetConfigurationTest method testProcessorComputation03.

@Test
public void testProcessorComputation03() {
    final ProcessorAggregationTestDialect dialect = ProcessorAggregationTestDialect.buildDialect("standard", "TH", "E-20-null-src, E-10-null-src,E-20-null-href,E-20-null-text,E-10-null-text,E-10-*div-text,E-15-*div-src,E-1-form-*action,E-20-form-null,E-10-null-*action,E-50-null-null", "E-200-null-src, E-100-null-src,E-200-null-href,E-200-null-text,E-100-null-text,E-100-*div-text,E-150-*div-src,E-10-form-*action,E-200-form-null,E-100-null-*action,E-500-null-null");
    final DialectConfiguration dialectConfiguration = new DialectConfiguration(dialect);
    final DialectSetConfiguration dialectSetConfiguration = DialectSetConfiguration.build(Collections.singleton(dialectConfiguration));
    final AttributeDefinitions attributeDefinitions = dialectSetConfiguration.getAttributeDefinitions();
    final ElementDefinitions elementDefinitions = dialectSetConfiguration.getElementDefinitions();
    Assert.assertEquals("TH", dialect.getPrefix());
    Assert.assertEquals("[E-10-null-{th:src,data-th-src}, E-15-{div}-{th:src,data-th-src}, E-20-null-{th:src,data-th-src}]", attributeDefinitions.forHTMLName("th:src").getAssociatedProcessors().toString());
    Assert.assertEquals("[E-1-{th:form,th-form}-{action}, E-10-null-{action}]", attributeDefinitions.forHTMLName("action").getAssociatedProcessors().toString());
    Assert.assertEquals("[E-20-{th:form,th-form}-null, E-50-null-null]", elementDefinitions.forHTMLName("th", "form").getAssociatedProcessors().toString());
    Assert.assertEquals("[]", attributeDefinitions.forHTMLName("th", "utext").getAssociatedProcessors().toString());
    Assert.assertEquals("[E-50-null-null]", elementDefinitions.forHTMLName("p").getAssociatedProcessors().toString());
    Assert.assertEquals("[]", attributeDefinitions.forXMLName("th:src").getAssociatedProcessors().toString());
    Assert.assertEquals("[E-100-null-{TH:src}, E-150-{div}-{TH:src}, E-200-null-{TH:src}]", attributeDefinitions.forXMLName("TH:src").getAssociatedProcessors().toString());
    Assert.assertEquals("[E-10-{TH:form}-{action}, E-100-null-{action}]", attributeDefinitions.forXMLName("action").getAssociatedProcessors().toString());
    Assert.assertEquals("[E-200-{TH:form}-null, E-500-null-null]", elementDefinitions.forXMLName("TH", "form").getAssociatedProcessors().toString());
    Assert.assertEquals("[]", attributeDefinitions.forXMLName("th", "utext").getAssociatedProcessors().toString());
    Assert.assertEquals("[]", attributeDefinitions.forXMLName("TH", "utext").getAssociatedProcessors().toString());
    Assert.assertEquals("[E-500-null-null]", elementDefinitions.forXMLName("p").getAssociatedProcessors().toString());
}
Also used : ProcessorAggregationTestDialect(org.thymeleaf.engine.ProcessorAggregationTestDialect) AttributeDefinitions(org.thymeleaf.engine.AttributeDefinitions) ElementDefinitions(org.thymeleaf.engine.ElementDefinitions) Test(org.junit.Test)

Example 4 with ProcessorAggregationTestDialect

use of org.thymeleaf.engine.ProcessorAggregationTestDialect in project thymeleaf-tests by thymeleaf.

the class DialectSetConfigurationTest method testProcessorComputation04.

@Test
public void testProcessorComputation04() {
    final ProcessorAggregationTestDialect dialect = ProcessorAggregationTestDialect.buildDialect("standard", "TH", "N-ELEMENT-20-null-src, N-ELEMENT-10-null-src,N-ELEMENT-20-null-href,N-ELEMENT-20-null-text,N-ELEMENT-10-null-text,N-ELEMENT-10-*div-text,N-ELEMENT-15-*div-src,N-ELEMENT-1-form-*action,N-ELEMENT-20-form-null,N-ELEMENT-10-null-*action,N-ELEMENT-50-null-null", "N-ELEMENT-200-null-src, N-ELEMENT-100-null-src,N-ELEMENT-200-null-href,N-ELEMENT-200-null-text,N-ELEMENT-100-null-text,N-ELEMENT-100-*div-text,N-ELEMENT-150-*div-src,N-ELEMENT-10-form-*action,N-ELEMENT-200-form-null,N-ELEMENT-100-null-*action,N-ELEMENT-500-null-null");
    final DialectConfiguration dialectConfiguration = new DialectConfiguration(dialect);
    final DialectSetConfiguration dialectSetConfiguration = DialectSetConfiguration.build(Collections.singleton(dialectConfiguration));
    final AttributeDefinitions attributeDefinitions = dialectSetConfiguration.getAttributeDefinitions();
    final ElementDefinitions elementDefinitions = dialectSetConfiguration.getElementDefinitions();
    Assert.assertEquals("TH", dialect.getPrefix());
    Assert.assertEquals("[N-ELEMENT-10-null-{th:src,data-th-src}, N-ELEMENT-15-{div}-{th:src,data-th-src}, N-ELEMENT-20-null-{th:src,data-th-src}]", attributeDefinitions.forHTMLName("th:src").getAssociatedProcessors().toString());
    Assert.assertEquals("[N-ELEMENT-1-{th:form,th-form}-{action}, N-ELEMENT-10-null-{action}]", attributeDefinitions.forHTMLName("action").getAssociatedProcessors().toString());
    Assert.assertEquals("[N-ELEMENT-20-{th:form,th-form}-null, N-ELEMENT-50-null-null]", elementDefinitions.forHTMLName("th", "form").getAssociatedProcessors().toString());
    Assert.assertEquals("[]", attributeDefinitions.forHTMLName("th", "utext").getAssociatedProcessors().toString());
    Assert.assertEquals("[N-ELEMENT-50-null-null]", elementDefinitions.forHTMLName("p").getAssociatedProcessors().toString());
    Assert.assertEquals("[]", attributeDefinitions.forXMLName("th:src").getAssociatedProcessors().toString());
    Assert.assertEquals("[N-ELEMENT-100-null-{TH:src}, N-ELEMENT-150-{div}-{TH:src}, N-ELEMENT-200-null-{TH:src}]", attributeDefinitions.forXMLName("TH:src").getAssociatedProcessors().toString());
    Assert.assertEquals("[N-ELEMENT-10-{TH:form}-{action}, N-ELEMENT-100-null-{action}]", attributeDefinitions.forXMLName("action").getAssociatedProcessors().toString());
    Assert.assertEquals("[N-ELEMENT-200-{TH:form}-null, N-ELEMENT-500-null-null]", elementDefinitions.forXMLName("TH", "form").getAssociatedProcessors().toString());
    Assert.assertEquals("[]", attributeDefinitions.forXMLName("th", "utext").getAssociatedProcessors().toString());
    Assert.assertEquals("[]", attributeDefinitions.forXMLName("TH", "utext").getAssociatedProcessors().toString());
    Assert.assertEquals("[N-ELEMENT-500-null-null]", elementDefinitions.forXMLName("p").getAssociatedProcessors().toString());
}
Also used : ProcessorAggregationTestDialect(org.thymeleaf.engine.ProcessorAggregationTestDialect) AttributeDefinitions(org.thymeleaf.engine.AttributeDefinitions) ElementDefinitions(org.thymeleaf.engine.ElementDefinitions) Test(org.junit.Test)

Example 5 with ProcessorAggregationTestDialect

use of org.thymeleaf.engine.ProcessorAggregationTestDialect in project thymeleaf-tests by thymeleaf.

the class DialectSetConfigurationTest method testProcessorComputation08.

@Test
public void testProcessorComputation08() {
    final ProcessorAggregationTestDialect dialect = ProcessorAggregationTestDialect.buildDialect("standard", "TH", "CD-4-other,C-4-other,DT-4-other,PI-4-other,T-4-other,XD-4-other", "CD-40-other,C-40-other,DT-40-other,PI-40-other,T-40-other,XD-40-other");
    final DialectConfiguration dialectConfiguration = new DialectConfiguration(dialect);
    final DialectSetConfiguration dialectSetConfiguration = DialectSetConfiguration.build(Collections.singleton(dialectConfiguration));
    Assert.assertEquals("TH", dialect.getPrefix());
    Assert.assertEquals("[CD-4-other]", dialectSetConfiguration.getCDATASectionProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[C-4-other]", dialectSetConfiguration.getCommentProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[DT-4-other]", dialectSetConfiguration.getDocTypeProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[PI-4-other]", dialectSetConfiguration.getProcessingInstructionProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[T-4-other]", dialectSetConfiguration.getTextProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[XD-4-other]", dialectSetConfiguration.getXMLDeclarationProcessors(TemplateMode.HTML).toString());
    Assert.assertEquals("[CD-40-other]", dialectSetConfiguration.getCDATASectionProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[C-40-other]", dialectSetConfiguration.getCommentProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[DT-40-other]", dialectSetConfiguration.getDocTypeProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[PI-40-other]", dialectSetConfiguration.getProcessingInstructionProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[T-40-other]", dialectSetConfiguration.getTextProcessors(TemplateMode.XML).toString());
    Assert.assertEquals("[XD-40-other]", dialectSetConfiguration.getXMLDeclarationProcessors(TemplateMode.XML).toString());
}
Also used : ProcessorAggregationTestDialect(org.thymeleaf.engine.ProcessorAggregationTestDialect) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 ProcessorAggregationTestDialect (org.thymeleaf.engine.ProcessorAggregationTestDialect)8 AttributeDefinitions (org.thymeleaf.engine.AttributeDefinitions)4 ElementDefinitions (org.thymeleaf.engine.ElementDefinitions)4