Package org.mapfish.print.config

Examples of org.mapfish.print.config.Template


                        }
                    }
                }
        );
        final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config.yaml"));
        final Template template = config.getTemplate("main");
        PJsonObject requestData = loadJsonRequestData();
        Values values = new Values(requestData, template, this.parser, getTaskDirectory(), this.requestFactory, new File("."));
        template.getProcessorGraph().createTask(values).invoke();

        @SuppressWarnings("unchecked")
        List<URI> layerGraphics = (List<URI>) values.getObject("overviewMapLayerGraphics", List.class);
        assertEquals(3, layerGraphics.size());
View Full Code Here


                        }
                    }
                }
        );
        final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config.yaml"));
        final Template template = config.getTemplate("main");

        PJsonObject requestData = loadJsonRequestData();

        Values values = new Values(requestData, template, this.parser, getTaskDirectory(), this.requestFactory, new File("."));
        template.getProcessorGraph().createTask(values).invoke();

        @SuppressWarnings("unchecked")
        List<URI> layerGraphics = (List<URI>) values.getObject("layerGraphics", List.class);
        assertEquals(2, layerGraphics.size());
View Full Code Here

    @SuppressWarnings("unchecked")
    @Test(expected = IllegalArgumentException.class)
    public void testMaxDpi() throws Exception {
        final File configFile = getFile(CreateMapProcessorFlexibleScaleBBoxGeoJsonTest.class, BASE_DIR + "config.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");

        final PJsonObject pJsonObject = loadJsonRequestData();
        final PJsonObject attributesJson = pJsonObject.getJSONObject("attributes");
        final JSONObject mapDef = attributesJson.getJSONObject("mapDef").getInternalObj();
        mapDef.remove("dpi");
        mapDef.accumulate("dpi", 1000);

        final ReflectiveAttribute<MapAttribute.MapAttributeValues> mapAttribute = (ReflectiveAttribute<MapAttribute
                        .MapAttributeValues>) template.getAttributes().get("mapDef");

        final MapAttribute.MapAttributeValues value = mapAttribute.createValue(template);
        parser.parse(true, attributesJson.getJSONObject("mapDef"), value);
    }
View Full Code Here

    @Test
    public void testDpiSuggestions() throws Exception {
        final File configFile = getFile(MapAttributeTest.class, "map_attributes/config-json-dpi.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");

        final MapAttribute mapAttribute = (MapAttribute) template.getAttributes().get("mapDef");
        List<Throwable> errors = Lists.newArrayList();
        mapAttribute.validate(errors, config);

        assertFalse(errors.isEmpty());
    }
View Full Code Here

    @Test
    public void testAttributesFromJson() throws Exception {
        final File configFile = getFile(MapAttributeTest.class, "map_attributes/config-json.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");
        final PJsonObject pJsonObject = parseJSONObjectFromFile(MapAttributeTest.class, "map_attributes/requestData-json.json");
        final Values values = new Values(pJsonObject, template, new MapfishParser(), getTaskDirectory(), this.httpRequestFactory,
                new File("."));
        final MapAttribute.MapAttributeValues value = values.getObject("mapDef", MapAttribute.MapAttributeValues.class);
View Full Code Here

    @Test
    public void testAttributesFromYaml() throws Exception {
        final File configFile = getFile(MapAttributeTest.class, "map_attributes/config-yaml.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");
        final PJsonObject pJsonObject = parseJSONObjectFromFile(MapAttributeTest.class, "map_attributes/requestData-yaml.json");
        final Values values = new Values(pJsonObject, template, new MapfishParser(), getTaskDirectory(), this.httpRequestFactory, new File("."));
        final MapAttribute.MapAttributeValues value = values.getObject("mapDef", MapAttribute.MapAttributeValues.class);

        assertEquals(80.0, value.getDpi(), 0.1);
View Full Code Here

    @Test
    public void testAttributesFromBoth() throws Exception {
        final File configFile = getFile(MapAttributeTest.class, "map_attributes/config-yaml.yaml");
        final Configuration config = configurationFactory.getConfig(configFile);
        final Template template = config.getTemplate("main");
        final PJsonObject pJsonObject = parseJSONObjectFromFile(MapAttributeTest.class, "map_attributes/requestData-json.json");
        final Values values = new Values(pJsonObject, template, new MapfishParser(), getTaskDirectory(), this.httpRequestFactory, new File("."));
        final MapAttribute.MapAttributeValues value = values.getObject("mapDef", MapAttribute.MapAttributeValues.class);

        assertEquals(90.0, value.getDpi(), 0.1);
View Full Code Here

    private Map<String, OutputFormat> outputFormat;

    @Test
    public void testBasicTableProperties() throws Exception {
        final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config.yaml"));
        final Template template = config.getTemplate("main");
        PJsonObject requestData = loadJsonRequestData();
        Values values = new Values(requestData, template, parser, getTaskDirectory(), this.httpRequestFactory, new File("."));
        forkJoinPool.invoke(template.getProcessorGraph().createTask(values));

        final DataSourceAttributeValue datasource = values.getObject("datasource", DataSourceAttributeValue.class);

        assertEquals(2, datasource.attributesValues.length);
    }
View Full Code Here

        PJsonObject requestData = parseJSONObjectFromFile(ValuesTest.class, BASE_DIR + "requestData.json");

        final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config-no-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

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

        Template template = config.getTemplates().values().iterator().next();
        new Values(requestData, template, this.parser, new File("tmp"), this.httpRequestFactory, new File("."));
    }
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.