Search in sources :

Example 1 with InvoiceTrackingSqlDao

use of org.killbill.billing.invoice.dao.InvoiceTrackingSqlDao in project killbill by killbill.

the class InvoiceChecker method checkTrackingIds.

public void checkTrackingIds(final Invoice invoice, final Set<String> expectedTrackingIds, final InternalCallContext internalCallContext) {
    final InvoiceTrackingSqlDao dao = dbi.onDemand(InvoiceTrackingSqlDao.class);
    final List<InvoiceTrackingModelDao> result = dao.getTrackingsForInvoices(ImmutableList.of(invoice.getId().toString()), internalCallContext);
    final Set<String> existingTrackingIds = ImmutableSet.copyOf(Iterables.transform(result, new Function<InvoiceTrackingModelDao, String>() {

        @Override
        public String apply(final InvoiceTrackingModelDao input) {
            return input.getTrackingId();
        }
    }));
    assertEquals(existingTrackingIds.size(), expectedTrackingIds.size());
    for (final String cur : existingTrackingIds) {
        assertTrue(expectedTrackingIds.contains(cur));
    }
}
Also used : Function(com.google.common.base.Function) InvoiceTrackingSqlDao(org.killbill.billing.invoice.dao.InvoiceTrackingSqlDao) InvoiceTrackingModelDao(org.killbill.billing.invoice.dao.InvoiceTrackingModelDao)

Aggregations

Function (com.google.common.base.Function)1 InvoiceTrackingModelDao (org.killbill.billing.invoice.dao.InvoiceTrackingModelDao)1 InvoiceTrackingSqlDao (org.killbill.billing.invoice.dao.InvoiceTrackingSqlDao)1