Search in sources :

Example 1 with ProductSeriesEmo

use of eu.ggnet.dwoss.spec.ee.emo.ProductSeriesEmo in project dwoss by gg-net.

the class ProductModelEmoIT method testRequestBrandGroupNameByHand.

@Test
public void testRequestBrandGroupNameByHand() throws Exception {
    TradeName sb = TradeName.HP;
    ProductGroup sg = ProductGroup.PROJECTOR;
    String sn = "SERIES";
    String fn = "FAMILY";
    String mn = "MODEL";
    utx.begin();
    em.joinTransaction();
    new ProductSeriesEmo(em).request(sb, sg, sn);
    utx.commit();
    utx.begin();
    em.joinTransaction();
    new ProductFamilyEmo(em).request(sb, sg, sn, fn);
    utx.commit();
    utx.begin();
    em.joinTransaction();
    ProductModel model = new ProductModelEmo(em).request(sb, sg, sn, fn, mn);
    assertNotNull(model);
    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) ProductSeriesEmo(eu.ggnet.dwoss.spec.ee.emo.ProductSeriesEmo) ProductModel(eu.ggnet.dwoss.spec.ee.entity.ProductModel) Test(org.junit.Test)

Example 2 with ProductSeriesEmo

use of eu.ggnet.dwoss.spec.ee.emo.ProductSeriesEmo 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();
}
Also used : TradeName(eu.ggnet.dwoss.rules.TradeName) ProductGroup(eu.ggnet.dwoss.rules.ProductGroup) ProductSeriesEao(eu.ggnet.dwoss.spec.ee.eao.ProductSeriesEao) ProductSeries(eu.ggnet.dwoss.spec.ee.entity.ProductSeries) ProductSeriesEmo(eu.ggnet.dwoss.spec.ee.emo.ProductSeriesEmo) Test(org.junit.Test)

Aggregations

ProductGroup (eu.ggnet.dwoss.rules.ProductGroup)2 TradeName (eu.ggnet.dwoss.rules.TradeName)2 ProductSeriesEmo (eu.ggnet.dwoss.spec.ee.emo.ProductSeriesEmo)2 Test (org.junit.Test)2 ProductSeriesEao (eu.ggnet.dwoss.spec.ee.eao.ProductSeriesEao)1 ProductFamilyEmo (eu.ggnet.dwoss.spec.ee.emo.ProductFamilyEmo)1 ProductModelEmo (eu.ggnet.dwoss.spec.ee.emo.ProductModelEmo)1 ProductModel (eu.ggnet.dwoss.spec.ee.entity.ProductModel)1 ProductSeries (eu.ggnet.dwoss.spec.ee.entity.ProductSeries)1