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);
}
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);
}
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());
}
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);
}
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");
}
Aggregations