@Test public void testEmptyList() throws IOException { objectMapper.writeValue(data, Collections.emptyList()); assertEquals(transactionCompletion, senderSupplier.get().sendFiles()); verify(transaction, never()).send(any(DataPacket.class)); verify(transaction).complete(); verifyNoMoreInteractions(siteToSiteClient, transaction, transactionCompletion); }
public TransactionCompletion sendFiles() throws IOException { Transaction transaction = siteToSiteClient.createTransaction(TransferDirection.SEND); try { DataPacketDto.getDataPacketStream(input).forEachOrdered(d -> { try { transaction.send(d); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw new IOException(e.getMessage(), e); } transaction.confirm(); return transaction.complete(); }
SiteToSiteSender { public TransactionCompletion sendFiles() throws IOException { Transaction transaction = siteToSiteClient.createTransaction(TransferDirection.SEND); try { DataPacketDto.getDataPacketStream(input).forEachOrdered(d -> { try { transaction.send(d); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw new IOException(e.getMessage(), e); } transaction.confirm(); return transaction.complete(); } }
SiteToSiteSender { public TransactionCompletion sendFiles() throws IOException { Transaction transaction = siteToSiteClient.createTransaction(TransferDirection.SEND); try { DataPacketDto.getDataPacketStream(input).forEachOrdered(d -> { try { transaction.send(d); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw new IOException(e.getMessage(), e); } transaction.confirm(); return transaction.complete(); } SiteToSiteSender(SiteToSiteClient siteToSiteClient, InputStream input); }
SiteToSiteSender { public TransactionCompletion sendFiles() throws IOException { Transaction transaction = siteToSiteClient.createTransaction(TransferDirection.SEND); try { DataPacketDto.getDataPacketStream(input).forEachOrdered(d -> { try { transaction.send(d); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw new IOException(e.getMessage(), e); } transaction.confirm(); return transaction.complete(); } SiteToSiteSender(SiteToSiteClient siteToSiteClient, InputStream input); TransactionCompletion sendFiles(); }
SiteToSiteSender { public TransactionCompletion sendFiles() throws IOException { Transaction transaction = siteToSiteClient.createTransaction(TransferDirection.SEND); try { DataPacketDto.getDataPacketStream(input).forEachOrdered(d -> { try { transaction.send(d); } catch (IOException e) { throw new RuntimeException(e); } }); } catch (RuntimeException e) { Throwable cause = e.getCause(); if (cause instanceof IOException) { throw (IOException) cause; } throw new IOException(e.getMessage(), e); } transaction.confirm(); return transaction.complete(); } SiteToSiteSender(SiteToSiteClient siteToSiteClient, InputStream input); TransactionCompletion sendFiles();  }