@Test
@Ignore("Depends on outside resources, doesn't test anything")
public void testPDFVector() throws ServiceException, IOException, NoSuchAuthorityCodeException, FactoryException, DuplicateException, JSONException {

    PropertyUtil.addProperty("oskari.native.srs", "EPSG:3067", true);
    PrintRequest request = new PrintRequest();
    request.setFormat(PrintFormat.PDF);
    request.setUser(new User());
    request.setEast(385940);
    request.setNorth(6672046);
    request.setSrsName("EPSG:3067");
    request.setTitle("Hello world!");
    request.setWidth(PDF.mmToPx(210 - 20));
    request.setHeight(PDF.mmToPx(297 - 30));
    request.setResolution(1);
    request.setShowLogo(true);
    request.setShowScale(true);
    OskariLayer taustakartta = new OskariLayer();
    taustakartta.setId(1);
    taustakartta.setName("taustakartta");
    taustakartta.setType(OskariLayer.TYPE_WMTS);
    taustakartta.setVersion("1.0.0");
    taustakartta.setUrl("https://karttamoottori.maanmittauslaitos.fi/maasto/wmts");
    taustakartta.setStyle("default");
    PrintLayer bg = new PrintLayer(0);
    bg.setOskariLayer(taustakartta);
    bg.setOpacity(100);
    OskariLayer tieviiva = new OskariLayer();
    tieviiva.setId(2);
    tieviiva.setName("tieviiva");
    tieviiva.setType(OskariLayer.TYPE_WFS);
    tieviiva.setVersion("3.0.0");
    tieviiva.setUrl("http://visukysely01.nls.fi:8080/mtkgml");
    JSONObject opt = new JSONObject("" +
            "{\"styles\":{\"StyleName\":{\"tieviiva\":{\"featureStyle\":" +
            "{\"stroke\":{\"color\":\"#ff0000\",\"width\":2,\"lineDash\": \"dot\"}}" +
            "}}}}"
    );
    tieviiva.setOptions(opt);
    PrintLayer fg = new PrintLayer(1);
    fg.setOskariLayer(tieviiva);
    fg.setOpacity(100);
    fg.setStyle("StyleName");
    OskariLayer rakennus = new OskariLayer();
    rakennus.setId(3);
    rakennus.setName("rakennus");
    rakennus.setType(OskariLayer.TYPE_WFS);
    rakennus.setVersion("3.0.0");
    rakennus.setUrl("http://visukysely01.nls.fi:8080/mtkgml");
    JSONObject opt2 = new JSONObject("" +
            "{\"styles\":{\"StyleName\":{\"rakennus\":{\"featureStyle\":" +
            "{\"fill\":{\"color\":\"#00ff00\",\"area\":{\"pattern\": 2}}}," +
            "\"stroke\":{\"area\":{\"color\":\"#0000ff\"}}}" +
            "}}}}"
    );
    rakennus.setOptions(opt2);
    PrintLayer fg2 = new PrintLayer(2);
    fg2.setOskariLayer(rakennus);
    fg2.setOpacity(50);
    fg2.setStyle("StyleName");
    request.setLayers(Arrays.asList(bg, fg, fg2));
    String dataBg = CapabilitiesCacheService.getFromService(bg.getUrl(), bg.getType(), bg.getUsername(), bg.getPassword(), bg.getVersion());
    OskariLayerCapabilities answerBg = new OskariLayerCapabilities(1L, bg.getUrl(), bg.getType(), bg.getVersion(), dataBg, null, null);
    CapabilitiesCacheService mock = Mockito.mock(CapabilitiesCacheService.class);
    Mockito.when(mock.getCapabilities(bg.getUrl(), bg.getType(), bg.getVersion(), bg.getUsername(), bg.getPassword())).thenReturn(answerBg);
    WMTSCapabilitiesCache cache = new WMTSCapabilitiesCache(mock);
    PrintService service = new PrintService(cache);
    PDDocument doc = new PDDocument();
    service.getPDF(request, doc);
    File file = File.createTempFile("print-test", ".pdf");
    doc.save(file);
    doc.close();
    Desktop.getDesktop().open(file);
}