Package org.mapfish.print.wrapper.json

Examples of org.mapfish.print.wrapper.json.PJsonObject


    @Test
    @DirtiesContext
    public void testExecute() throws Exception {
        Configuration config = configurationFactory.getConfig(getFile(BASE_DIR + "config.yaml"));
        PJsonObject requestData = loadJsonRequestData();

        final AbstractJasperReportOutputFormat format = (AbstractJasperReportOutputFormat) this.outputFormat.get("pngOutputFormat");
        testPrint(config, requestData, "default-aoi", format);

        getAreaOfInterest(requestData).put("display", "CLIP");
View Full Code Here


    private JSONObject getAreaOfInterest(PJsonObject requestData) throws JSONException {
        return getMapAttributes(requestData).getJSONObject("areaOfInterest");
    }

    private JSONObject getPagingAttributes(PJsonObject requestData) throws JSONException {
        final PJsonObject attributes = requestData.getJSONObject("attributes");
        JSONObject paging = attributes.getInternalObj().optJSONObject("paging");
        if (paging == null) {
            paging = new JSONObject();
            attributes.getInternalObj().put("paging", paging);
        }
        return paging;
    }
View Full Code Here

        final MockHttpServletRequest servletCreateRequest = new MockHttpServletRequest();
        final MockHttpServletResponse servletCreateResponse = new MockHttpServletResponse();

        String requestData = loadRequestDataAsString();
        servlet.createReport("docx", requestData, servletCreateRequest, servletCreateResponse);
        final PJsonObject createResponseJson = parseJSONObjectFromString(servletCreateResponse.getContentAsString());
        assertTrue(createResponseJson.has(MapPrinterServlet.JSON_PRINT_JOB_REF));
        assertEquals(HttpStatus.OK.value(), servletCreateResponse.getStatus());

        String ref = createResponseJson.getString(MapPrinterServlet.JSON_PRINT_JOB_REF);

        final String atHostRefSegment = "@" + this.servletInfo.getServletId();
        assertTrue(ref.endsWith(atHostRefSegment));
        assertTrue(ref.indexOf(atHostRefSegment) > 0);
        waitForFailure(ref);
View Full Code Here

        }
        return paging;
    }

    private JSONObject getMapAttributes(PJsonObject requestData) throws JSONException {
        final PJsonObject attributes = requestData.getJSONObject("attributes");
        return attributes.getInternalObj().optJSONObject("map");
    }
View Full Code Here

    public void testCreatePointSymbolizerExternalGraphic() throws Exception {

        JSONObject style = new JSONObject();
        style.put("externalGraphic", "mark.png");

        PointSymbolizer symbolizer = helper.createPointSymbolizer(new PJsonObject(style, null));
        assertNotNull(symbolizer);
        transformer.transform(symbolizer); // assert it can be converted to SLD

        final Graphic graphic = symbolizer.getGraphic();
        assertNotNull(graphic);
View Full Code Here

        style.put("strokeLinecap", lineCap);
        style.put("graphicOpacity", 0.4);
        style.put("pointRadius", 5);
        style.put("rotation", 90);

        final PointSymbolizer symbolizer = helper.createPointSymbolizer(new PJsonObject(style, null));
        assertNotNull(symbolizer);

        transformer.transform(symbolizer); // verify it can be encoded without exceptions

        final Graphic graphic = symbolizer.getGraphic();
View Full Code Here

        setUpConfigFiles();

        final MockHttpServletRequest servletCreateRequest = new MockHttpServletRequest();
        final MockHttpServletResponse servletCreateResponse = new MockHttpServletResponse();

        final PJsonObject requestJson = parseJSONObjectFromFile(MapPrinterServletTest.class, "requestData.json");
        requestJson.getInternalObj().remove("outputFilename");

        this.servlet.createReportAndGetNoAppId("png", requestJson.getInternalObj().toString(2), false, servletCreateRequest, servletCreateResponse);
        assertEquals(HttpStatus.OK.value(), servletCreateResponse.getStatus());

        assertCorrectResponse(servletCreateResponse, "config_test_outputname-");

        requestJson.getInternalObj().put("layout", "WithOutputName");

        this.servlet.createReportAndGetNoAppId("png", requestJson.getInternalObj().toString(2), false, servletCreateRequest, servletCreateResponse);
        assertEquals(HttpStatus.OK.value(), servletCreateResponse.getStatus());

        assertCorrectResponse(servletCreateResponse, "template_test_outputname-");
    }
View Full Code Here

        style.put("strokeOpacity", 0.2);
        style.put("strokeWidth", 2);
        style.put("strokeDashstyle", "5 2");
        style.put("strokeLinecap", "round");

        final PolygonSymbolizer symbolizer = helper.createPolygonSymbolizer(new PJsonObject(style, null));
        assertNotNull(symbolizer);

        transformer.transform(symbolizer); // verify it converts to xml correctly

        assertStroke(0.2, "round", symbolizer.getStroke(), "#FFFFFF", new float[]{5f, 2f}, 2.0);
View Full Code Here

        style.put("strokeOpacity", 0.2);
        style.put("strokeWidth", 2);
        style.put("strokeDashstyle", "5 2");
        style.put("strokeLinecap", "round");

        LineSymbolizer symbolizer = helper.createLineSymbolizer(new PJsonObject(style, null));
        assertNotNull(symbolizer);

        transformer.transform(symbolizer); // verify it converts to xml correctly

        assertStroke(0.2, "round", symbolizer.getStroke(), "#FFFFFF", new float[]{5f, 2f}, 2.0);
View Full Code Here

        style.put("labelAlign", "cm");
        style.put("haloColor", haloColor);
        style.put("haloOpacity", "0.7");
        style.put("haloRadius", haloRadius);

        final PJsonObject pStyle = new PJsonObject(style, null);
        TextSymbolizer symbolizer = helper.createTextSymbolizer(pStyle);
        assertNotNull(symbolizer);

        transformer.transform(symbolizer)// test that it can be written to xml correctly
View Full Code Here

TOP

Related Classes of org.mapfish.print.wrapper.json.PJsonObject

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.