Package org.mapfish.print.config

Examples of org.mapfish.print.config.Template


        PJsonObject requestData = new PJsonObject(obj, "");
        final JSONObject atts = new JSONObject();
        obj.put("attributes", atts);
        final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config-defaults.yaml"));

        Template template = config.getTemplates().values().iterator().next();
        final Values values = new Values(requestData, template, this.parser, new File("tmp"), this.httpRequestFactory, new File("."));

        assertTrue(values.containsKey("title"));
        assertEquals("title", values.getString("title"));
        assertEquals(134, values.getInteger("count").intValue());
View Full Code Here


    @Test
    public void testPrintClientConfig() throws Exception {
        final StringWriter jsonOutput = new StringWriter();
        JSONWriter json = new JSONWriter(jsonOutput);
        Template template = Mockito.mock(Template.class);
        // verify there is no error
        json.object();
        final Attribute attribute = createAttribute();
        attribute.printClientConfig(json, template);
        json.endObject();
View Full Code Here

    private ConfigurationFactory configurationFactory;

    @Test
    public void testParseRequest() throws Exception {
        final Configuration config = configurationFactory.getConfig(getFile("datasource/config.yaml"));
        final Template template = config.getTemplates().values().iterator().next();

        final Map<String, Attribute> attributes = template.getAttributes();

        PJsonObject jsonData = parseJSONObjectFromFile(DataSourceAttributeTest.class, "datasource/requestData.json");
        final Values values = new Values();
        values.populateFromAttributes(template, parser, attributes, jsonData);
View Full Code Here

    private Map<String, OutputFormat> outputFormat;

    @Test
    public void testPdfConfigDefaults() throws Exception {
        final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config-defaults.yaml"));
        final Template rawTemplate = config.getTemplate("main");
        final PDFConfig pdfConfigSpy = Mockito.spy(rawTemplate.getPdfConfig());
        Template templateSpy = Mockito.spy(rawTemplate);
        Mockito.when(templateSpy.getPdfConfig()).thenReturn(pdfConfigSpy);

        final Map<String, Template> templates = config.getTemplates();
        templates.put("main", templateSpy);
        config.setTemplates(templates);
View Full Code Here

        MapfishMapContext mapContext = new MapfishMapContext(new BBoxMapBounds(null, 0,0,10,10), new Dimension(20,20), 0,
                72, Constants.PDF_DPI, null, true);
        configurationFactory.setDoValidation(false);
        final File configFile = getFile(StyleAttributeTest.class, "style_attributes/config.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");
        final PJsonObject pJsonObject = parseJSONObjectFromFile(StyleAttributeTest.class, "style_attributes/request.json");
        final Values values = new Values(pJsonObject, template, new MapfishParser(), this.folder.getRoot(),
                this.clientHttpRequestFactory, new File("."));
        final StyleAttribute.StylesAttributeValues value = values.getObject("styleDef", StyleAttribute.StylesAttributeValues.class);
View Full Code Here

    }

    @Test
    public void testPdfConfigValuesFromConfig() throws Exception {
        final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config-settings-in-config.yaml"));
        final Template rawTemplate = config.getTemplate("main");
        final PDFConfig pdfConfigSpy = Mockito.spy(rawTemplate.getPdfConfig());
        Template templateSpy = Mockito.spy(rawTemplate);
        Mockito.when(templateSpy.getPdfConfig()).thenReturn(pdfConfigSpy);

        final Map<String, Template> templates = config.getTemplates();
        templates.put("main", templateSpy);
        config.setTemplates(templates);
View Full Code Here

    }

    @Test
    public void testPdfConfigValuesFromTemplate() throws Exception {
        final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config-settings-in-template.yaml"));
        final Template rawTemplate = config.getTemplate("main");
        final PDFConfig pdfConfigSpy = Mockito.spy(rawTemplate.getPdfConfig());
        Template templateSpy = Mockito.spy(rawTemplate);
        Mockito.when(templateSpy.getPdfConfig()).thenReturn(pdfConfigSpy);

        final Map<String, Template> templates = config.getTemplates();
        templates.put("main", templateSpy);
        config.setTemplates(templates);
View Full Code Here

    }

    @Test
    public void testPdfConfigValuesInTemplateOverrideValuesInConfig() throws Exception {
        final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config-template-override-config.yaml"));
        final Template rawTemplate = config.getTemplate("main");
        final PDFConfig pdfConfigSpy = Mockito.spy(rawTemplate.getPdfConfig());
        Template templateSpy = Mockito.spy(rawTemplate);
        Mockito.when(templateSpy.getPdfConfig()).thenReturn(pdfConfigSpy);

        final Map<String, Template> templates = config.getTemplates();
        templates.put("main", templateSpy);
        config.setTemplates(templates);
View Full Code Here

    }
    @Test
    public void testAllPrintClientConfig() throws Exception {
        Configuration configuration = new Configuration();
        configuration.setConfigurationFile(getFile("map/map_attributes/config-yaml.yaml"));
        Template template = new Template();
        template.setConfiguration(configuration);
        for (Attribute attribute : allAttributes) {
            final String attName = "!" + attribute.getClass().getSimpleName();

            Map<String, Attribute> attMap = Maps.newHashMap();
            attMap.put(attName, attribute);
            template.setAttributes(attMap);
            if (attribute instanceof ReflectiveAttribute<?>) {
                ReflectiveAttribute<?> reflectiveAttribute = (ReflectiveAttribute<?>) attribute;

                AttributeTesting.configureAttributeForTesting(reflectiveAttribute);
            }
View Full Code Here

TOP

Related Classes of org.mapfish.print.config.Template

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.