Search in sources :

Example 16 with ProductSeries

use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries in project dwoss by gg-net.

the class ReceiptProductLogicProductFamilyIT method testCreateProductFamilyExceptionSameNameDifferentSeries.

@Test(expected = RuntimeException.class)
public void testCreateProductFamilyExceptionSameNameDifferentSeries() {
    ProductSeries series = bean.makeSeries(TradeName.DELL, ProductGroup.MISC, "Die Exception");
    // Test if two Products where created with the same name but different ProductSeries that will be throw a exception
    productProcessor.create(TradeName.DELL, ProductGroup.NOTEBOOK, series, "TestPC");
    productProcessor.create(TradeName.DELL, ProductGroup.NOTEBOOK, null, "TestPC");
    failBecauseExceptionWasNotThrown(RuntimeException.class);
}
Also used : ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) Test(org.junit.Test)

Example 17 with ProductSeries

use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries in project dwoss by gg-net.

the class ReceiptProductLogicProductModelIT method testCreateProductModellExceptionSameNameDifferentSeries.

@Test(expected = RuntimeException.class)
public void testCreateProductModellExceptionSameNameDifferentSeries() {
    // Create a ProductSeries and persist it.
    ProductSeries series = specStore.makeSeries(TradeName.HP, ProductGroup.MISC, "Die Exception2");
    ProductFamily family = specStore.makeFamily("Family Exception", series);
    // Test if two Products where created with the same name but different ProductSeries that will be throw a exception
    productProcessor.create(TradeName.HP, ProductGroup.DESKTOP, series, family, "Model1");
    productProcessor.create(TradeName.HP, ProductGroup.DESKTOP, series, family, "Model1");
    failBecauseExceptionWasNotThrown(RuntimeException.class);
}
Also used : ProductFamily(eu.ggnet.dwoss.spec.ee.entity.ProductFamily) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) Test(org.junit.Test)

Example 18 with ProductSeries

use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries 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 19 with ProductSeries

use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries 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)

Example 20 with ProductSeries

use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries in project dwoss by gg-net.

the class ReceiptProductLogicProductSpecIT method testCreateProductSpecException.

@Test(expected = RuntimeException.class)
public void testCreateProductSpecException() {
    // 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(PACKARD_BELL, 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);
    productProcessor.create(notebook, productModel, 0);
    productProcessor.create(notebook, productModel, 0);
    fail("Error 040: No Exception Found at: CreateProductSpec");
}
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) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) 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

ProductSeries (eu.ggnet.dwoss.spec.ee.entity.ProductSeries)32 ProductFamily (eu.ggnet.dwoss.spec.ee.entity.ProductFamily)23 Test (org.junit.Test)17 ProductModel (eu.ggnet.dwoss.spec.ee.entity.ProductModel)15 Cpu (eu.ggnet.dwoss.spec.ee.entity.piece.Cpu)8 Gpu (eu.ggnet.dwoss.spec.ee.entity.piece.Gpu)8 ProductSeriesEao (eu.ggnet.dwoss.spec.ee.eao.ProductSeriesEao)7 ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)7 Notebook (eu.ggnet.dwoss.spec.ee.entity.Notebook)6 Display (eu.ggnet.dwoss.spec.ee.entity.piece.Display)6 ProductFamilyEao (eu.ggnet.dwoss.spec.ee.eao.ProductFamilyEao)4 Desktop (eu.ggnet.dwoss.spec.ee.entity.Desktop)3 EntityManager (javax.persistence.EntityManager)3 TradeName (eu.ggnet.dwoss.rules.TradeName)2 ProductModelEao (eu.ggnet.dwoss.spec.ee.eao.ProductModelEao)2 ProductSpecEao (eu.ggnet.dwoss.spec.ee.eao.ProductSpecEao)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 ProductProcessor (eu.ggnet.dwoss.receipt.ee.ProductProcessor)1