Search in sources :

Example 21 with SeekBookError

use of org.talend.services.test.library._1_0.SeekBookError in project tesb-rt-se by Talend.

the class CorrelationFeatureTest method commonTest.

private void commonTest(String testName, String searchFor, String expectedResult) {
    LOG.setLevel(Level.FINE);
    final String dir = testName;
    serviceContext = startParticipants(dir);
    retrieveInterceptors(serviceContext);
    Library client = (Library) serviceContext.getBean("libraryHttp");
    try {
        searchFor(searchFor, client);
    } catch (SeekBookError e) {
        fail("Exception during service call");
    }
    // assertEquals("Books amount in response differs from 1", 1, booksInResponse(response));
    assertNotNull(providerInInterceptor.getLatestCorrelationHeader());
    assertTrue(providerInInterceptor.getLatestCorrelationHeader().toString().contains(expectedResult));
// assertNotNull(consumerInInterceptor.getLatestCorrelationHeader());
// System.out.println("PROBLEM: " + consumerInInterceptor.getLatestCorrelationHeader());
// assertTrue(consumerInInterceptor.getLatestCorrelationHeader().toString().contains(expectedResult));
}
Also used : SeekBookError(org.talend.services.test.library._1_0.SeekBookError) Library(org.talend.services.test.library._1_0.Library)

Example 22 with SeekBookError

use of org.talend.services.test.library._1_0.SeekBookError in project tesb-rt-se by Talend.

the class CorrelationIdAssertionTest method commonTest.

private void commonTest(String testName, String searchFor, String expectedResult) {
    final String dir = testName;
    serviceContext = startParticipants(dir);
    retrieveInterceptors(serviceContext);
    Library client = (Library) serviceContext.getBean("libraryHttp");
    try {
        searchFor(searchFor, client);
    } catch (SeekBookError e) {
        fail("Exception during service call");
    }
    // assertEquals("Books amount in response differs from 1", 1, booksInResponse(response));
    assertNotNull(consumerOutInterceptor.getLatestCorrelationHeader());
    assertNotNull(providerInInterceptor.getLatestCorrelationHeader());
    assertTrue(providerInInterceptor.getLatestCorrelationHeader().toString().contains(expectedResult));
    assertNotNull(consumerInInterceptor.getLatestCorrelationHeader());
    assertTrue(consumerInInterceptor.getLatestCorrelationHeader().toString().contains(expectedResult));
    String providerInCorrelationId = providerInInterceptor.getLatestCorrelationHeader().toString();
    String consumerInCorrelationId = consumerInInterceptor.getLatestCorrelationHeader().toString();
    assertEquals(providerInCorrelationId, consumerInCorrelationId);
}
Also used : SeekBookError(org.talend.services.test.library._1_0.SeekBookError) Library(org.talend.services.test.library._1_0.Library)

Example 23 with SeekBookError

use of org.talend.services.test.library._1_0.SeekBookError 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));
}
Also used : SeekBookError(org.talend.services.test.library._1_0.SeekBookError) Library(org.talend.services.test.library._1_0.Library) ListOfBooks(org.talend.types.test.library.common._1.ListOfBooks)

Example 24 with SeekBookError

use of org.talend.services.test.library._1_0.SeekBookError 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));
}
Also used : SeekBookError(org.talend.services.test.library._1_0.SeekBookError) Library(org.talend.services.test.library._1_0.Library) ListOfBooks(org.talend.types.test.library.common._1.ListOfBooks)

Example 25 with SeekBookError

use of org.talend.services.test.library._1_0.SeekBookError in project tesb-rt-se by Talend.

the class LibraryServerImpl method prepareException.

private SeekBookError prepareException(String message) {
    ExceptionType exception = new ExceptionType();
    exception.setOperation("seekBook");
    exception.setServiceName("LibraryService");
    exception.setExceptionText(message);
    ExceptionFrame frame = new ExceptionFrame();
    frame.getException().add(exception);
    return new SeekBookError("Book not found", frame);
}
Also used : ExceptionType(org.talend.types.test.generalobjects.errorhandling._1.ExceptionType) SeekBookError(org.talend.services.test.library._1_0.SeekBookError) ExceptionFrame(org.talend.types.test.generalobjects.errorhandling._1.ExceptionFrame)

Aggregations

SeekBookError (org.talend.services.test.library._1_0.SeekBookError)23 ListOfBooks (org.talend.types.test.library.common._1.ListOfBooks)16 Library (org.talend.services.test.library._1_0.Library)8 Calendar (java.util.Calendar)7 GregorianCalendar (java.util.GregorianCalendar)7 ExceptionFrame (org.talend.types.test.generalobjects.errorhandling._1.ExceptionFrame)5 ExceptionType (org.talend.types.test.generalobjects.errorhandling._1.ExceptionType)5 BookType (org.talend.types.test.library.common._1.BookType)5 PersonType (org.talend.types.test.library.common._1.PersonType)5 SearchFor (org.talend.types.test.library.common._1.SearchFor)5 SeekBookError (org.talend.services.demos.library._1_0.SeekBookError)4 ListOfBooks (org.talend.types.demos.library.common._1.ListOfBooks)3 BookType (org.talend.types.demos.library.common._1.BookType)2 PersonType (org.talend.types.demos.library.common._1.PersonType)2 CallContext (org.talend.esb.mep.requestcallback.feature.CallContext)1 CallContextStore (org.talend.esb.mep.requestcallback.impl.callcontext.CallContextStore)1 LibraryConsumer (org.talend.services.demos.library._1_0.LibraryConsumer)1 ExceptionFrame (org.talend.types.demos.generalobjects.errorhandling._1.ExceptionFrame)1 ExceptionType (org.talend.types.demos.generalobjects.errorhandling._1.ExceptionType)1 SearchFor (org.talend.types.demos.library.common._1.SearchFor)1