use of org.talend.esb.examples.ebook.model.Format in project tesb-rt-se by Talend.
the class ParseTest method testParse.
@Test
public void testParse() throws Exception {
Document doc = readDocument("pg50180.rdf");
BookParser parser = new BookParser();
Book book = parser.parse(doc);
Assert.assertEquals("Maugham, W. Somerset (William Somerset) - Penelope\nA Comedy in Three Acts", book.toString());
Assert.assertEquals("ebooks/50180", book.getId());
Assert.assertEquals("Penelope\nA Comedy in Three Acts", book.getTitle());
Assert.assertEquals("Maugham, W. Somerset (William Somerset)", book.getCreator());
// Assert.assertEquals(4, book.getSubjects().size());
// Assert.assertEquals("Justice -- Early works to 1800", book.getSubjects().get(0).getSubject());
Assert.assertEquals("http://www.gutenberg.org/cache/epub/50180/pg50180.cover.medium.jpg", book.getCover().toString());
Assert.assertEquals(11, book.getFormats().size());
Format format = book.getFormats().get(0);
Assert.assertEquals("http://www.gutenberg.org/ebooks/50180.kindle.images", format.getFile().toString());
Assert.assertEquals("application/x-mobipocket-ebook", format.getMediaType().toString());
}
use of org.talend.esb.examples.ebook.model.Format 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;
}
Aggregations