@Test public void testExtractRecordData() throws Exception { final EtmPoint point = mock(EtmPoint.class); mockStatic(PointFactory.class); when(PointFactory.getPoint(RecordDataExtractor.class, "extractRecordData")).thenReturn(point); mockStatic(AuthHelper.class); when(AuthHelper.fromCurrentSubject()).thenReturn(ftpProduct); mockStatic(SftpDownloader.class); when(SftpDownloader.createDownloader(ftpProduct)).thenReturn(downloader); final Field i2Field = mock(Field.class); when(i2Field.getName()).thenReturn("I2_FIELD"); when(i2Field.getType()).thenReturn(DataType.I2); final Structure structure = mock(Structure.class); when(structure.getFields()).thenReturn(Arrays.asList(i2Field)); final Record record = mock(Record.class); when(record.getName()).thenReturn("REPLY"); when(record.getStructure()).thenReturn(structure); final RecordDataExtractor extractor = new RecordDataExtractor(record, environment); FileUtils.writeLines(extractor.getLocalDataLocation(), Arrays.asList("{\"REPLY\":{\"I2_FIELD\":123}}")); extractor.extractRecordData(); verify(record, times(1)).setI2("I2_FIELD", (short) 123); verify(point).collect(); }
public void extractRecordData() throws IOException { final EtmPoint point = PointFactory.getPoint(getClass(), "extractRecordData"); try { final Downloader downloader = SftpDownloader.createDownloader(AuthHelper.fromCurrentSubject()); final Collection<FileRequest> requests = Collections .singleton(FileRequestFactory.create(getRemoteDataLocation(), getLocalDataLocation().toURI())); downloader.download(requests); RecordWriter.putFromJson(retrieveJsonData(), getRecord()); } finally { point.collect(); } }
RecordDataExtractor { public void extractRecordData() throws IOException { final EtmPoint point = PointFactory.getPoint(getClass(), "extractRecordData"); try { final Downloader downloader = SftpDownloader.createDownloader(AuthHelper.fromCurrentSubject()); final Collection<FileRequest> requests = Collections .singleton(FileRequestFactory.create(getRemoteDataLocation(), getLocalDataLocation().toURI())); downloader.download(requests); RecordWriter.putFromJson(retrieveJsonData(), getRecord()); } finally { point.collect(); } } }
RecordDataExtractor { public void extractRecordData() throws IOException { final EtmPoint point = PointFactory.getPoint(getClass(), "extractRecordData"); try { final Downloader downloader = SftpDownloader.createDownloader(AuthHelper.fromCurrentSubject()); final Collection<FileRequest> requests = Collections .singleton(FileRequestFactory.create(getRemoteDataLocation(), getLocalDataLocation().toURI())); downloader.download(requests); RecordWriter.putFromJson(retrieveJsonData(), getRecord()); } finally { point.collect(); } } RecordDataExtractor(final Record record);  RecordDataExtractor(final Record record, final Environment environment); }
RecordDataExtractor { public void extractRecordData() throws IOException { final EtmPoint point = PointFactory.getPoint(getClass(), "extractRecordData"); try { final Downloader downloader = SftpDownloader.createDownloader(AuthHelper.fromCurrentSubject()); final Collection<FileRequest> requests = Collections .singleton(FileRequestFactory.create(getRemoteDataLocation(), getLocalDataLocation().toURI())); downloader.download(requests); RecordWriter.putFromJson(retrieveJsonData(), getRecord()); } finally { point.collect(); } } RecordDataExtractor(final Record record);  RecordDataExtractor(final Record record, final Environment environment); void extractRecordData(); Collection<String> getExtractionCommands(); Record getRecord(); }
RecordDataExtractor { public void extractRecordData() throws IOException { final EtmPoint point = PointFactory.getPoint(getClass(), "extractRecordData"); try { final Downloader downloader = SftpDownloader.createDownloader(AuthHelper.fromCurrentSubject()); final Collection<FileRequest> requests = Collections .singleton(FileRequestFactory.create(getRemoteDataLocation(), getLocalDataLocation().toURI())); downloader.download(requests); RecordWriter.putFromJson(retrieveJsonData(), getRecord()); } finally { point.collect(); } } RecordDataExtractor(final Record record);  RecordDataExtractor(final Record record, final Environment environment); void extractRecordData(); Collection<String> getExtractionCommands(); Record getRecord();  }