Search in sources :

Example 11 with Book

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;
}
Also used : Format(org.talend.esb.examples.ebook.model.Format) Book(org.talend.esb.examples.ebook.model.Book) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Example 12 with 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);
}
Also used : Book(org.talend.esb.examples.ebook.model.Book) Test(org.junit.Test)

Aggregations

Book (org.talend.esb.examples.ebook.model.Book)12 Test (org.junit.Test)7 Format (org.talend.esb.examples.ebook.model.Format)5 URI (java.net.URI)2 TimeoutException (java.util.concurrent.TimeoutException)2 JMSException (javax.jms.JMSException)2 GET (javax.ws.rs.GET)2 Path (javax.ws.rs.Path)2 JAXBException (javax.xml.bind.JAXBException)2 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 POST (javax.ws.rs.POST)1 Coordination (org.osgi.service.coordinator.Coordination)1 Document (org.w3c.dom.Document)1 NodeList (org.w3c.dom.NodeList)1