use of org.talend.types.demos.library.common._1.ListOfBooks in project tesb-rt-se by Talend.
the class SamEnablingAssertionTest method commonTest.
private void commonTest(String testName, String searchFor, String isbn, String expectedResult) {
final String dir = testName;
serviceContext = startParticipants(dir);
Library client = (Library) serviceContext.getBean("libraryHttp");
ListOfBooks response = null;
try {
response = searchFor(searchFor, isbn, 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.demos.library.common._1.ListOfBooks in project tesb-rt-se by Talend.
the class SamEnablingFeatureTest method commonTest.
private void commonTest(String testName, String searchFor, String isbn, String expectedResult) {
final String dir = testName;
serviceContext = startProvider(dir);
Library client = (Library) serviceContext.getBean("libraryHttp");
ListOfBooks response = null;
try {
response = searchFor(searchFor, isbn, 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.demos.library.common._1.ListOfBooks in project tesb-rt-se by Talend.
the class SamEnablingFeatureTest method searchFor.
private ListOfBooks searchFor(String authorLastName, String isbn, Library client) throws SeekBookError {
SearchFor request = new SearchFor();
request.getAuthorLastName().add(authorLastName);
request.setISBNNumber(isbn);
return client.seekBook(request);
}
use of org.talend.types.demos.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.demos.library.common._1.ListOfBooks in project tesb-rt-se by Talend.
the class LibraryTester method testRequestResponseBusinessFault.
/**
* Test request response business fault.
*
* @throws SeekBookError the seek book error
*/
@SuppressWarnings("unused")
public void testRequestResponseBusinessFault() throws SeekBookError {
// Test for an unknown Customer name and expect the NoSuchCustomerException
System.out.println("***************************************************************");
System.out.println("*** Request-Response operation with Business Fault ************");
System.out.println("***************************************************************");
try {
SearchFor request = new SearchFor();
System.out.println("\nSending request for authors named Grizzlybear");
request.getAuthorLastName().add("Grizzlybear");
ListOfBooks response = libraryHttp.seekBook(request);
System.out.println("FAIL: We should get a SeekBookError here");
} catch (SeekBookError e) {
if (e.getFaultInfo() == null) {
System.out.println("FaultInfo must not be null");
}
if ("No book available from author Grizzlybear".equals(e.getFaultInfo().getException().get(0).getExceptionText())) {
System.out.println("Unexpected error message received");
}
System.out.println("\nSeekBookError exception was received as expected:\n");
}
}
Aggregations