use of eu.ggnet.dwoss.spec.ee.entity.ProductModel in project dwoss by gg-net.
the class ProductModelEaoIT method testFind.
@Test
public void testFind() throws Exception {
utx.begin();
em.joinTransaction();
ProductFamily family = new ProductFamily("Family1");
ProductSeries series = new ProductSeries(TradeName.SAMSUNG, ProductGroup.MISC, "TestSeries");
em.persist(series);
family.setSeries(series);
em.persist(family);
ProductModel model = new ProductModel("Model 1");
model.setFamily(family);
em.persist(model);
utx.commit();
utx.begin();
em.joinTransaction();
ProductModelEao productModelEao = new ProductModelEao(em);
ProductModel productModel = productModelEao.find("Model 1");
assertNotNull(productModel);
assertEquals(model, productModel);
assertNull(productModelEao.find("No Model"));
utx.commit();
}
use of eu.ggnet.dwoss.spec.ee.entity.ProductModel in project dwoss by gg-net.
the class ProductModelEmoIT method testFullRequestBrandGroupName.
@Test
public void testFullRequestBrandGroupName() throws Exception {
TradeName sb = TradeName.HP;
ProductGroup sg = ProductGroup.PROJECTOR;
String sn = "SERIES";
String fn = "FAMILY";
String mn = "MODEL";
utx.begin();
em.joinTransaction();
ProductModelEmo modelEmo = new ProductModelEmo(em);
ProductModel model = modelEmo.request(sb, sg, sn, fn, mn);
assertNotNull(model);
assertEquals(mn, model.getName());
assertEquals(fn, model.getFamily().getName());
assertEquals(sb, model.getFamily().getSeries().getBrand());
assertEquals(sg, model.getFamily().getSeries().getGroup());
assertEquals(sn, model.getFamily().getSeries().getName());
long fid = model.getFamily().getId();
long mid = model.getId();
long sid = model.getFamily().getSeries().getId();
utx.commit();
utx.begin();
em.joinTransaction();
model = modelEmo.request(sb, sg, sn, fn, mn);
assertNotNull(model);
assertEquals(mid, model.getId());
assertEquals(fid, model.getFamily().getId());
assertEquals(sid, model.getFamily().getSeries().getId());
utx.commit();
}
use of eu.ggnet.dwoss.spec.ee.entity.ProductModel in project dwoss by gg-net.
the class ProductModelEmoIT method testHalfRequestBrandGroupName.
@Test
public void testHalfRequestBrandGroupName() throws Exception {
TradeName sb = TradeName.HP;
ProductGroup sg = ProductGroup.PROJECTOR;
String sn = "SERIES";
String fn = "FAMILY";
String mn = "MODEL";
utx.begin();
em.joinTransaction();
new ProductFamilyEmo(em).request(sb, sg, sn, fn);
utx.commit();
utx.begin();
em.joinTransaction();
ProductModelEmo modelEmo = new ProductModelEmo(em);
ProductModel model = modelEmo.request(sb, sg, sn, fn, mn);
assertNotNull(model);
assertEquals(mn, model.getName());
assertEquals(fn, model.getFamily().getName());
assertEquals(sb, model.getFamily().getSeries().getBrand());
assertEquals(sg, model.getFamily().getSeries().getGroup());
assertEquals(sn, model.getFamily().getSeries().getName());
long fid = model.getFamily().getId();
long mid = model.getId();
long sid = model.getFamily().getSeries().getId();
utx.commit();
utx.begin();
em.joinTransaction();
model = modelEmo.request(sb, sg, sn, fn, mn);
assertNotNull(model);
assertEquals(mid, model.getId());
assertEquals(fid, model.getFamily().getId());
assertEquals(sid, model.getFamily().getSeries().getId());
utx.commit();
}
use of eu.ggnet.dwoss.spec.ee.entity.ProductModel in project dwoss by gg-net.
the class ReceiptProductLogicProductModelIT method testCreateProductModell.
@Test
public void testCreateProductModell() {
ProductModel productModel = productProcessor.create(TradeName.HP, ProductGroup.DESKTOP, null, null, "ProductModel1");
assertNotNull(productModel);
assertTrue(productModel.getId() > 0);
assertEquals(SpecPu.DEFAULT_NAME, productModel.getFamily().getSeries().getName());
ProductModel productModel2 = productProcessor.create(TradeName.HP, ProductGroup.DESKTOP, null, null, "ProductModel2");
assertNotNull(productModel2);
assertTrue(productModel2.getId() > 0);
assertEquals(SpecPu.DEFAULT_NAME, productModel2.getFamily().getSeries().getName());
// Create a ProductSeries and persist it.
ProductSeries series = specStore.makeSeries(TradeName.HP, ProductGroup.MISC, "Der Name2");
ProductFamily family = specStore.makeFamily("Family 2", series);
ProductModel productModel3 = productProcessor.create(TradeName.HP, ProductGroup.DESKTOP, series, family, "ProductModel3");
assertNotNull(productModel3);
assertTrue(productModel3.getId() > 0);
assertEquals("Der Name2", productModel3.getFamily().getSeries().getName());
ProductModel productModel4 = productProcessor.create(TradeName.HP, ProductGroup.DESKTOP, series, family, "ProductModel4");
assertNotNull(productModel4);
assertTrue(productModel4.getId() > 0);
assertEquals("Der Name2", productModel4.getFamily().getSeries().getName());
}
use of eu.ggnet.dwoss.spec.ee.entity.ProductModel in project dwoss by gg-net.
the class ReceiptProductLogicProductSpecIT method testCreateProductSpec.
@Test
public void testCreateProductSpec() throws Exception {
final long GTIN = 123456782;
// Create a CPU and GPU and persist it.
Cpu cpu = productProcessor.create(new Cpu(Cpu.Series.AMD_V, "TestCPU", Cpu.Type.MOBILE, 2.0, 5));
Gpu gpu = productProcessor.create(new Gpu(Gpu.Type.MOBILE, Gpu.Series.GEFORCE_100, "TestGPU"));
// Persist Display
Display display = new Display(Display.Size._10_1, Display.Resolution.VGA, Display.Type.MATT, Display.Ration.FOUR_TO_THREE);
ProductModel productModel = new ProductModel("M", new ProductFamily("F", new ProductSeries(ACER, NOTEBOOK, "S")));
Notebook notebook = new Notebook();
notebook.setDisplay(display);
notebook.setGpu(gpu);
notebook.setCpu(cpu);
notebook.setMemory(2048);
notebook.setOs(Desktop.Os.LINUX);
notebook.add(Desktop.Hdd.SSD_0016);
notebook.add(Desktop.Hdd.ROTATING_2000);
notebook.add(Desktop.Odd.DVD_ROM);
notebook.setExtras(ProductSpec.Extra.E_SATA, ProductSpec.Extra.HIGHT_CHANGEABLE);
notebook.setPartNo("LX.ASDFG.GHJ");
notebook.setModel(productModel);
ProductSpec testSpec = productProcessor.create(notebook, productModel, 0);
assertNotNull(testSpec);
Notebook notebook2 = new Notebook();
notebook2.setDisplay(display);
notebook2.setGpu(gpu);
notebook2.setCpu(cpu);
notebook2.setMemory(2048);
notebook2.setOs(Desktop.Os.LINUX);
notebook2.add(Desktop.Hdd.SSD_0016);
notebook2.add(Desktop.Hdd.ROTATING_2000);
notebook2.add(Desktop.Odd.DVD_ROM);
notebook2.setExtras(ProductSpec.Extra.E_SATA, ProductSpec.Extra.HIGHT_CHANGEABLE);
notebook2.setPartNo("LX.ASDFG.GH2");
notebook2.setModel(productModel);
ProductSpec testSpec2 = productProcessor.create(notebook2, productModel, GTIN);
assertNotNull(testSpec2);
assertNotSame(testSpec2, testSpec);
Product product = uuAgent.findById(Product.class, testSpec2.getProductId());
assertThat(product).isNotNull().returns(GTIN, Product::getGtin);
}
Aggregations