@Test public void resendAsynchronouslySeveralMessages() throws Exception { Map filterMap = Collections.singletonMap("state", "prepare_%"); MailStatus status1 = new MailStatus(); status1.setBatchId("batch1"); status1.setMessageId("message1"); MailStatus status2 = new MailStatus(); status2.setBatchId("batch2"); status2.setMessageId("message2"); MailStatusResult statusResult1 = mock(MailStatusResult.class, "status1"); when(statusResult1.getTotalMailCount()).thenReturn(1L); MailStatusResult statusResult2 = mock(MailStatusResult.class, "status2"); when(statusResult2.getTotalMailCount()).thenReturn(2L); List<Pair<MailStatus, MailStatusResult>> results = new ArrayList<>(); results.add(new ImmutablePair<>(status1, statusResult1)); results.add(new ImmutablePair<>(status2, statusResult2)); MailResender resender = this.mocker.getInstance(MailResender.class, "database"); when(resender.resendAsynchronously(filterMap, 5, 10)).thenReturn(results); List<ScriptMailResult> scriptResults = this.mocker.getComponentUnderTest().resendAsynchronously(filterMap, 5, 10); assertEquals(2, scriptResults.size()); assertEquals("batch1", scriptResults.get(0).getBatchId()); assertEquals(1L, scriptResults.get(0).getStatusResult().getTotalMailCount()); assertEquals("batch2", scriptResults.get(1).getBatchId()); assertEquals(2L, scriptResults.get(1).getStatusResult().getTotalMailCount()); }
public ScriptMailResult resendAsynchronously(String batchId, String uniqueMessageId) { try { MailStatusResult statusResult = this.mailResender.resendAsynchronously(batchId, uniqueMessageId); ScriptMailResult scriptMailResult = new ScriptMailResult(new DefaultMailResult(batchId), statusResult); return scriptMailResult; } catch (MailStoreException e) { setError(e); return null; } }
DeprecatedMailStorageScriptService extends AbstractMailScriptService { public ScriptMailResult resendAsynchronously(String batchId, String uniqueMessageId) { try { MailStatusResult statusResult = this.mailResender.resendAsynchronously(batchId, uniqueMessageId); ScriptMailResult scriptMailResult = new ScriptMailResult(new DefaultMailResult(batchId), statusResult); return scriptMailResult; } catch (MailStoreException e) { setError(e); return null; } } }
DeprecatedMailStorageScriptService extends AbstractMailScriptService { public ScriptMailResult resendAsynchronously(String batchId, String uniqueMessageId) { try { MailStatusResult statusResult = this.mailResender.resendAsynchronously(batchId, uniqueMessageId); ScriptMailResult scriptMailResult = new ScriptMailResult(new DefaultMailResult(batchId), statusResult); return scriptMailResult; } catch (MailStoreException e) { setError(e); return null; } }  }
DeprecatedMailStorageScriptService extends AbstractMailScriptService { public ScriptMailResult resendAsynchronously(String batchId, String uniqueMessageId) { try { MailStatusResult statusResult = this.mailResender.resendAsynchronously(batchId, uniqueMessageId); ScriptMailResult scriptMailResult = new ScriptMailResult(new DefaultMailResult(batchId), statusResult); return scriptMailResult; } catch (MailStoreException e) { setError(e); return null; } }  ScriptMailResult resend(String batchId, String uniqueMessageId); ScriptMailResult resendAsynchronously(String batchId, String uniqueMessageId); List<ScriptMailResult> resendAsynchronously(Map<String, Object> filterMap, int offset, int count); MailStatus load(String uniqueMessageId); List<MailStatus> load(Map<String, Object> filterMap, int offset, int count, String sortField,
        boolean sortAscending); long count(Map<String, Object> filterMap); void delete(String batchId); void deleteAll(); void delete(String batchId, String uniqueMessageId); MailStorageConfiguration getConfiguration(); }
DeprecatedMailStorageScriptService extends AbstractMailScriptService { public ScriptMailResult resendAsynchronously(String batchId, String uniqueMessageId) { try { MailStatusResult statusResult = this.mailResender.resendAsynchronously(batchId, uniqueMessageId); ScriptMailResult scriptMailResult = new ScriptMailResult(new DefaultMailResult(batchId), statusResult); return scriptMailResult; } catch (MailStoreException e) { setError(e); return null; } }  ScriptMailResult resend(String batchId, String uniqueMessageId); ScriptMailResult resendAsynchronously(String batchId, String uniqueMessageId); List<ScriptMailResult> resendAsynchronously(Map<String, Object> filterMap, int offset, int count); MailStatus load(String uniqueMessageId); List<MailStatus> load(Map<String, Object> filterMap, int offset, int count, String sortField,
        boolean sortAscending); long count(Map<String, Object> filterMap); void delete(String batchId); void deleteAll(); void delete(String batchId, String uniqueMessageId); MailStorageConfiguration getConfiguration();  }