@Test @Ignore("Depends on karttamoottori.maanmittauslaitos.fi, doesn't test anything") public void testPDF() throws ServiceException, IOException, NoSuchAuthorityCodeException, FactoryException { PrintRequest request = new PrintRequest(); request.setFormat(PrintFormat.PDF); request.setEast(500000); request.setNorth(6750000); request.setSrsName("EPSG:3067"); request.setTitle("Hello world!"); request.setWidth(PDF.mmToPx(210 - 20)); request.setHeight(PDF.mmToPx(297 - 30)); request.setResolution(2); 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: taustakartta.setStyle("default"); OskariLayer kiinteistotunnukset = new OskariLayer(); kiinteistotunnukset.setId(2); kiinteistotunnukset.setType(OskariLayer.TYPE_WMTS); kiinteistotunnukset.setVersion("1.0.0"); kiinteistotunnukset.setName("kiinteistotunnukset"); kiinteistotunnukset.setUrl("https: kiinteistotunnukset.setStyle("default"); PrintLayer bg = new PrintLayer(0); bg.setOskariLayer(taustakartta); bg.setOpacity(100); PrintLayer fg = new PrintLayer(1); fg.setOskariLayer(kiinteistotunnukset); fg.setOpacity(30); request.setLayers(Arrays.asList(bg, fg)); 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); String dataFg = CapabilitiesCacheService.getFromService(fg.getUrl(), fg.getType(), fg.getUsername(), fg.getPassword(), fg.getVersion()); OskariLayerCapabilities answerFg = new OskariLayerCapabilities(1L, fg.getUrl(), fg.getType(), fg.getVersion(), dataFg, null, null); CapabilitiesCacheService mock = Mockito.mock(CapabilitiesCacheService.class); Mockito.when(mock.getCapabilities(bg.getUrl(), bg.getType(), bg.getVersion(), bg.getUsername(), bg.getPassword())).thenReturn(answerBg); Mockito.when(mock.getCapabilities(fg.getUrl(), fg.getType(), fg.getVersion(), fg.getUsername(), fg.getPassword())).thenReturn(answerFg); 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); }
public void getPDF(PrintRequest request, PDDocument doc) throws IOException, ServiceException { PDF.getPDF(request, wmtsCapsCache, featureClient, doc); }
PrintService { public void getPDF(PrintRequest request, PDDocument doc) throws IOException, ServiceException { PDF.getPDF(request, wmtsCapsCache, featureClient, doc); } }
PrintService { public void getPDF(PrintRequest request, PDDocument doc) throws IOException, ServiceException { PDF.getPDF(request, wmtsCapsCache, featureClient, doc); } PrintService();  PrintService(OskariFeatureClient featureClient);  PrintService(WMTSCapabilitiesCache wmtsCapsCache);  PrintService(WMTSCapabilitiesCache wmtsCapsCache, OskariFeatureClient featureClient); }
PrintService { public void getPDF(PrintRequest request, PDDocument doc) throws IOException, ServiceException { PDF.getPDF(request, wmtsCapsCache, featureClient, doc); } PrintService();  PrintService(OskariFeatureClient featureClient);  PrintService(WMTSCapabilitiesCache wmtsCapsCache);  PrintService(WMTSCapabilitiesCache wmtsCapsCache, OskariFeatureClient featureClient); BufferedImage getPNG(PrintRequest request); void getPDF(PrintRequest request, PDDocument doc); }
PrintService { public void getPDF(PrintRequest request, PDDocument doc) throws IOException, ServiceException { PDF.getPDF(request, wmtsCapsCache, featureClient, doc); } PrintService();  PrintService(OskariFeatureClient featureClient);  PrintService(WMTSCapabilitiesCache wmtsCapsCache);  PrintService(WMTSCapabilitiesCache wmtsCapsCache, OskariFeatureClient featureClient); BufferedImage getPNG(PrintRequest request); void getPDF(PrintRequest request, PDDocument doc);  }