Search in sources :

Example 6 with Display

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

the class DisplayPanel method main.

// End of variables declaration//GEN-END:variables
public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    // A full Display
    // Display display = new Display(Display.Size._15_4, Display.Resolution.HD,
    // Display.Type.CRYSTAL_BRIGHT, Display.Ration.SIXTEEN_TO_NINE);
    // display.setLed(true);
    Display display = new Display(null, null, null, null);
    System.out.println(display);
    DisplayPanel view = new DisplayPanel(ProductGroup.TABLET_SMARTPHONE);
    view.setDisplay(display);
    OkCancelDialog<DisplayPanel> create = new OkCancelDialog<>(" ", view);
    create.setVisible(true);
    if (create.getCloseType() == CloseType.OK) {
        System.out.println("Result :" + view.getDisplay());
    }
    System.exit(0);
}
Also used : OkCancelDialog(eu.ggnet.dwoss.util.OkCancelDialog) Display(eu.ggnet.dwoss.spec.ee.entity.piece.Display)

Example 7 with Display

use of eu.ggnet.dwoss.spec.ee.entity.piece.Display 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 8 with Display

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

Example 9 with Display

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

the class ReceiptProductLogicProductSpecIT method testUpdateProductSpecModelChange.

@Test
public void testUpdateProductSpecModelChange() {
    ProductModel productModel = productProcessor.create(ACER, NOTEBOOK, null, null, "TestModel");
    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"));
    Notebook notebook = new Notebook();
    notebook.setDisplay(new Display(Display.Size._10_1, Display.Resolution.VGA, Display.Type.MATT, Display.Ration.FOUR_TO_THREE));
    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.GHP");
    notebook.setModel(productModel);
    ProductSpec spec = productProcessor.create(notebook, productModel, 0);
    ProductFamily family = spec.getModel().getFamily();
    ProductModel productModel2 = productProcessor.create(ACER, NOTEBOOK, family.getSeries(), family, "TestModel2");
    spec = productProcessor.refresh(spec, productModel2);
    long model2Id = spec.getModel().getId();
    String comment = "MuhBlub";
    ((Notebook) spec).setComment(comment);
    productProcessor.update(spec, 0);
    List<ProductSeries> series = specAgent.findAllEager(ProductSeries.class);
    assertNotNull(series);
    assertEquals(1, series.size());
    assertNotNull(series.get(0));
    assertNotNull(series.get(0).getFamilys());
    assertEquals(1, series.get(0).getFamilys().size());
    assertNotNull(series.get(0).getFamilys().toArray()[0]);
    List<ProductSpec> specs = specAgent.findAllEager(ProductSpec.class);
    assertNotNull(specs);
    assertEquals(1, specs.size());
    assertEquals(model2Id, specs.get(0).getModel().getId());
    assertEquals(comment, ((Notebook) specs.get(0)).getComment());
}
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) ProductSpec(eu.ggnet.dwoss.spec.ee.entity.ProductSpec) 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)

Example 10 with Display

use of eu.ggnet.dwoss.spec.ee.entity.piece.Display 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();
}
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) 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) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Display (eu.ggnet.dwoss.spec.ee.entity.piece.Display)13 Test (org.junit.Test)8 Notebook (eu.ggnet.dwoss.spec.ee.entity.Notebook)7 Cpu (eu.ggnet.dwoss.spec.ee.entity.piece.Cpu)7 Gpu (eu.ggnet.dwoss.spec.ee.entity.piece.Gpu)7 ProductFamily (eu.ggnet.dwoss.spec.ee.entity.ProductFamily)6 ProductModel (eu.ggnet.dwoss.spec.ee.entity.ProductModel)6 ProductSeries (eu.ggnet.dwoss.spec.ee.entity.ProductSeries)6 ProductSpec (eu.ggnet.dwoss.spec.ee.entity.ProductSpec)5 DisplayEao (eu.ggnet.dwoss.spec.ee.eao.DisplayEao)2 Monitor (eu.ggnet.dwoss.spec.ee.entity.Monitor)2 Product (eu.ggnet.dwoss.uniqueunit.ee.entity.Product)2 DisplayEmo (eu.ggnet.dwoss.spec.ee.emo.DisplayEmo)1 Desktop (eu.ggnet.dwoss.spec.ee.entity.Desktop)1 DesktopBundle (eu.ggnet.dwoss.spec.ee.entity.DesktopBundle)1 DisplayAble (eu.ggnet.dwoss.spec.ee.entity.DisplayAble)1 ProductEao (eu.ggnet.dwoss.uniqueunit.ee.eao.ProductEao)1 OkCancelDialog (eu.ggnet.dwoss.util.OkCancelDialog)1 Validator (javax.validation.Validator)1 Ignore (org.junit.Ignore)1