Search in sources :

Example 11 with ProductModel

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();
}
Also used : ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) ProductModelEao(eu.ggnet.dwoss.spec.ee.eao.ProductModelEao) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) Test(org.junit.Test)

Example 12 with ProductModel

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();
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ProductGroup(eu.ggnet.dwoss.rules.ProductGroup) ProductModelEmo(eu.ggnet.dwoss.spec.ee.emo.ProductModelEmo) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) Test(org.junit.Test)

Example 13 with ProductModel

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();
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ProductGroup(eu.ggnet.dwoss.rules.ProductGroup) ProductModelEmo(eu.ggnet.dwoss.spec.ee.emo.ProductModelEmo) ProductFamilyEmo(eu.ggnet.dwoss.spec.ee.emo.ProductFamilyEmo) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) Test(org.junit.Test)

Example 14 with ProductModel

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());
}
Also used : ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) Test(org.junit.Test)

Example 15 with ProductModel

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);
}
Also used : ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) Notebook(eu.ggnet.dwoss.spec.ee.entity.Notebook) Cpu(eu.ggnet.dwoss.spec.ee.entity.piece.Cpu) Product(eu.ggnet.dwoss.uniqueunit.ee.entity.Product) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec) Gpu(eu.ggnet.dwoss.spec.ee.entity.piece.Gpu) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) Display(eu.ggnet.dwoss.spec.ee.entity.piece.Display) Test(org.junit.Test)

Aggregations

ProductModel (eu.ggnet.dwoss.spec.ee.entity.ProductModel)19 ProductFamily (eu.ggnet.dwoss.spec.ee.entity.ProductFamily)15 ProductSeries (eu.ggnet.dwoss.spec.ee.entity.ProductSeries)15 Test (org.junit.Test)14 Cpu (eu.ggnet.dwoss.spec.ee.entity.piece.Cpu)9 Gpu (eu.ggnet.dwoss.spec.ee.entity.piece.Gpu)9 ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)8 Notebook (eu.ggnet.dwoss.spec.ee.entity.Notebook)6 Display (eu.ggnet.dwoss.spec.ee.entity.piece.Display)6 TradeName (eu.ggnet.dwoss.rules.TradeName)4 ProductModelEmo (eu.ggnet.dwoss.spec.ee.emo.ProductModelEmo)4 Desktop (eu.ggnet.dwoss.spec.ee.entity.Desktop)4 ProductGroup (eu.ggnet.dwoss.rules.ProductGroup)3 SpecGenerator (eu.ggnet.dwoss.spec.ee.assist.gen.SpecGenerator)2 ProductModelEao (eu.ggnet.dwoss.spec.ee.eao.ProductModelEao)2 ProductSpecEao (eu.ggnet.dwoss.spec.ee.eao.ProductSpecEao)2 ProductFamilyEmo (eu.ggnet.dwoss.spec.ee.emo.ProductFamilyEmo)2 Product (eu.ggnet.dwoss.uniqueunit.ee.entity.Product)2 Mandators (eu.ggnet.dwoss.mandator.Mandators)1 eu.ggnet.dwoss.mandator.api.value (eu.ggnet.dwoss.mandator.api.value)1