@Test(expected = RDFHandlerException.class) public void throwsRDFHandlerExceptionWhenHandlerFails() throws Exception { RDFHandler rdfHandler = Mockito.mock(RDFHandler.class); doThrow(new RDFHandlerException("")).when(rdfHandler).handleStatement(any(Statement.class)); Collection<Statement> statements = ImmutableList.of( createHttpStatement("s1", "p", "o", "g1") ); DataSourceConfig dataSource = createFileDataSource(statements, EnumSerializationFormat.RDF_XML); RdfFileLoader loader = new RdfFileLoader(dataSource, LDFTConfigConstants.DEFAULT_FILE_PARSER_CONFIG); loader.read((rdfHandler)); }
public void read(RDFHandler rdfHandler) throws LDFusionToolException, RDFHandlerException { String label = dataSourceConfig.getName() != null ? dataSourceConfig.getName() : dataSourceConfig.getType().toString(); String displayPath = paramReader.getStringValue(ConfigParameters.DATA_SOURCE_FILE_PATH, ""); try { loadFile(label, rdfHandler); } catch (IOException e) { throw new LDFusionToolApplicationException(LDFusionToolErrorCodes.RDF_FILE_LOADER_READ, "I/O Error while reading input file " + displayPath, e); } catch (RDFParseException e) { throw new LDFusionToolApplicationException(LDFusionToolErrorCodes.RDF_FILE_LOADER_PARSE, "Error parsing input file " + displayPath, e); } }
RdfFileLoader { public void read(RDFHandler rdfHandler) throws LDFusionToolException, RDFHandlerException { String label = dataSourceConfig.getName() != null ? dataSourceConfig.getName() : dataSourceConfig.getType().toString(); String displayPath = paramReader.getStringValue(ConfigParameters.DATA_SOURCE_FILE_PATH, ""); try { loadFile(label, rdfHandler); } catch (IOException e) { throw new LDFusionToolApplicationException(LDFusionToolErrorCodes.RDF_FILE_LOADER_READ, "I/O Error while reading input file " + displayPath, e); } catch (RDFParseException e) { throw new LDFusionToolApplicationException(LDFusionToolErrorCodes.RDF_FILE_LOADER_PARSE, "Error parsing input file " + displayPath, e); } } }
RdfFileLoader { public void read(RDFHandler rdfHandler) throws LDFusionToolException, RDFHandlerException { String label = dataSourceConfig.getName() != null ? dataSourceConfig.getName() : dataSourceConfig.getType().toString(); String displayPath = paramReader.getStringValue(ConfigParameters.DATA_SOURCE_FILE_PATH, ""); try { loadFile(label, rdfHandler); } catch (IOException e) { throw new LDFusionToolApplicationException(LDFusionToolErrorCodes.RDF_FILE_LOADER_READ, "I/O Error while reading input file " + displayPath, e); } catch (RDFParseException e) { throw new LDFusionToolApplicationException(LDFusionToolErrorCodes.RDF_FILE_LOADER_PARSE, "Error parsing input file " + displayPath, e); } } RdfFileLoader(SourceConfig sourceConfig, ParserConfig parserConfig); }
RdfFileLoader { public void read(RDFHandler rdfHandler) throws LDFusionToolException, RDFHandlerException { String label = dataSourceConfig.getName() != null ? dataSourceConfig.getName() : dataSourceConfig.getType().toString(); String displayPath = paramReader.getStringValue(ConfigParameters.DATA_SOURCE_FILE_PATH, ""); try { loadFile(label, rdfHandler); } catch (IOException e) { throw new LDFusionToolApplicationException(LDFusionToolErrorCodes.RDF_FILE_LOADER_READ, "I/O Error while reading input file " + displayPath, e); } catch (RDFParseException e) { throw new LDFusionToolApplicationException(LDFusionToolErrorCodes.RDF_FILE_LOADER_PARSE, "Error parsing input file " + displayPath, e); } } RdfFileLoader(SourceConfig sourceConfig, ParserConfig parserConfig); void read(RDFHandler rdfHandler); }
RdfFileLoader { public void read(RDFHandler rdfHandler) throws LDFusionToolException, RDFHandlerException { String label = dataSourceConfig.getName() != null ? dataSourceConfig.getName() : dataSourceConfig.getType().toString(); String displayPath = paramReader.getStringValue(ConfigParameters.DATA_SOURCE_FILE_PATH, ""); try { loadFile(label, rdfHandler); } catch (IOException e) { throw new LDFusionToolApplicationException(LDFusionToolErrorCodes.RDF_FILE_LOADER_READ, "I/O Error while reading input file " + displayPath, e); } catch (RDFParseException e) { throw new LDFusionToolApplicationException(LDFusionToolErrorCodes.RDF_FILE_LOADER_PARSE, "Error parsing input file " + displayPath, e); } } RdfFileLoader(SourceConfig sourceConfig, ParserConfig parserConfig); void read(RDFHandler rdfHandler);  }