use of eu.ggnet.dwoss.spec.ee.eao.ProductSeriesEao 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.eao.ProductSeriesEao 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