@Test @Rollback(value = false) @Transactional(value = TxType.NEVER) public void storeEntity() throws IOException, PreviewTooLongException { Assert.assertEquals(printerProjectDao.getRowCount(), 0); project1 = createPrinterProject( PROJECT_1_NAME, PROJECT_1_DESCRIPTION, PROJECT_1_TAGS, PROJECT_1_CATEGORIES, ImageTools.loadImageFromResource(PROJECT_1_PREVIEW_FILE), PROJECT_1_USER); printerProjectDao.makePersistent(project1); Assert.assertNotNull(project1.getId()); Assert.assertEquals(printerProjectDao.getRowCount(), 1); // Retrieve from database PrinterProject projectRetrieved = printerProjectDao.get(project1.getId()); // Check new object. Assert.assertTrue(comparePrinterProjects(project1, projectRetrieved)); // Add new Project project2 = createPrinterProject( PROJECT_2_NAME, PROJECT_2_DESCRIPTION, PROJECT_2_TAGS, PROJECT_2_CATEGORIES, ImageTools.loadImageFromResource(PROJECT_2_PREVIEW_FILE), PROJECT_2_USER); printerProjectDao.makePersistent(project2); Assert.assertNotNull(project2.getId()); Assert.assertEquals(printerProjectDao.getRowCount(), 2); }
public static PrinterProject createPrinterProject() throws PreviewTooLongException, IOException { return createPrinterProject( PROJECT_1_NAME, PROJECT_1_DESCRIPTION, PROJECT_1_TAGS, PROJECT_1_CATEGORIES, ImageTools.loadImageFromResource(PROJECT_1_PREVIEW_FILE), PROJECT_1_USER); }