public void fill (final @Nonnull Accounting accounting) { final CustomerRegistry customerRegistry = accounting.getCustomerRegistry(); final ProjectRegistry projectRegistry = accounting.getProjectRegistry(); final InvoiceRegistry invoiceRegistry = accounting.getInvoiceRegistry(); customersXml.forEach(customer -> customerRegistry.addCustomer().with(customer.toBuilder()).create()); projectsXml.forEach(project -> projectRegistry.addProject().with(project.toBuilder(accounting)).create()); invoicesxml.forEach(invoice -> invoiceRegistry.addInvoice().with(invoice.toBuilder(accounting)).create()); } }
public AccountingXml (final @Nonnull Accounting accounting) { customersXml = accounting.getCustomerRegistry().findCustomers().stream().map(customer -> new CustomerXml(customer)) .collect(toList()); projectsXml = accounting.getProjectRegistry().findProjects().stream().map(project -> new ProjectXml(project)) .collect(toList()); invoicesxml = accounting.getInvoiceRegistry().findInvoices().stream().map(invoice -> new InvoiceXml(invoice)) .collect(toList()); }
final Project project = projectRegistry.findProjects().withId(projectId).result(); final Stream<Id> eventIds = configuration.getIds("jobEventIDs").stream(); final List<JobEvent> events = eventIds.flatMap(id -> projectRegistry.findJobEvents().withId(id).stream()) .collect(toList());
@DataProvider(name = "projects") public static Object[][] projectProvider() { return ScenarioFactory.createScenarios().entrySet().stream() .flatMap(entry -> entry.getValue().getProjectRegistry().findProjects().stream() .map(project -> new Object[] { entry.getKey(), project })) .collect(Collectors.toList()) .toArray(new Object[0][0]); }
projectRegistry.addProject().withId(projectConfig.getId("uniqueIdentifier")) .withBudget(projectConfig.getMoney("projectEstimate")) .withCustomer(customer)
@Nonnull public Invoice.Builder toBuilder (final @Nonnull Accounting accounting) { try { final Project customer = accounting.getProjectRegistry().findProjects().withId(projectXml.getId()).result(); return new Invoice.Builder().withId(id) .withNumber(number) .withProject(customer) .withDate(date) .withDueDate(dueDate) .withEarnings(earnings) .withTax(tax) .withJobEvents(JobEventXml.toJobEvents(jobEventsXml)); } catch (NotFoundException e) { throw new RuntimeException(e); } } }
projectRegistry.addProject() .withId(new Id("" + nextId++)) .withCustomer(acmeConsulting) .create(); final Project acmeConsultingProject2 = projectRegistry.addProject() .withId(new Id("" + nextId++)) .withCustomer(acmeConsulting) .create(); final Project acmeFinancingProject1 = projectRegistry.addProject() .withId(new Id("" + nextId++)) .withCustomer(acmeFinancing) .create(); final Project acmeFinancingProject2 = projectRegistry.addProject() .withId(new Id("" + nextId++)) .withCustomer(acmeFinancing)
public void dumpAll() throws IOException { dumpCustomers(accounting.getCustomerRegistry().findCustomers()); dumpProjects(accounting.getProjectRegistry().findProjects()); dumpInvoices(accounting.getInvoiceRegistry().findInvoices()); }