@Test public void should_import_CodeBasePublication3() throws URISyntaxException { File file = new File(getClass().getResource("/sample-publications/codebase-v2.ser").toURI()); when(codeBaseImporter.importPublication(any(CodeBasePublication3.class))).thenReturn(true); boolean handled = publicationImporter.importPublicationFile(file); assertThat(handled, is(true)); verify(codeBaseImporter).importPublication(any(CodeBasePublication3.class)); verify(validator).validate(any()); verifyNoMoreInteractions(codeBaseImporter, invocationDataImporter, validator); }
@Override @SneakyThrows public boolean importPublicationFile(File file) { return lockTemplate.doWithLock( Lock.forPublication(file), () -> doImportPublicationFile(file), () -> { logger.info( "Processing of {} was already in progress in another transaction", file.getName()); return false; }); }
PublicationImporterImpl implements PublicationImporter { @Override @SneakyThrows public boolean importPublicationFile(File file) { return lockTemplate.doWithLock( Lock.forPublication(file), () -> doImportPublicationFile(file), () -> { logger.info( "Processing of {} was already in progress in another transaction", file.getName()); return false; }); } }
PublicationImporterImpl implements PublicationImporter { @Override @SneakyThrows public boolean importPublicationFile(File file) { return lockTemplate.doWithLock( Lock.forPublication(file), () -> doImportPublicationFile(file), () -> { logger.info( "Processing of {} was already in progress in another transaction", file.getName()); return false; }); }  }
PublicationImporterImpl implements PublicationImporter { @Override @SneakyThrows public boolean importPublicationFile(File file) { return lockTemplate.doWithLock( Lock.forPublication(file), () -> doImportPublicationFile(file), () -> { logger.info( "Processing of {} was already in progress in another transaction", file.getName()); return false; }); }  @Override @SneakyThrows boolean importPublicationFile(File file); }
PublicationImporterImpl implements PublicationImporter { @Override @SneakyThrows public boolean importPublicationFile(File file) { return lockTemplate.doWithLock( Lock.forPublication(file), () -> doImportPublicationFile(file), () -> { logger.info( "Processing of {} was already in progress in another transaction", file.getName()); return false; }); }  @Override @SneakyThrows boolean importPublicationFile(File file);  }