use of de.metas.purchasecandidate.ReferenceGenerator in project metasfresh-webui-api by metasfresh.
the class PurchaseRowsLoaderTest method init.
@BeforeEach
public void init() {
AdempiereTestHelper.get().init();
availabilityCheckService = Mockito.mock(AvailabilityCheckService.class);
org = newInstance(I_AD_Org.class);
saveRecord(org);
final I_C_UOM uom = newInstance(I_C_UOM.class);
uom.setUOMSymbol("testUOMSympol");
saveRecord(uom);
this.TEN = Quantity.of(BigDecimal.TEN, uom);
warehouse = newInstance(I_M_Warehouse.class);
saveRecord(warehouse);
final I_M_Product_Category productCategory = newInstance(I_M_Product_Category.class);
saveRecord(productCategory);
product = newInstance(I_M_Product.class);
product.setM_Product_Category_ID(productCategory.getM_Product_Category_ID());
product.setC_UOM_ID(uom.getC_UOM_ID());
saveRecord(product);
final I_C_BPartner bPartnerCustomer = newInstance(I_C_BPartner.class);
bPartnerCustomer.setName("bPartnerCustomer.Name");
saveRecord(bPartnerCustomer);
salesOrderRecord = newInstance(I_C_Order.class);
salesOrderRecord.setC_BPartner_ID(bPartnerCustomer.getC_BPartner_ID());
salesOrderRecord.setPreparationDate(SystemTime.asTimestamp());
salesOrderRecord.setC_PaymentTerm_ID(30);
saveRecord(salesOrderRecord);
bPartnerVendor = newInstance(I_C_BPartner.class);
bPartnerVendor.setName("bPartnerVendor.Name");
saveRecord(bPartnerVendor);
currencyId = PlainCurrencyDAO.createCurrencyId(CurrencyCode.EUR);
// wire together a SalesOrder2PurchaseViewFactory
final PurchaseCandidateRepository purchaseCandidateRepository = new PurchaseCandidateRepository(new PurchaseItemRepository(), new ReferenceGenerator(), new BPPurchaseScheduleService(new BPPurchaseScheduleRepository()));
final DoNothingPurchaseProfitInfoServiceImpl purchaseProfitInfoService = new DoNothingPurchaseProfitInfoServiceImpl();
final PurchaseDemandWithCandidatesService purchaseDemandWithCandidatesService = new PurchaseDemandWithCandidatesService(purchaseCandidateRepository, new BPPurchaseScheduleService(new BPPurchaseScheduleRepository()), new VendorProductInfoService(new BPartnerBL(new UserRepository())), purchaseProfitInfoService);
final PurchaseRowFactory purchaseRowFactory = new PurchaseRowFactory(new AvailableToPromiseRepository(), purchaseProfitInfoService);
salesOrder2PurchaseViewFactory = new SalesOrder2PurchaseViewFactory(purchaseDemandWithCandidatesService, // mocked
availabilityCheckService, purchaseCandidateRepository, purchaseRowFactory, new SalesOrderLineRepository(new OrderLineRepository()));
}
Aggregations