use of org.talend.types.test.library.common._1.ListOfBooks in project tesb-rt-se by Talend.
the class TransformationAssertionTest method commonTest.
private void commonTest(String testName, String searchFor, String expectedResult) {
final String dir = testName;
serviceContext = startParticipants(dir);
Library client = (Library) serviceContext.getBean("libraryHttp");
ListOfBooks response = null;
try {
response = searchFor(searchFor, client);
} catch (SeekBookError e) {
fail("Exception during service call");
}
assertEquals("Books amount in response differs from 1", 1, booksInResponse(response));
assertEquals("Received unexpected author name", expectedResult, authorLastName(response));
}
use of org.talend.types.test.library.common._1.ListOfBooks in project tesb-rt-se by Talend.
the class TransformationFeatureTest method commonTest.
private void commonTest(String testName, String searchFor, String expectedResult) {
final String dir = testName;
serviceContext = startProvider(dir);
Library client = (Library) serviceContext.getBean("libraryHttp");
ListOfBooks response = null;
try {
response = searchFor(searchFor, client);
} catch (SeekBookError e) {
fail("Exception during service call");
}
assertEquals("Books amount in response differs from 1", 1, booksInResponse(response));
assertEquals("Received unexpected author name", expectedResult, authorLastName(response));
}
use of org.talend.types.test.library.common._1.ListOfBooks in project tesb-rt-se by Talend.
the class LibraryTester method testRequestResponsePositive.
public void testRequestResponsePositive() throws SeekBookError {
// Test the positive case where author(s) are found and we retrieve
// a list of books
System.out.println("***************************************************************");
System.out.println("*** Request-Response operation ********************************");
System.out.println("***************************************************************");
System.out.println("\nSending request for authors named Icebear");
SearchFor request = new SearchFor();
request.getAuthorLastName().add("Icebear");
ListOfBooks response = libraryHttp.seekBook(request);
System.out.println("\nResponse received:");
if (response.getBook().size() != 1) {
System.out.println("An error occured: number of books found is not equal to 1");
}
if (!"Icebear".equals(response.getBook().get(0).getAuthor().get(0).getLastName())) {
System.out.println("An error occured: the author of the found book is not Icebear");
}
}
use of org.talend.types.test.library.common._1.ListOfBooks in project tesb-rt-se by Talend.
the class LibraryNotificationReceiverImpl method showNewBooks.
private void showNewBooks(final Date listDate, final List<BookType> response) {
System.out.println("New books from " + DateFormat.getDateInstance().format(listDate));
final ListOfBooks books = new ListOfBooks();
books.getBook().addAll(response);
Utils.showBooks(books);
}
use of org.talend.types.test.library.common._1.ListOfBooks in project tesb-rt-se by Talend.
the class Utils method showBooks.
/**
* Show books.
*
* @param booksList the books list
*/
public static void showBooks(final ListOfBooks booksList) {
if (booksList != null && booksList.getBook() != null && !booksList.getBook().isEmpty()) {
List<BookType> books = booksList.getBook();
System.out.println("\nNumber of books: " + books.size());
int cnt = 0;
for (BookType book : books) {
System.out.println("\nBookNum: " + (cnt++ + 1));
List<PersonType> authors = book.getAuthor();
if (authors != null && !authors.isEmpty()) {
for (PersonType author : authors) {
System.out.println("Author: " + author.getFirstName() + " " + author.getLastName());
}
}
System.out.println("Title: " + book.getTitle());
System.out.println("Year: " + book.getYearPublished());
if (book.getISBN() != null) {
System.out.println("ISBN: " + book.getISBN());
}
}
} else {
System.out.println("List of books is empty");
}
System.out.println("");
}
Aggregations