/** * Test of getJsonDataSource method, of class Db. */ @Test public void testGetJsonDataSource() throws Exception { System.out.println("getJsonDataSource"); Config config = new Config(); config.dbType = DsType.json; config.dataFile = new File("target/test-classes/contacts.json"); config.jsonQuery = "contacts.person"; Db instance = new Db(); JsonDataSource jsonDataSource = instance.getJsonDataSource(config); assertTrue(jsonDataSource.next()); assertEquals(jsonDataSource.getClass().getCanonicalName(), "net.sf.jasperreports.engine.data.JsonDataSource"); }
@Override protected JsonDataSource getJsonDataInstance(InputStream jsonInputStream) throws JRException { return new JsonDataSource(jsonInputStream, getQueryString()); }
@Override protected JsonDataSource getJsonDataInstance(String jsonSource) throws JRException { return new JsonDataSource(getJasperReportsContext(), jsonSource, getQueryString()); }
@Override protected RewindableDataSourceProvider<JsonDataSource> getJsonDataProviderInstance(String source, TextDataSourceAttributes textAttributes) { return new JsonDataSourceProvider(getJasperReportsContext(), source, getQueryString(), textAttributes); }