@Test public void testNotExistingFile() { try { traceReader.read("/not/existing/file"); fail("Should throw IllegalArgumentException"); } catch (IllegalArgumentException e) { assertThat(e.getMessage()).startsWith("File not found: "); } }
public void read(String filename) { FileSystemUtil.assertFileOrResourceExists(filename); try { List<List<Span>> traces = mapper.readValue(new File(filename), new TypeReference<List<List<Span>>>() { }); LOGGER.info("Read traces: {}", traces.size()); analyzeAllTraces(traces); } catch (IOException e) { LOGGER.error("Can't read file {}", FileNameUtil.getCanonicalPath(filename), e); throw new IllegalArgumentException(e); } }
TraceReader { public void read(String filename) { FileSystemUtil.assertFileOrResourceExists(filename); try { List<List<Span>> traces = mapper.readValue(new File(filename), new TypeReference<List<List<Span>>>() { }); LOGGER.info("Read traces: {}", traces.size()); analyzeAllTraces(traces); } catch (IOException e) { LOGGER.error("Can't read file {}", FileNameUtil.getCanonicalPath(filename), e); throw new IllegalArgumentException(e); } } }
TraceReader { public void read(String filename) { FileSystemUtil.assertFileOrResourceExists(filename); try { List<List<Span>> traces = mapper.readValue(new File(filename), new TypeReference<List<List<Span>>>() { }); LOGGER.info("Read traces: {}", traces.size()); analyzeAllTraces(traces); } catch (IOException e) { LOGGER.error("Can't read file {}", FileNameUtil.getCanonicalPath(filename), e); throw new IllegalArgumentException(e); } } TraceReader(DependencyGraph dependencyGraph); }
TraceReader { public void read(String filename) { FileSystemUtil.assertFileOrResourceExists(filename); try { List<List<Span>> traces = mapper.readValue(new File(filename), new TypeReference<List<List<Span>>>() { }); LOGGER.info("Read traces: {}", traces.size()); analyzeAllTraces(traces); } catch (IOException e) { LOGGER.error("Can't read file {}", FileNameUtil.getCanonicalPath(filename), e); throw new IllegalArgumentException(e); } } TraceReader(DependencyGraph dependencyGraph); void read(String filename); }
TraceReader { public void read(String filename) { FileSystemUtil.assertFileOrResourceExists(filename); try { List<List<Span>> traces = mapper.readValue(new File(filename), new TypeReference<List<List<Span>>>() { }); LOGGER.info("Read traces: {}", traces.size()); analyzeAllTraces(traces); } catch (IOException e) { LOGGER.error("Can't read file {}", FileNameUtil.getCanonicalPath(filename), e); throw new IllegalArgumentException(e); } } TraceReader(DependencyGraph dependencyGraph); void read(String filename); static final String TYPE_SPAN; static final String SCOPE_TRACE_ENDPOINT; static final String SCOPE_TRACE_SERVICE; static final String TRACES_PARENT_KEY; static final String PLACEHOLDER_NAME; }