use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries in project dwoss by gg-net.
the class ReceiptProductLogicPossibleDeadlockIT method testDeadlockProductSpec.
@Test
@Ignore
public void testDeadlockProductSpec() throws Exception {
//
//
// Test will run into a Deadlock if no Product Modell is setted!
// It will Display no Error but we hope for an Exception!
// To Recreated the Deadlock comment the Line Between the "Comment This" Comments
//
//
// Possible Reason that it will here appear a deadlock ist a bug in EJB that by a Validator Exception not return a exception
// but hang there. Maybe fixed in next version.
// TODO when used new Version of EJB then testet deadlock again!
//
Display display = new Display(Display.Size._10_1, Display.Resolution.VGA, Display.Type.MATT, Display.Ration.FOUR_TO_THREE);
ProductModel productModel = new ProductModel("TestModel");
productModel.setFamily(new ProductFamily("TestFamily"));
// Create a CPU and GPU and persist it.
utx.begin();
em.joinTransaction();
Cpu cpu = new Cpu(Cpu.Series.CORE, "TestCPU", Cpu.Type.MOBILE, 2.0, 5);
Gpu gpu = new Gpu(Gpu.Type.MOBILE, Gpu.Series.GEFORCE_100, "TestGPU");
ProductSeries productSeries = new ProductSeries(TradeName.ONESELF, ProductGroup.MISC, "TestSeries");
ProductFamily productFamily = new ProductFamily("TestFamily", productSeries);
// Comment This
// productModel.setFamily(productFamily);
// Comment This
em.persist(cpu);
em.persist(gpu);
em.persist(productSeries);
em.persist(productFamily);
em.persist(productModel);
utx.commit();
Notebook notebook = new Notebook(display, Desktop.Os.LINUX, cpu, null, gpu, null, 2048, null);
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 = productLogic.create(notebook, productModel, 0);
assertThat(testSpec).isNotNull();
}
use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries in project dwoss by gg-net.
the class ProductSeriesEmoIT method testRequestBrandGroupName.
@Test
public void testRequestBrandGroupName() throws Exception {
TradeName b1 = TradeName.APPLE;
ProductGroup g1 = ProductGroup.PROJECTOR;
String n1 = "SERIES";
TradeName b2 = TradeName.LENOVO;
ProductGroup g2 = ProductGroup.DESKTOP;
String n2 = "SERIES";
utx.begin();
em.joinTransaction();
em.persist(new ProductSeries(b1, g1, n1));
utx.commit();
utx.begin();
em.joinTransaction();
ProductSeriesEmo seriesEmo = new ProductSeriesEmo(em);
ProductSeries productSeries = seriesEmo.request(b1, g1, n1);
assertNotNull(productSeries);
assertEquals(b1, productSeries.getBrand());
assertEquals(g1, productSeries.getGroup());
assertEquals(n1, productSeries.getName());
utx.commit();
utx.begin();
em.joinTransaction();
productSeries = seriesEmo.request(b2, g2, n2);
assertNotNull(productSeries);
assertEquals(b2, productSeries.getBrand());
assertEquals(g2, productSeries.getGroup());
assertEquals(n2, productSeries.getName());
utx.commit();
utx.begin();
em.joinTransaction();
seriesEmo.request(b2, g2, n2);
seriesEmo.request(b2, g2, n2);
seriesEmo.request(b2, g2, n2);
List<ProductSeries> pss = new ProductSeriesEao(em).findAll();
assertNotNull(pss);
assertEquals("Only Two Elements should exist", 2, pss.size());
utx.commit();
}
use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries in project dwoss by gg-net.
the class ProductSpecTest method testValidateProductSpec.
@Test
public void testValidateProductSpec() {
ProductSeries veriton = new ProductSeries(TradeName.ACER, ProductGroup.DESKTOP, "Veriton");
ProductFamily lfamiliy = new ProductFamily("Veriton L");
lfamiliy.setSeries(veriton);
ProductModel l640 = new ProductModel("Veriton L640");
l640.setFamily(lfamiliy);
ProductSpec s = new BasicSpec("LX.AAAAA.BBB", 1L);
s.setModel(l640);
assertThat(validator.validate(s)).isEmpty();
s.setPartNo("LX.AAAAA.OOB");
assertTrue("The letter O should be allowed", validator.validate(s).isEmpty());
s.setPartNo(" LLL");
assertFalse(s.getPartNo() + " should be invalid", validator.validate(s).isEmpty());
s.setPartNo("RA LL");
assertFalse(s.getPartNo() + " should be invalid", validator.validate(s).isEmpty());
}
use of eu.ggnet.dwoss.spec.ee.entity.ProductSeries 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.ProductSeries in project dwoss by gg-net.
the class ProductSeriesEaoIT method testFindBrandGroupName.
@Test
public void testFindBrandGroupName() throws Exception {
utx.begin();
em.joinTransaction();
ProductSeries series = new ProductSeries(TradeName.SAMSUNG, ProductGroup.MISC, "GG-Net uber Multicore");
em.persist(series);
utx.commit();
utx.begin();
em.joinTransaction();
ProductSeriesEao seriesEao = new ProductSeriesEao(em);
ProductSeries productSeries = seriesEao.find(series.getBrand(), series.getGroup(), series.getName());
assertNull(seriesEao.find(TradeName.SAMSUNG, ProductGroup.MISC, "Gibbet nich"));
assertNotNull(productSeries);
assertEquals(series, productSeries);
utx.commit();
}
Aggregations