use of org.talend.esb.examples.ebook.model.Book in project tesb-rt-se by Talend.
the class AbstractJPAItest method createBook.
protected Book createBook(String title) {
Book book = new Book();
book.setId("myid" + UUID.randomUUID());
book.setTitle(title);
book.setCreator("Me");
try {
Format format = new Format();
format.setFile(new URI("file:/test"));
book.getFormats().add(format);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
return book;
}
use of org.talend.esb.examples.ebook.model.Book in project tesb-rt-se by Talend.
the class BookRepositoryTest method testAddThenDelete.
/**
* Shows adding and removing a book with implicit XA transactions inside BookRepository
*/
@Test
public void testAddThenDelete() {
Book book = createBook("My title");
bookRepository.add(book);
Book book2 = bookRepository.getBook(book.getId());
Assert.assertEquals(book.getId(), book2.getId());
Assert.assertEquals(book.getTitle(), book2.getTitle());
bookRepository.delete(book.getId());
Book book3 = bookRepository.getBook(book.getId());
Assert.assertNull(book3);
}
Aggregations