Package org.mapfish.print.config

Examples of org.mapfish.print.config.Configuration


    @Test
    @DirtiesContext
    public void testParameterValidation_WrongType() throws Exception {
        configurationFactory.setDoValidation(false);
        final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config-map-wrong-type.yaml"));
        PJsonObject requestData = loadJsonRequestData();

        final AbstractJasperReportOutputFormat format = (AbstractJasperReportOutputFormat) this.outputFormat.get("pngOutputFormat");
        try {
            format.getJasperPrint(requestData, config,
View Full Code Here


    @Test
    @DirtiesContext
    public void testParameterValidation_MissingParameter() throws Exception {
        configurationFactory.setDoValidation(false);
        final Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config-missing-map.yaml"));
        PJsonObject requestData = loadJsonRequestData();

        final AbstractJasperReportOutputFormat format = (AbstractJasperReportOutputFormat) this.outputFormat.get("pngOutputFormat");
        try {
            format.getJasperPrint(requestData, config,
View Full Code Here

    @Test
    @DirtiesContext
    public void testFieldValidation_WrongType() throws Exception {
        configurationFactory.setDoValidation(false);
        final Configuration config = configurationFactory.getConfig(getFile(TABLE_BASE_DIR + "config.yaml"));
        config.getTemplate("main").setReportTemplate("simpleReport-wrong-field-type.jrxml");
        PJsonObject requestData = loadTableJsonRequestData();

        final AbstractJasperReportOutputFormat format = (AbstractJasperReportOutputFormat) this.outputFormat.get("pngOutputFormat");
        try {
            format.getJasperPrint(requestData, config,
View Full Code Here

    public void testNoDefaults() throws Exception {
        configurationFactory.setDoValidation(false);

        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

        configurationFactory.setDoValidation(false);
        final JSONObject obj = new JSONObject();
        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

        configurationFactory.setDoValidation(false);
        final JSONObject obj = new JSONObject();
        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

    public void testValidate() throws Exception {
        final HttpProxy httpProxy = new HttpProxy();

        List<Throwable> errors = Lists.newArrayList();

        Configuration configuration = new Configuration();
        httpProxy.validate(errors, configuration);
        assertEquals(1, errors.size());

        httpProxy.setHost(LOCALHOST);
        httpProxy.setPort(PROXY_PORT);
View Full Code Here

    static void assertCorrectResponse(ConfigurationFactory configurationFactory, MfClientHttpRequestFactoryImpl requestFactory,
                                             HttpCredential httpCredential, String expected, String target, String path) throws Exception {
        final File configFile = AbstractMapfishSpringTest.getFile(HttpProxyTest.class, "proxy/config.yaml");
        configurationFactory.setDoValidation(false);
        final Configuration config = configurationFactory.getConfig(configFile);
        final CertificateStore certificateStore = new CertificateStore();
        certificateStore.setConfiguration(config);
        certificateStore.setPassword("password");
        certificateStore.setUri(getKeystoreFile().toURI());

        config.setCertificateStore(certificateStore);
        if (httpCredential instanceof HttpProxy) {
            config.setProxies(Collections.singletonList((HttpProxy)httpCredential));
        } else {
            config.setCredentials(Collections.singletonList(httpCredential));
        }

        ConfigFileResolvingHttpRequestFactory clientHttpRequestFactory = new ConfigFileResolvingHttpRequestFactory(requestFactory,
                config);
View Full Code Here

    }

    @Test
    public void testValidate() throws Exception {
        List<Throwable> errors = Lists.newArrayList();
        Configuration configuration = new Configuration();
        createAttribute().validate(errors, configuration);

        assertTrue(errors.toString(), errors.isEmpty());
    }
View Full Code Here

    @Autowired
    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);

        PJsonObject requestData = loadJsonRequestData();
        OutputStream outputStream = new ByteArrayOutputStream();
        OutputFormat format = this.outputFormat.get("pdfOutputFormat");
        format.print(requestData, config,
View Full Code Here

TOP

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

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.