@Test(expected = ReferentialException.class) @RunWithCustomExecutor public void testFormatXMLKO() throws FileNotFoundException, ReferentialException { formatFile.checkFile(new FileInputStream(PropertiesUtils.findFile(FILE_TO_TEST_KO))); }
public List<FileFormatModel> checkFile(InputStream xmlPronom) throws ReferentialException { ParametersChecker.checkParameter("Pronom file is a mandatory parameter", xmlPronom); File xmlPronomFile = null; try { xmlPronomFile = PropertiesUtils.fileFromTmpFolder( VitamThreadUtils.getVitamSession().getRequestId() + ".xml"); FileUtils.copyInputStreamToFile(xmlPronom, xmlPronomFile); return PronomParser.getPronom(xmlPronomFile); } catch (IOException e) { throw new ReferentialException(e); } finally { StreamUtils.closeSilently(xmlPronom); FileUtils.deleteQuietly(xmlPronomFile); } }
ReferentialFormatFileImpl implements ReferentialFile<FileFormat>, VitamAutoCloseable { public List<FileFormatModel> checkFile(InputStream xmlPronom) throws ReferentialException { ParametersChecker.checkParameter("Pronom file is a mandatory parameter", xmlPronom); File xmlPronomFile = null; try { xmlPronomFile = PropertiesUtils.fileFromTmpFolder( VitamThreadUtils.getVitamSession().getRequestId() + ".xml"); FileUtils.copyInputStreamToFile(xmlPronom, xmlPronomFile); return PronomParser.getPronom(xmlPronomFile); } catch (IOException e) { throw new ReferentialException(e); } finally { StreamUtils.closeSilently(xmlPronom); FileUtils.deleteQuietly(xmlPronomFile); } } }
ReferentialFormatFileImpl implements ReferentialFile<FileFormat>, VitamAutoCloseable { public List<FileFormatModel> checkFile(InputStream xmlPronom) throws ReferentialException { ParametersChecker.checkParameter("Pronom file is a mandatory parameter", xmlPronom); File xmlPronomFile = null; try { xmlPronomFile = PropertiesUtils.fileFromTmpFolder( VitamThreadUtils.getVitamSession().getRequestId() + ".xml"); FileUtils.copyInputStreamToFile(xmlPronom, xmlPronomFile); return PronomParser.getPronom(xmlPronomFile); } catch (IOException e) { throw new ReferentialException(e); } finally { StreamUtils.closeSilently(xmlPronom); FileUtils.deleteQuietly(xmlPronomFile); } } ReferentialFormatFileImpl(MongoDbAccessAdminImpl dbConfiguration, VitamCounterService vitamCounterService); @VisibleForTesting  ReferentialFormatFileImpl(MongoDbAccessAdminImpl dbConfiguration,
        FunctionalBackupService backupService, LogbookOperationsClient logbookOperationsClient); }
ReferentialFormatFileImpl implements ReferentialFile<FileFormat>, VitamAutoCloseable { public List<FileFormatModel> checkFile(InputStream xmlPronom) throws ReferentialException { ParametersChecker.checkParameter("Pronom file is a mandatory parameter", xmlPronom); File xmlPronomFile = null; try { xmlPronomFile = PropertiesUtils.fileFromTmpFolder( VitamThreadUtils.getVitamSession().getRequestId() + ".xml"); FileUtils.copyInputStreamToFile(xmlPronom, xmlPronomFile); return PronomParser.getPronom(xmlPronomFile); } catch (IOException e) { throw new ReferentialException(e); } finally { StreamUtils.closeSilently(xmlPronom); FileUtils.deleteQuietly(xmlPronomFile); } } ReferentialFormatFileImpl(MongoDbAccessAdminImpl dbConfiguration, VitamCounterService vitamCounterService); @VisibleForTesting  ReferentialFormatFileImpl(MongoDbAccessAdminImpl dbConfiguration,
        FunctionalBackupService backupService, LogbookOperationsClient logbookOperationsClient); @Override void importFile(InputStream xmlPronom, String filename); List<FileFormatModel> checkFile(InputStream xmlPronom); @Override FileFormat findDocumentById(String id); @Override RequestResponseOK<FileFormat> findDocuments(JsonNode select); @Override void close(); }
ReferentialFormatFileImpl implements ReferentialFile<FileFormat>, VitamAutoCloseable { public List<FileFormatModel> checkFile(InputStream xmlPronom) throws ReferentialException { ParametersChecker.checkParameter("Pronom file is a mandatory parameter", xmlPronom); File xmlPronomFile = null; try { xmlPronomFile = PropertiesUtils.fileFromTmpFolder( VitamThreadUtils.getVitamSession().getRequestId() + ".xml"); FileUtils.copyInputStreamToFile(xmlPronom, xmlPronomFile); return PronomParser.getPronom(xmlPronomFile); } catch (IOException e) { throw new ReferentialException(e); } finally { StreamUtils.closeSilently(xmlPronom); FileUtils.deleteQuietly(xmlPronomFile); } } ReferentialFormatFileImpl(MongoDbAccessAdminImpl dbConfiguration, VitamCounterService vitamCounterService); @VisibleForTesting  ReferentialFormatFileImpl(MongoDbAccessAdminImpl dbConfiguration,
        FunctionalBackupService backupService, LogbookOperationsClient logbookOperationsClient); @Override void importFile(InputStream xmlPronom, String filename); List<FileFormatModel> checkFile(InputStream xmlPronom); @Override FileFormat findDocumentById(String id); @Override RequestResponseOK<FileFormat> findDocuments(JsonNode select); @Override void close(); static final String FILE_FORMAT_REPORT; }